Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions nppRandomStringGenerator/Forms/ConfigAndGenerate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void LoadSettings()
{
foreach (nppRandomStringGenerator.Storage.Models.ConfigItem configitem in settings.settings.ConfigItems)
{
if (configitem == null) { continue; }
if (configitem == null || configitem.Name.StartsWith("Quick")) { continue; }

Control ctrl = this.Controls.Find(configitem.Name, true).FirstOrDefault();

Expand Down Expand Up @@ -93,6 +93,8 @@ private void SaveSettings()
{
foreach (nppRandomStringGenerator.Storage.Models.ConfigItem configitem in settings.settings.ConfigItems)
{
if (configitem.Name.StartsWith("Quick")) { continue; }

Control ctrl = this.Controls.Find(configitem.Name, true).FirstOrDefault();

if (ctrl != null && ctrl.Name.StartsWith("NumericUpDown"))
Expand Down Expand Up @@ -132,14 +134,6 @@ private void SaveSettings()

private async void ButtonGenerate_Click(Object sender, EventArgs e)
{
//if (this.RadioButtonInline.Checked && NumericUpDownQuantity.Value > 5000)
//{
// if (MessageBox.Show($"It will take allot of time to process {this.NumericUpDownQuantity.Value} lines and Notepad++ will be frozen until it is done.\nFor example it will take 20 seconds to process 5000 lines on a AMD Ryzen 9 5900. Are you sure you want to start this process?", "Are you sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.No)
// {
// return;
// }
//}

this.Cursor = Cursors.WaitCursor;

this.AvailableChars = "";
Expand Down
211 changes: 211 additions & 0 deletions nppRandomStringGenerator/Forms/InsertGuid.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

80 changes: 80 additions & 0 deletions nppRandomStringGenerator/Forms/InsertGuid.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
using Kbg.NppPluginNET.PluginInfrastructure;
using nppRandomStringGenerator.Storage;
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 nppRandomStringGenerator.Forms
{
public partial class InsertGuid : Form
{
public Settings settings { get; set; }
private IScintillaGateway Editor;
private INotepadPPGateway Notepad;

public InsertGuid()
{
InitializeComponent();
this.Editor = new ScintillaGateway(PluginBase.GetCurrentScintilla());
this.Notepad = new NotepadPPGateway();
}

public void LoadSettings()
{
foreach (nppRandomStringGenerator.Storage.Models.ConfigItem configitem in settings.settings.ConfigItems)
{
if (configitem == null || !configitem.Name.StartsWith("Quick")) { continue; }

Control ctrl = this.Controls.Find(configitem.Value, true).FirstOrDefault();

if (ctrl != null)
{
RadioButton radio = ctrl as RadioButton;
radio.Checked = true;
}
}
}

private void SaveSettings()
{
foreach (nppRandomStringGenerator.Storage.Models.ConfigItem configitem in settings.settings.ConfigItems)
{
if (configitem == null || !configitem.Name.StartsWith("Quick")) { continue; }

foreach (Control ctrl in this.groupBox1.Controls)
{
if (ctrl is RadioButton radio && radio.Checked)
{
configitem.Value = radio.Name;
break;
}
}
}

settings.Save();
}

private void btnOK_Click(object sender, EventArgs e)
{
if (radioB.Checked) { this.Editor.InsertText(this.Editor.GetCurrentPos(), Guid.NewGuid().ToString("B")); }
if (radioD.Checked) { this.Editor.InsertText(this.Editor.GetCurrentPos(), Guid.NewGuid().ToString("D")); }
if (radioN.Checked) { this.Editor.InsertText(this.Editor.GetCurrentPos(), Guid.NewGuid().ToString("N")); }
if (radioX.Checked) { this.Editor.InsertText(this.Editor.GetCurrentPos(), Guid.NewGuid().ToString("X")); }
if (radioUE.Checked) { this.Editor.InsertText(this.Editor.GetCurrentPos(), "(ID=" + Guid.NewGuid().ToString("N") + ")"); }

this.SaveSettings();
this.Close();
}

private void btnCancel_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
Loading