@@ -107,8 +107,6 @@ internal static void Automated_Install(string destination, string selected_versi
107107 string proxy_path = null ;
108108 if ( GetExistingProxyPath ( destination , out proxy_path ) )
109109 File . Delete ( proxy_path ) ;
110- //if (legacy_version)
111- // DowngradeMelonPreferences(destination);
112110 using FileStream stream = new FileStream ( temp_path , FileMode . Open , FileAccess . Read ) ;
113111 using ZipArchive zip = new ZipArchive ( stream ) ;
114112 int total_entry_count = zip . Entries . Count ;
@@ -147,6 +145,7 @@ internal static void Automated_Install(string destination, string selected_versi
147145 throw new IOException ( "Zip entry name ends in directory separator character but contains data." ) ;
148146 Directory . CreateDirectory ( fullPath ) ;
149147 }
148+ DowngradeMelonPreferences ( destination , legacy_version ) ;
150149 ExtraDirectoryChecks ( destination ) ;
151150 }
152151 catch ( Exception ex )
@@ -255,13 +254,13 @@ private static bool GetExistingProxyPath(string destination, out string proxy_pa
255254 return ! string . IsNullOrEmpty ( proxy_path ) ;
256255 }
257256
258- /*
259- private static void DowngradeMelonPreferences(string destination)
257+ private static void DowngradeMelonPreferences ( string destination , bool legacy_version )
260258 {
259+ if ( ! legacy_version || ( Program . mainForm . CurrentInstalledVersion == null ) || ( Program . mainForm . CurrentInstalledVersion . CompareTo ( new Version ( "0.3.0" ) ) < 0 ) )
260+ return ;
261261 string userdatapath = Path . Combine ( destination , "UserData" ) ;
262- string newfilepath = Path.Combine(userdatapath, "modprefs.ini");
263- if (File.Exists(newfilepath))
264- File.Delete(newfilepath);
262+ if ( ! Directory . Exists ( userdatapath ) )
263+ return ;
265264 string oldfilepath = Path . Combine ( userdatapath , "MelonPreferences.cfg" ) ;
266265 if ( ! File . Exists ( oldfilepath ) )
267266 return ;
@@ -274,6 +273,9 @@ private static void DowngradeMelonPreferences(string destination)
274273 TomlTable model = docsyn . ToModel ( ) ;
275274 if ( model . Count <= 0 )
276275 return ;
276+ string newfilepath = Path . Combine ( userdatapath , "modprefs.ini" ) ;
277+ if ( File . Exists ( newfilepath ) )
278+ File . Delete ( newfilepath ) ;
277279 IniFile iniFile = new IniFile ( newfilepath ) ;
278280 foreach ( KeyValuePair < string , object > keypair in model )
279281 {
@@ -310,7 +312,6 @@ private static void DowngradeMelonPreferences(string destination)
310312 }
311313 File . Delete ( oldfilepath ) ;
312314 }
313- */
314315
315316 private static void ExtraDirectoryChecks ( string destination )
316317 {
0 commit comments