From 99066eb7369b47f9751b31d4cdf6edff46a394de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Trzci=C5=84ski?= Date: Tue, 20 Dec 2022 09:47:55 +0100 Subject: [PATCH] Update `Updater.exe` to send nb of updates in last 1, 3 and 7 days --- Updater/Program.cs | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/Updater/Program.cs b/Updater/Program.cs index 6d61c3d..e961ea4 100644 --- a/Updater/Program.cs +++ b/Updater/Program.cs @@ -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);