Skip to content

Commit

Permalink
set readonly values
Browse files Browse the repository at this point in the history
  • Loading branch information
Aetherinox committed Feb 3, 2024
1 parent 8d5d231 commit 207f765
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 28 deletions.
43 changes: 30 additions & 13 deletions Classes/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ public class App

#region "Define: Paths"

static string xsum_path_full = Process.GetCurrentProcess( ).MainModule.FileName; // XSum full path to exe
static string xsum_path_dir = Path.GetDirectoryName( xsum_path_full ); // XSum path to folder only
static string xsum_path_exe = Path.GetFileName( xsum_path_full ); // XSum exe name only
readonly static string xsum_path_full = Process.GetCurrentProcess( ).MainModule.FileName; // XSum full path to exe
readonly static string xsum_path_dir = Path.GetDirectoryName( xsum_path_full ); // XSum path to folder only
readonly static string xsum_path_exe = Path.GetFileName( xsum_path_full ); // XSum exe name only

#endregion

Expand All @@ -62,8 +62,8 @@ utilized with Log module.

#region "Define: Classes"

private AppInfo AppInfo = new AppInfo( );
private Benchmark Benchmark = new Benchmark( );
readonly private AppInfo AppInfo = new AppInfo( );
readonly private Benchmark Benchmark = new Benchmark( );

#endregion

Expand All @@ -77,7 +77,7 @@ This is a console application. Short-hand some of the console methods to keep th

#region "Define: Delegates"

delegate string del_sf ( string format, params object[] arg );
delegate string del_sf ( string format, params object[] arg );
static del_sf sf = String.Format;

delegate void del_write ( string format, params object[] arg );
Expand Down Expand Up @@ -216,7 +216,7 @@ static public ConsoleColor wc( string ColorName )

#region "Define: Miscellaneous"

static string assemblyName = Assembly.GetEntryAssembly( ).GetName( ).Name;
readonly static string assemblyName = Assembly.GetEntryAssembly( ).GetName( ).Name;

#endregion

Expand Down Expand Up @@ -387,6 +387,17 @@ public static bool IsFullPath( string path )
{ "BLAKE*.txt", true },
};

/*
pre-defined hash digests
*/

private static Dictionary<string, bool> dict_SignedDigests = new Dictionary<string, bool>
{
{ "MD5*.asc", true },
{ "SHA*.asc", true },
{ "BLAKE*.asc", true },
};

/*
pre-defined ignore list
--exclude argument can add additional entries
Expand Down Expand Up @@ -751,6 +762,11 @@ static int Main( string[] args )
}
else
{

/*
Create list of recognized auto-verify digests to look for if user manually double-clicks xsum
*/

var ProcParent = AppInfo.GetParentProcess( Process.GetCurrentProcess( ) );
if ( ProcParent.ProcessName == "explorer" )
{
Expand All @@ -760,12 +776,13 @@ static int Main( string[] args )
nl( );
c2( sf( " {0,-24} {1,-30}", "[#Red][/]", "Could not locate a valid hash digest file with the name:" ) );
nl( );
c2( sf( " {0,-23} {1,-30}", "[#Red][/]", " · [#Yellow]SHA*.asc[/]" ) );
nl( );
c2( sf( " {0,-23} {1,-30}", "[#Red][/]", " · [#Yellow]MD5*.asc[/]" ) );
nl( );
c2( sf( " {0,-23} {1,-30}", "[#Red][/]", " · [#Yellow]BLAKE*.asc[/]" ) );
nl( );

foreach( KeyValuePair<string, bool> item in dict_SignedDigests )
{
c2( sf( " {0,-23} {1,-30}", "[#Red][/]", " · [#Yellow]" + item.Key + "[/]" ) );
nl( );
}

nl( );
c2( sf( " {0,-24} {1,-30}", "[#Red][/]", "Press any key to exit.[/]" ) );
nl( );
Expand Down
8 changes: 1 addition & 7 deletions Classes/Hash.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
/*
@app : MobaXterm Keygen
@repo : https://github.com/Aetherinox/MobaXtermKeygen
@author : Aetherinox
*/

#region "Using"
#region "Using"

using XSum;
using System;
Expand Down
7 changes: 6 additions & 1 deletion Classes/Helpers.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
using System;

#region "Using"

using System;
using System.Diagnostics;
using System.Text.RegularExpressions;
using System.Text;
using System.Collections;
using System.IO;

#endregion

namespace XSum
{

Expand Down
8 changes: 1 addition & 7 deletions Classes/Log.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
/*
@app : xSum
@repo : https://github.com/Aetherinox/XSum
@author : Aetherinox
*/

#region "Using"
#region "Using"

using System;
using System.IO;
Expand Down
Binary file modified bin/Release/net481/publish/xsum.exe
Binary file not shown.
Binary file modified bin/Release/net481/xsum.exe
Binary file not shown.

0 comments on commit 207f765

Please sign in to comment.