Exemplo n.º 1
0
        /// <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 LoadDemoData()
        {
            FFXIVLogFileReader fr = new FFXIVLogFileReader(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "log"));
            demoLogs = fr.GetLogs();
            demoIndex = 0;
            lastSeconds = demoLogs[0].TotalSeconds;

            //foreach (FFXIVLog log in demoLogs)
            //{
            //    actionreport.Add(log);
            //}
            timer1.Start();
        }
        private void ファイルからインポートToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FF14FastReport.OpenGameLogFolderForm frm = new FF14FastReport.OpenGameLogFolderForm();
            if (frm.ShowDialog(this) == DialogResult.OK)
            {
                FFXIVLogFileReader fr = new FFXIVLogFileReader(frm.SelectedFolder);
              FF14LogParser actionReport = new FF14LogParser();

                foreach (FFXIVLog log in fr.GetLogs())
                {
                    actionReport.Add(log);
                }
                bindingSource1.DataSource = actionReport.ds;
                bindingSource1.DataMember = "Anaylzed";
            }

        }
Exemplo n.º 4
0
        /// <summary>
        /// ログを読みこむ
        /// </summary>
        /// <returns></returns>
        public FFXIVLog[] GetLogs()
        {
            List <FFXIVLog> loglist = new List <FFXIVLog>();

            int i = 0;
            //00000015
            string logfile = Path.Combine(FolderPath, i.ToString("X8") + ".log");

            while (File.Exists(logfile))
            {
                FFXIVLog[] logs = FFXIVLogFileReader.GetLogsFromFile(logfile);
                if (loglist.Count > 0 && logs[0].TimeStampServerTime < loglist[loglist.Count - 1].TimeStampServerTime)
                {
                    break;
                }
                loglist.AddRange(logs);
                i++;
                logfile = Path.Combine(FolderPath, i.ToString("X8") + ".log");
            }
            return(loglist.ToArray());
        }
        private void ログのインポートToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                FF14FastReport.OpenGameLogFolderForm frm = new FF14FastReport.OpenGameLogFolderForm();
                if (frm.ShowDialog(this) == DialogResult.OK)
                {
                    if (Directory.Exists(frm.SelectedFolder))
                    {
                        FFXIVLogFileReader fr = new FFXIVLogFileReader(frm.SelectedFolder);
                        FF14LogParser _ar = new FF14LogParser();

                        FFXIVLog[] logs = fr.GetLogs();
                        SetStatus(logs.Length + "行のログを解析しています。");
                        Application.DoEvents();
                        System.Threading.ThreadStart ts = () =>
                        {
                            foreach (FFXIVLog log in logs)
                            {
                                _ar.Add(log);
                            }
                        };
                        System.Threading.Thread th = new System.Threading.Thread(ts);
                        th.Start();

                        while (th.IsAlive)
                        {
                            SetProgress(100 * _ar.ds.Anaylzed.Count / logs.Length, true);
                            Application.DoEvents();
                            System.Threading.Thread.Sleep(100);
                        }
                        SetProgress(0, false);
                        SetStatus("読み込みが完了しました");
                        Application.DoEvents();

                        actionReport = _ar;
                        データ範囲指定ToolStripMenuItem_Click(this, null);
                    }
                }
            }
            catch
            {
                MessageBox.Show("ログファイルの読み込みに失敗しました。");
            }
        }
        /// <summary>
        /// ゲームクライアントが保存したログファイルの読み込み
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void fFXIVで保存されたログからインポートIToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (OpenLogFolderBrowserDialog.ShowDialog() == DialogResult.OK)
            {
                FFXIVLogFileReader filereader = new FFXIVLogFileReader(OpenLogFolderBrowserDialog.SelectedPath);
                int count = 0;
                foreach (FFXIVLog log in filereader.GetLogs())
                {
                    if(IsVisibleLog(log))
                    {
                        AddLog(log);
                    }

                    count++;
                    if (count > 1000)
                        break;
                }
            }
        }