mirror of
https://github.com/HolographicHat/Yae.git
synced 2025-12-15 19:08:12 +08:00
refactor
This commit is contained in:
@@ -29,29 +29,27 @@ new EventLog("AppInit") {
|
|||||||
{ "SystemVersion", DeviceHelper.GetSystemVersion() }
|
{ "SystemVersion", DeviceHelper.GetSystemVersion() }
|
||||||
}
|
}
|
||||||
}.Enqueue();
|
}.Enqueue();
|
||||||
var usePreviousData = false;
|
|
||||||
var historyCache = new CacheFile("ExportData");
|
var historyCache = new CacheFile("ExportData");
|
||||||
if (historyCache.LastWriteTime.AddMinutes(10) > DateTime.UtcNow) {
|
|
||||||
|
AchievementAllDataNotify? data = null;
|
||||||
|
try {
|
||||||
|
data = AchievementAllDataNotify.Parser.ParseFrom(historyCache.Read().Content);
|
||||||
|
} catch (Exception) { /* ignored */ }
|
||||||
|
|
||||||
|
if (historyCache.LastWriteTime.AddMinutes(10) > DateTime.UtcNow && data != null) {
|
||||||
Console.WriteLine(App.UsePreviousData);
|
Console.WriteLine(App.UsePreviousData);
|
||||||
usePreviousData = Console.ReadLine() == "yes";
|
if (Console.ReadLine() == "yes") {
|
||||||
}
|
Export.Choose(data);
|
||||||
Export:
|
return;
|
||||||
if(usePreviousData) {
|
|
||||||
AchievementAllDataNotify data;
|
|
||||||
try {
|
|
||||||
data = AchievementAllDataNotify.Parser.ParseFrom(historyCache.Read().Content);
|
|
||||||
} catch (Exception) {
|
|
||||||
usePreviousData = false;
|
|
||||||
goto Export;
|
|
||||||
}
|
}
|
||||||
Export.Choose(data);
|
}
|
||||||
} else {
|
|
||||||
StartAndWaitResult(AppConfig.GamePath, str => {
|
StartAndWaitResult(AppConfig.GamePath, str => {
|
||||||
GlobalVars.UnexpectedExit = false;
|
GlobalVars.UnexpectedExit = false;
|
||||||
var data = Convert.FromBase64String(str);
|
var bytes = Convert.FromBase64String(str);
|
||||||
var list = AchievementAllDataNotify.Parser.ParseFrom(data);
|
var list = AchievementAllDataNotify.Parser.ParseFrom(bytes);
|
||||||
historyCache.Write(data);
|
historyCache.Write(bytes);
|
||||||
Export.Choose(list);
|
Export.Choose(list);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user