Added Debug Tools form with config editor (TODO: Log Viewer)

This commit is contained in:
N00MKRAD
2021-05-04 00:20:31 +02:00
parent 337c045110
commit f8d7537e31
12 changed files with 3459 additions and 8 deletions

View File

@@ -81,6 +81,9 @@
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
</PropertyGroup>
<ItemGroup>
<Reference Include="AdamsLair.WinForms, Version=1.1.18.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\AdamsLair.WinForms.1.1.18\lib\net45\AdamsLair.WinForms.dll</HintPath>
</Reference>
<Reference Include="CircularProgressBar, Version=2.8.0.16, Culture=neutral, PublicKeyToken=310fd07b25df79b3, processorArchitecture=MSIL">
<HintPath>packages\CircularProgressBar.2.8.0.16\lib\net40\CircularProgressBar.dll</HintPath>
</Reference>
@@ -127,6 +130,9 @@
<Reference Include="PagedControl, Version=2.2.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\PagedControl.2.2.0\lib\net35\PagedControl.dll</HintPath>
</Reference>
<Reference Include="PopupControl, Version=1.0.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\AdamsLair.WinForms.PopupControl.1.0.1\lib\net40\PopupControl.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
@@ -342,6 +348,12 @@
<Compile Include="Forms\BigPreviewForm.Designer.cs">
<DependentUpon>BigPreviewForm.cs</DependentUpon>
</Compile>
<Compile Include="Forms\DebugForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\DebugForm.Designer.cs">
<DependentUpon>DebugForm.cs</DependentUpon>
</Compile>
<Compile Include="Forms\SettingsForm.cs">
<SubType>Form</SubType>
</Compile>
@@ -418,6 +430,9 @@
<EmbeddedResource Include="Forms\BigPreviewForm.resx">
<DependentUpon>BigPreviewForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\DebugForm.resx">
<DependentUpon>DebugForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\SettingsForm.resx">
<DependentUpon>SettingsForm.cs</DependentUpon>
<SubType>Designer</SubType>
@@ -463,6 +478,7 @@
</ItemGroup>
<ItemGroup>
<Content Include="FlowframesLogo2021.ico" />
<None Include="Resources\baseline_list_alt_white_48dp.png" />
<None Include="Resources\baseline_play_arrow_white_48dp.png" />
<None Include="Resources\baseline_pause_white_48dp.png" />
<None Include="Resources\baseline_stop_white_48dp.png" />

29
Code/Form1.Designer.cs generated
View File

@@ -128,6 +128,7 @@
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.pauseBtn = new System.Windows.Forms.Button();
this.cancelBtn = new System.Windows.Forms.Button();
this.debugBtn = new HTAlt.WinForms.HTButton();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit();
@@ -632,7 +633,7 @@
this.patreonBtn.ForeColor = System.Drawing.Color.White;
this.patreonBtn.ImageIndex = 0;
this.patreonBtn.ImageSizeMode = HTAlt.WinForms.HTButton.ButtonImageSizeMode.Zoom;
this.patreonBtn.Location = new System.Drawing.Point(652, 12);
this.patreonBtn.Location = new System.Drawing.Point(606, 12);
this.patreonBtn.Name = "patreonBtn";
this.patreonBtn.Size = new System.Drawing.Size(40, 40);
this.patreonBtn.TabIndex = 37;
@@ -650,7 +651,7 @@
this.paypalBtn.ForeColor = System.Drawing.Color.White;
this.paypalBtn.ImageIndex = 0;
this.paypalBtn.ImageSizeMode = HTAlt.WinForms.HTButton.ButtonImageSizeMode.Zoom;
this.paypalBtn.Location = new System.Drawing.Point(605, 12);
this.paypalBtn.Location = new System.Drawing.Point(559, 12);
this.paypalBtn.Name = "paypalBtn";
this.paypalBtn.Size = new System.Drawing.Size(40, 40);
this.paypalBtn.TabIndex = 36;
@@ -668,7 +669,7 @@
this.discordBtn.ForeColor = System.Drawing.Color.White;
this.discordBtn.ImageIndex = 0;
this.discordBtn.ImageSizeMode = HTAlt.WinForms.HTButton.ButtonImageSizeMode.Zoom;
this.discordBtn.Location = new System.Drawing.Point(698, 12);
this.discordBtn.Location = new System.Drawing.Point(652, 12);
this.discordBtn.Name = "discordBtn";
this.discordBtn.Size = new System.Drawing.Size(40, 40);
this.discordBtn.TabIndex = 35;
@@ -1397,7 +1398,7 @@
this.htButton1.ForeColor = System.Drawing.Color.White;
this.htButton1.ImageIndex = 0;
this.htButton1.ImageSizeMode = HTAlt.WinForms.HTButton.ButtonImageSizeMode.Zoom;
this.htButton1.Location = new System.Drawing.Point(744, 12);
this.htButton1.Location = new System.Drawing.Point(698, 9);
this.htButton1.Name = "htButton1";
this.htButton1.Size = new System.Drawing.Size(40, 40);
this.htButton1.TabIndex = 40;
@@ -1493,6 +1494,24 @@
this.cancelBtn.UseVisualStyleBackColor = true;
this.cancelBtn.Click += new System.EventHandler(this.cancelBtn_Click);
//
// debugBtn
//
this.debugBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
this.debugBtn.ButtonImage = global::Flowframes.Properties.Resources.baseline_list_alt_white_48dp;
this.debugBtn.DrawImage = true;
this.debugBtn.FlatAppearance.BorderSize = 0;
this.debugBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.debugBtn.ForeColor = System.Drawing.Color.White;
this.debugBtn.ImageIndex = 0;
this.debugBtn.ImageSizeMode = HTAlt.WinForms.HTButton.ButtonImageSizeMode.Zoom;
this.debugBtn.Location = new System.Drawing.Point(744, 12);
this.debugBtn.Name = "debugBtn";
this.debugBtn.Size = new System.Drawing.Size(40, 40);
this.debugBtn.TabIndex = 75;
this.toolTip1.SetToolTip(this.debugBtn, "Debug Tools");
this.debugBtn.UseVisualStyleBackColor = false;
this.debugBtn.Click += new System.EventHandler(this.debugBtn_Click);
//
// Form1
//
this.AllowDrop = true;
@@ -1500,6 +1519,7 @@
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(32)))), ((int)(((byte)(32)))), ((int)(((byte)(32)))));
this.ClientSize = new System.Drawing.Size(934, 501);
this.Controls.Add(this.debugBtn);
this.Controls.Add(this.busyControlsPanel);
this.Controls.Add(this.runBtn);
this.Controls.Add(this.stepSelector);
@@ -1663,6 +1683,7 @@
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.Button pauseBtn;
private System.Windows.Forms.Button cancelBtn;
private HTAlt.WinForms.HTButton debugBtn;
}
}

