11using System ;
2- using System . Collections . Generic ;
3- using System . Linq ;
4- using System . Threading . Tasks ;
5- using System . Windows . Forms ;
62using System . Diagnostics ;
73using System . IO ;
4+ using System . Windows . Forms ;
85using TimeControl . Tools ;
96using TimeControl . Windows ;
107
118namespace TimeControl
129{
13- static class Program
10+ internal static class Program
1411 {
1512 /// <summary>
1613 /// The main entry point for the application.
1714 /// </summary>
1815 [ STAThread ]
19- static void Main ( string [ ] args )
16+ private static void Main ( string [ ] args )
2017 {
2118 IntPtr nowDesktop = Dllimport . GetThreadDesktop ( Dllimport . GetCurrentThreadId ( ) ) ;
2219 try
@@ -52,7 +49,7 @@ static void Main(string[] args)
5249 Application . SetCompatibleTextRenderingDefault ( false ) ;
5350 Application . Run ( new ControlPanel ( hide ) ) ;
5451 }
55- catch ( Exception ex )
52+ catch ( Exception ex )
5653 {
5754 Dllimport . SwitchDesktop ( nowDesktop ) ;
5855 File . Delete ( TimeControlFile . TempTimeFile ) ;
@@ -61,12 +58,12 @@ static void Main(string[] args)
6158 File . AppendAllText ( TimeControlFile . LogFile , ex . ToString ( ) + Environment . NewLine ) ;
6259 if ( ex is InvalidOperationException )
6360 {
64- MessageBox . Show ( "可能发生了文件错误,请检查保存的文件是否有效或删除配置文件。" , "错误" ,
65- MessageBoxButtons . OK , MessageBoxIcon . Error ) ;
61+ MessageBox . Show ( "可能发生了文件错误,请检查保存的文件是否有效或删除配置文件。" , "错误" ,
62+ MessageBoxButtons . OK , MessageBoxIcon . Error ) ;
6663 }
67- MessageBox . Show ( ex . Message + Environment . NewLine + "以上为错误消息,已保存到" + TimeControlFile . LogFile
64+ MessageBox . Show ( ex . Message + Environment . NewLine + "以上为错误消息,已保存到" + TimeControlFile . LogFile
6865 + ",请反馈此问题到项目主页Issue。保护程序已暂时关闭。" , "TimeControl发生错误" ,
69- MessageBoxButtons . OK , MessageBoxIcon . Error ) ;
66+ MessageBoxButtons . OK , MessageBoxIcon . Error ) ;
7067 Process . Start ( "explorer.exe" , "https://gitee.com/Sam-Hou/ComputerTimeControl/issues" ) ;
7168 //关闭保护进程
7269 Process [ ] processes = Process . GetProcessesByName ( "TimeControlConsole" ) ;
@@ -75,4 +72,4 @@ static void Main(string[] args)
7572 }
7673 }
7774 }
78- }
75+ }
0 commit comments