Better config editor, finished log viewer

This commit is contained in:
N00MKRAD 2021-05-04 12:30:49 +02:00
parent 743663fb0a
commit 747b5e3886
14 changed files with 380 additions and 63 deletions

View File

@ -415,6 +415,7 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="MiscUtils\FormatUtils.cs" />
<Compile Include="UI\ControlExtensions.cs" />
<Compile Include="UI\DebugFormHelper.cs" />
<Compile Include="UI\GetWebInfo.cs" />
<Compile Include="UI\InterpolationProgress.cs" />
<Compile Include="UI\MainUiFunctions.cs" />
@ -478,6 +479,9 @@
</ItemGroup>
<ItemGroup>
<Content Include="FlowframesLogo2021.ico" />
<None Include="Resources\baseline_format_size_white_48dp.png" />
<None Include="Resources\baseline_wrap_text_white_48dp.png" />
<None Include="Resources\baseline_refresh_white_48dp.png" />
<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" />

38
Code/Form1.Designer.cs generated
View File

@ -77,6 +77,7 @@
this.panel10 = new System.Windows.Forms.Panel();
this.panel14 = new System.Windows.Forms.Panel();
this.panel3 = new System.Windows.Forms.Panel();
this.debugBtn = new HTAlt.WinForms.HTButton();
this.longProgBar = new HTAlt.WinForms.HTProgressBar();
this.mainTabControl = new HTAlt.WinForms.HTTabControl();
this.welcomeTab = new System.Windows.Forms.TabPage();
@ -128,7 +129,6 @@
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();
@ -731,6 +731,24 @@
this.panel3.TabIndex = 57;
this.toolTip1.SetToolTip(this.panel3, "Allows custom input.");
//
// 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);
//
// longProgBar
//
this.longProgBar.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
@ -1494,24 +1512,6 @@
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;

View File