View File

@@ -566,5 +566,10 @@ namespace Flowframes
{
AiProcessSuspend.SuspendResumeAi(!AiProcessSuspend.aiProcFrozen);
}
private void debugBtn_Click(object sender, EventArgs e)
{
new DebugForm().ShowDialog();
}
}
}

150
Code/Forms/DebugForm.Designer.cs generated Normal file
View File

@@ -0,0 +1,150 @@

namespace Flowframes.Forms
{
partial class DebugForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DebugForm));
this.titleLabel = new System.Windows.Forms.Label();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.htTabControl1 = new HTAlt.WinForms.HTTabControl();
this.configDataGrid = new System.Windows.Forms.DataGridView();
this.tabPage2.SuspendLayout();
this.htTabControl1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.configDataGrid)).BeginInit();
this.SuspendLayout();
//
// titleLabel
//
this.titleLabel.AutoSize = true;
this.titleLabel.Font = new System.Drawing.Font("Yu Gothic UI", 21.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.titleLabel.ForeColor = System.Drawing.Color.White;
this.titleLabel.Location = new System.Drawing.Point(12, 9);
this.titleLabel.Margin = new System.Windows.Forms.Padding(3, 0, 3, 10);
this.titleLabel.Name = "titleLabel";
this.titleLabel.Size = new System.Drawing.Size(175, 40);
this.titleLabel.TabIndex = 2;
this.titleLabel.Text = "Debug Tools";
//
// tabPage2
//
this.tabPage2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
this.tabPage2.Controls.Add(this.configDataGrid);
this.tabPage2.Location = new System.Drawing.Point(4, 27);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(912, 396);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "Config Editor";
//
// tabPage1
//
this.tabPage1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
this.tabPage1.Location = new System.Drawing.Point(4, 27);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(768, 345);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "Log Viewer";
//
// htTabControl1
//
this.htTabControl1.AllowDrop = true;
this.htTabControl1.BackgroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(45)))), ((int)(((byte)(48)))));
this.htTabControl1.BorderTabLineColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(122)))), ((int)(((byte)(204)))));
this.htTabControl1.Controls.Add(this.tabPage1);
this.htTabControl1.Controls.Add(this.tabPage2);
this.htTabControl1.DisableClose = false;
this.htTabControl1.DisableDragging = false;
this.htTabControl1.Font = new System.Drawing.Font("Segoe UI", 9F);
this.htTabControl1.HoverTabButtonColor = System.Drawing.Color.FromArgb(((int)(((byte)(82)))), ((int)(((byte)(176)))), ((int)(((byte)(239)))));
this.htTabControl1.HoverTabColor = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(151)))), ((int)(((byte)(234)))));
this.htTabControl1.HoverUnselectedTabButtonColor = System.Drawing.Color.FromArgb(((int)(((byte)(85)))), ((int)(((byte)(85)))), ((int)(((byte)(85)))));
this.htTabControl1.Location = new System.Drawing.Point(12, 62);
this.htTabControl1.Name = "htTabControl1";
this.htTabControl1.Padding = new System.Drawing.Point(14, 4);
this.htTabControl1.SelectedIndex = 0;
this.htTabControl1.SelectedTabButtonColor = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(151)))), ((int)(((byte)(234)))));
this.htTabControl1.SelectedTabColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(122)))), ((int)(((byte)(204)))));
this.htTabControl1.Size = new System.Drawing.Size(920, 427);
this.htTabControl1.TabIndex = 3;
this.htTabControl1.TextColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
this.htTabControl1.UnderBorderTabLineColor = System.Drawing.Color.FromArgb(((int)(((byte)(67)))), ((int)(((byte)(67)))), ((int)(((byte)(70)))));
this.htTabControl1.UnselectedBorderTabLineColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(63)))), ((int)(((byte)(70)))));
this.htTabControl1.UnselectedTabColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(63)))), ((int)(((byte)(70)))));
this.htTabControl1.UpDownBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(63)))), ((int)(((byte)(70)))));
this.htTabControl1.UpDownTextColor = System.Drawing.Color.FromArgb(((int)(((byte)(109)))), ((int)(((byte)(109)))), ((int)(((byte)(112)))));
//
// configDataGrid
//
this.configDataGrid.AllowUserToResizeColumns = false;
this.configDataGrid.AllowUserToResizeRows = false;
this.configDataGrid.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells;
this.configDataGrid.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells;
this.configDataGrid.ClipboardCopyMode = System.Windows.Forms.DataGridViewClipboardCopyMode.EnableWithoutHeaderText;
this.configDataGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.configDataGrid.Dock = System.Windows.Forms.DockStyle.Fill;
this.configDataGrid.Location = new System.Drawing.Point(3, 3);
this.configDataGrid.MultiSelect = false;
this.configDataGrid.Name = "configDataGrid";
this.configDataGrid.Size = new System.Drawing.Size(906, 390);
this.configDataGrid.TabIndex = 0;
//
// DebugForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(32)))), ((int)(((byte)(32)))), ((int)(((byte)(32)))));
this.ClientSize = new System.Drawing.Size(944, 501);
this.Controls.Add(this.htTabControl1);
this.Controls.Add(this.titleLabel);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "DebugForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "DebugForm";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.DebugForm_FormClosing);
this.Load += new System.EventHandler(this.DebugForm_Load);
this.tabPage2.ResumeLayout(false);
this.htTabControl1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.configDataGrid)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label titleLabel;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.TabPage tabPage1;
private HTAlt.WinForms.HTTabControl htTabControl1;
private System.Windows.Forms.DataGridView configDataGrid;
}
}

