diff --git a/Core/Core.csproj b/Core/Core.csproj index e86e518b4..ef4e0de09 100644 --- a/Core/Core.csproj +++ b/Core/Core.csproj @@ -87,6 +87,7 @@ + diff --git a/Core/Models/Demo.cs b/Core/Models/Demo.cs index 737de0f30..34bcef24b 100644 --- a/Core/Models/Demo.cs +++ b/Core/Models/Demo.cs @@ -416,7 +416,7 @@ public class Demo : ObservableObject /// /// Contains text messages from game chat /// - private List _chatMessageList; + private List _chatMessages; #endregion @@ -539,7 +539,8 @@ public string Path public int CheaterCount { get { return _cheaterCounter; } - set { + set + { Set(() => CheaterCount, ref _cheaterCounter, value); RaisePropertyChanged(() => HasCheater); } @@ -1045,10 +1046,10 @@ public decimal AverageEseaRws } [JsonProperty("chat_messages")] - public List ChatMessageList + public List ChatMessages { - get { return _chatMessageList; } - set { Set(() => ChatMessageList, ref _chatMessageList, value); } + get { return _chatMessages; } + set { Set(() => ChatMessages, ref _chatMessages, value); } } #endregion @@ -1069,7 +1070,7 @@ public Demo() BombDefused = new Collection(); PlayerBlinded = new Collection(); Overtimes = new Collection(); - ChatMessageList = new List(); + ChatMessages = new List(); _teamCt = new Team { @@ -1172,7 +1173,7 @@ public Demo Copy() BombPlanted = new Collection(), MolotovsFireStarted = new Collection(), IncendiariesFireStarted = new Collection(), - ChatMessageList = new List(), + ChatMessages = new List(), PlayersHurted = new Collection(), Kills = new Collection(), PlayerBlinded = new Collection(), @@ -1206,9 +1207,9 @@ public Demo Copy() demo.BombExploded.Add(e); } - foreach (string msg in ChatMessageList) + foreach (ChatMessage msg in ChatMessages) { - demo.ChatMessageList.Add(msg); + demo.ChatMessages.Add(msg); } foreach (DecoyStartedEvent e in DecoyStarted) @@ -1464,7 +1465,7 @@ public void ResetStats(bool resetTeams = true) BombDefused.Clear(); BombExploded.Clear(); BombPlanted.Clear(); - ChatMessageList.Clear(); + ChatMessages.Clear(); DecoyStarted.Clear(); IncendiariesFireStarted.Clear(); Kills.Clear(); diff --git a/Core/Models/Events/ChatMessage.cs b/Core/Models/Events/ChatMessage.cs new file mode 100644 index 000000000..8171ca9fe --- /dev/null +++ b/Core/Models/Events/ChatMessage.cs @@ -0,0 +1,30 @@ +using Core.Models.Serialization; +using Newtonsoft.Json; + +namespace Core.Models.Events +{ + public class ChatMessage : BaseEvent + { + [JsonProperty("sender_steamid")] + [JsonConverter(typeof(LongToStringConverter))] + public long SenderSteamId { get; set; } + + [JsonProperty("sender_name")] + public string SenderName { get; set; } + + [JsonProperty("sender_side")] + public Side SenderSide { get; set; } + + [JsonProperty("is_sender_alive")] + public bool IsSenderAlive { get; set; } + + [JsonProperty("text")] + public string Text { get; set; } + + + public ChatMessage(int tick, float seconds) + : base(tick, seconds) + { + } + } +} diff --git a/Manager/Converters/SecondsToTimerConverter.cs b/Manager/Converters/SecondsToTimerConverter.cs new file mode 100644 index 000000000..e906c2381 --- /dev/null +++ b/Manager/Converters/SecondsToTimerConverter.cs @@ -0,0 +1,28 @@ +using System; +using System.Globalization; +using System.Windows.Data; + +namespace Manager.Converters +{ + public class SecondsToTimerConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + float totalSeconds = value as float? ?? 0; + double minutes = Math.Floor(totalSeconds / 60 % 60); + double seconds = Math.Floor(totalSeconds % 60); + + return $"{FormatValue(minutes)}:{FormatValue(seconds)}"; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return value; + } + + private static string FormatValue(double value) + { + return value.ToString(CultureInfo.InvariantCulture).PadLeft(2, '0'); + } + } +} diff --git a/Manager/Internals/Navigation.cs b/Manager/Internals/Navigation.cs index 1f919c30e..584d631a1 100644 --- a/Manager/Internals/Navigation.cs +++ b/Manager/Internals/Navigation.cs @@ -51,7 +51,7 @@ public static void ShowPlayerDetails(Demo demo, Player player) public static void ShowDemoHeatmap(Demo demo) { new ViewModelLocator().DemoHeatmap.Demo = demo; - + ShowPage(new DemoHeatmapView()); } @@ -76,6 +76,13 @@ public static void ShowDemoDamages(Demo demo) ShowPage(new DemoDamagesView()); } + public static void ShowDemoChat(Demo demo) + { + new ViewModelLocator().DemoChat.Demo = demo; + + ShowPage(new DemoChatView()); + } + public static void ShowDemoFlashbangs(Demo demo) { new ViewModelLocator().DemoFlashbangs.Demo = demo; diff --git a/Manager/Manager.csproj b/Manager/Manager.csproj index 46f12e29f..d7348ea05 100644 --- a/Manager/Manager.csproj +++ b/Manager/Manager.csproj @@ -178,6 +178,7 @@ + @@ -231,6 +232,7 @@ + @@ -241,6 +243,9 @@ + + DemoChatView.xaml + DemoFlashbangsView.xaml @@ -332,6 +337,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile diff --git a/Manager/MultilingualResources/Manager.ar.xlf b/Manager/MultilingualResources/Manager.ar.xlf index cb1084126..59748b3fc 100644 --- a/Manager/MultilingualResources/Manager.ar.xlf +++ b/Manager/MultilingualResources/Manager.ar.xlf @@ -3314,14 +3314,6 @@ Message Error : Export chat Export chat - - Chat messages file has been created. - Chat messages file has been created. - - - No chat messages found. (It only works for demos coming from a server that has "tv_relaytextchat" set to a value different from "0" which is not the case for Valve matchmaking). - No chat messages found. (It only works for demos coming from a server that has "tv_relaytextchat" set to a value different from "0" which is not the case for Valve matchmaking). - No {0} found for this selection. No {0} found for this selection. @@ -4223,6 +4215,14 @@ Please update it by clicking on the "Update" button. KAST KAST + + Chat + Chat + + + Chat + Chat + diff --git a/Manager/MultilingualResources/Manager.da.xlf b/Manager/MultilingualResources/Manager.da.xlf index beeaf1c4e..ce68524e9 100644 --- a/Manager/MultilingualResources/Manager.da.xlf +++ b/Manager/MultilingualResources/Manager.da.xlf @@ -3315,14 +3315,6 @@ Besked Fejl : Export chat Export chat - - Chat messages file has been created. - Chat messages file has been created. - - - No chat messages found. (It only works for demos coming from a server that has "tv_relaytextchat" set to a value different from "0" which is not the case for Valve matchmaking). - No chat messages found. (It only works for demos coming from a server that has "tv_relaytextchat" set to a value different from "0" which is not the case for Valve matchmaking). - No {0} found for this selection. No {0} found for this selection. @@ -4224,6 +4216,14 @@ Please update it by clicking on the "Update" button. KAST KAST + + Chat + Chat + + + Chat + Chat + diff --git a/Manager/MultilingualResources/Manager.de.xlf b/Manager/MultilingualResources/Manager.de.xlf index 93eed54e4..f4ef89104 100644 --- a/Manager/MultilingualResources/Manager.de.xlf +++ b/Manager/MultilingualResources/Manager.de.xlf @@ -3315,14 +3315,6 @@ Message Error : Export chat Exportiere Chat - - Chat messages file has been created. - Chat Message Datei wurde erstellt. - - - No chat messages found. (It only works for demos coming from a server that has "tv_relaytextchat" set to a value different from "0" which is not the case for Valve matchmaking). - Keine Chatnachrichten gefunden. (Es funktioniert nur bei Demos, die auf einem Server aufgenommen wurden, mit "tv_relaytextchat" ungleich "0" - dies ist nicht der Fall bei Valve Matchmaking) - No {0} found for this selection. Nichts {0} gefunden bei dieser Auswahl. @@ -4224,6 +4216,14 @@ Bitte aktualisieren Sie mit dem Klicken auf den "Update"-Button. KAST KAST + + Chat + Chat + + + Chat + Chat + diff --git a/Manager/MultilingualResources/Manager.es.xlf b/Manager/MultilingualResources/Manager.es.xlf index 37c6d013d..9621dddf0 100644 --- a/Manager/MultilingualResources/Manager.es.xlf +++ b/Manager/MultilingualResources/Manager.es.xlf @@ -3331,14 +3331,6 @@ Mensaje de error: Export chat Exportar chat - - Chat messages file has been created. - El archivo de mensajes de chat ha sido creado. - - - No chat messages found. (It only works for demos coming from a server that has "tv_relaytextchat" set to a value different from "0" which is not the case for Valve matchmaking). - No se han encontrado mensajes de chat. (Solo funciona para repeticiones de un servidor que tenga "tv_relaytextchat" con un valor diferente de "0", no es el caso de los de Valve) - No {0} found for this selection. No se ha encontrado {0} en esta selección. @@ -4241,6 +4233,14 @@ Please update it by clicking on the "Update" button. KAST KAST + + Chat + Chat + + + Chat + Chat + diff --git a/Manager/MultilingualResources/Manager.fr.xlf b/Manager/MultilingualResources/Manager.fr.xlf index a812e2f39..33edf4450 100644 --- a/Manager/MultilingualResources/Manager.fr.xlf +++ b/Manager/MultilingualResources/Manager.fr.xlf @@ -3317,14 +3317,6 @@ Message d'erreur : Export chat Exporter tchat - - Chat messages file has been created. - Le fichier contenant les messages du tchat a été créé avec succès. - - - No chat messages found. (It only works for demos coming from a server that has "tv_relaytextchat" set to a value different from "0" which is not the case for Valve matchmaking). - Aucun message de tchat trouvé. (L'export ne fonctionne que lorsque la démo provient d'un serveur ayant "tv_relaytextchat" différent de "0", ce qui n'est pas le cas des serveurs Valve matchmaking) - No {0} found for this selection. Pas de {0} pour cette selection. @@ -4230,6 +4222,14 @@ Il peut être pratique dans ce cas d'ajouter un commentaire pour noter les ticks KAST KAST + + Chat + Tchat + + + Chat + Tchat + diff --git a/Manager/MultilingualResources/Manager.hr.xlf b/Manager/MultilingualResources/Manager.hr.xlf index 1f0ddd9b1..351e0630c 100644 --- a/Manager/MultilingualResources/Manager.hr.xlf +++ b/Manager/MultilingualResources/Manager.hr.xlf @@ -3314,14 +3314,6 @@ Message Error : Export chat Export chat - - Chat messages file has been created. - Chat messages file has been created. - - - No chat messages found. (It only works for demos coming from a server that has "tv_relaytextchat" set to a value different from "0" which is not the case for Valve matchmaking). - No chat messages found. (It only works for demos coming from a server that has "tv_relaytextchat" set to a value different from "0" which is not the case for Valve matchmaking). - No {0} found for this selection. No {0} found for this selection. @@ -4223,6 +4215,14 @@ Please update it by clicking on the "Update" button. KAST KAST + + Chat + Chat + + + Chat + Chat + diff --git a/Manager/MultilingualResources/Manager.hu.xlf b/Manager/MultilingualResources/Manager.hu.xlf index 7b311a1db..ea780db76 100644 --- a/Manager/MultilingualResources/Manager.hu.xlf +++ b/Manager/MultilingualResources/Manager.hu.xlf @@ -3315,14 +3315,6 @@ Hibaüzenet: Export chat Chat exportálása - - Chat messages file has been created. - Chat üzenetek létrehozva. - - - No chat messages found. (It only works for demos coming from a server that has "tv_relaytextchat" set to a value different from "0" which is not the case for Valve matchmaking). - Nem található chat üzenet. (Csak akkor működik, ha a szerveren a "tv_relaytextchat" parancs értéke nem "0"). - No {0} found for this selection. Nem található {0} ehhez a kiválasztáshoz. @@ -4224,6 +4216,14 @@ Please update it by clicking on the "Update" button. KAST KAST + + Chat + Chat + + + Chat + Chat + diff --git a/Manager/MultilingualResources/Manager.it.xlf b/Manager/MultilingualResources/Manager.it.xlf index fb60f256c..e1a8cb69e 100644 --- a/Manager/MultilingualResources/Manager.it.xlf +++ b/Manager/MultilingualResources/Manager.it.xlf @@ -3314,14 +3314,6 @@ Message Error : Export chat Export chat - - Chat messages file has been created. - Chat messages file has been created. - - - No chat messages found. (It only works for demos coming from a server that has "tv_relaytextchat" set to a value different from "0" which is not the case for Valve matchmaking). - No chat messages found. (It only works for demos coming from a server that has "tv_relaytextchat" set to a value different from "0" which is not the case for Valve matchmaking). - No {0} found for this selection. No {0} found for this selection. @@ -4223,6 +4215,14 @@ Please update it by clicking on the "Update" button. KAST KAST + + Chat + Chat + + + Chat + Chat + diff --git a/Manager/MultilingualResources/Manager.ja.xlf b/Manager/MultilingualResources/Manager.ja.xlf index 6c5b497ea..bfbe8623c 100644 --- a/Manager/MultilingualResources/Manager.ja.xlf +++ b/Manager/MultilingualResources/Manager.ja.xlf @@ -3314,14 +3314,6 @@ Message Error : Export chat Export chat - - Chat messages file has been created. - Chat messages file has been created. - - - No chat messages found. (It only works for demos coming from a server that has "tv_relaytextchat" set to a value different from "0" which is not the case for Valve matchmaking). - No chat messages found. (It only works for demos coming from a server that has "tv_relaytextchat" set to a value different from "0" which is not the case for Valve matchmaking). - No {0} found for this selection. No {0} found for this selection. @@ -4223,6 +4215,14 @@ Please update it by clicking on the "Update" button. KAST KAST + + Chat + Chat + + + Chat + Chat + diff --git a/Manager/MultilingualResources/Manager.nl.xlf b/Manager/MultilingualResources/Manager.nl.xlf index b23a56de8..1bdb20928 100644 --- a/Manager/MultilingualResources/Manager.nl.xlf +++ b/Manager/MultilingualResources/Manager.nl.xlf @@ -3322,14 +3322,6 @@ Message Error : {0} minutes {0} minutes - - Chat messages file has been created. - Chat messages file has been created. - - - No chat messages found. (It only works for demos coming from a server that has "tv_relaytextchat" set to a value different from "0" which is not the case for Valve matchmaking). - No chat messages found. (It only works for demos coming from a server that has "tv_relaytextchat" set to a value different from "0" which is not the case for Valve matchmaking). - Export chat Export chat @@ -4223,6 +4215,14 @@ Please update it by clicking on the "Update" button. KAST KAST + + Chat + Chat + + + Chat + Chat + diff --git a/Manager/MultilingualResources/Manager.pl.xlf b/Manager/MultilingualResources/Manager.pl.xlf index e821f61db..094aa8923 100644 --- a/Manager/MultilingualResources/Manager.pl.xlf +++ b/Manager/MultilingualResources/Manager.pl.xlf @@ -3315,14 +3315,6 @@ Treść błędu : Export chat Eksportuj czat - - Chat messages file has been created. - Plik wiadomości czatu został utworzony. - - - No chat messages found. (It only works for demos coming from a server that has "tv_relaytextchat" set to a value different from "0" which is not the case for Valve matchmaking). - Nie znaleziono wiadomości czatu (działa tylko dla dem pochodzących z serwera z ustawionym "tv_relaytextchat" na wartość inną niż "0". Niestety opcja nie jest dostępna dla dobierania przeciwników Valve). - No {0} found for this selection. Nie znaleziono {0} dla tego zaznaczenia. @@ -4224,6 +4216,14 @@ Please update it by clicking on the "Update" button. KAST KAST + + Chat + Chat + + + Chat + Chat + diff --git a/Manager/MultilingualResources/Manager.pt-BR.xlf b/Manager/MultilingualResources/Manager.pt-BR.xlf index f59c5fa85..3c0dacaea 100644 --- a/Manager/MultilingualResources/Manager.pt-BR.xlf +++ b/Manager/MultilingualResources/Manager.pt-BR.xlf @@ -3315,14 +3315,6 @@ Mensagem de Erro: Export chat Exportar chat - - Chat messages file has been created. - Arquivo de mensagens de chat foi criado. - - - No chat messages found. (It only works for demos coming from a server that has "tv_relaytextchat" set to a value different from "0" which is not the case for Valve matchmaking). - Nenhuma mensagem de chat encontrados. (Funciona apenas para demos provenientes de um servidor que tem "tv_relaytextchat" definido como um valor diferente de "0", o que não é o caso para os servidores oficiais de MM da Valve). - No {0} found for this selection. Nenhum {0} encontrado para esta seleção @@ -4224,6 +4216,14 @@ Please update it by clicking on the "Update" button. KAST KAST + + Chat + Chat + + + Chat + Chat + diff --git a/Manager/MultilingualResources/Manager.pt.xlf b/Manager/MultilingualResources/Manager.pt.xlf index cead3e482..e7fa1331b 100644 --- a/Manager/MultilingualResources/Manager.pt.xlf +++ b/Manager/MultilingualResources/Manager.pt.xlf @@ -3314,14 +3314,6 @@ Message Error : Export chat Export chat - - Chat messages file has been created. - Chat messages file has been created. - - - No chat messages found. (It only works for demos coming from a server that has "tv_relaytextchat" set to a value different from "0" which is not the case for Valve matchmaking). - No chat messages found. (It only works for demos coming from a server that has "tv_relaytextchat" set to a value different from "0" which is not the case for Valve matchmaking). - No {0} found for this selection. No {0} found for this selection. @@ -4223,6 +4215,14 @@ Please update it by clicking on the "Update" button. KAST KAST + + Chat + Chat + + + Chat + Chat + diff --git a/Manager/MultilingualResources/Manager.ru.xlf b/Manager/MultilingualResources/Manager.ru.xlf index f10238b60..70001aaf8 100644 --- a/Manager/MultilingualResources/Manager.ru.xlf +++ b/Manager/MultilingualResources/Manager.ru.xlf @@ -3314,14 +3314,6 @@ Message Error : Export chat Export chat - - Chat messages file has been created. - Chat messages file has been created. - - - No chat messages found. (It only works for demos coming from a server that has "tv_relaytextchat" set to a value different from "0" which is not the case for Valve matchmaking). - No chat messages found. (It only works for demos coming from a server that has "tv_relaytextchat" set to a value different from "0" which is not the case for Valve matchmaking). - No {0} found for this selection. No {0} found for this selection. @@ -4223,6 +4215,14 @@ Please update it by clicking on the "Update" button. KAST KAST + + Chat + Chat + + + Chat + Chat + diff --git a/Manager/MultilingualResources/Manager.sr-Cyrl.xlf b/Manager/MultilingualResources/Manager.sr-Cyrl.xlf index 5d706f3ae..99ee36335 100644 --- a/Manager/MultilingualResources/Manager.sr-Cyrl.xlf +++ b/Manager/MultilingualResources/Manager.sr-Cyrl.xlf @@ -3314,14 +3314,6 @@ Message Error : Export chat Export chat - - Chat messages file has been created. - Chat messages file has been created. - - - No chat messages found. (It only works for demos coming from a server that has "tv_relaytextchat" set to a value different from "0" which is not the case for Valve matchmaking). - No chat messages found. (It only works for demos coming from a server that has "tv_relaytextchat" set to a value different from "0" which is not the case for Valve matchmaking). - No {0} found for this selection. No {0} found for this selection. @@ -4223,6 +4215,14 @@ Please update it by clicking on the "Update" button. KAST KAST + + Chat + Chat + + + Chat + Chat + diff --git a/Manager/MultilingualResources/Manager.tr-TR.xlf b/Manager/MultilingualResources/Manager.tr-TR.xlf index 883028a84..7624242e7 100644 --- a/Manager/MultilingualResources/Manager.tr-TR.xlf +++ b/Manager/MultilingualResources/Manager.tr-TR.xlf @@ -3322,14 +3322,6 @@ Message Error : {0} minutes {0} minutes - - Chat messages file has been created. - Chat messages file has been created. - - - No chat messages found. (It only works for demos coming from a server that has "tv_relaytextchat" set to a value different from "0" which is not the case for Valve matchmaking). - No chat messages found. (It only works for demos coming from a server that has "tv_relaytextchat" set to a value different from "0" which is not the case for Valve matchmaking). - Export chat Export chat @@ -4223,6 +4215,14 @@ Please update it by clicking on the "Update" button. KAST KAST + + Chat + Chat + + + Chat + Chat + diff --git a/Manager/MultilingualResources/Manager.tr.xlf b/Manager/MultilingualResources/Manager.tr.xlf index 23326f9b2..d6bc7cf4d 100644 --- a/Manager/MultilingualResources/Manager.tr.xlf +++ b/Manager/MultilingualResources/Manager.tr.xlf @@ -3322,14 +3322,6 @@ Message Error : {0} minutes {0} minutes - - Chat messages file has been created. - Chat messages file has been created. - - - No chat messages found. (It only works for demos coming from a server that has "tv_relaytextchat" set to a value different from "0" which is not the case for Valve matchmaking). - No chat messages found. (It only works for demos coming from a server that has "tv_relaytextchat" set to a value different from "0" which is not the case for Valve matchmaking). - Export chat Export chat @@ -4223,6 +4215,14 @@ Please update it by clicking on the "Update" button. KAST KAST + + Chat + Chat + + + Chat + Chat + diff --git a/Manager/MultilingualResources/Manager.zh-Hans.xlf b/Manager/MultilingualResources/Manager.zh-Hans.xlf index 7b7790283..920095ca5 100644 --- a/Manager/MultilingualResources/Manager.zh-Hans.xlf +++ b/Manager/MultilingualResources/Manager.zh-Hans.xlf @@ -3314,14 +3314,6 @@ Message Error : Export chat 导出聊天记录 - - Chat messages file has been created. - 聊天记录文件已创建 - - - No chat messages found. (It only works for demos coming from a server that has "tv_relaytextchat" set to a value different from "0" which is not the case for Valve matchmaking). - 未找到聊天信息。(此功能仅适用于来自将 "tv_relaytextchat" 参数设为 0 的服务器的录像文件,Valve 官方竞技匹配服务器并未启用此参数) - No {0} found for this selection. 该分类找不到 {0} @@ -4223,6 +4215,14 @@ Please update it by clicking on the "Update" button. KAST KAST + + Chat + Chat + + + Chat + Chat + diff --git a/Manager/MultilingualResources/Manager.zh-Hant.xlf b/Manager/MultilingualResources/Manager.zh-Hant.xlf index b68dff0e5..7a31cd4fc 100644 --- a/Manager/MultilingualResources/Manager.zh-Hant.xlf +++ b/Manager/MultilingualResources/Manager.zh-Hant.xlf @@ -3314,14 +3314,6 @@ Message Error : Export chat Export chat - - Chat messages file has been created. - Chat messages file has been created. - - - No chat messages found. (It only works for demos coming from a server that has "tv_relaytextchat" set to a value different from "0" which is not the case for Valve matchmaking). - No chat messages found. (It only works for demos coming from a server that has "tv_relaytextchat" set to a value different from "0" which is not the case for Valve matchmaking). - No {0} found for this selection. No {0} found for this selection. @@ -4223,6 +4215,14 @@ Please update it by clicking on the "Update" button. KAST KAST + + Chat + Chat + + + Chat + Chat + diff --git a/Manager/Properties/Resources.Designer.cs b/Manager/Properties/Resources.Designer.cs index 77c7e2c8b..bebd908f9 100644 --- a/Manager/Properties/Resources.Designer.cs +++ b/Manager/Properties/Resources.Designer.cs @@ -628,6 +628,15 @@ public static string ChangeHLAEParentFolderLocation { } } + /// + /// Looks up a localized string similar to Chat. + /// + public static string Chat { + get { + return ResourceManager.GetString("Chat", resourceCulture); + } + } + /// /// Looks up a localized string similar to Check for updates on app startup. /// @@ -1385,15 +1394,6 @@ public static string DialogBoilerIncorrect { } } - /// - /// Looks up a localized string similar to Chat messages file has been created.. - /// - public static string DialogChatFileCreated { - get { - return ResourceManager.GetString("DialogChatFileCreated", resourceCulture); - } - } - /// /// Looks up a localized string similar to Your configuration file is corrupted. Please restart the application to reset your configuration.. /// @@ -2118,15 +2118,6 @@ public static string DialogNewVersionAvailable { } } - /// - /// Looks up a localized string similar to No chat messages found. (It only works for demos coming from a server that has "tv_relaytextchat" set to a value different from "0" which is not the case for Valve matchmaking).. - /// - public static string DialogNoChatFound { - get { - return ResourceManager.GetString("DialogNoChatFound", resourceCulture); - } - } - /// /// Looks up a localized string similar to No Internet Connection. /// @@ -7954,6 +7945,15 @@ public static string ToolTipChangeRawFilesDestination { } } + /// + /// Looks up a localized string similar to Chat. + /// + public static string TooltipChat { + get { + return ResourceManager.GetString("TooltipChat", resourceCulture); + } + } + /// /// Looks up a localized string similar to Copy setpos command (CTRL+C). /// diff --git a/Manager/Properties/Resources.de.resx b/Manager/Properties/Resources.de.resx index 8dd8dcf65..b6e5718cf 100644 --- a/Manager/Properties/Resources.de.resx +++ b/Manager/Properties/Resources.de.resx @@ -2484,12 +2484,6 @@ Message Error : Exportiere Chat - - Chat Message Datei wurde erstellt. - - - Keine Chatnachrichten gefunden. (Es funktioniert nur bei Demos, die auf einem Server aufgenommen wurden, mit "tv_relaytextchat" ungleich "0" - dies ist nicht der Fall bei Valve Matchmaking) - Nichts {0} gefunden bei dieser Auswahl. diff --git a/Manager/Properties/Resources.es.resx b/Manager/Properties/Resources.es.resx index f551258bb..00f234511 100644 --- a/Manager/Properties/Resources.es.resx +++ b/Manager/Properties/Resources.es.resx @@ -2487,12 +2487,6 @@ Mensaje de error: Exportar chat - - El archivo de mensajes de chat ha sido creado. - - - No se han encontrado mensajes de chat. (Solo funciona para repeticiones de un servidor que tenga "tv_relaytextchat" con un valor diferente de "0", no es el caso de los de Valve) - No se ha encontrado {0} en esta selección. diff --git a/Manager/Properties/Resources.fr.resx b/Manager/Properties/Resources.fr.resx index fe0d8d977..e35b7af46 100644 --- a/Manager/Properties/Resources.fr.resx +++ b/Manager/Properties/Resources.fr.resx @@ -2493,12 +2493,6 @@ Message d'erreur : Exporter tchat - - Le fichier contenant les messages du tchat a été créé avec succès. - - - Aucun message de tchat trouvé. (L'export ne fonctionne que lorsque la démo provient d'un serveur ayant "tv_relaytextchat" différent de "0", ce qui n'est pas le cas des serveurs Valve matchmaking) - Pas de {0} pour cette selection. @@ -3171,4 +3165,10 @@ Il peut être pratique dans ce cas d'ajouter un commentaire pour noter les ticks KAST + + Tchat + + + Tchat + \ No newline at end of file diff --git a/Manager/Properties/Resources.hu.resx b/Manager/Properties/Resources.hu.resx index b7752a732..665961bb6 100644 --- a/Manager/Properties/Resources.hu.resx +++ b/Manager/Properties/Resources.hu.resx @@ -2487,12 +2487,6 @@ Hibaüzenet: Chat exportálása - - Chat üzenetek létrehozva. - - - Nem található chat üzenet. (Csak akkor működik, ha a szerveren a "tv_relaytextchat" parancs értéke nem "0"). - Nem található {0} ehhez a kiválasztáshoz. diff --git a/Manager/Properties/Resources.pl.resx b/Manager/Properties/Resources.pl.resx index 41bba255c..2f49e1c56 100644 --- a/Manager/Properties/Resources.pl.resx +++ b/Manager/Properties/Resources.pl.resx @@ -2488,12 +2488,6 @@ Treść błędu : Eksportuj czat - - Plik wiadomości czatu został utworzony. - - - Nie znaleziono wiadomości czatu (działa tylko dla dem pochodzących z serwera z ustawionym "tv_relaytextchat" na wartość inną niż "0". Niestety opcja nie jest dostępna dla dobierania przeciwników Valve). - Nie znaleziono {0} dla tego zaznaczenia. diff --git a/Manager/Properties/Resources.pt-BR.resx b/Manager/Properties/Resources.pt-BR.resx index 2cc5bcc8d..560f2a4b5 100644 --- a/Manager/Properties/Resources.pt-BR.resx +++ b/Manager/Properties/Resources.pt-BR.resx @@ -2488,12 +2488,6 @@ Mensagem de Erro: Exportar chat - - Arquivo de mensagens de chat foi criado. - - - Nenhuma mensagem de chat encontrados. (Funciona apenas para demos provenientes de um servidor que tem "tv_relaytextchat" definido como um valor diferente de "0", o que não é o caso para os servidores oficiais de MM da Valve). - Nenhum {0} encontrado para esta seleção diff --git a/Manager/Properties/Resources.resx b/Manager/Properties/Resources.resx index 3197c521b..d0148a7dc 100644 --- a/Manager/Properties/Resources.resx +++ b/Manager/Properties/Resources.resx @@ -2606,12 +2606,6 @@ Message Error : {0} minutes - - Chat messages file has been created. - - - No chat messages found. (It only works for demos coming from a server that has "tv_relaytextchat" set to a value different from "0" which is not the case for Valve matchmaking). - Export chat @@ -3276,4 +3270,10 @@ Please update it by clicking on the "Update" button. KAST + + Chat + + + Chat + \ No newline at end of file diff --git a/Manager/Properties/Resources.zh-Hans.resx b/Manager/Properties/Resources.zh-Hans.resx index c22d5f045..9d9392bac 100644 --- a/Manager/Properties/Resources.zh-Hans.resx +++ b/Manager/Properties/Resources.zh-Hans.resx @@ -2487,12 +2487,6 @@ 导出聊天记录 - - 聊天记录文件已创建 - - - 未找到聊天信息。(此功能仅适用于来自将 "tv_relaytextchat" 参数设为 0 的服务器的录像文件,Valve 官方竞技匹配服务器并未启用此参数) - 该分类找不到 {0} diff --git a/Manager/Resources/Colors.xaml b/Manager/Resources/Colors.xaml index 12a0e3379..f52ea1849 100644 --- a/Manager/Resources/Colors.xaml +++ b/Manager/Resources/Colors.xaml @@ -16,6 +16,8 @@ #2a1014 #FF9800 #2980b9 + #378ef0 + #f29423 @@ -25,6 +27,8 @@ + + diff --git a/Manager/Resources/ListView.xaml b/Manager/Resources/ListView.xaml index 839aa482d..7fb14e428 100644 --- a/Manager/Resources/ListView.xaml +++ b/Manager/Resources/ListView.xaml @@ -4,14 +4,16 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d" xmlns:models="clr-namespace:Manager.Models" - xmlns:core="clr-namespace:Core.Models;assembly=csgodm.core"> + xmlns:core="clr-namespace:Core.Models;assembly=csgodm.core" + xmlns:events="clr-namespace:Core.Models.Events;assembly=csgodm.core" + xmlns:converters="clr-namespace:Manager.Converters"> - + + + + + + + + + + + + + + + + + + + + + diff --git a/Manager/ViewModel/Demos/DemoChatViewModel.cs b/Manager/ViewModel/Demos/DemoChatViewModel.cs new file mode 100644 index 000000000..4b056f7e4 --- /dev/null +++ b/Manager/ViewModel/Demos/DemoChatViewModel.cs @@ -0,0 +1,38 @@ +using System.Windows.Forms; +using GalaSoft.MvvmLight.Command; +using Services.Interfaces; + +namespace Manager.ViewModel.Demos +{ + public class DemoChatViewModel : DemoViewModel + { + private readonly IDemosService _demosService; + private RelayCommand _exportCommand; + + public DemoChatViewModel(IDemosService demosService) + { + _demosService = demosService; + } + + public RelayCommand ExportCommand + { + get + { + return _exportCommand + ?? (_exportCommand = new RelayCommand( + () => + { + SaveFileDialog exportDialog = new SaveFileDialog + { + FileName = Demo.Name.Substring(0, Demo.Name.Length - 4) + "-chat.txt", + Filter = "Text file (*.txt)|*.txt", + }; + if (exportDialog.ShowDialog() == DialogResult.OK) + { + _demosService.WriteChatFile(Demo, exportDialog.FileName); + } + }, () => Demo != null)); + } + } + } +} diff --git a/Manager/ViewModel/Demos/DemoDetailsViewModel.cs b/Manager/ViewModel/Demos/DemoDetailsViewModel.cs index 2581b5a33..08bfe4989 100644 --- a/Manager/ViewModel/Demos/DemoDetailsViewModel.cs +++ b/Manager/ViewModel/Demos/DemoDetailsViewModel.cs @@ -94,6 +94,8 @@ public class DemoDetailsViewModel : DemoViewModel private RelayCommand _showDemoFlashbangsCommand; + private RelayCommand _showChatCommand; + private RelayCommand _showDemoStuffsCommand; private RelayCommand _saveCommentDemoCommand; @@ -122,8 +124,6 @@ public class DemoDetailsViewModel : DemoViewModel private RelayCommand _showPlayerDemosCommand; - private RelayCommand _exportChatCommand; - private RelayCommand _goToPreviousDemoCommand; private RelayCommand _goToNextDemoCommand; @@ -317,7 +317,7 @@ public RelayCommand ShowDemoHeatmapCommand return; } - Navigation.ShowDemoHeatmap(Demo); + Navigation.ShowDemoHeatmap(Demo); }, () => !IsBusy && Demo != null && Demo.Source.GetType() != typeof(Pov))); } } @@ -380,6 +380,19 @@ public RelayCommand ShowDemoFlashbangsCommand } } + public RelayCommand ShowChatCommand + { + get + { + return _showChatCommand + ?? (_showChatCommand = new RelayCommand( + () => + { + Navigation.ShowDemoChat(Demo); + }, () => !IsBusy && Demo != null && Demo.Source.GetType() != typeof(Pov))); + } + } + public RelayCommand ShowDemoMovie { get @@ -922,75 +935,6 @@ public RelayCommand GoToNextDemoCommand } } - public RelayCommand ExportChatCommand - { - get - { - return _exportChatCommand - ?? (_exportChatCommand = new RelayCommand( - async () => - { - if (Demo.Status == DemoStatus.NAME_DEMO_STATUS_CORRUPTED) - { - await _dialogService.ShowDemosCorruptedWarningAsync(new List { Demo }); - } - - SaveFileDialog exportDialog = new SaveFileDialog - { - FileName = Demo.Name.Substring(0, Demo.Name.Length - 4) + "-chat.txt", - Filter = "Text file (*.txt)|*.txt", - }; - - if (exportDialog.ShowDialog() == DialogResult.OK) - { - if (!_cacheService.HasDemoInCache(Demo.Id)) - { - try - { - Notification = Properties.Resources.NotificationAnalyzing; - IsBusy = true; - HasNotification = true; - - if (_cts == null) - { - _cts = new CancellationTokenSource(); - } - - await _demosService.AnalyzeDemo(Demo, _cts.Token); - - if (AppSettings.IsInternetConnectionAvailable()) - { - await _demosService.AnalyzeBannedPlayersAsync(Demo); - } - - await _cacheService.WriteDemoDataCache(Demo); - } - catch (Exception e) - { - await HandleAnalyzeException(e); - } - finally - { - IsBusy = false; - HasNotification = false; - } - } - - if (Demo.ChatMessageList.Any()) - { - _demosService.WriteChatFile(Demo, exportDialog.FileName); - await _dialogService.ShowMessageAsync(Properties.Resources.DialogChatFileCreated, - MessageDialogStyle.Affirmative); - } - else - { - await _dialogService.ShowMessageAsync(Properties.Resources.DialogNoChatFound, MessageDialogStyle.Affirmative); - } - } - })); - } - } - /// /// Update the demo's status (from the combobox). /// diff --git a/Manager/ViewModel/Demos/DemoFlashbangsViewModel.cs b/Manager/ViewModel/Demos/DemoFlashbangsViewModel.cs index 68c6b6973..e70d0c6e2 100644 --- a/Manager/ViewModel/Demos/DemoFlashbangsViewModel.cs +++ b/Manager/ViewModel/Demos/DemoFlashbangsViewModel.cs @@ -4,10 +4,8 @@ using System.Windows; using Core.Models; using GalaSoft.MvvmLight.CommandWpf; -using Manager.Internals; using Services.Interfaces; using Services.Models.Stats; -using Demo = Core.Models.Demo; namespace Manager.ViewModel.Demos { diff --git a/Manager/ViewModel/ViewModelLocator.cs b/Manager/ViewModel/ViewModelLocator.cs index 397f08659..dabafed10 100644 --- a/Manager/ViewModel/ViewModelLocator.cs +++ b/Manager/ViewModel/ViewModelLocator.cs @@ -65,6 +65,7 @@ public ViewModelLocator() SimpleIoc.Default.Register(); SimpleIoc.Default.Register(); SimpleIoc.Default.Register(); + SimpleIoc.Default.Register(); SimpleIoc.Default.Register(); SimpleIoc.Default.Register(); SimpleIoc.Default.Register(); @@ -114,6 +115,8 @@ public ViewModelLocator() public DemoFlashbangsViewModel DemoFlashbangs => ServiceLocator.Current.GetInstance(); + public DemoChatViewModel DemoChat => ServiceLocator.Current.GetInstance(); + public RoundDetailsViewModel RoundDetails => ServiceLocator.Current.GetInstance(); public DemoStuffsViewModel DemoStuffs => ServiceLocator.Current.GetInstance(); diff --git a/Manager/Views/Demos/DemoChatView.xaml b/Manager/Views/Demos/DemoChatView.xaml new file mode 100644 index 000000000..9751d48c0 --- /dev/null +++ b/Manager/Views/Demos/DemoChatView.xaml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Manager/Views/Demos/DemoChatView.xaml.cs b/Manager/Views/Demos/DemoChatView.xaml.cs new file mode 100644 index 000000000..448e308ce --- /dev/null +++ b/Manager/Views/Demos/DemoChatView.xaml.cs @@ -0,0 +1,12 @@ +using System.Windows.Controls; + +namespace Manager.Views.Demos +{ + public partial class DemoChatView : UserControl + { + public DemoChatView() + { + InitializeComponent(); + } + } +} diff --git a/Manager/Views/Demos/DemoDetailsView.xaml b/Manager/Views/Demos/DemoDetailsView.xaml index 0d84e5c47..e127f59a9 100644 --- a/Manager/Views/Demos/DemoDetailsView.xaml +++ b/Manager/Views/Demos/DemoDetailsView.xaml @@ -115,10 +115,10 @@ Icon="MicrosoftExcel" Command="{Binding ExportDemoToExcelCommand}" /> + Command="{Binding ShowChatCommand}" /> diff --git a/Services/Concrete/Analyzer/CevoAnalyzer.cs b/Services/Concrete/Analyzer/CevoAnalyzer.cs index 29500717e..a5b274832 100644 --- a/Services/Concrete/Analyzer/CevoAnalyzer.cs +++ b/Services/Concrete/Analyzer/CevoAnalyzer.cs @@ -72,7 +72,6 @@ protected sealed override void RegisterEvents() Parser.PlayerHurt += HandlePlayerHurted; Parser.PlayerDisconnect += HandlePlayerDisconnect; Parser.PlayerTeam += HandlePlayerTeam; - Parser.SayText += HandleSayText; Parser.SayText2 += HandleSayText2; Parser.FreezetimeEnded += HandleFreezetimeEnded; } diff --git a/Services/Concrete/Analyzer/DemoAnalyzer.cs b/Services/Concrete/Analyzer/DemoAnalyzer.cs index 0db72a797..fb06fad86 100644 --- a/Services/Concrete/Analyzer/DemoAnalyzer.cs +++ b/Services/Concrete/Analyzer/DemoAnalyzer.cs @@ -1512,21 +1512,21 @@ protected void HandlePlayerTeam(object sender, PlayerTeamEventArgs e) protected void HandleSayText2(object sender, SayText2EventArgs e) { - e.Text = CleanUpChatText(e.Text); - string message = string.Empty; - if (e.Sender != null) + if (sender == null) { - message += e.Sender.Name + ": "; + return; } - message += e.Text; - Demo.ChatMessageList.Add(message); - } + ChatMessage chatMessage = new ChatMessage(Parser.IngameTick, Parser.CurrentTime) + { + Text = CleanUpChatText(e.Text), + SenderName = e.Sender.Name, + SenderSide = e.Sender.Team.ToSide(), + SenderSteamId = e.Sender.SteamID, + IsSenderAlive = e.Sender.IsAlive, + }; - protected void HandleSayText(object sender, SayTextEventArgs e) - { - e.Text = CleanUpChatText(e.Text); - Demo.ChatMessageList.Add(e.Text); + Demo.ChatMessages.Add(chatMessage); } #endregion diff --git a/Services/Concrete/Analyzer/EbotAnalyzer.cs b/Services/Concrete/Analyzer/EbotAnalyzer.cs index 1438799be..8924d31a4 100644 --- a/Services/Concrete/Analyzer/EbotAnalyzer.cs +++ b/Services/Concrete/Analyzer/EbotAnalyzer.cs @@ -201,10 +201,8 @@ protected void HandleLastRoundHalf(object sender, LastRoundHalfEventArgs e) } } - protected new void HandleSayText(object sender, SayTextEventArgs e) + private void HandleSayText(object sender, SayTextEventArgs e) { - base.HandleSayText(sender, e); - // game pause if (e.Text == STOP_ROUND) { diff --git a/Services/Concrete/Analyzer/EseaAnalyzer.cs b/Services/Concrete/Analyzer/EseaAnalyzer.cs index f5a17c717..1c362b091 100644 --- a/Services/Concrete/Analyzer/EseaAnalyzer.cs +++ b/Services/Concrete/Analyzer/EseaAnalyzer.cs @@ -49,7 +49,6 @@ protected sealed override void RegisterEvents() Parser.PlayerHurt += HandlePlayerHurted; Parser.PlayerDisconnect += HandlePlayerDisconnect; Parser.PlayerTeam += HandlePlayerTeam; - Parser.SayText += HandleSayText; Parser.SayText2 += HandleSayText2; } diff --git a/Services/Concrete/Analyzer/ValveAnalyzer.cs b/Services/Concrete/Analyzer/ValveAnalyzer.cs index f0e5dea16..639def9ef 100644 --- a/Services/Concrete/Analyzer/ValveAnalyzer.cs +++ b/Services/Concrete/Analyzer/ValveAnalyzer.cs @@ -68,7 +68,6 @@ protected sealed override void RegisterEvents() Parser.RankUpdate += HandleServerRankUpdate; Parser.PlayerDisconnect += HandlePlayerDisconnect; Parser.PlayerTeam += HandlePlayerTeam; - Parser.SayText += HandleSayText; Parser.SayText2 += HandleSayText2; Parser.FreezetimeEnded += HandleFreezetimeEnded; Parser.RoundFinal += HandleRoundFinal; diff --git a/Services/Concrete/DemosService.cs b/Services/Concrete/DemosService.cs index 1a6c6b804..8750911bc 100644 --- a/Services/Concrete/DemosService.cs +++ b/Services/Concrete/DemosService.cs @@ -447,7 +447,12 @@ public async Task> GetDemoListUrl() public void WriteChatFile(Demo demo, string filePath) { - File.WriteAllText(filePath, string.Join(Environment.NewLine, demo.ChatMessageList.ToArray())); + string content = ""; + foreach (ChatMessage chatMMessage in demo.ChatMessages) + { + content += $"{chatMMessage.SenderName}: {chatMMessage.Text}{Environment.NewLine}"; + } + File.WriteAllText(filePath, content); } public async Task GetShareCode(Demo demo)