@@ -23,6 +23,7 @@ namespace SignToolGUI.Forms
2323 public partial class MainForm : Form
2424 {
2525 #region Fields
26+
2627 // All fields and properties
2728
2829 public static string ConfigIniPath = FileManager . ConfigIniPath ; // Path to the configuration file
@@ -34,14 +35,17 @@ public partial class MainForm : Form
3435 private int _jobSigned ; //number of files in job signed
3536 public int Signerrors ; //number of errors to sign
3637 public string SignToolExe ; //path to signtool.exe
38+
3739 //private bool _isSignErrorShowed;
3840 private CertificateMonitor _certificateMonitor ; // Certificate monitor for checking certificate expiry
41+
3942 private Timer _pfxValidationTimer ; // Timer for debouncing PFX certificate validation
4043 private TimestampManager _timestampManager ; // Timestamp manager for handling timestamping operations
4144
42- #endregion
45+ #endregion Fields
4346
4447 #region Constructor & Initialization
48+
4549 // MainForm(), InitializeComponent(), and setup
4650
4751 public MainForm ( )
@@ -616,9 +620,10 @@ void SaveGeneralConfig(string encryptedPassword)
616620 }
617621 }
618622
619- #endregion
623+ #endregion Constructor & Initialization
620624
621625 #region Certificate Management
626+
622627 // Certificate-related methods
623628
624629 public async void InitializeAsyncCertificateCheck ( )
@@ -872,7 +877,6 @@ private static string GetCspName(X509Certificate2 cert)
872877
873878 // Return the provider name or an empty string if an exception was caught.
874879 return str ;
875-
876880 }
877881
878882 private string GetCertificateInfo ( X509Certificate2 cert )
@@ -1068,10 +1072,11 @@ private void ShowCertificateStatusForm()
10681072 "Error" , MessageBoxButtons . OK , MessageBoxIcon . Error ) ;
10691073 }
10701074 }
1071-
1072- #endregion
1075+
1076+ #endregion Certificate Management
10731077
10741078 #region Timestamp Management
1079+
10751080 // Timestamp-related methods
10761081
10771082 public class TimestampProvider
@@ -1109,9 +1114,10 @@ private void InitializeTimestampManager()
11091114 Message ( "Timestamp manager initialized" , EventType . Information , 3000 ) ;
11101115 }
11111116
1112- #endregion
1117+ #endregion Timestamp Management
11131118
11141119 #region File Management
1120+
11151121 // File add/remove, directory logic
11161122
11171123 public void CheckAllFiles ( )
@@ -1129,9 +1135,10 @@ private static string[] GetFiles(string sourceFolder, string filters, SearchOpti
11291135 return filters . Split ( ';' ) . SelectMany ( filter => Directory . GetFiles ( sourceFolder , filter , searchOption ) ) . ToArray ( ) ;
11301136 }
11311137
1132- #endregion
1138+ #endregion File Management
11331139
11341140 #region Signing Logic
1141+
11351142 // SignWithWindowsCertificateStoreAsync, SignWithPfxCertificateAsync, etc.
11361143
11371144 /// <summary>
@@ -1256,7 +1263,7 @@ private async Task SignWithPfxCertificateAsync()
12561263 {
12571264 if ( string . IsNullOrEmpty ( message ) ) return ;
12581265 // Filter out non-essential messages if the output checkbox is not checked.
1259- if ( ! checkBoxShowOutput . Checked && new [ ]
1266+ if ( ! checkBoxShowOutput . Checked && new [ ]
12601267 {
12611268 "Number of" , "Done Adding Additional Store" , "The following certificate was selected:" ,
12621269 "Signing file" , "hash:" , "Issued to:" , "Issued by:" , "Expires:" ,
@@ -1387,7 +1394,7 @@ private async Task SignWithTrustedSigningAsync()
13871394 {
13881395 if ( string . IsNullOrEmpty ( message ) ) return ;
13891396 // Filter out non-essential messages if the output checkbox is not checked.
1390- if ( ! checkBoxShowOutput . Checked && new [ ]
1397+ if ( ! checkBoxShowOutput . Checked && new [ ]
13911398 {
13921399 "Number of" , "Done Adding Additional Store" , "The following certificate was selected:" ,
13931400 "Signing file" , "hash:" , "Issued to:" , "Issued by:" , "Expires:" ,
@@ -1467,9 +1474,10 @@ private async Task SignWithTrustedSigningAsync()
14671474 Message ( "Signing process completed for Trusted Signing Certificate" , EventType . Information , 1050 ) ;
14681475 }
14691476
1470- #endregion
1477+ #endregion Signing Logic
14711478
14721479 #region Configuration Management
1480+
14731481 // Save/Load config methods
14741482
14751483 private void SaveTimestampConfiguration ( )
@@ -1578,11 +1586,13 @@ private void LoadCertificateTypeConfiguration()
15781586 radioButtonWindowsCertificateStore . Checked = false ;
15791587 radioButtonTrustedSigning . Checked = false ;
15801588 break ;
1589+
15811590 case "TrustedSigning" :
15821591 radioButtonTrustedSigning . Checked = true ;
15831592 radioButtonWindowsCertificateStore . Checked = false ;
15841593 radioButtonPFXCertificate . Checked = false ;
15851594 break ;
1595+
15861596 case "WindowsCertificateStore" :
15871597 default :
15881598 radioButtonWindowsCertificateStore . Checked = true ;
@@ -1603,9 +1613,10 @@ private void LoadCertificateTypeConfiguration()
16031613 }
16041614 }
16051615
1606- #endregion
1616+ #endregion Configuration Management
16071617
16081618 #region UI Logic
1619+
16091620 // InterfaceCheck, PopulateComboBox, etc.
16101621
16111622 private void PopulateComboBox ( )
@@ -1803,9 +1814,10 @@ private void CheckBoxAll_CheckedChanged(object sender, EventArgs e)
18031814 Message ( "User have " + ( isChecked ? "checked" : "unchecked" ) + " the 'Select All' checkbox for file(s) to sign" , EventType . Information , 1042 ) ;
18041815 }
18051816
1806- #endregion
1817+ #endregion UI Logic
18071818
18081819 #region Event Handlers
1820+
18091821 // All event handlers
18101822
18111823 private void buttonBrowseSignTool_Click ( object sender , EventArgs e )
@@ -2707,9 +2719,10 @@ private void comboBoxTimestampProviders_SelectedIndexChanged(object sender, Even
27072719 }
27082720 }
27092721
2710- #endregion
2722+ #endregion Event Handlers
27112723
27122724 #region Helper Methods
2725+
27132726 // Utility methods
27142727
27152728 private void ExportSigningReportToCsv ( )
@@ -2927,7 +2940,7 @@ private bool FindSignToolExe()
29272940
29282941 // Define the versions and architectures to search
29292942 var versions = new [ ]
2930- {
2943+ {
29312944 // Add other versions as needed...
29322945 "10.0.26100.0" ,
29332946 "10.0.22621.0" ,
@@ -2994,7 +3007,7 @@ private bool FindSignToolExe()
29943007 return ! string . IsNullOrEmpty ( SignToolExe ) && File . Exists ( SignToolExe ) ;
29953008 }
29963009
2997- #endregion
3010+ #endregion Helper Methods
29983011
29993012 private void buttonExportAsScript_Click ( object sender , EventArgs e )
30003013 {
0 commit comments