@ -29,6 +29,7 @@ namespace Flowframes.Forms
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DebugForm));
this.titleLabel = new System.Windows.Forms.Label();
this.tabPage2 = new System.Windows.Forms.TabPage();
@ -37,11 +38,21 @@ namespace Flowframes.Forms
this.panel1 = new System.Windows.Forms.Panel();
this.configDataGrid = new System.Windows.Forms.DataGridView();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.copyTextClipboardBtn = new HTAlt.WinForms.HTButton();
this.monospaceBtn = new HTAlt.WinForms.HTButton();
this.refreshBtn = new HTAlt.WinForms.HTButton();
this.textWrapBtn = new HTAlt.WinForms.HTButton();
this.clearLogsBtn = new HTAlt.WinForms.HTButton();
this.openLogFolderBtn = new HTAlt.WinForms.HTButton();
this.logFilesDropdown = new System.Windows.Forms.ComboBox();
this.logBox = new System.Windows.Forms.TextBox();
this.htTabControl1 = new HTAlt.WinForms.HTTabControl();
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
this.tabPage2.SuspendLayout();
this.panel2.SuspendLayout();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.configDataGrid)).BeginInit();
this.tabPage1.SuspendLayout();
this.htTabControl1.SuspendLayout();
this.SuspendLayout();
//
@ -68,13 +79,14 @@ namespace Flowframes.Forms
this.tabPage2.Size = new System.Drawing.Size(912, 396);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "Config Editor";
this.tabPage2.Enter += new System.EventHandler(this.tabPage2_Enter);
//
// panel2
//
this.panel2.Controls.Add(this.label1);
this.panel2.Location = new System.Drawing.Point(6, 6);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(900, 79);
this.panel2.Size = new System.Drawing.Size(900, 68);
this.panel2.TabIndex = 5;
//
// label1
@ -90,9 +102,9 @@ namespace Flowframes.Forms
// panel1
//
this.panel1.Controls.Add(this.configDataGrid);
this.panel1.Location = new System.Drawing.Point(6, 91);
this.panel1.Location = new System.Drawing.Point(6, 80);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(900, 299);
this.panel1.Size = new System.Drawing.Size(900, 310);
this.panel1.TabIndex = 4;
//
// configDataGrid
@ -107,7 +119,7 @@ namespace Flowframes.Forms
this.configDataGrid.Location = new System.Drawing.Point(0, 0);
this.configDataGrid.MultiSelect = false;
this.configDataGrid.Name = "configDataGrid";
this.configDataGrid.Size = new System.Drawing.Size(900, 299);
this.configDataGrid.Size = new System.Drawing.Size(900, 310);
this.configDataGrid.TabIndex = 0;
this.configDataGrid.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.configDataGrid_CellValueChanged);
this.configDataGrid.RowsAdded += new System.Windows.Forms.DataGridViewRowsAddedEventHandler(this.configDataGrid_RowsAdded);
@ -116,6 +128,14 @@ namespace Flowframes.Forms
// tabPage1
//
this.tabPage1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
this.tabPage1.Controls.Add(this.copyTextClipboardBtn);
this.tabPage1.Controls.Add(this.monospaceBtn);
this.tabPage1.Controls.Add(this.refreshBtn);
this.tabPage1.Controls.Add(this.textWrapBtn);
this.tabPage1.Controls.Add(this.clearLogsBtn);
this.tabPage1.Controls.Add(this.openLogFolderBtn);
this.tabPage1.Controls.Add(this.logFilesDropdown);
this.tabPage1.Controls.Add(this.logBox);
this.tabPage1.Location = new System.Drawing.Point(4, 27);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
@ -123,6 +143,129 @@ namespace Flowframes.Forms
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "Log Viewer";
//
// copyTextClipboardBtn
//
this.copyTextClipboardBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.copyTextClipboardBtn.FlatAppearance.BorderSize = 0;
this.copyTextClipboardBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.copyTextClipboardBtn.ForeColor = System.Drawing.Color.White;
this.copyTextClipboardBtn.Location = new System.Drawing.Point(600, 6);
this.copyTextClipboardBtn.Name = "copyTextClipboardBtn";
this.copyTextClipboardBtn.Size = new System.Drawing.Size(150, 23);
this.copyTextClipboardBtn.TabIndex = 80;
this.copyTextClipboardBtn.Text = "Copy Text To Clipboard";
this.copyTextClipboardBtn.UseVisualStyleBackColor = false;
this.copyTextClipboardBtn.Click += new System.EventHandler(this.copyTextClipboardBtn_Click);
//
// monospaceBtn
//
this.monospaceBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.monospaceBtn.ButtonImage = global::Flowframes.Properties.Resources.baseline_format_size_white_48dp;
this.monospaceBtn.DrawImage = true;
this.monospaceBtn.FlatAppearance.BorderSize = 0;
this.monospaceBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.monospaceBtn.ForeColor = System.Drawing.Color.White;
this.monospaceBtn.ImageSizeMode = HTAlt.WinForms.HTButton.ButtonImageSizeMode.Zoom;
this.monospaceBtn.Location = new System.Drawing.Point(317, 6);
this.monospaceBtn.Name = "monospaceBtn";
this.monospaceBtn.Size = new System.Drawing.Size(23, 23);
this.monospaceBtn.TabIndex = 79;
this.toolTip.SetToolTip(this.monospaceBtn, "Toggle Monospace Font");
this.monospaceBtn.UseVisualStyleBackColor = false;
this.monospaceBtn.Click += new System.EventHandler(this.monospaceBtn_Click);
//
// refreshBtn
//
this.refreshBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.refreshBtn.ButtonImage = global::Flowframes.Properties.Resources.baseline_refresh_white_48dp;
this.refreshBtn.DrawImage = true;
this.refreshBtn.FlatAppearance.BorderSize = 0;
this.refreshBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.refreshBtn.ForeColor = System.Drawing.Color.White;
this.refreshBtn.ImageSizeMode = HTAlt.WinForms.HTButton.ButtonImageSizeMode.Zoom;
this.refreshBtn.Location = new System.Drawing.Point(288, 6);
this.refreshBtn.Name = "refreshBtn";
this.refreshBtn.Size = new System.Drawing.Size(23, 23);
this.refreshBtn.TabIndex = 78;
this.toolTip.SetToolTip(this.refreshBtn, "Refresh");
this.refreshBtn.UseVisualStyleBackColor = false;
this.refreshBtn.Click += new System.EventHandler(this.refreshBtn_Click);
//
// textWrapBtn
//
this.textWrapBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.textWrapBtn.ButtonImage = global::Flowframes.Properties.Resources.baseline_wrap_text_white_48dp;
this.textWrapBtn.DrawImage = true;
this.textWrapBtn.FlatAppearance.BorderSize = 0;
this.textWrapBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.textWrapBtn.ForeColor = System.Drawing.Color.White;
this.textWrapBtn.ImageSizeMode = HTAlt.WinForms.HTButton.ButtonImageSizeMode.Zoom;
this.textWrapBtn.Location = new System.Drawing.Point(346, 5);
this.textWrapBtn.Name = "textWrapBtn";
this.textWrapBtn.Size = new System.Drawing.Size(23, 23);
this.textWrapBtn.TabIndex = 77;
this.toolTip.SetToolTip(this.textWrapBtn, "Toggle Text Wrap");
this.textWrapBtn.UseVisualStyleBackColor = false;
this.textWrapBtn.Click += new System.EventHandler(this.textWrapBtn_Click);
//
// clearLogsBtn
//
this.clearLogsBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.clearLogsBtn.FlatAppearance.BorderSize = 0;
this.clearLogsBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.clearLogsBtn.ForeColor = System.Drawing.Color.White;
this.clearLogsBtn.Location = new System.Drawing.Point(756, 6);
this.clearLogsBtn.Name = "clearLogsBtn";
this.clearLogsBtn.Size = new System.Drawing.Size(150, 23);
this.clearLogsBtn.TabIndex = 76;
this.clearLogsBtn.Text = "Clear Logs";
this.clearLogsBtn.UseVisualStyleBackColor = false;
this.clearLogsBtn.Click += new System.EventHandler(this.clearLogsBtn_Click);
//
// openLogFolderBtn
//
this.openLogFolderBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.openLogFolderBtn.FlatAppearance.BorderSize = 0;
this.openLogFolderBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.openLogFolderBtn.ForeColor = System.Drawing.Color.White;
this.openLogFolderBtn.Location = new System.Drawing.Point(444, 6);
this.openLogFolderBtn.Name = "openLogFolderBtn";
this.openLogFolderBtn.Size = new System.Drawing.Size(150, 23);
this.openLogFolderBtn.TabIndex = 75;
this.openLogFolderBtn.Text = "Open Log Folder";
this.openLogFolderBtn.UseVisualStyleBackColor = false;
this.openLogFolderBtn.Click += new System.EventHandler(this.openLogFolderBtn_Click);
//
// logFilesDropdown
//
this.logFilesDropdown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.logFilesDropdown.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.logFilesDropdown.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.logFilesDropdown.ForeColor = System.Drawing.Color.White;
this.logFilesDropdown.FormattingEnabled = true;
this.logFilesDropdown.Location = new System.Drawing.Point(6, 6);
this.logFilesDropdown.Name = "logFilesDropdown";
this.logFilesDropdown.Size = new System.Drawing.Size(276, 23);
this.logFilesDropdown.TabIndex = 73;
this.logFilesDropdown.SelectedIndexChanged += new System.EventHandler(this.logFilesDropdown_SelectedIndexChanged);
//
// logBox
//
this.logBox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.logBox.Cursor = System.Windows.Forms.Cursors.Arrow;
this.logBox.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.logBox.ForeColor = System.Drawing.Color.White;
this.logBox.Location = new System.Drawing.Point(6, 35);
this.logBox.MinimumSize = new System.Drawing.Size(4, 21);
this.logBox.Multiline = true;
this.logBox.Name = "logBox";
this.logBox.ReadOnly = true;
this.logBox.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.logBox.Size = new System.Drawing.Size(900, 355);
this.logBox.TabIndex = 6;
this.logBox.TabStop = false;
this.logBox.WordWrap = false;
//
// htTabControl1
//
this.htTabControl1.AllowDrop = true;
@ -130,8 +273,8 @@ namespace Flowframes.Forms
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.DisableClose = true;
this.htTabControl1.DisableDragging = true;
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)))));
@ -163,14 +306,16 @@ namespace Flowframes.Forms
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "DebugForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "DebugForm";
this.Text = "Debug Tools";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.DebugForm_FormClosing);
this.Load += new System.EventHandler(this.DebugForm_Load);
this.Shown += new System.EventHandler(this.DebugForm_Shown);
this.tabPage2.ResumeLayout(false);
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
this.panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.configDataGrid)).EndInit();
this.tabPage1.ResumeLayout(false);
this.tabPage1.PerformLayout();
this.htTabControl1.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
@ -187,5 +332,14 @@ namespace Flowframes.Forms
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.TextBox logBox;
private System.Windows.Forms.ComboBox logFilesDropdown;
private HTAlt.WinForms.HTButton clearLogsBtn;
private HTAlt.WinForms.HTButton openLogFolderBtn;
private HTAlt.WinForms.HTButton textWrapBtn;
private HTAlt.WinForms.HTButton refreshBtn;
private System.Windows.Forms.ToolTip toolTip;
private HTAlt.WinForms.HTButton monospaceBtn;
private HTAlt.WinForms.HTButton copyTextClipboardBtn;
}
}