59
Code/Forms/DebugForm.cs Normal file
View File

@@ -0,0 +1,59 @@
using Flowframes.IO;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Flowframes.Forms
{
public partial class DebugForm : Form
{
public DebugForm()
{
InitializeComponent();
}
private void DebugForm_Load(object sender, EventArgs e)
{
Dictionary<string, string> configDict = new Dictionary<string, string>();
configDataGrid.Columns.Add("keys", "Key Name");
configDataGrid.Columns.Add("vals", "Saved Value");
foreach (string entry in Config.cachedLines)
{
string[] data = entry.Split('|');
configDict.Add(data[0], data[1]);
configDataGrid.Rows.Add(data[0], data[1]);
}
configDataGrid.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
configDataGrid.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
}
void Save ()
{
foreach(DataGridViewRow row in configDataGrid.Rows)
{
string key = row.Cells[0].Value?.ToString();
string val = row.Cells[1].Value?.ToString();
if (key == null || val == null || string.IsNullOrWhiteSpace(key.Trim()) || string.IsNullOrWhiteSpace(val.Trim()))
continue;
Config.Set(key, val);
Logger.Log($"Config Editor: Saved Key '{key}' with value '{val}'", true);
}
}
private void DebugForm_FormClosing(object sender, FormClosingEventArgs e)
{
Save();
}
}
}

3185
Code/Forms/DebugForm.resx Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -12,7 +12,7 @@ namespace Flowframes.IO
{
private static string configPath;
private static string[] cachedLines;
public static string[] cachedLines;
public static void Init()
{

View File

@@ -120,6 +120,16 @@ namespace Flowframes.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap baseline_list_alt_white_48dp {
get {
object obj = ResourceManager.GetObject("baseline_list_alt_white_48dp", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>

View File

@@ -178,10 +178,13 @@
<data name="baseline_settings_white_48dp" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\baseline_settings_white_48dp.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="baseline_image_white_48dp-4x-25pcAlpha" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\baseline_image_white_48dp-4x-25pcAlpha.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="baseline_play_arrow_white_48dp" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\baseline_play_arrow_white_48dp.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="baseline_image_white_48dp-4x-25pcAlpha" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\baseline_image_white_48dp-4x-25pcAlpha.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="baseline_list_alt_white_48dp" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\baseline_list_alt_white_48dp.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 B

View File

@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="AdamsLair.WinForms" version="1.1.18" targetFramework="net472" />
<package id="AdamsLair.WinForms.PopupControl" version="1.0.1" targetFramework="net472" />
<package id="CircularProgressBar" version="2.8.0.16" targetFramework="net472" />
<package id="Costura.Fody" version="5.1.0" targetFramework="net472" developmentDependency="true" />
<package id="Crc32.NET" version="1.2.0" targetFramework="net472" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 B