11using System ;
2+ using System . Collections . Generic ;
3+ using System . Linq ;
4+ using System . Text ;
5+ using System . Threading . Tasks ;
26using System . Threading ;
37using System . Diagnostics ;
8+ using System . Windows ;
49using System . Windows . Forms ;
510using System . IO ;
611using System . IO . Compression ;
@@ -12,66 +17,61 @@ public static class Program
1217 [ STAThread ]
1318 public static void Main ( )
1419 {
15- var process = Process . GetProcessesByName ( "Spedit.exe" ) ;
16-
17- if ( process . Length > 0 )
20+ Process [ ] p = Process . GetProcessesByName ( "Spedit.exe" ) ;
21+ if ( p . Length > 0 )
1822 {
19- foreach ( var p in process )
23+ for ( int i = 0 ; i < p . Length ; ++ i )
24+ {
2025 try
2126 {
22- p . WaitForExit ( ) ;
23- }
24- catch ( Exception )
25- {
26- // ignored
27+ p [ i ] . WaitForExit ( ) ;
2728 }
29+ catch ( Exception ) { }
30+ }
2831 }
29-
3032 Application . EnableVisualStyles ( ) ;
3133 Application . SetCompatibleTextRenderingDefault ( true ) ;
32-
33- var um = new UpdateMarquee ( ) ;
34+ UpdateMarquee um = new UpdateMarquee ( ) ;
3435 um . Show ( ) ;
35-
36- Application . DoEvents ( ) ;
37-
38- var t = new Thread ( Worker ) ;
36+ Application . DoEvents ( ) ; //execute Visual
37+ Thread t = new Thread ( new ParameterizedThreadStart ( Worker ) ) ;
3938 t . Start ( um ) ;
40-
4139 Application . Run ( um ) ;
4240 }
4341
4442 private static void Worker ( object arg )
4543 {
46- var um = ( UpdateMarquee ) arg ;
47- var zipFile = Path . Combine ( Environment . CurrentDirectory , "updateZipFile.zip" ) ;
48- var zipFileContent = Properties . Resources . spedit1_2_0_1Update ;
44+ UpdateMarquee um = ( UpdateMarquee ) arg ;
45+ string zipFile = Path . Combine ( Environment . CurrentDirectory , "updateZipFile.zip" ) ;
46+
47+ byte [ ] zipFileContent = SpeditUpdater . Properties . Resources . spedit1_2_0_1Update ;
4948
5049 File . WriteAllBytes ( zipFile , zipFileContent ) ;
5150
52- var zipInfo = new FileInfo ( zipFile ) ;
53- var extractPath = Environment . CurrentDirectory ;
51+ FileInfo zipInfo = new FileInfo ( zipFile ) ;
5452
55- using ( var archieve = ZipFile . OpenRead ( zipInfo . FullName ) )
53+ string extractPath = Environment . CurrentDirectory ;
54+ using ( ZipArchive archieve = ZipFile . OpenRead ( zipInfo . FullName ) )
5655 {
5756 var entries = archieve . Entries ;
58-
5957 foreach ( var entry in entries )
6058 {
61- var full = Path . Combine ( extractPath , entry . FullName ) ;
62- var fInfo = new FileInfo ( full ) ;
63-
59+ string full = Path . Combine ( extractPath , entry . FullName ) ;
60+ FileInfo fInfo = new FileInfo ( full ) ;
6461 if ( ! Directory . Exists ( fInfo . DirectoryName ) )
65- if ( fInfo . DirectoryName != null )
66- Directory . CreateDirectory ( fInfo . DirectoryName ) ;
67-
62+ {
63+ Directory . CreateDirectory ( fInfo . DirectoryName ) ;
64+ }
6865 entry . ExtractToFile ( fInfo . FullName , true ) ;
6966 }
7067 }
7168
7269 zipInfo . Delete ( ) ;
7370
74- um . Invoke ( ( InvokeDel ) ( ( ) => { um . SetToReadyState ( ) ; } ) ) ;
71+ um . Invoke ( ( InvokeDel ) ( ( ) =>
72+ {
73+ um . SetToReadyState ( ) ;
74+ } ) ) ;
7575 }
7676
7777 public delegate void InvokeDel ( ) ;
0 commit comments