Update Updater.exe to send nb of updates in last 1, 3 and 7 days

This commit is contained in:
Kamil Trzciński 2022-12-20 09:47:55 +01:00
parent 9ef4b6136d
commit 99066eb736

View file

@ -107,34 +107,39 @@ namespace Updater
TrackProcess("PerformanceOverlay", usedTools);
TrackProcess("SteamController", usedTools);
var todayMatch = DateTimeOffset.UtcNow.DayOfYear;
var runToday = Settings.Default.GetRunTimes("Today", todayMatch) + 1;
var thisWeekMatch = DateTimeOffset.UtcNow.DayOfYear / 7;
var runThisWeek = Settings.Default.GetRunTimes("ThisWeek", thisWeekMatch) + 1;
var last1Match = DateTimeOffset.UtcNow.DayOfYear;
var last1 = Settings.Default.GetRunTimes("Last1", last1Match) + 1;
var last3Match = DateTimeOffset.UtcNow.DayOfYear / 3;
var last3 = Settings.Default.GetRunTimes("Last3", last3Match) + 1;
var last7Match = DateTimeOffset.UtcNow.DayOfYear / 7;
var last7 = Settings.Default.GetRunTimes("Last7", last7Match) + 1;
AutoUpdater.ParseUpdateInfoEvent += delegate
{
Settings.Default.SetRunTimes("Today", todayMatch, runToday);
Settings.Default.SetRunTimes("ThisWeek", thisWeekMatch, runThisWeek);
Settings.Default.SetRunTimes("Last1", last1Match, last1);
Settings.Default.SetRunTimes("Last3", last3Match, last3);
Settings.Default.SetRunTimes("Last7", last7Match, last7);
};
// This method requests an auto-update from remote server. It includes the following information:
// Type of installation: prod/dev, release/debug, setup/zip
// Version of application: 0.5.40+12345cdef
// Installation time: when the application was installed to track the age
// Used Tools: which application of suite are running, like: FanControl,PerformanceOverlay
// Updates Today/ThisWeek: amount of times update run today and this week
// This method requests an auto-update from remote server.
// It includes the following information:
// - Type of installation: prod/dev, release/debug, setup/zip
// - Version of application: 0.5.40+12345cdef
// - Installation time: when the application was installed
// - Used Tools: which application of suite are running, like: FanControl,PerformanceOverlay
// - Updates 1, 3 and 7 days: amount of times update run in 1 day, 3 and 7 days
var updateURL = String.Format(
"https://steam-deck-tools.ayufan.dev/updates/{4}_{0}_{1}.xml?version={2}&installTime={3}&env={4}&apps={5}&updatesToday={6}&updatesThisWeek={7}",
"https://steam-deck-tools.ayufan.dev/updates/{4}_{0}_{1}.xml?version={2}&installTime={3}&env={4}&apps={5}&updatesLast1={6}&updatesLast3={7}&updatesLast7={8}",
Instance.IsDEBUG ? "debug" : "release",
IsUsingInstaller ? "setup" : "zip",
HttpUtility.UrlEncode(Instance.ProductVersionWithSha),
InstallationTime,
Instance.IsProductionBuild ? "prod" : "dev",
HttpUtility.UrlEncode(String.Join(",", usedTools)),
runToday,
runThisWeek
last1,
last3,
last7
);
AutoUpdater.Start(updateURL);