Ejemplo n.º 1
0
        private void loadLogButton_Click(object sender, EventArgs e)
        {
            string file = mConfig.GetLogFileName();

            openFileDialog.InitialDirectory = Path.GetDirectoryName(file);
            openFileDialog.FileName         = mConfig.GetLogFileName();
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                mPlugin.LoadViewerLog(openFileDialog.FileName);

                statsList.Items.Clear();

                foreach (var stat in mPlugin.Stats)
                {
                    ListViewItem item = new ListViewItem(stat.ToString());
                    foreach (var value in stat.Split(','))
                    {
                        item.SubItems.Add(value);
                    }

                    statsList.Items.Add(item);
                }
            }
        }
Ejemplo n.º 2
0
        private void Finish()
        {
            Logger.Info("Finished walking route.");
            lock (this) {
                mCore.Tick  -= mTickListener;
                mTargetIndex = 0;
                mRunning     = false;
                mConfig.StopRecordingLog(mCore);

                Console.Beep(2000, 100);
                Thread.Sleep(100);
                Console.Beep(2000, 100);
                Thread.Sleep(100);
                Console.Beep(2000, 100);

                Thread.Sleep(1000);

                string ids = "";

                foreach (var controller in mCore.Frames.Select(f => f.Output as OpenSimController))
                {
                    ids += "," + controller.ProxyController.SessionID;
                    controller.Stop();
                }

                Thread.Sleep(500);

                bool success = false;

                if (mRecorder != null && mConfig.ProcessOnFinish)
                {
                    foreach (var frame in mCore.Frames)
                    {
                        string viewerLogFile = mConfig.GetLogFileName(frame.Name);
                        success = mRecorder.LoadViewerLog(viewerLogFile);
                        mRecorder.WriteCSV(frame);
                    }
                }

                //This will break if ClientRecorderPlugin is not loaded.
                string csvFile = mCore.GetPlugin <ClientRecorderPlugin>().GetCSVName();
                string logFile = Path.Combine(Path.GetDirectoryName(csvFile), "Runs.csv");
                if (!File.Exists(logFile))
                {
                    File.AppendAllText(logFile, "Run,Region,Start,Finish,Mode,Settings File,Startup Key Presses,Settings Loader Plugin,SettingsChangerPlugin,Log Loaded,# Samples,UUID" + Environment.NewLine);
                }

                File.AppendAllText(logFile, mConfig.RunInfo + ",");
                File.AppendAllText(logFile, mConfig.Region + ",");
                File.AppendAllText(logFile, mConfig.Timestamp.ToString() + ",");
                File.AppendAllText(logFile, DateTime.Now + ",");
                File.AppendAllText(logFile, mConfig.Mode + ",");
                if (mConfig.SettingsLoaderEnabled && mCore.HasPlugin <SettingLoaderPlugin>())
                {
                    File.AppendAllText(logFile, mCore.GetPlugin <SettingLoaderPlugin>().Setting + ",");
                }
                else
                {
                    File.AppendAllText(logFile, Path.GetFileName(mConfig.SettingsFile) + ",");
                }
                File.AppendAllText(logFile, mConfig.StartupKeyPresses.Aggregate((a, c) => a + ":" + c) + ",");
                File.AppendAllText(logFile, (mConfig.SettingsLoaderEnabled ? "Enabled" : "Disabled") + ",");
                File.AppendAllText(logFile, (mConfig.SettingsChangerEnabled ? "Enabled" : "Disabled") + ",");
                if (File.Exists(csvFile))
                {
                    File.AppendAllText(logFile, "True," + (File.ReadAllLines(csvFile).Length - 1) + "," + ids);
                }
                else
                {
                    File.AppendAllText(logFile, "False,-1," + ids);
                }

                File.AppendAllText(logFile, Environment.NewLine);
            }
            if (mConfig.AutoShutdown)
            {
                mForm.Invoke(new Action(() => mForm.Close()));
            }
        }