Inheritance: IChatLogEntry
コード例 #1
0
        public static ChatLogEntry Process(byte[] raw)
        {
            var chatLogEntry = new ChatLogEntry();
            try
            {
                chatLogEntry.Bytes = raw;
                chatLogEntry.TimeStamp = UnixTimeStampToDateTime(int.Parse(ByteArrayToString(raw.Take(4)
                                                                                                .Reverse()
                                                                                                .ToArray()), NumberStyles.HexNumber));
                chatLogEntry.Code = ByteArrayToString(raw.Skip(4)
                                                         .Take(2)
                                                         .Reverse()
                                                         .ToArray());
                chatLogEntry.Raw = Encoding.UTF8.GetString(raw.ToArray());
                var cleanable = raw.Skip(8)
                                   .ToArray();
                var cleaned = new ChatCleaner(cleanable).Result;
                var cut = (cleaned.Substring(1, 1) == ":") ? 2 : 1;
                chatLogEntry.Line = XmlHelper.SanitizeXmlString(cleaned.Substring(cut));
                chatLogEntry.Line = new ChatCleaner(chatLogEntry.Line).Result;
                chatLogEntry.JP = Encoding.UTF8.GetBytes(chatLogEntry.Line)
                                          .Any(b => b > 128);

                chatLogEntry.Combined = $"{chatLogEntry.Code}:{chatLogEntry.Line}";
            }
            catch (Exception)
            {
                chatLogEntry.Bytes = new byte[0];
                chatLogEntry.Raw = "";
                chatLogEntry.Line = "";
                chatLogEntry.Code = "";
                chatLogEntry.Combined = "";
            }
            return chatLogEntry;
        }
コード例 #2
0
ファイル: ChatEntry.cs プロジェクト: shenkan/ffxivapp-memory
        public static ChatLogEntry Process(byte[] raw)
        {
            var chatLogEntry = new ChatLogEntry();

            try
            {
                chatLogEntry.Bytes     = raw;
                chatLogEntry.TimeStamp = UnixTimeStampToDateTime(int.Parse(ByteArrayToString(raw.Take(4)
                                                                                             .Reverse()
                                                                                             .ToArray()), NumberStyles.HexNumber));
                chatLogEntry.Code = ByteArrayToString(raw.Skip(4)
                                                      .Take(2)
                                                      .Reverse()
                                                      .ToArray());
                chatLogEntry.Raw = Encoding.UTF8.GetString(raw.ToArray());
                var cleanable = raw.Skip(8)
                                .ToArray();
                var cleaned = new ChatCleaner(cleanable).Result;
                var cut     = cleaned.Substring(1, 1) == ":" ? 2 : 1;
                chatLogEntry.Line = XmlHelper.SanitizeXmlString(cleaned.Substring(cut));
                chatLogEntry.Line = new ChatCleaner(chatLogEntry.Line).Result;
                chatLogEntry.JP   = IsJapanese(chatLogEntry.Line);

                chatLogEntry.Combined = $"{chatLogEntry.Code}:{chatLogEntry.Line}";
            }
            catch (Exception)
            {
                chatLogEntry.Bytes    = new byte[0];
                chatLogEntry.Raw      = string.Empty;
                chatLogEntry.Line     = string.Empty;
                chatLogEntry.Code     = string.Empty;
                chatLogEntry.Combined = string.Empty;
            }
            return(chatLogEntry);
        }
コード例 #3
0
ファイル: AppContextHelper.cs プロジェクト: kidaak/ffxivapp
 public void RaiseNewChatLogEntry(ChatLogEntry chatLogEntry)
 {
     if (ChatLogWorkerDelegate.IsPaused)
     {
         return;
     }
     AppViewModel.Instance.ChatHistory.Add(chatLogEntry);
     // THIRD PARTY
     PluginHost.Instance.RaiseNewChatLogEntry(chatLogEntry);
 }
コード例 #4
0
ファイル: PluginHost.cs プロジェクト: Catacatata/ffxivapp
 public virtual void RaiseNewChatLogEntry(ChatLogEntry e)
 {
     var chatLogEntryEvent = new ChatLogEntryEvent(this, e);
     var handler = NewChatLogEntry;
     if (handler != null)
     {
         handler(this, chatLogEntryEvent);
     }
 }