-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add cache configuration patch, compatible with older versions
- Loading branch information
Showing
5 changed files
with
95 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Windows.ApplicationModel; | ||
|
||
namespace ContextMenuCustomApp | ||
{ | ||
public static class AppVersion | ||
{ | ||
public static int Current() | ||
{ | ||
var version = Package.Current.Id.Version; | ||
return version.Major * 1000 + version.Minor; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using ContextMenuCustomApp.Common; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Windows.ApplicationModel; | ||
using Windows.Storage; | ||
|
||
namespace ContextMenuCustomApp.Patchs | ||
{ | ||
public class Patch1 | ||
{ | ||
|
||
public static void Run() | ||
{ | ||
var appVersion = AppVersion.Current(); | ||
var patchVersion = Settings.INS.PatchVersion; | ||
if (patchVersion < 2003) | ||
{ | ||
FixCacheSetting(); | ||
} | ||
|
||
if (patchVersion != appVersion) | ||
{ | ||
Settings.INS.PatchVersion = appVersion; | ||
} | ||
} | ||
|
||
private static void FixCacheSetting() | ||
{ | ||
try | ||
{ | ||
var cacheTimeValue = ApplicationData.Current.LocalSettings.Values["Cache_Time"]; | ||
if (cacheTimeValue is string cacheTime) | ||
{ | ||
Settings.INS.CacheEnabled = !string.IsNullOrEmpty(cacheTime); | ||
} | ||
} | ||
catch | ||
{ | ||
|
||
} | ||
} | ||
|
||
} | ||
} |