@@ -272,16 +272,16 @@ private static bool IsZip (ZipArchive zipFile, string themefile)
272272 }
273273
274274 public static void UpdateZip ( string path , string content , Image img , bool wantToKeepImage = false , Image sticker = null ,
275- bool wantToKeepSticker = false , string themeName = "" )
275+ bool wantToKeepSticker = false , string themeName = "" , bool asOld = true )
276276 {
277277 if ( ! wantToKeepImage && ! wantToKeepSticker && img == null && sticker == null )
278278 {
279- SaveToFile ( path , content ) ;
279+ SaveToFile ( path , content , asOld ) ;
280280 } else
281281 {
282282 using ( var archive = ZipFile . Open ( path , ZipArchiveMode . Update ) )
283283 {
284- if ( themeName . Length == 0 ) themeName = GetThemeSaveName ( ) ;
284+ if ( themeName . Length == 0 ) themeName = GetThemeSaveName ( asOld ) ;
285285 ZipArchiveEntry entry = archive . GetEntry ( themeName ) ;
286286
287287 entry ? . Delete ( ) ;
@@ -316,10 +316,10 @@ public static void UpdateZip (string path, string content, Image img, bool wantT
316316 }
317317 }
318318
319- private static void SaveToFile ( string path , string content )
319+ private static void SaveToFile ( string path , string content , bool asOld )
320320 {
321321 if ( File . Exists ( path ) ) File . Delete ( path ) ;
322- if ( Settings . saveAsOld )
322+ if ( asOld )
323323 SaveToFileOld ( path , content ) ;
324324 else
325325 SaveToFileNew ( path , content ) ;
@@ -376,18 +376,18 @@ private static void ExtractFile (ZipArchive archive, string filename, string des
376376 }
377377 }
378378
379- public static void Zip ( string path , string content , Image img , Image sticker = null , string themeName = "" )
379+ public static void Zip ( string path , string content , Image img , Image sticker = null , string themeName = "" , bool asOld = true )
380380 {
381381 if ( img == null && sticker == null )
382382 {
383- SaveToFile ( path , content ) ;
383+ SaveToFile ( path , content , asOld ) ;
384384 } else
385385 {
386386 using ( var fileStream = new FileStream ( path , FileMode . Create ) )
387387 {
388388 using ( var archive = new ZipArchive ( fileStream , ZipArchiveMode . Create ) )
389389 {
390- if ( themeName . Length == 0 ) themeName = GetThemeSaveName ( ) ;
390+ if ( themeName . Length == 0 ) themeName = GetThemeSaveName ( asOld ) ;
391391 ZipArchiveEntry entry = archive . CreateEntry ( themeName , CompressionLevel . Optimal ) ;
392392
393393
@@ -443,14 +443,14 @@ public static Color ChangeColorBrightness (Color color, float correctionFactor)
443443 return Color . FromArgb ( color . A , ( int ) red , ( int ) green , ( int ) blue ) ;
444444 }
445445
446- public static string GetThemeSaveName ( )
446+ public static string GetThemeSaveName ( bool asOld )
447447 {
448- return "theme." + GetSaveFormat ( ) ;
448+ return "theme." + GetSaveFormat ( asOld ) ;
449449 }
450450
451- public static string GetSaveFormat ( )
451+ public static string GetSaveFormat ( bool asOld )
452452 {
453- return Settings . saveAsOld ? "xshd" : "json" ;
453+ return asOld ? "xshd" : "json" ;
454454 }
455455
456456 public static bool IsDark ( Color clr )
0 commit comments