Trace Logger - some code clean up, some tiny speedups, and implement a few small tweaks like Always on Top, and Select All
This commit is contained in:
parent
9ccc214667
commit
0ed9d832c7
|
@ -290,6 +290,7 @@ namespace BizHawk.Client.Common
|
||||||
//Trace Logger Settings
|
//Trace Logger Settings
|
||||||
public bool TraceLoggerAutoLoad = false;
|
public bool TraceLoggerAutoLoad = false;
|
||||||
public bool TraceLoggerSaveWindowPosition = true;
|
public bool TraceLoggerSaveWindowPosition = true;
|
||||||
|
public bool TraceLoggerOnTop = false;
|
||||||
public int TraceLoggerMaxLines = 100000;
|
public int TraceLoggerMaxLines = 100000;
|
||||||
public int TraceLoggerWndx = -1;
|
public int TraceLoggerWndx = -1;
|
||||||
public int TraceLoggerWndy = -1;
|
public int TraceLoggerWndy = -1;
|
||||||
|
|
|
@ -34,17 +34,18 @@
|
||||||
this.Script = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
this.Script = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||||
this.menuStrip1 = new MenuStripEx();
|
this.menuStrip1 = new MenuStripEx();
|
||||||
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.FileSubMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.saveLogToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.SaveLogMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
|
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
|
||||||
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.ExitMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.EditSubMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.copyAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.CopyMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.SelectAllMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.setMaxWindowLinesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.OptionsSubMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.MaxLinesMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
|
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
|
||||||
this.autoloadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.AutoloadMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.saveWindowPositionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.SaveWindowPositionMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||||
this.BrowseBox = new System.Windows.Forms.Button();
|
this.BrowseBox = new System.Windows.Forms.Button();
|
||||||
this.FileBox = new System.Windows.Forms.TextBox();
|
this.FileBox = new System.Windows.Forms.TextBox();
|
||||||
|
@ -52,6 +53,7 @@
|
||||||
this.ToWindowRadio = new System.Windows.Forms.RadioButton();
|
this.ToWindowRadio = new System.Windows.Forms.RadioButton();
|
||||||
this.ClearButton = new System.Windows.Forms.Button();
|
this.ClearButton = new System.Windows.Forms.Button();
|
||||||
this.LoggingEnabled = new System.Windows.Forms.CheckBox();
|
this.LoggingEnabled = new System.Windows.Forms.CheckBox();
|
||||||
|
this.AlwaysOnTopMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.TracerBox.SuspendLayout();
|
this.TracerBox.SuspendLayout();
|
||||||
this.menuStrip1.SuspendLayout();
|
this.menuStrip1.SuspendLayout();
|
||||||
this.groupBox2.SuspendLayout();
|
this.groupBox2.SuspendLayout();
|
||||||
|
@ -91,7 +93,6 @@
|
||||||
this.TraceView.TabStop = false;
|
this.TraceView.TabStop = false;
|
||||||
this.TraceView.UseCompatibleStateImageBehavior = false;
|
this.TraceView.UseCompatibleStateImageBehavior = false;
|
||||||
this.TraceView.View = System.Windows.Forms.View.Details;
|
this.TraceView.View = System.Windows.Forms.View.Details;
|
||||||
this.TraceView.KeyDown += new System.Windows.Forms.KeyEventHandler(this.TraceView_KeyDown);
|
|
||||||
//
|
//
|
||||||
// Script
|
// Script
|
||||||
//
|
//
|
||||||
|
@ -103,9 +104,9 @@
|
||||||
this.menuStrip1.ClickThrough = true;
|
this.menuStrip1.ClickThrough = true;
|
||||||
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
this.toolStripMenuItem1,
|
this.toolStripMenuItem1,
|
||||||
this.fileToolStripMenuItem,
|
this.FileSubMenu,
|
||||||
this.editToolStripMenuItem,
|
this.EditSubMenu,
|
||||||
this.optionsToolStripMenuItem});
|
this.OptionsSubMenu});
|
||||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||||
this.menuStrip1.Name = "menuStrip1";
|
this.menuStrip1.Name = "menuStrip1";
|
||||||
this.menuStrip1.Size = new System.Drawing.Size(644, 24);
|
this.menuStrip1.Size = new System.Drawing.Size(644, 24);
|
||||||
|
@ -117,90 +118,102 @@
|
||||||
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
|
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
|
||||||
this.toolStripMenuItem1.Size = new System.Drawing.Size(12, 20);
|
this.toolStripMenuItem1.Size = new System.Drawing.Size(12, 20);
|
||||||
//
|
//
|
||||||
// fileToolStripMenuItem
|
// FileSubMenu
|
||||||
//
|
//
|
||||||
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.FileSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
this.saveLogToolStripMenuItem,
|
this.SaveLogMenuItem,
|
||||||
this.toolStripSeparator1,
|
this.toolStripSeparator1,
|
||||||
this.exitToolStripMenuItem});
|
this.ExitMenuItem});
|
||||||
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
|
this.FileSubMenu.Name = "FileSubMenu";
|
||||||
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
|
this.FileSubMenu.Size = new System.Drawing.Size(37, 20);
|
||||||
this.fileToolStripMenuItem.Text = "&File";
|
this.FileSubMenu.Text = "&File";
|
||||||
//
|
//
|
||||||
// saveLogToolStripMenuItem
|
// SaveLogMenuItem
|
||||||
//
|
//
|
||||||
this.saveLogToolStripMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.SaveAs;
|
this.SaveLogMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.SaveAs;
|
||||||
this.saveLogToolStripMenuItem.Name = "saveLogToolStripMenuItem";
|
this.SaveLogMenuItem.Name = "SaveLogMenuItem";
|
||||||
this.saveLogToolStripMenuItem.Size = new System.Drawing.Size(134, 22);
|
this.SaveLogMenuItem.Size = new System.Drawing.Size(134, 22);
|
||||||
this.saveLogToolStripMenuItem.Text = "&Save Log";
|
this.SaveLogMenuItem.Text = "&Save Log";
|
||||||
this.saveLogToolStripMenuItem.Click += new System.EventHandler(this.saveLogToolStripMenuItem_Click);
|
this.SaveLogMenuItem.Click += new System.EventHandler(this.SaveLogMenuItem_Click);
|
||||||
//
|
//
|
||||||
// toolStripSeparator1
|
// toolStripSeparator1
|
||||||
//
|
//
|
||||||
this.toolStripSeparator1.Name = "toolStripSeparator1";
|
this.toolStripSeparator1.Name = "toolStripSeparator1";
|
||||||
this.toolStripSeparator1.Size = new System.Drawing.Size(131, 6);
|
this.toolStripSeparator1.Size = new System.Drawing.Size(131, 6);
|
||||||
//
|
//
|
||||||
// exitToolStripMenuItem
|
// ExitMenuItem
|
||||||
//
|
//
|
||||||
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
|
this.ExitMenuItem.Name = "ExitMenuItem";
|
||||||
this.exitToolStripMenuItem.ShortcutKeyDisplayString = "Alt+F4";
|
this.ExitMenuItem.ShortcutKeyDisplayString = "Alt+F4";
|
||||||
this.exitToolStripMenuItem.Size = new System.Drawing.Size(134, 22);
|
this.ExitMenuItem.Size = new System.Drawing.Size(134, 22);
|
||||||
this.exitToolStripMenuItem.Text = "E&xit";
|
this.ExitMenuItem.Text = "E&xit";
|
||||||
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
|
this.ExitMenuItem.Click += new System.EventHandler(this.ExitMenuItem_Click);
|
||||||
//
|
//
|
||||||
// editToolStripMenuItem
|
// EditSubMenu
|
||||||
//
|
//
|
||||||
this.editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.EditSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
this.copyAllToolStripMenuItem});
|
this.CopyMenuItem,
|
||||||
this.editToolStripMenuItem.Name = "editToolStripMenuItem";
|
this.SelectAllMenuItem});
|
||||||
this.editToolStripMenuItem.Size = new System.Drawing.Size(39, 20);
|
this.EditSubMenu.Name = "EditSubMenu";
|
||||||
this.editToolStripMenuItem.Text = "Edit";
|
this.EditSubMenu.Size = new System.Drawing.Size(39, 20);
|
||||||
|
this.EditSubMenu.Text = "Edit";
|
||||||
//
|
//
|
||||||
// copyAllToolStripMenuItem
|
// CopyMenuItem
|
||||||
//
|
//
|
||||||
this.copyAllToolStripMenuItem.Name = "copyAllToolStripMenuItem";
|
this.CopyMenuItem.Name = "CopyMenuItem";
|
||||||
this.copyAllToolStripMenuItem.ShortcutKeyDisplayString = "Ctrl+C";
|
this.CopyMenuItem.ShortcutKeyDisplayString = "";
|
||||||
this.copyAllToolStripMenuItem.Size = new System.Drawing.Size(161, 22);
|
this.CopyMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C)));
|
||||||
this.copyAllToolStripMenuItem.Text = "Copy All";
|
this.CopyMenuItem.Size = new System.Drawing.Size(164, 22);
|
||||||
this.copyAllToolStripMenuItem.Click += new System.EventHandler(this.copyAllToolStripMenuItem_Click);
|
this.CopyMenuItem.Text = "&Copy";
|
||||||
|
this.CopyMenuItem.Click += new System.EventHandler(this.CopyMenuItem_Click);
|
||||||
//
|
//
|
||||||
// optionsToolStripMenuItem
|
// SelectAllMenuItem
|
||||||
//
|
//
|
||||||
this.optionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.SelectAllMenuItem.Name = "SelectAllMenuItem";
|
||||||
this.setMaxWindowLinesToolStripMenuItem,
|
this.SelectAllMenuItem.ShortcutKeyDisplayString = "";
|
||||||
|
this.SelectAllMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.A)));
|
||||||
|
this.SelectAllMenuItem.Size = new System.Drawing.Size(164, 22);
|
||||||
|
this.SelectAllMenuItem.Text = "Select &All";
|
||||||
|
this.SelectAllMenuItem.Click += new System.EventHandler(this.SelectAllMenuItem_Click);
|
||||||
|
//
|
||||||
|
// OptionsSubMenu
|
||||||
|
//
|
||||||
|
this.OptionsSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.MaxLinesMenuItem,
|
||||||
this.toolStripSeparator2,
|
this.toolStripSeparator2,
|
||||||
this.autoloadToolStripMenuItem,
|
this.AutoloadMenuItem,
|
||||||
this.saveWindowPositionToolStripMenuItem});
|
this.SaveWindowPositionMenuItem,
|
||||||
this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem";
|
this.AlwaysOnTopMenuItem});
|
||||||
this.optionsToolStripMenuItem.Size = new System.Drawing.Size(61, 20);
|
this.OptionsSubMenu.Name = "OptionsSubMenu";
|
||||||
this.optionsToolStripMenuItem.Text = "&Options";
|
this.OptionsSubMenu.Size = new System.Drawing.Size(61, 20);
|
||||||
this.optionsToolStripMenuItem.DropDownOpened += new System.EventHandler(this.optionsToolStripMenuItem_DropDownOpened);
|
this.OptionsSubMenu.Text = "&Options";
|
||||||
|
this.OptionsSubMenu.DropDownOpened += new System.EventHandler(this.OptionsSubMenu_DropDownOpened);
|
||||||
//
|
//
|
||||||
// setMaxWindowLinesToolStripMenuItem
|
// MaxLinesMenuItem
|
||||||
//
|
//
|
||||||
this.setMaxWindowLinesToolStripMenuItem.Name = "setMaxWindowLinesToolStripMenuItem";
|
this.MaxLinesMenuItem.Name = "MaxLinesMenuItem";
|
||||||
this.setMaxWindowLinesToolStripMenuItem.Size = new System.Drawing.Size(201, 22);
|
this.MaxLinesMenuItem.Size = new System.Drawing.Size(191, 22);
|
||||||
this.setMaxWindowLinesToolStripMenuItem.Text = "&Set Max Window Lines...";
|
this.MaxLinesMenuItem.Text = "&Set Max Lines...";
|
||||||
this.setMaxWindowLinesToolStripMenuItem.Click += new System.EventHandler(this.setMaxWindowLinesToolStripMenuItem_Click);
|
this.MaxLinesMenuItem.Click += new System.EventHandler(this.MaxLinesMenuItem_Click);
|
||||||
//
|
//
|
||||||
// toolStripSeparator2
|
// toolStripSeparator2
|
||||||
//
|
//
|
||||||
this.toolStripSeparator2.Name = "toolStripSeparator2";
|
this.toolStripSeparator2.Name = "toolStripSeparator2";
|
||||||
this.toolStripSeparator2.Size = new System.Drawing.Size(198, 6);
|
this.toolStripSeparator2.Size = new System.Drawing.Size(188, 6);
|
||||||
//
|
//
|
||||||
// autoloadToolStripMenuItem
|
// AutoloadMenuItem
|
||||||
//
|
//
|
||||||
this.autoloadToolStripMenuItem.Name = "autoloadToolStripMenuItem";
|
this.AutoloadMenuItem.Name = "AutoloadMenuItem";
|
||||||
this.autoloadToolStripMenuItem.Size = new System.Drawing.Size(201, 22);
|
this.AutoloadMenuItem.Size = new System.Drawing.Size(191, 22);
|
||||||
this.autoloadToolStripMenuItem.Text = "&Autoload";
|
this.AutoloadMenuItem.Text = "&Autoload";
|
||||||
this.autoloadToolStripMenuItem.Click += new System.EventHandler(this.autoloadToolStripMenuItem_Click);
|
this.AutoloadMenuItem.Click += new System.EventHandler(this.AutoloadMenuItem_Click);
|
||||||
//
|
//
|
||||||
// saveWindowPositionToolStripMenuItem
|
// SaveWindowPositionMenuItem
|
||||||
//
|
//
|
||||||
this.saveWindowPositionToolStripMenuItem.Name = "saveWindowPositionToolStripMenuItem";
|
this.SaveWindowPositionMenuItem.Name = "SaveWindowPositionMenuItem";
|
||||||
this.saveWindowPositionToolStripMenuItem.Size = new System.Drawing.Size(201, 22);
|
this.SaveWindowPositionMenuItem.Size = new System.Drawing.Size(191, 22);
|
||||||
this.saveWindowPositionToolStripMenuItem.Text = "&Save Window Position";
|
this.SaveWindowPositionMenuItem.Text = "&Save Window Position";
|
||||||
this.saveWindowPositionToolStripMenuItem.Click += new System.EventHandler(this.saveWindowPositionToolStripMenuItem_Click);
|
this.SaveWindowPositionMenuItem.Click += new System.EventHandler(this.SaveWindowPositionMenuItem_Click);
|
||||||
//
|
//
|
||||||
// groupBox2
|
// groupBox2
|
||||||
//
|
//
|
||||||
|
@ -289,6 +302,13 @@
|
||||||
this.LoggingEnabled.UseVisualStyleBackColor = true;
|
this.LoggingEnabled.UseVisualStyleBackColor = true;
|
||||||
this.LoggingEnabled.CheckedChanged += new System.EventHandler(this.LoggingEnabled_CheckedChanged);
|
this.LoggingEnabled.CheckedChanged += new System.EventHandler(this.LoggingEnabled_CheckedChanged);
|
||||||
//
|
//
|
||||||
|
// AlwaysOnTopMenuItem
|
||||||
|
//
|
||||||
|
this.AlwaysOnTopMenuItem.Name = "AlwaysOnTopMenuItem";
|
||||||
|
this.AlwaysOnTopMenuItem.Size = new System.Drawing.Size(191, 22);
|
||||||
|
this.AlwaysOnTopMenuItem.Text = "&Always on Top";
|
||||||
|
this.AlwaysOnTopMenuItem.Click += new System.EventHandler(this.AlwaysOnTopMenuItem_Click);
|
||||||
|
//
|
||||||
// TraceLogger
|
// TraceLogger
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
|
@ -305,7 +325,6 @@
|
||||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||||
this.Text = "TraceLogger";
|
this.Text = "TraceLogger";
|
||||||
this.Load += new System.EventHandler(this.TraceLogger_Load);
|
this.Load += new System.EventHandler(this.TraceLogger_Load);
|
||||||
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.TraceLogger_KeyDown);
|
|
||||||
this.TracerBox.ResumeLayout(false);
|
this.TracerBox.ResumeLayout(false);
|
||||||
this.menuStrip1.ResumeLayout(false);
|
this.menuStrip1.ResumeLayout(false);
|
||||||
this.menuStrip1.PerformLayout();
|
this.menuStrip1.PerformLayout();
|
||||||
|
@ -321,25 +340,27 @@
|
||||||
private System.Windows.Forms.GroupBox TracerBox;
|
private System.Windows.Forms.GroupBox TracerBox;
|
||||||
private MenuStripEx menuStrip1;
|
private MenuStripEx menuStrip1;
|
||||||
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1;
|
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1;
|
||||||
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem FileSubMenu;
|
||||||
private System.Windows.Forms.ToolStripMenuItem saveLogToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem SaveLogMenuItem;
|
||||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
|
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
|
||||||
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem ExitMenuItem;
|
||||||
private System.Windows.Forms.GroupBox groupBox2;
|
private System.Windows.Forms.GroupBox groupBox2;
|
||||||
private System.Windows.Forms.CheckBox LoggingEnabled;
|
private System.Windows.Forms.CheckBox LoggingEnabled;
|
||||||
private System.Windows.Forms.Button ClearButton;
|
private System.Windows.Forms.Button ClearButton;
|
||||||
private System.Windows.Forms.ToolStripMenuItem optionsToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem OptionsSubMenu;
|
||||||
private System.Windows.Forms.ToolStripMenuItem autoloadToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem AutoloadMenuItem;
|
||||||
private VirtualListView TraceView;
|
private VirtualListView TraceView;
|
||||||
public System.Windows.Forms.ColumnHeader Script;
|
public System.Windows.Forms.ColumnHeader Script;
|
||||||
private System.Windows.Forms.ToolStripMenuItem setMaxWindowLinesToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem MaxLinesMenuItem;
|
||||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
|
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
|
||||||
private System.Windows.Forms.ToolStripMenuItem saveWindowPositionToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem SaveWindowPositionMenuItem;
|
||||||
private System.Windows.Forms.RadioButton ToFileRadio;
|
private System.Windows.Forms.RadioButton ToFileRadio;
|
||||||
private System.Windows.Forms.RadioButton ToWindowRadio;
|
private System.Windows.Forms.RadioButton ToWindowRadio;
|
||||||
private System.Windows.Forms.TextBox FileBox;
|
private System.Windows.Forms.TextBox FileBox;
|
||||||
private System.Windows.Forms.Button BrowseBox;
|
private System.Windows.Forms.Button BrowseBox;
|
||||||
private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem EditSubMenu;
|
||||||
private System.Windows.Forms.ToolStripMenuItem copyAllToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem CopyMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem SelectAllMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem AlwaysOnTopMenuItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,9 +1,10 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using System.IO;
|
|
||||||
|
|
||||||
using BizHawk.Client.Common;
|
using BizHawk.Client.Common;
|
||||||
|
|
||||||
|
@ -14,46 +15,40 @@ namespace BizHawk.Client.EmuHawk
|
||||||
// Refresh rate slider
|
// Refresh rate slider
|
||||||
// Make faster, such as not saving to disk until the logging is stopped, dont' add to Instructions list every frame, etc
|
// Make faster, such as not saving to disk until the logging is stopped, dont' add to Instructions list every frame, etc
|
||||||
// Remember window size
|
// Remember window size
|
||||||
|
private readonly List<string> _instructions = new List<string>();
|
||||||
private readonly List<string> Instructions = new List<string>();
|
private FileInfo _logFile;
|
||||||
private FileInfo LogFile;
|
|
||||||
|
|
||||||
public bool AskSave() { return true; }
|
|
||||||
public bool UpdateBefore { get { return false; } }
|
|
||||||
|
|
||||||
public TraceLogger()
|
public TraceLogger()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
TraceView.QueryItemText += TraceView_QueryItemText;
|
TraceView.QueryItemText += TraceView_QueryItemText;
|
||||||
TraceView.QueryItemBkColor += TraceView_QueryItemBkColor;
|
|
||||||
TraceView.VirtualMode = true;
|
TraceView.VirtualMode = true;
|
||||||
|
|
||||||
|
TopMost = Global.Config.TraceLoggerOnTop;
|
||||||
Closing += (o, e) => SaveConfigSettings();
|
Closing += (o, e) => SaveConfigSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SaveConfigSettings()
|
public bool UpdateBefore
|
||||||
|
{
|
||||||
|
get { return false; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool AskSave()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SaveConfigSettings()
|
||||||
{
|
{
|
||||||
Global.CoreComm.Tracer.Enabled = false;
|
Global.CoreComm.Tracer.Enabled = false;
|
||||||
Global.Config.TraceLoggerWndx = Location.X;
|
Global.Config.TraceLoggerWndx = Location.X;
|
||||||
Global.Config.TraceLoggerWndy = Location.Y;
|
Global.Config.TraceLoggerWndy = Location.Y;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void TraceView_QueryItemBkColor(int index, int column, ref Color color)
|
|
||||||
{
|
|
||||||
//TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
private void TraceView_QueryItemText(int index, int column, out string text)
|
private void TraceView_QueryItemText(int index, int column, out string text)
|
||||||
{
|
{
|
||||||
if (index < Instructions.Count)
|
text = index < _instructions.Count ? _instructions[index] : String.Empty;
|
||||||
{
|
|
||||||
text = Instructions[index];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
text = "";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void TraceLogger_Load(object sender, EventArgs e)
|
private void TraceLogger_Load(object sender, EventArgs e)
|
||||||
|
@ -72,7 +67,15 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
public void UpdateValues()
|
public void UpdateValues()
|
||||||
{
|
{
|
||||||
DoInstructions();
|
TraceView.BlazingFast = !GlobalWin.MainForm.EmulatorPaused;
|
||||||
|
if (ToWindowRadio.Checked)
|
||||||
|
{
|
||||||
|
LogToWindow();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LogToFile();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Restart()
|
public void Restart()
|
||||||
|
@ -97,16 +100,210 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void ClearList()
|
private void ClearList()
|
||||||
{
|
{
|
||||||
Instructions.Clear();
|
_instructions.Clear();
|
||||||
TraceView.ItemCount = 0;
|
TraceView.ItemCount = 0;
|
||||||
SetTracerBoxTitle();
|
SetTracerBoxTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
|
private void LogToFile()
|
||||||
|
{
|
||||||
|
using (var sw = new StreamWriter(_logFile.FullName, true))
|
||||||
|
{
|
||||||
|
sw.Write(Global.CoreComm.Tracer.TakeContents());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LogToWindow()
|
||||||
|
{
|
||||||
|
var instructions = Global.CoreComm.Tracer.TakeContents().Split('\n');
|
||||||
|
if (!String.IsNullOrWhiteSpace(instructions[0]))
|
||||||
|
{
|
||||||
|
_instructions.AddRange(instructions);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_instructions.Count >= Global.Config.TraceLoggerMaxLines)
|
||||||
|
{
|
||||||
|
var x = _instructions.Count - Global.Config.TraceLoggerMaxLines;
|
||||||
|
_instructions.RemoveRange(0, x);
|
||||||
|
}
|
||||||
|
|
||||||
|
TraceView.ItemCount = _instructions.Count;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Point GetPromptPoint()
|
||||||
|
{
|
||||||
|
return PointToScreen(
|
||||||
|
new Point(TraceView.Location.X + 30, TraceView.Location.Y + 30)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetTracerBoxTitle()
|
||||||
|
{
|
||||||
|
if (Global.CoreComm.Tracer.Enabled)
|
||||||
|
{
|
||||||
|
if (ToFileRadio.Checked)
|
||||||
|
{
|
||||||
|
TracerBox.Text = "Trace log - logging to file...";
|
||||||
|
}
|
||||||
|
else if (_instructions.Any())
|
||||||
|
{
|
||||||
|
TracerBox.Text = "Trace log - logging - " + _instructions.Count + " instructions";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TracerBox.Text = "Trace log - logging...";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (_instructions.Any())
|
||||||
|
{
|
||||||
|
TracerBox.Text = "Trace log - " + _instructions.Count + " instructions";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TracerBox.Text = "Trace log";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CloseFile()
|
||||||
|
{
|
||||||
|
// TODO: save the remaining instructions in CoreComm
|
||||||
|
}
|
||||||
|
|
||||||
|
private FileInfo GetFileFromUser()
|
||||||
|
{
|
||||||
|
var sfd = new SaveFileDialog();
|
||||||
|
if (_logFile == null)
|
||||||
|
{
|
||||||
|
sfd.FileName = PathManager.FilesystemSafeName(Global.Game) + ".txt";
|
||||||
|
sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.LogPath, null);
|
||||||
|
}
|
||||||
|
else if (!String.IsNullOrWhiteSpace(_logFile.FullName))
|
||||||
|
{
|
||||||
|
sfd.FileName = PathManager.FilesystemSafeName(Global.Game);
|
||||||
|
sfd.InitialDirectory = Path.GetDirectoryName(_logFile.FullName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sfd.FileName = Path.GetFileNameWithoutExtension(_logFile.FullName);
|
||||||
|
sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.LogPath, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
sfd.Filter = "Text Files (*.txt)|*.txt|Log Files (*.log)|*.log|All Files|*.*";
|
||||||
|
sfd.RestoreDirectory = true;
|
||||||
|
var result = sfd.ShowHawkDialog();
|
||||||
|
if (result == DialogResult.OK)
|
||||||
|
{
|
||||||
|
return new FileInfo(sfd.FileName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DumpListToDisk(FileSystemInfo file)
|
||||||
|
{
|
||||||
|
using (var sw = new StreamWriter(file.FullName))
|
||||||
|
{
|
||||||
|
foreach (var instruction in _instructions)
|
||||||
|
{
|
||||||
|
sw.WriteLine(instruction);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Events
|
||||||
|
|
||||||
|
#region Menu Items
|
||||||
|
|
||||||
|
private void SaveLogMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var file = GetFileFromUser();
|
||||||
|
if (file != null)
|
||||||
|
{
|
||||||
|
DumpListToDisk(file);
|
||||||
|
GlobalWin.OSD.AddMessage("Log dumped to " + file.FullName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ExitMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void CopyMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var indices = TraceView.SelectedIndices;
|
||||||
|
|
||||||
|
if (indices.Count > 0)
|
||||||
|
{
|
||||||
|
var blob = new StringBuilder();
|
||||||
|
foreach (int index in indices)
|
||||||
|
{
|
||||||
|
blob.AppendLine(_instructions[index]);
|
||||||
|
}
|
||||||
|
|
||||||
|
blob.Remove(blob.Length - 2, 2); // Lazy way to not have a line break at the end
|
||||||
|
Clipboard.SetDataObject(blob.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SelectAllMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
for (var i = 0; i < _instructions.Count; i++)
|
||||||
|
{
|
||||||
|
TraceView.SelectItem(i, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MaxLinesMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var prompt = new InputPrompt();
|
||||||
|
prompt.SetMessage("Max lines to display in the window");
|
||||||
|
prompt.SetInitialValue(Global.Config.TraceLoggerMaxLines.ToString());
|
||||||
|
prompt.TextInputType = InputPrompt.InputType.UNSIGNED;
|
||||||
|
prompt._Location = GetPromptPoint();
|
||||||
|
prompt.ShowDialog();
|
||||||
|
if (prompt.UserOK)
|
||||||
|
{
|
||||||
|
var max = int.Parse(prompt.UserText);
|
||||||
|
if (max > 0)
|
||||||
|
{
|
||||||
|
Global.Config.TraceLoggerMaxLines = max;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OptionsSubMenu_DropDownOpened(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
AutoloadMenuItem.Checked = Global.Config.TraceLoggerAutoLoad;
|
||||||
|
SaveWindowPositionMenuItem.Checked = Global.Config.TraceLoggerSaveWindowPosition;
|
||||||
|
AlwaysOnTopMenuItem.Checked = Global.Config.TraceLoggerOnTop;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AutoloadMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Global.Config.TraceLoggerAutoLoad ^= true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SaveWindowPositionMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Global.Config.TraceLoggerSaveWindowPosition ^= true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AlwaysOnTopMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Global.Config.TraceLoggerOnTop ^= true;
|
||||||
|
TopMost = Global.Config.TraceLoggerOnTop;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Dialog and ListView Events
|
||||||
|
|
||||||
private void LoggingEnabled_CheckedChanged(object sender, EventArgs e)
|
private void LoggingEnabled_CheckedChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Global.CoreComm.Tracer.Enabled = LoggingEnabled.Checked;
|
Global.CoreComm.Tracer.Enabled = LoggingEnabled.Checked;
|
||||||
|
@ -118,115 +315,13 @@ namespace BizHawk.Client.EmuHawk
|
||||||
ClearList();
|
ClearList();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DoInstructions()
|
private void BrowseBox_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (ToWindowRadio.Checked)
|
var file = GetFileFromUser();
|
||||||
|
if (file != null)
|
||||||
{
|
{
|
||||||
LogToWindow();
|
_logFile = file;
|
||||||
SetTracerBoxTitle();
|
FileBox.Text = _logFile.FullName;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LogToFile();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LogToFile()
|
|
||||||
{
|
|
||||||
using (StreamWriter sw = new StreamWriter(LogFile.FullName, true))
|
|
||||||
{
|
|
||||||
sw.Write(Global.CoreComm.Tracer.TakeContents());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LogToWindow()
|
|
||||||
{
|
|
||||||
string[] instructions = Global.CoreComm.Tracer.TakeContents().Split('\n');
|
|
||||||
if (!String.IsNullOrWhiteSpace(instructions[0]))
|
|
||||||
{
|
|
||||||
foreach (string s in instructions)
|
|
||||||
{
|
|
||||||
Instructions.Add(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
if (Instructions.Count >= Global.Config.TraceLoggerMaxLines)
|
|
||||||
{
|
|
||||||
int x = Instructions.Count - Global.Config.TraceLoggerMaxLines;
|
|
||||||
Instructions.RemoveRange(0, x);
|
|
||||||
}
|
|
||||||
|
|
||||||
TraceView.ItemCount = Instructions.Count;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void autoloadToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
Global.Config.TraceLoggerAutoLoad ^= true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void optionsToolStripMenuItem_DropDownOpened(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
autoloadToolStripMenuItem.Checked = Global.Config.TraceLoggerAutoLoad;
|
|
||||||
saveWindowPositionToolStripMenuItem.Checked = Global.Config.TraceLoggerSaveWindowPosition;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void saveWindowPositionToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
Global.Config.TraceLoggerSaveWindowPosition ^= true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Point GetPromptPoint()
|
|
||||||
{
|
|
||||||
Point p = new Point(TraceView.Location.X + 30, TraceView.Location.Y + 30);
|
|
||||||
return PointToScreen(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setMaxWindowLinesToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
InputPrompt p = new InputPrompt();
|
|
||||||
p.SetMessage("Max lines to display in the window");
|
|
||||||
p.SetInitialValue(Global.Config.TraceLoggerMaxLines.ToString());
|
|
||||||
p.TextInputType = InputPrompt.InputType.UNSIGNED;
|
|
||||||
p._Location = GetPromptPoint();
|
|
||||||
p.ShowDialog();
|
|
||||||
if (p.UserOK)
|
|
||||||
{
|
|
||||||
int x = int.Parse(p.UserText);
|
|
||||||
if (x > 0)
|
|
||||||
{
|
|
||||||
Global.Config.TraceLoggerMaxLines = x;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SetTracerBoxTitle()
|
|
||||||
{
|
|
||||||
if (Global.CoreComm.Tracer.Enabled)
|
|
||||||
{
|
|
||||||
if (ToFileRadio.Checked)
|
|
||||||
{
|
|
||||||
TracerBox.Text = "Trace log - logging to file...";
|
|
||||||
}
|
|
||||||
else if (Instructions.Count > 0)
|
|
||||||
{
|
|
||||||
TracerBox.Text = "Trace log - logging - " + Instructions.Count.ToString() + " instructions";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TracerBox.Text = "Trace log - logging...";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (Instructions.Count > 0)
|
|
||||||
{
|
|
||||||
TracerBox.Text = "Trace log - " + Instructions.Count.ToString() + " instructions";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TracerBox.Text = "Trace log";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,142 +331,38 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
FileBox.Visible = true;
|
FileBox.Visible = true;
|
||||||
BrowseBox.Visible = true;
|
BrowseBox.Visible = true;
|
||||||
string name = PathManager.FilesystemSafeName(Global.Game);
|
var name = PathManager.FilesystemSafeName(Global.Game);
|
||||||
string filename = Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathEntries.LogPath, null), name) + ".txt";
|
var filename = Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathEntries.LogPath, null), name) + ".txt";
|
||||||
LogFile = new FileInfo(filename);
|
_logFile = new FileInfo(filename);
|
||||||
if (LogFile.Directory != null && !LogFile.Directory.Exists)
|
if (_logFile.Directory != null && !_logFile.Directory.Exists)
|
||||||
{
|
{
|
||||||
LogFile.Directory.Create();
|
_logFile.Directory.Create();
|
||||||
}
|
}
|
||||||
if (LogFile.Exists)
|
|
||||||
|
if (_logFile.Exists)
|
||||||
{
|
{
|
||||||
LogFile.Delete();
|
_logFile.Delete();
|
||||||
LogFile.Create();
|
_logFile.Create();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LogFile.Create();
|
_logFile.Create();
|
||||||
}
|
}
|
||||||
|
|
||||||
FileBox.Text = LogFile.FullName;
|
FileBox.Text = _logFile.FullName;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CloseFile();
|
CloseFile();
|
||||||
FileBox.Visible = false;
|
FileBox.Visible = false;
|
||||||
BrowseBox.Visible = false;
|
BrowseBox.Visible = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SetTracerBoxTitle();
|
SetTracerBoxTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CloseFile()
|
#endregion
|
||||||
{
|
|
||||||
//TODO: save the remaining instructions in CoreComm
|
|
||||||
}
|
|
||||||
|
|
||||||
private void TraceView_KeyDown(object sender, KeyEventArgs e)
|
#endregion
|
||||||
{
|
|
||||||
if (e.Control && e.KeyCode == Keys.C)
|
|
||||||
{
|
|
||||||
ListView.SelectedIndexCollection indexes = TraceView.SelectedIndices;
|
|
||||||
|
|
||||||
if (indexes.Count > 0)
|
|
||||||
{
|
|
||||||
StringBuilder blob = new StringBuilder();
|
|
||||||
foreach (int x in indexes)
|
|
||||||
{
|
|
||||||
blob.Append(Instructions[x]);
|
|
||||||
blob.Append("\r\n");
|
|
||||||
}
|
|
||||||
blob.Remove(blob.Length - 2, 2); //Lazy way to not have a line break at the end
|
|
||||||
Clipboard.SetDataObject(blob.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void BrowseBox_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var file = GetFileFromUser();
|
|
||||||
if (file != null)
|
|
||||||
{
|
|
||||||
LogFile = file;
|
|
||||||
FileBox.Text = LogFile.FullName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private FileInfo GetFileFromUser()
|
|
||||||
{
|
|
||||||
var sfd = new SaveFileDialog();
|
|
||||||
if (LogFile == null)
|
|
||||||
{
|
|
||||||
string name = PathManager.FilesystemSafeName(Global.Game);
|
|
||||||
sfd.FileName = name + ".txt";
|
|
||||||
sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.LogPath, null);
|
|
||||||
}
|
|
||||||
else if (!String.IsNullOrWhiteSpace(LogFile.FullName))
|
|
||||||
{
|
|
||||||
sfd.FileName = PathManager.FilesystemSafeName(Global.Game);
|
|
||||||
sfd.InitialDirectory = Path.GetDirectoryName(LogFile.FullName);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sfd.FileName = Path.GetFileNameWithoutExtension(LogFile.FullName);
|
|
||||||
sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.LogPath, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
sfd.Filter = "Text Files (*.txt)|*.txt|Log Files (*.log)|*.log|All Files|*.*";
|
|
||||||
sfd.RestoreDirectory = true;
|
|
||||||
var result = sfd.ShowHawkDialog();
|
|
||||||
if (result != DialogResult.OK)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new FileInfo(sfd.FileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void saveLogToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var file = GetFileFromUser();
|
|
||||||
if (file != null)
|
|
||||||
{
|
|
||||||
DumpListToDisk(file);
|
|
||||||
GlobalWin.OSD.AddMessage("Log dumped to " + file.FullName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void DumpListToDisk(FileInfo file)
|
|
||||||
{
|
|
||||||
using (StreamWriter sw = new StreamWriter(file.FullName))
|
|
||||||
{
|
|
||||||
foreach (string s in Instructions)
|
|
||||||
{
|
|
||||||
sw.WriteLine(s);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CopyAllToClipboard()
|
|
||||||
{
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
foreach (string s in Instructions)
|
|
||||||
sb.AppendLine(s);
|
|
||||||
string ss = sb.ToString();
|
|
||||||
if (!string.IsNullOrEmpty(ss))
|
|
||||||
Clipboard.SetText(sb.ToString(), TextDataFormat.Text);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void TraceLogger_KeyDown(object sender, KeyEventArgs e)
|
|
||||||
{
|
|
||||||
if (ModifierKeys.HasFlag(Keys.Control) && e.KeyCode == Keys.C)
|
|
||||||
CopyAllToClipboard();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void copyAllToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
CopyAllToClipboard();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,8 +93,7 @@ namespace BizHawk.Emulation.Common
|
||||||
{
|
{
|
||||||
if (logging)
|
if (logging)
|
||||||
{
|
{
|
||||||
buffer.Append(content);
|
buffer.AppendLine(content);
|
||||||
buffer.Append('\n');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue