@@ -11,7 +11,7 @@ private static void Main()
1111 {
1212 Action < string > display = Console . WriteLine ;
1313 Console . ForegroundColor = ConsoleColor . White ;
14- display ( $ "Save Windows 10 wallpaper V1.3 with Explorer opening") ;
14+ display ( $ "Save Windows 10 wallpaper V1.4 without Explorer opening") ;
1515 display ( string . Empty ) ;
1616 display ( "Checking if there are new images to be copied..." ) ;
1717 List < string > files = new List < string > ( ) ;
@@ -49,9 +49,12 @@ private static void Main()
4949 for ( int i = 0 ; i < files . Count ; i ++ )
5050 {
5151 string source = files [ i ] ;
52- string destination = Path . Combine ( imagePath , source ) + ".jpg" ;
53- File . Copy ( source , destination , overwirte ) ;
54- counter ++ ;
52+ string destination = Path . Combine ( imagePath , Path . GetFileName ( source ) ) + ".jpg" ;
53+ if ( ! File . Exists ( destination ) )
54+ {
55+ File . Copy ( source , destination , overwirte ) ;
56+ counter ++ ;
57+ }
5558 }
5659 }
5760 catch ( Exception )
@@ -72,22 +75,22 @@ private static void Main()
7275 display ( $ "{ counter } image{ Plural ( counter ) } { Plural ( counter , "have" ) } been copied to the picture folder.") ;
7376 display ( string . Empty ) ;
7477
75- // Open explorer to see source picture folder
76- userName = Environment . UserName ;
77- imagePath = $@ "C:\Users\{ userName } \Pictures";
78- if ( Directory . Exists ( $@ "C:\Users\{ userName } \Pictures\fond_ecran") )
79- {
80- imagePath = $@ "C:\Users\{ userName } \Pictures\fond_ecran";
81- }
78+ // Open explorer to see source picture folder for test to debug
79+ // userName = Environment.UserName;
80+ // imagePath = $@"C:\Users\{userName}\Pictures";
81+ // if (Directory.Exists($@"C:\Users\{userName}\Pictures\fond_ecran"))
82+ // {
83+ // imagePath = $@"C:\Users\{userName}\Pictures\fond_ecran";
84+ // }
8285
83- StartProcess ( "Explorer.exe" , imagePath , true , false ) ;
86+ // StartProcess("Explorer.exe", imagePath, true, false);
8487
85- // Open explorer to view target picture folder
86- imagePath = $@ "C:\Users\{ userName } \AppData\Local\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets";
87- if ( Directory . Exists ( imagePath ) )
88- {
89- StartProcess ( "Explorer.exe" , imagePath , true , false ) ;
90- }
88+ // Open explorer to view target picture folder for test to debug
89+ // imagePath = $@"C:\Users\{userName}\AppData\Local\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets";
90+ // if (Directory.Exists(imagePath))
91+ // {
92+ // StartProcess("Explorer.exe", imagePath, true, false);
93+ // }
9194
9295 Console . ForegroundColor = ConsoleColor . Yellow ;
9396 display ( "Press any key to exit:" ) ;
0 commit comments