@@ -137,76 +137,84 @@ private static void Main()
137137 }
138138 }
139139 }
140- if ( ! Directory . Exists ( Path . Combine ( backupDir , "msc" ) ) )
140+ foreach ( string regFile in pendingFiles )
141141 {
142- Directory . CreateDirectory ( Path . Combine ( backupDir , "msc" ) ) ;
143- if ( CultureInfo . CurrentUICulture . Name != "en-US" )
142+ if ( regFile . Contains ( "mmcbase.dll.mun" )
143+ || regFile . Contains ( "mmcndmgr.dll.mun" )
144+ || regFile . Contains ( "mmc.exe" ) )
144145 {
145- Directory . CreateDirectory ( Path . Combine ( backupDir , "msc" , CultureInfo . CurrentUICulture . Name ) ) ;
146- }
147- Directory . CreateDirectory ( Path . Combine ( backupDir , "msc" , "en-US" ) ) ;
148- }
149- var langFolder = Path . Combine ( Variables . sys32Folder , CultureInfo . CurrentUICulture . Name ) ;
150- var usaFolder = Path . Combine ( Variables . sys32Folder , "en-US" ) ;
151- List < string > langMsc = new List < string > ( Directory . GetFiles ( langFolder , "*.msc" , SearchOption . TopDirectoryOnly ) ) ;
152- List < string > usaMsc = new List < string > ( Directory . GetFiles ( usaFolder , "*.msc" , SearchOption . TopDirectoryOnly ) ) ;
153- List < string > sysMsc = new List < string > ( Directory . GetFiles ( Variables . sys32Folder , "*.msc" , SearchOption . TopDirectoryOnly ) ) ;
154- List < string > r11Msc = new List < string > ( Directory . GetFiles ( Path . Combine ( Variables . r11Folder , "Tmp" , "msc" ) , "*.msc" , SearchOption . TopDirectoryOnly ) ) ;
155- if ( CultureInfo . CurrentUICulture . Name != "en-US" )
156- {
157- for ( int i = 0 ; i < langMsc . Count ; i ++ )
158- {
159- for ( int j = 0 ; j < usaMsc . Count ; j ++ )
146+ if ( ! Directory . Exists ( Path . Combine ( backupDir , "msc" ) ) )
160147 {
161- if ( Path . GetFileName ( langMsc [ i ] ) == Path . GetFileName ( usaMsc [ j ] ) )
148+ Directory . CreateDirectory ( Path . Combine ( backupDir , "msc" ) ) ;
149+ if ( CultureInfo . CurrentUICulture . Name != "en-US" )
162150 {
163- usaMsc . RemoveAt ( j ) ;
151+ Directory . CreateDirectory ( Path . Combine ( backupDir , "msc" , CultureInfo . CurrentUICulture . Name ) ) ;
164152 }
153+ Directory . CreateDirectory ( Path . Combine ( backupDir , "msc" , "en-US" ) ) ;
165154 }
166- }
167- }
168- for ( int j = 0 ; j < r11Msc . Count ; j ++ )
169- {
170- for ( int i = 0 ; i < usaMsc . Count ; i ++ )
171- {
172- if ( Path . GetFileName ( usaMsc [ i ] ) == Path . GetFileName ( r11Msc [ j ] ) )
155+ var langFolder = Path . Combine ( Variables . sys32Folder , CultureInfo . CurrentUICulture . Name ) ;
156+ var usaFolder = Path . Combine ( Variables . sys32Folder , "en-US" ) ;
157+ List < string > langMsc = new List < string > ( Directory . GetFiles ( langFolder , "*.msc" , SearchOption . TopDirectoryOnly ) ) ;
158+ List < string > usaMsc = new List < string > ( Directory . GetFiles ( usaFolder , "*.msc" , SearchOption . TopDirectoryOnly ) ) ;
159+ List < string > sysMsc = new List < string > ( Directory . GetFiles ( Variables . sys32Folder , "*.msc" , SearchOption . TopDirectoryOnly ) ) ;
160+ List < string > r11Msc = new List < string > ( Directory . GetFiles ( Path . Combine ( Variables . r11Folder , "Tmp" , "msc" ) , "*.msc" , SearchOption . TopDirectoryOnly ) ) ;
161+ if ( CultureInfo . CurrentUICulture . Name != "en-US" )
173162 {
174- Console . WriteLine ( usaMsc [ i ] ) ;
175- if ( ! File . Exists ( Path . Combine ( backupDir , "msc" , "en-US" , Path . GetFileName ( usaMsc [ i ] ) ) ) )
163+ for ( int i = 0 ; i < langMsc . Count ; i ++ )
176164 {
177- File . Move ( usaMsc [ i ] , Path . Combine ( backupDir , "msc" , "en-US" , Path . GetFileName ( usaMsc [ i ] ) ) ) ;
165+ for ( int j = 0 ; j < usaMsc . Count ; j ++ )
166+ {
167+ if ( Path . GetFileName ( langMsc [ i ] ) == Path . GetFileName ( usaMsc [ j ] ) )
168+ {
169+ usaMsc . RemoveAt ( j ) ;
170+ }
171+ }
178172 }
179- File . Copy ( r11Msc [ j ] , usaMsc [ i ] , true ) ;
180173 }
181- }
182- for ( int i = 0 ; i < sysMsc . Count ; i ++ )
183- {
184- if ( Path . GetFileName ( sysMsc [ i ] ) == Path . GetFileName ( r11Msc [ j ] ) )
174+ for ( int j = 0 ; j < r11Msc . Count ; j ++ )
185175 {
186- Console . WriteLine ( sysMsc [ i ] ) ;
187- if ( ! File . Exists ( Path . Combine ( backupDir , "msc" , Path . GetFileName ( sysMsc [ i ] ) ) ) )
176+ for ( int i = 0 ; i < usaMsc . Count ; i ++ )
177+ {
178+ if ( Path . GetFileName ( usaMsc [ i ] ) == Path . GetFileName ( r11Msc [ j ] ) )
179+ {
180+ Console . WriteLine ( usaMsc [ i ] ) ;
181+ if ( ! File . Exists ( Path . Combine ( backupDir , "msc" , "en-US" , Path . GetFileName ( usaMsc [ i ] ) ) ) )
182+ {
183+ File . Move ( usaMsc [ i ] , Path . Combine ( backupDir , "msc" , "en-US" , Path . GetFileName ( usaMsc [ i ] ) ) ) ;
184+ }
185+ File . Copy ( r11Msc [ j ] , usaMsc [ i ] , true ) ;
186+ }
187+ }
188+ for ( int i = 0 ; i < sysMsc . Count ; i ++ )
188189 {
189- File . Move ( sysMsc [ i ] , Path . Combine ( backupDir , "msc" , Path . GetFileName ( sysMsc [ i ] ) ) ) ;
190+ if ( Path . GetFileName ( sysMsc [ i ] ) == Path . GetFileName ( r11Msc [ j ] ) )
191+ {
192+ Console . WriteLine ( sysMsc [ i ] ) ;
193+ if ( ! File . Exists ( Path . Combine ( backupDir , "msc" , Path . GetFileName ( sysMsc [ i ] ) ) ) )
194+ {
195+ File . Move ( sysMsc [ i ] , Path . Combine ( backupDir , "msc" , Path . GetFileName ( sysMsc [ i ] ) ) ) ;
196+ }
197+ File . Copy ( r11Msc [ j ] , sysMsc [ i ] , true ) ;
198+ }
190199 }
191- File . Copy ( r11Msc [ j ] , sysMsc [ i ] , true ) ;
192200 }
193- }
194- }
195- if ( CultureInfo . CurrentUICulture . Name != "en-US" )
196- {
197- List < string > r11LangMsc = new List < string > ( Directory . GetFiles ( Path . Combine ( Variables . r11Folder , "Tmp" , "msc" , CultureInfo . CurrentUICulture . Name ) , "*.msc" , SearchOption . TopDirectoryOnly ) ) ;
198- for ( int j = 0 ; j < r11LangMsc . Count ; j ++ )
199- {
200- for ( int i = 0 ; i < langMsc . Count ; i ++ )
201+ if ( CultureInfo . CurrentUICulture . Name != "en-US" )
201202 {
202- if ( Path . GetFileName ( langMsc [ i ] ) == Path . GetFileName ( r11LangMsc [ j ] ) )
203+ List < string > r11LangMsc = new List < string > ( Directory . GetFiles ( Path . Combine ( Variables . r11Folder , "Tmp" , "msc" , CultureInfo . CurrentUICulture . Name ) , "*.msc" , SearchOption . TopDirectoryOnly ) ) ;
204+ for ( int j = 0 ; j < r11LangMsc . Count ; j ++ )
203205 {
204- Console . WriteLine ( langMsc [ i ] ) ;
205- if ( ! File . Exists ( Path . Combine ( backupDir , "msc" , CultureInfo . CurrentUICulture . Name , Path . GetFileName ( langMsc [ i ] ) ) ) )
206+ for ( int i = 0 ; i < langMsc . Count ; i ++ )
206207 {
207- File . Move ( langMsc [ i ] , Path . Combine ( backupDir , "msc" , CultureInfo . CurrentUICulture . Name , Path . GetFileName ( langMsc [ i ] ) ) ) ;
208+ if ( Path . GetFileName ( langMsc [ i ] ) == Path . GetFileName ( r11LangMsc [ j ] ) )
209+ {
210+ Console . WriteLine ( langMsc [ i ] ) ;
211+ if ( ! File . Exists ( Path . Combine ( backupDir , "msc" , CultureInfo . CurrentUICulture . Name , Path . GetFileName ( langMsc [ i ] ) ) ) )
212+ {
213+ File . Move ( langMsc [ i ] , Path . Combine ( backupDir , "msc" , CultureInfo . CurrentUICulture . Name , Path . GetFileName ( langMsc [ i ] ) ) ) ;
214+ }
215+ File . Copy ( r11LangMsc [ j ] , langMsc [ i ] , true ) ;
216+ }
208217 }
209- File . Copy ( r11LangMsc [ j ] , langMsc [ i ] , true ) ;
210218 }
211219 }
212220 }
@@ -226,14 +234,6 @@ private static void MoveFile(string newval, string file)
226234 {
227235 File . Move ( newval , finalpath ) ;
228236 }
229- else
230- {
231- if ( ! Directory . Exists ( Path . Combine ( Variables . r11Folder , "trash" ) ) )
232- {
233- Directory . CreateDirectory ( Path . Combine ( Variables . r11Folder , "trash" ) ) ;
234- }
235- File . Move ( newval , Path . Combine ( Variables . r11Folder , "trash" , Path . GetFileName ( newval ) ) ) ;
236- }
237237 File . Copy ( file , newval , true ) ;
238238
239239 }
@@ -248,14 +248,6 @@ private static void MoveFilex86(string newval, string file)
248248 {
249249 File . Move ( newval , finalpath ) ;
250250 }
251- else
252- {
253- if ( ! Directory . Exists ( Path . Combine ( Variables . r11Folder , "trash" ) ) )
254- {
255- Directory . CreateDirectory ( Path . Combine ( Variables . r11Folder , "trash" ) ) ;
256- }
257- File . Move ( newval , Path . Combine ( Variables . r11Folder , "trash" , Path . GetFileName ( newval ) ) ) ;
258- }
259251 File . Copy ( file , newval , true ) ;
260252 }
261253 private static void MoveTrouble ( string newval , string file , string name )
0 commit comments