View File

@ -1,9 +1,12 @@
using Flowframes.IO;
using Flowframes.UI;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@ -13,73 +16,96 @@ namespace Flowframes.Forms
{
public partial class DebugForm : Form
{
public bool changed;
public bool configGridChanged;
public DebugForm()
{
InitializeComponent();
}
private void DebugForm_Load(object sender, EventArgs e)
private void DebugForm_Shown(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;
changed = false;
configDataGrid.Font = new Font("Consolas", 9f);
RefreshLogs();
}
void Save ()
void RefreshLogs ()
{
foreach(DataGridViewRow row in configDataGrid.Rows)
{
string key = row.Cells[0].Value?.ToString();
string val = row.Cells[1].Value?.ToString();
DebugFormHelper.FillLogDropdown(logFilesDropdown);
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);
}
if (logFilesDropdown.Items.Count > 0)
logFilesDropdown.SelectedIndex = 0;
}
private void DebugForm_FormClosing(object sender, FormClosingEventArgs e)
{
if (!changed)
if (!configGridChanged)
return;
DialogResult dialogResult = MessageBox.Show($"Save the modified configuration file?", "Save Configuration?", MessageBoxButtons.YesNo);
if (dialogResult == DialogResult.Yes)
Save();
DebugFormHelper.SaveGrid(configDataGrid);
}
private void configDataGrid_CellValueChanged(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex > -1)
changed = true;
configGridChanged = true;
}
private void configDataGrid_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e)
{
changed = true;
configGridChanged = true;
}
private void configDataGrid_RowsRemoved(object sender, DataGridViewRowsRemovedEventArgs e)
{
changed = true;
configGridChanged = true;
}
private void logFilesDropdown_SelectedIndexChanged(object sender, EventArgs e)
{
logBox.Text = File.ReadAllText(Path.Combine(Paths.GetLogPath(), logFilesDropdown.Text)).Trim('\r', '\n');
}
private void textWrapBtn_Click(object sender, EventArgs e)
{
logBox.WordWrap = !logBox.WordWrap;
}
private void openLogFolderBtn_Click(object sender, EventArgs e)
{
Process.Start("explorer.exe", Paths.GetLogPath());
}
private void clearLogsBtn_Click(object sender, EventArgs e)
{
foreach (string str in logFilesDropdown.Items)
File.WriteAllText(Path.Combine(Paths.GetLogPath(), str), "");
logFilesDropdown_SelectedIndexChanged(null, null);
}
private void refreshBtn_Click(object sender, EventArgs e)
{
RefreshLogs();
}
private void monospaceBtn_Click(object sender, EventArgs e)
{
DebugFormHelper.ToggleMonospace(logBox);
}
private void copyTextClipboardBtn_Click(object sender, EventArgs e)
{
Clipboard.SetText(logBox.Text);
}
private void tabPage2_Enter(object sender, EventArgs e)
{
DebugFormHelper.LoadGrid(configDataGrid);
configGridChanged = false;
}
}
}

