/// <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 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); }
private void Mark(FFXIVLog log) { if (log.LogBodyReplaceTabCode.Contains("設定しました")) { var regex = new Regex(@".*?が(?<name>[A-Z][a-z']+? [A-Z][a-z']+?)に『(?<marker>.+?)』を設定しました。"); var match = regex.Match(log.LogBodyReplaceTabCode); if (match.Success) { string name = match.Groups["name"].Value; string marker = match.Groups["marker"].Value; if (!FF14LogParser.IsPet(name)) { var actorsStatusChanged = new Dictionary <string, PvPActor>(); foreach (string key in actors.Keys) { var pvpActor = FindOrCreatePvPActor(key); if (!pvpActor.isPTMember) { if (key == name) { pvpActor.marker = PvPActor.GetMarkerEnum(marker); actorsStatusChanged[name] = pvpActor; } else if (pvpActor.marker.ToString() == marker) { pvpActor.marker = Marker.なし; actorsStatusChanged[name] = pvpActor; } } } foreach (string key in actorsStatusChanged.Keys) { actors[key] = actorsStatusChanged[key]; } } } } }
private void ParseActor(FFXIVLogDataSet.AnaylzedRow row, ActorType type) { if (!row.IsFromNull()) { var actorName = type == ActorType.FROM ? row.From : row.To; var actor = logParser.ds.Actor.FindByName(actorName); if (actor != null && !FF14LogParser.IsPet(actorName)) { Regex regex = new Regex(@"(?<name>[A-Z][a-z']+? [A-Z][a-z']+?)"); Match match = regex.Match(actorName); if (!match.Success) { return; } var pvpActor = FindOrCreatePvPActor(actorName); if (pvpActor.jobList.Count == 0 && actorsLog.Keys.Contains(actorName)) { pvpActor.jobList = actorsLog[actorName].jobList; } if (type == ActorType.FROM && !actor.IsClassJobNull()) { if (!row.IsActionNameNull()) { if (row.ActionName == "プロテス" || row.ActionName == "ストンスキン") { pvpActor.isHealer = true; actor.ClassJob = "白魔道士 学者"; } } pvpActor.SetJobList(PvPActor.ParseJob(actor.ClassJob)); } actors[actorName] = pvpActor; } } }
public StealGaze() { InitializeComponent(); logParser = new FF14LogParser(); }