From 4c65e8b60b6f7a9f28b74475cdaa20a2a3b25f6a Mon Sep 17 00:00:00 2001 From: 13xforever Date: Wed, 17 Aug 2022 02:26:10 +0500 Subject: [PATCH 1/3] new docker image seems to be missing tzdata package --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index ebecaf9a..4c212d3b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM mcr.microsoft.com/dotnet/sdk:6.0-jammy AS base # Native libgdiplus dependencies RUN apt-get update -RUN apt-get install -y --allow-unauthenticated libc6-dev libgdiplus libx11-dev fonts-roboto +RUN apt-get install -y --allow-unauthenticated libc6-dev libgdiplus libx11-dev fonts-roboto tzdata # debian-specific? #RUN rm -rf /var/lib/apt/lists/* From 7acfa1189b7763b3febac67f278f780ab17f2d19 Mon Sep 17 00:00:00 2001 From: 13xforever Date: Wed, 17 Aug 2022 02:39:13 +0500 Subject: [PATCH 2/3] try to build acronyms for all time zones --- CompatBot/Utils/TimeParser.cs | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/CompatBot/Utils/TimeParser.cs b/CompatBot/Utils/TimeParser.cs index 6c63d0d2..b9baa001 100644 --- a/CompatBot/Utils/TimeParser.cs +++ b/CompatBot/Utils/TimeParser.cs @@ -32,6 +32,8 @@ public static class TimeParser var tzList = TimeZoneInfo.GetSystemTimeZones(); Config.Log.Trace("[TZI] System TZI count: " + tzList.Count); var result = new Dictionary(); + var standardNames = new Dictionary(); + var daylightNames = new Dictionary(); foreach (var tzi in tzList) { Config.Log.Trace($"[TZI] Checking {tzi.Id} ({tzi.DisplayName} / {tzi.StandardName} / {tzi.DaylightName})"); @@ -47,9 +49,26 @@ public static class TimeParser foreach (var tza in acronyms) result[tza] = tzi; } + else + { + var a = tzi.StandardName.GetAcronym(); + if (TimeZoneAcronyms.ContainsKey(a)) + continue; + + if (!standardNames.ContainsKey(a)) + standardNames[a] = tzi; + a = tzi.DaylightName.GetAcronym(); + if (TimeZoneAcronyms.ContainsKey(a) || standardNames.ContainsKey(a)) + continue; + + if (!daylightNames.ContainsKey(a)) + daylightNames[a] = tzi; + } } Config.Log.Trace("[TZI] Total matched acronyms: " + result.Count); - TimeZoneMap = result; + TimeZoneMap = result.Concat(standardNames).Concat(daylightNames) + .DistinctBy(kvp => kvp.Key) + .ToDictionary(kvp => kvp.Key, kvp => kvp.Value); } public static bool TryParse(string dateTime, out DateTime result) From 3a96e5af3505cd466687cea56890a7feaa4d64d0 Mon Sep 17 00:00:00 2001 From: 13xforever Date: Wed, 17 Aug 2022 02:48:54 +0500 Subject: [PATCH 3/3] update 3rd party deps --- .../CompatApiClient/CompatApiClient.csproj | 2 +- Clients/GithubClient/GithubClient.csproj | 2 +- CompatBot/Commands/BotStats.cs | 2 +- CompatBot/CompatBot.csproj | 20 +++++++++---------- CompatBot/Config.cs | 8 ++++---- Tests/Tests.csproj | 2 +- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Clients/CompatApiClient/CompatApiClient.csproj b/Clients/CompatApiClient/CompatApiClient.csproj index 91fea613..31d6c8b0 100644 --- a/Clients/CompatApiClient/CompatApiClient.csproj +++ b/Clients/CompatApiClient/CompatApiClient.csproj @@ -17,7 +17,7 @@ - + diff --git a/Clients/GithubClient/GithubClient.csproj b/Clients/GithubClient/GithubClient.csproj index b180bd6e..a0c0ef87 100644 --- a/Clients/GithubClient/GithubClient.csproj +++ b/Clients/GithubClient/GithubClient.csproj @@ -6,7 +6,7 @@ - + diff --git a/CompatBot/Commands/BotStats.cs b/CompatBot/Commands/BotStats.cs index 7f2eeac1..44437658 100644 --- a/CompatBot/Commands/BotStats.cs +++ b/CompatBot/Commands/BotStats.cs @@ -74,7 +74,7 @@ internal sealed class BotStats: BaseCommandModuleCustom .Append(File.Exists(Config.GoogleApiConfigPath) ? "✅" : "❌").AppendLine(" Google Drive") .Append(string.IsNullOrEmpty(Config.AzureDevOpsToken) ? "❌" : "✅").AppendLine(" Azure DevOps") .Append(string.IsNullOrEmpty(Config.AzureComputerVisionKey) ? "❌" : "✅").AppendLine(" Computer Vision") - .Append(string.IsNullOrEmpty(Config.AzureAppInsightsKey) ? "❌" : "✅").AppendLine(" AppInsights") + .Append(string.IsNullOrEmpty(Config.AzureAppInsightsConnectionString) ? "❌" : "✅").AppendLine(" AppInsights") .Append(string.IsNullOrEmpty(Config.GithubToken) ? "❌" : "✅").AppendLine(" Github") .ToString() .Trim(); diff --git a/CompatBot/CompatBot.csproj b/CompatBot/CompatBot.csproj index 33f41f36..4842946f 100644 --- a/CompatBot/CompatBot.csproj +++ b/CompatBot/CompatBot.csproj @@ -39,10 +39,10 @@ - - - - + + + + @@ -50,21 +50,21 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + - + - - + + diff --git a/CompatBot/Config.cs b/CompatBot/Config.cs index 7d75718f..c322a724 100644 --- a/CompatBot/Config.cs +++ b/CompatBot/Config.cs @@ -82,7 +82,7 @@ internal static class Config public static string AzureComputerVisionKey => config.GetValue(nameof(AzureComputerVisionKey), ""); public static string AzureComputerVisionEndpoint => config.GetValue(nameof(AzureComputerVisionEndpoint), "https://westeurope.api.cognitive.microsoft.com/"); public static Guid AzureDevOpsProjectId => config.GetValue(nameof(AzureDevOpsProjectId), new Guid("3598951b-4d39-4fad-ad3b-ff2386a649de")); - public static string AzureAppInsightsKey => config.GetValue(nameof(AzureAppInsightsKey), ""); + public static string AzureAppInsightsConnectionString => config.GetValue(nameof(AzureAppInsightsConnectionString), ""); public static string GithubToken => config.GetValue(nameof(GithubToken), ""); public static string PreferredFontFamily => config.GetValue(nameof(PreferredFontFamily), ""); public static string LogPath => config.GetValue(nameof(LogPath), "./logs/"); // paths are relative to the working directory @@ -305,14 +305,14 @@ internal static class Config { get { - if (string.IsNullOrEmpty(AzureAppInsightsKey)) + if (string.IsNullOrEmpty(AzureAppInsightsConnectionString)) return null; - if (telemetryClient?.InstrumentationKey == AzureAppInsightsKey) + if (telemetryClient?.InstrumentationKey == AzureAppInsightsConnectionString) return telemetryClient; var telemetryConfig = TelemetryConfiguration.CreateDefault(); - telemetryConfig.InstrumentationKey = AzureAppInsightsKey; + telemetryConfig.ConnectionString = AzureAppInsightsConnectionString; telemetryConfig.TelemetryInitializers.Add(new HttpDependenciesParsingTelemetryInitializer()); DependencyTrackingTelemetryModule.Initialize(telemetryConfig); PerformanceCollectorModule.Initialize(telemetryConfig); diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj index 64de56ea..e826d0d8 100644 --- a/Tests/Tests.csproj +++ b/Tests/Tests.csproj @@ -5,7 +5,7 @@ - + all