View File

@ -123,6 +123,9 @@ To edit a cell, double click it or press F2 while it's selected.
To add an entry, scroll to the end of the list and type into the last (empty) line.
To delete an entry, select the line by clicking on the left part, then press DEL.</value>
</data>
<metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>

View File

@ -90,6 +90,16 @@ namespace Flowframes.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap baseline_format_size_white_48dp {
get {
object obj = ResourceManager.GetObject("baseline_format_size_white_48dp", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@ -160,6 +170,16 @@ namespace Flowframes.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap baseline_refresh_white_48dp {
get {
object obj = ResourceManager.GetObject("baseline_refresh_white_48dp", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@ -190,6 +210,16 @@ namespace Flowframes.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap baseline_wrap_text_white_48dp {
get {
object obj = ResourceManager.GetObject("baseline_wrap_text_white_48dp", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized string similar to @echo off
///if not &quot;%1&quot;==&quot;am_admin&quot; (powershell start -verb runas &apos;%0&apos; am_admin &amp; exit /b)

View File

@ -121,6 +121,9 @@
<data name="baseline_image_white_48dp-4x" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\baseline_image_white_48dp-4x.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>
<data name="baseline_queue_white_48dp" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\baseline_queue_white_48dp.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
@ -163,6 +166,9 @@
<data name="devmode" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\devmode.bat;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
<data name="baseline_wrap_text_white_48dp" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\baseline_wrap_text_white_48dp.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="baseline_pause_white_48dp" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\baseline_pause_white_48dp.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
@ -172,6 +178,9 @@
<data name="baseline_create_white_18dp-semiTransparent" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\baseline_create_white_18dp-semiTransparent.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="baseline_refresh_white_48dp" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\baseline_refresh_white_48dp.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="patreon256px" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\patreon256px.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
@ -184,7 +193,7 @@
<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 name="baseline_format_size_white_48dp" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\baseline_format_size_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: 108 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 939 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 383 B

View File

@ -0,0 +1,91 @@
using Flowframes.IO;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Flowframes.UI
{
class DebugFormHelper
{
#region Log Viewer
public static void FillLogDropdown (ComboBox dd)
{
dd.Items.Clear();
FileInfo[] logFiles = IOUtils.GetFileInfosSorted(Paths.GetLogPath(), false, "*.txt");
foreach (FileInfo file in logFiles)
dd.Items.Add(file.Name);
}
public static void ToggleMonospace(TextBox logBox)
{
bool isMonospace = logBox.Font.Name.ToLower().Contains("consolas");
if (isMonospace)
logBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.5f);
else
logBox.Font = new System.Drawing.Font("Consolas", 8.0f);
}
public static void CopyLogToClipboard (string logFilename)
{
StringCollection paths = new StringCollection();
string path = Path.Combine(Paths.GetLogPath(), logFilename);
paths.Add(path);
Clipboard.SetFileDropList(paths);
}
#endregion
#region Config Editor Grid
public static void LoadGrid (DataGridView grid)
{
Dictionary<string, string> configDict = new Dictionary<string, string>();
if(grid.Columns.Count < 2)
{
grid.Columns.Add("keys", "Key Name");
grid.Columns.Add("vals", "Saved Value");
}
grid.Rows.Clear();
foreach (string entry in Config.cachedLines)
{
string[] data = entry.Split('|');
configDict.Add(data[0], data[1]);
grid.Rows.Add(data[0], data[1]);
}
grid.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
grid.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
grid.Columns[0].FillWeight = 50;
grid.Columns[1].FillWeight = 50;
}
public static void SaveGrid (DataGridView grid)
{
foreach (DataGridViewRow row in grid.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);
}
}
#endregion
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 939 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 383 B