diff --git a/ConsoleLogReaderCSGO/Base/Interfaces/IMessage.cs b/ConsoleLogReaderCSGO/Base/Interfaces/IMessage.cs
new file mode 100644
index 0000000..168fc40
--- /dev/null
+++ b/ConsoleLogReaderCSGO/Base/Interfaces/IMessage.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ConsoleLogReaderCSGO.Base.Interfaces
+{
+ public interface IMessage
+ {
+ #region Fields
+ public int ID { get; set; }
+ public string User { get; set; }
+ public string Text { get; set; }
+
+ #endregion
+ }
+}
diff --git a/ConsoleLogReaderCSGO/Base/MessageConsole.cs b/ConsoleLogReaderCSGO/Base/MessageConsole.cs
new file mode 100644
index 0000000..e1084f1
--- /dev/null
+++ b/ConsoleLogReaderCSGO/Base/MessageConsole.cs
@@ -0,0 +1,30 @@
+using ConsoleLogReaderCSGO.Base.Roots;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ConsoleLogReaderCSGO.Base
+{
+ public class MessageConsole : Message
+ {
+ #region Fields
+ public bool IsDead { get; set; }
+ public ChatType MessageType { get; set; }
+ public string Location { get; set; }
+
+ #endregion
+
+ #region Constructors
+
+ public MessageConsole() { }
+ public MessageConsole(int id, string user, string text, bool isDead, ChatType type, string location = null) : base(id, user, text)
+ {
+ IsDead = isDead;
+ MessageType = type;
+ Location = location;
+ }
+
+ #endregion
+ }
+
+}
diff --git a/ConsoleLogReaderCSGO/Base/Roots/Message.cs b/ConsoleLogReaderCSGO/Base/Roots/Message.cs
new file mode 100644
index 0000000..9585726
--- /dev/null
+++ b/ConsoleLogReaderCSGO/Base/Roots/Message.cs
@@ -0,0 +1,27 @@
+using ConsoleLogReaderCSGO.Base.Interfaces;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ConsoleLogReaderCSGO.Base.Roots
+{
+ public abstract class Message : IMessage
+ {
+ #region Fields
+ public int ID { get; set; }
+ public string User { get; set; }
+ public string Text { get; set; }
+
+ #endregion
+
+ #region Constructors
+ internal Message() { }
+ internal Message(int id, string user, string text)
+ {
+ ID = id;
+ User = user;
+ Text = text;
+ }
+ #endregion
+ }
+}
diff --git a/ConsoleLogReaderCSGO/ConsoleLogReaderCSGO.csproj b/ConsoleLogReaderCSGO/ConsoleLogReaderCSGO.csproj
index 4925d42..dd7105e 100644
--- a/ConsoleLogReaderCSGO/ConsoleLogReaderCSGO.csproj
+++ b/ConsoleLogReaderCSGO/ConsoleLogReaderCSGO.csproj
@@ -22,7 +22,6 @@
-
diff --git a/ConsoleLogReaderCSGO/Data/LogRegex.cs b/ConsoleLogReaderCSGO/Data/LogRegex.cs
index 7e86ae0..53e6081 100644
--- a/ConsoleLogReaderCSGO/Data/LogRegex.cs
+++ b/ConsoleLogReaderCSGO/Data/LogRegex.cs
@@ -8,13 +8,14 @@ namespace ConsoleLogReaderCSGO.Data
{
internal static class LogRegex
{
- public static Regex LogChat = new Regex(@"[ ][:][ ]");
- public static Regex LogDamage = new Regex(@"^((Damage Given to)|(Damage Taken from)|(-------------------------)|(Player:(.*)- Damage Given)|(Player: (.*)- Damage Taken))");
+ public static Regex LogChat = new Regex($@"({Variables.MessageUserTextSeparator})");
- public static Regex LogMatchInfo = new Regex(@"^((Steamworks Stats: CSteamWorksGameStatsClient Received CLIENT session id:)|(Steamworks Stats: CSteamWorksGameStatsClient Ending CLIENT session id:))");
+ public static Regex LogDamage = new Regex($@"^(({Variables.MessageDmg1})|({Variables.MessageDmg2})|({Variables.MessageDmg3})|({Variables.MessageDmg4})|({Variables.MessageDmg5}))");
- public static (Regex, LogFlags)[] regexLog { get; private set; } =
+ public static Regex LogMatchInfo = new Regex($@"^(({Variables.MessageStartGame})|({Variables.MessageEndGame}))");
+ public static Regex LogChatTeam { get; private set; } = new Regex($@" ?({Variables.MessageDead}|)(({Variables.MessageCT}|{Variables.MessageTT})(.*))");
+ public static (Regex, LogFlags)[] RegexLog { get; private set; } =
{
(LogChat, LogFlags.Chat),
(LogDamage, LogFlags.Damage),
diff --git a/ConsoleLogReaderCSGO/Data/Variables.cs b/ConsoleLogReaderCSGO/Data/Variables.cs
index 2eb7875..a6254b6 100644
--- a/ConsoleLogReaderCSGO/Data/Variables.cs
+++ b/ConsoleLogReaderCSGO/Data/Variables.cs
@@ -8,8 +8,45 @@ namespace ConsoleLogReaderCSGO.Data
{
internal static class Variables
{
+ #region logs
+
public static List ConsoleLines { get; set; }
public static LogSorted[] ConsoleLinesArray { get; set; }
+
+ #endregion
+
+ #region chat
+
+ public static int LastIndexChat { get; set; }
+
+ #endregion
+
+ #region Console Log Lines
+
+ public const string MessageStartGame = "Steamworks Stats: CSteamWorksGameStatsClient Received CLIENT session id:";
+ public const string MessageEndGame = "Steamworks Stats: CSteamWorksGameStatsClient Ending CLIENT session id:";
+ public const string MessageDisconnectFromGame = "ChangeGameUIState: CSGO_GAME_UI_STATE_MAINMENU -> CSGO_GAME_UI_STATE_MAINMENU";
+ public const string MessageGameStartConfirm = "LoadingScreen::OnNetMsgSetConVar";
+ public const string MessageGameEndConfirmPNG = "PNG load error Interlace handling should be turned on when using png_read_image";
+
+ public const string MessageTT = "(Terrorist) ";
+ public const string MessageCT = "(Counter-Terrorist) ";
+ public const string MessageDead = "*DEAD*";
+ public const string MessageUserTextSeparator = " : ";
+ public const string MessageMapSpotSeparator = " @ ";
+
+ public const string MessageDamageTaken = "Damage Taken from";
+ public const string MessageDamageGiven = "Damage Given to ";
+
+ public const string MessageDmg1 = "Damage Given to";
+ public const string MessageDmg2 = "Damage Taken from";
+ public const string MessageDmg3 = "-------------------------";
+ public const string MessageDmg4 = "Player: (.*)- Damage Given";
+ public const string MessageDmg5 = "Player: (.*)- Damage Taken";
+
+
+
+ #endregion
}
}
diff --git a/ConsoleLogReaderCSGO/Flags.cs b/ConsoleLogReaderCSGO/Flags.cs
index ab47d5a..3ab033d 100644
--- a/ConsoleLogReaderCSGO/Flags.cs
+++ b/ConsoleLogReaderCSGO/Flags.cs
@@ -4,6 +4,9 @@
namespace ConsoleLogReaderCSGO
{
+
+ #region Enumerator Log Flag
+
///
/// Enumerator of Log Flags
///
@@ -30,4 +33,31 @@ public enum LogFlags
///
All = 20,
}
+
+ #endregion
+
+ #region Enumerator Chat Type
+
+ ///
+ /// Enumerator for Type of console chat
+ ///
+ public enum ChatType
+ {
+ ///
+ /// Counter Terrorist chat, only readable for counter terrorist team
+ ///
+ CT = 1,
+ ///
+ /// Terrorist chat, only readable for terrorist team
+ ///
+ TT = 2,
+ ///
+ /// Global chat, readable for everyone
+ ///
+ GLOBAL = 3,
+ }
+
+ #endregion
+
+
}
\ No newline at end of file
diff --git a/ConsoleLogReaderCSGO/LogReader.cs b/ConsoleLogReaderCSGO/LogReader.cs
index 51495ff..d3cc648 100644
--- a/ConsoleLogReaderCSGO/LogReader.cs
+++ b/ConsoleLogReaderCSGO/LogReader.cs
@@ -88,6 +88,35 @@ public void UpdateLogNewFile(T newLog) // old.txt + newlogs.txt
UpdateLog(newLog, false);
}
+ ///
+ ///
Method returns a List that contains chats in provided logs.
+ ///
Depend on provided parameter bool it return all chat logs or only chat logs that was not given from last time method executed.
+ /// returns List of MessageConsole
+ ///
+ ///
+ ///
A boolean if true returns all chat message from log file.
+ ///
A boolean if false returns only chat message from log file that was not given from last time method executed.
+ ///
+ ///
+ /// Object List where every object cointains:
+ ///
1) (int) ID- index of line in console logs
+ ///
2) (string) User - username of message
+ ///
3) (string) Text - a message
+ ///
4) (bool) IsDead - if username when wrote message was dead
+ ///
5) (ChatTypr) MessageType - enumerator that indicates if message is global, counter-terrorist team or terrorist team
+ ///
6) (string) Location - if message was on team chat, showing map spot where message was wroten
+ ///
+ public List