コード例 #1
0
ファイル: LogEntry.cs プロジェクト: demyte/RiftDKPParser
        public void Parse()
        {
            Type = EventType.Invalid;
            DateTime parsedDateTime;

            var validDateTime = DateTime.TryParse(string.Format("{0} {1}", _raidDate, Entry.Substring(0, 8)), out parsedDateTime);

            if (!validDateTime)
            {
                return;
            }

            EventTime = parsedDateTime.ToLocalTime();
            EventText = Entry.Substring(10);

            if (EventText.EndsWith("has joined the raid"))
            {
                Type = EventType.Join;
            }

            if (EventText.EndsWith("has left the raid"))
            {
                Type = EventType.Leave;
            }

            if (EventText == "You've left the raid group!")
            {
                Type = EventType.LeaveByLogger;
            }

            if (EventText == "You've entered a raid group!")
            {
                Type = EventType.JoinByLogger;
            }

            if (EventText.Contains(_lootChannel))
            {
                // Will not match anything but in the format
                // [blah] - [blah] - ###
                if (Regex.Match(EventText, @"[^\]:]\[.*?\] - \[.*?\] - \d*").Success)
                {
                    Type = EventType.Loot;
                }
            }
        }