Converting to file-scoped namespaces
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
namespace Common
|
namespace Common;
|
||||||
|
|
||||||
|
class Config
|
||||||
{
|
{
|
||||||
class Config
|
|
||||||
{
|
|
||||||
public string PasswordStorePath { get; set; }
|
public string PasswordStorePath { get; set; }
|
||||||
public string Recipient { get; set; }
|
public string Recipient { get; set; }
|
||||||
|
|
||||||
@@ -10,5 +10,4 @@ namespace Common
|
|||||||
this.PasswordStorePath = PasswordStorePath;
|
this.PasswordStorePath = PasswordStorePath;
|
||||||
this.Recipient = Recipient;
|
this.Recipient = Recipient;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
using Microsoft.VisualBasic.FileIO;
|
using Microsoft.VisualBasic.FileIO;
|
||||||
|
|
||||||
namespace Common
|
namespace Common;
|
||||||
|
|
||||||
|
static class ConfigFileManager
|
||||||
{
|
{
|
||||||
static class ConfigFileManager
|
|
||||||
{
|
|
||||||
#region Config flags
|
#region Config flags
|
||||||
/*Configuration: (format: fieldname=value)
|
/*Configuration: (format: fieldname=value)
|
||||||
|
|
||||||
@@ -90,5 +90,4 @@ namespace Common
|
|||||||
MessageBox.Show(e.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show(e.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
namespace Common
|
namespace Common;
|
||||||
|
|
||||||
|
class InvalidConfigurationException : Exception
|
||||||
{
|
{
|
||||||
class InvalidConfigurationException : Exception
|
|
||||||
{
|
|
||||||
public InvalidConfigurationException() : base() { }
|
public InvalidConfigurationException() : base() { }
|
||||||
public InvalidConfigurationException(string message) : base(message) { }
|
public InvalidConfigurationException(string message) : base(message) { }
|
||||||
public InvalidConfigurationException(string message, Exception inner) : base(message, inner) { }
|
public InvalidConfigurationException(string message, Exception inner) : base(message, inner) { }
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Common
|
namespace Common;
|
||||||
|
|
||||||
|
static class PasswordGenerator
|
||||||
{
|
{
|
||||||
static class PasswordGenerator
|
|
||||||
{
|
|
||||||
private static string RandomStr(int length, bool no_symbols = false)
|
private static string RandomStr(int length, bool no_symbols = false)
|
||||||
{
|
{
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
@@ -35,5 +35,4 @@ namespace Common
|
|||||||
{
|
{
|
||||||
return new ProcessBuilder().GetOutput("cmd.exe", $"echo {RandomStr(length, no_symbols)} | gpg --quiet --encrypt --recipient {recipient}");
|
return new ProcessBuilder().GetOutput("cmd.exe", $"echo {RandomStr(length, no_symbols)} | gpg --quiet --encrypt --recipient {recipient}");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Common
|
namespace Common;
|
||||||
|
|
||||||
|
public delegate void ProcessSuccess();
|
||||||
|
public delegate void ProcessFailure(Exception e);
|
||||||
|
sealed class ProcessBuilder
|
||||||
{
|
{
|
||||||
public delegate void ProcessSuccess();
|
|
||||||
public delegate void ProcessFailure(Exception e);
|
|
||||||
sealed class ProcessBuilder
|
|
||||||
{
|
|
||||||
public event ProcessSuccess? ProcessFinished;
|
public event ProcessSuccess? ProcessFinished;
|
||||||
public event ProcessFailure? ProcessFailed;
|
public event ProcessFailure? ProcessFailed;
|
||||||
|
|
||||||
@@ -57,5 +57,4 @@ namespace Common
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
7
GUI/GeneratePassword.Designer.cs
generated
7
GUI/GeneratePassword.Designer.cs
generated
@@ -1,7 +1,7 @@
|
|||||||
namespace GUI
|
namespace GUI;
|
||||||
|
|
||||||
|
partial class GeneratePassword
|
||||||
{
|
{
|
||||||
partial class GeneratePassword
|
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -132,5 +132,4 @@
|
|||||||
private CheckBox noSymbols;
|
private CheckBox noSymbols;
|
||||||
private Button generate;
|
private Button generate;
|
||||||
private Button cancel;
|
private Button cancel;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
namespace GUI
|
namespace GUI;
|
||||||
|
|
||||||
|
public delegate void MethodRequest();
|
||||||
|
public partial class GeneratePassword : Form
|
||||||
{
|
{
|
||||||
public delegate void MethodRequest();
|
|
||||||
public partial class GeneratePassword : Form
|
|
||||||
{
|
|
||||||
private string currentPath;
|
private string currentPath;
|
||||||
private string recipient;
|
private string recipient;
|
||||||
public event MethodRequest ReloadRequest;
|
public event MethodRequest ReloadRequest;
|
||||||
@@ -52,5 +52,4 @@
|
|||||||
{
|
{
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
7
GUI/MainForm.Designer.cs
generated
7
GUI/MainForm.Designer.cs
generated
@@ -1,7 +1,7 @@
|
|||||||
namespace GUI
|
namespace GUI;
|
||||||
|
|
||||||
|
sealed partial class MainForm : Form
|
||||||
{
|
{
|
||||||
sealed partial class MainForm : Form
|
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -111,5 +111,4 @@
|
|||||||
private PasswordListBox ResultList;
|
private PasswordListBox ResultList;
|
||||||
private Button DecryptBtn;
|
private Button DecryptBtn;
|
||||||
private Button Cancel;
|
private Button Cancel;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
namespace GUI
|
namespace GUI;
|
||||||
|
|
||||||
|
sealed public partial class MainForm : Form
|
||||||
{
|
{
|
||||||
sealed public partial class MainForm : Form
|
|
||||||
{
|
|
||||||
public event DataRequest PathRequest;
|
public event DataRequest PathRequest;
|
||||||
public event DataRequest? RecipientRequest;
|
public event DataRequest? RecipientRequest;
|
||||||
|
|
||||||
@@ -65,5 +65,4 @@ namespace GUI
|
|||||||
CopyAndNotify(pb.GetOutput("gpg.exe", $"--quiet --decrypt {PathRequest()}\\{ResultList.Text}"), ResultList.Text);
|
CopyAndNotify(pb.GetOutput("gpg.exe", $"--quiet --decrypt {PathRequest()}\\{ResultList.Text}"), ResultList.Text);
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
|
||||||
namespace GUI
|
namespace GUI;
|
||||||
|
|
||||||
|
public delegate string SearchQuery();
|
||||||
|
public class PasswordListBox : ListBox
|
||||||
{
|
{
|
||||||
public delegate string SearchQuery();
|
|
||||||
public class PasswordListBox : ListBox
|
|
||||||
{
|
|
||||||
public event DataRequest? PathRequest;
|
public event DataRequest? PathRequest;
|
||||||
public event SearchQuery? SearchQueryRequest;
|
public event SearchQuery? SearchQueryRequest;
|
||||||
|
|
||||||
@@ -69,5 +69,4 @@ namespace GUI
|
|||||||
SelectedIndex = -1;
|
SelectedIndex = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
namespace GUI
|
namespace GUI;
|
||||||
|
|
||||||
|
public delegate string DataRequest(); //Fire whenever a specific field of ProfileHandler.CurrentProfile is needed
|
||||||
|
internal static class Program
|
||||||
{
|
{
|
||||||
public delegate string DataRequest(); //Fire whenever a specific field of ProfileHandler.CurrentProfile is needed
|
|
||||||
internal static class Program
|
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The main entry point for the application.
|
/// The main entry point for the application.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -18,5 +18,4 @@ namespace GUI
|
|||||||
() => ConfigFileManager.GetPath(),
|
() => ConfigFileManager.GetPath(),
|
||||||
() => ConfigFileManager.GetRecipient()
|
() => ConfigFileManager.GetRecipient()
|
||||||
); //needed at creation so that MainForm may pass this method down to other classes in its constructor
|
); //needed at creation so that MainForm may pass this method down to other classes in its constructor
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user