/// <summary> /// 更新する /// </summary> public void Update() { Dirs.Clear(); Files.Clear(); LogFiles.Clear(); Dirs.AddRange(Directory.GetDirectories(FolderFullPath)); Files.AddRange(Directory.GetDirectories(FolderFullPath)); if (Directory.Exists(logFolderPath) && File.Exists(GetLogFilePath(0))) { LogFiles.AddRange(Directory.GetFiles(logFolderPath)); LogFiles.Sort(); string firstLogFile = GetLogFilePath(0); string lastLogFile = GeLastWriteLogFile(); FFXIVLog[] f_logs = FFXIVLogFileReader.GetLogsFromFile(firstLogFile); FFXIVLog[] l_logs = FFXIVLogFileReader.GetLogsFromFile(lastLogFile); //最後にログインした時間をログから設定 LastLoginTimeFromLogFile = f_logs[0].TimeStampServerTime.Add(new TimeSpan(9, 0, 0));//ログファイルの時間はGMTなので+9時間 //最後にプレイした時間をログから設定 LastPlayTimeFromLogFile = l_logs[l_logs.Length - 1].TimeStampServerTime.Add(new TimeSpan(9, 0, 0)); //サーバー名 for (int i = 0; i < 999; i++) { if (f_logs[i].LogBody.StartsWith(":Welcome to ")) { ServerName = f_logs[0].LogBody.Substring(":Welcome to ".Length).Replace(" !", ""); break; } } //キャラ名取得 FF14LogParser ar = new FF14LogParser(); foreach (FFXIVLog log in f_logs) { ar.Add(log); FFXIVLogDataSet.ActorRow[] arows = (FFXIVLogDataSet.ActorRow[])ar.ds.Actor.Select("IsMe = True"); if (arows.Length > 0) { CharacterName = arows[0].Name; break; } } if (CharacterName == "") { foreach (FFXIVLog log in l_logs) { ar.Add(log); FFXIVLogDataSet.ActorRow[] arows = (FFXIVLogDataSet.ActorRow[])ar.ds.Actor.Select("IsMe = True"); if (arows.Length > 0) { CharacterName = arows[0].Name; break; } } } } }
private void logReader_Tick(object sender, EventArgs e) { logReader.Stop(); foreach (byte[] logdata in logmemoryInfo.GetNewLogsData()) { FFXIVLog log = FFXIVLog.ParseSingleLog(logdata); FFXIVLogDataSet.AnaylzedRow row = logParser.Add(log); var msg = log.LogBodyReplaceTabCode; SetStatus(msg.StartsWith(":") ? msg.Substring(1) : msg); ClearActorList(row); Mark(log); RejectPTMember(log); ParseActor(row, ActorType.FROM); ParseActor(row, ActorType.TO); Display(); } if (logCount < logParser.ds.Anaylzed.Count - 100) { logCount = logParser.ds.Anaylzed.Count; } logReader.Start(); }
private void InitializeData() { this.logCount = 0; int memoryLogCount = logmemoryInfo.GetLogCount(); FF14LogParser logParser = new FF14LogParser(); if (memoryLogCount > 1000) { SetStatus("ログ読込中..."); FFXIVUserFolder userfolder = new FFXIVUserFolder(); CharacterFolder playnow = null; foreach (CharacterFolder cf in userfolder.GetCharacterFolders()) { if (playnow == null) { playnow = cf; } if (cf.LastPlayTimeFromLogFile > playnow.LastPlayTimeFromLogFile) { playnow = cf; } } List <FFXIVLog> LogsFromFile = new List <FFXIVLog>(); memoryLogCount = logmemoryInfo.GetLogCount(); if (playnow.LastPlayTimeFromLogFile > FFXIVLog.StartDateTime) { foreach (FFXIVLog log in FFXIVLogFileReader.GetLogsFromFile(playnow.GeLastWriteLogFile())) { logParser.Add(log); } } SetStatus("ログ読込中..."); foreach (byte[] data in logmemoryInfo.GetNewLogsData()) { logParser.Add(FFXIVLog.ParseSingleLog(data)); } SetStatus("読込完了"); } SetProgress(100, true); this.logParser = logParser; SetProgress(0, false); }