diff --git a/EdiabasLib/EdiabasLibConfigTool/EdiabasLibConfigTool.csproj b/EdiabasLib/EdiabasLibConfigTool/EdiabasLibConfigTool.csproj index 21f95d8dd..680e16fc3 100644 --- a/EdiabasLib/EdiabasLibConfigTool/EdiabasLibConfigTool.csproj +++ b/EdiabasLib/EdiabasLibConfigTool/EdiabasLibConfigTool.csproj @@ -48,12 +48,24 @@ True Resources.resx + + True + True + Strings.resx + ResXFileCodeGenerator Resources.Designer.cs + + ResXFileCodeGenerator + Strings.Designer.cs + + + + diff --git a/EdiabasLib/EdiabasLibConfigTool/FormMain.cs b/EdiabasLib/EdiabasLibConfigTool/FormMain.cs index 97c0c6693..9f51434cc 100644 --- a/EdiabasLib/EdiabasLibConfigTool/FormMain.cs +++ b/EdiabasLib/EdiabasLibConfigTool/FormMain.cs @@ -177,32 +177,6 @@ private bool IsWinVistaOrHigher() return (os.Platform == PlatformID.Win32NT) && (os.Version.Major >= 6); } - private int GetNetFrameworkVersion() - { - try - { - using (RegistryKey localMachine32 = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32)) - { - using (RegistryKey ndpKey = localMachine32.OpenSubKey(@"SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\")) - { - if (ndpKey != null) - { - object releaseValue = ndpKey.GetValue("Release"); - if (releaseValue is int releaseKey) - { - return releaseKey; - } - } - } - } - } - catch (Exception) - { - return -1; - } - return -1; - } - private void GetDirectories() { string dirBmw = Environment.GetEnvironmentVariable("ediabas_config_dir"); diff --git a/EdiabasLib/EdiabasLibConfigTool/Program.cs b/EdiabasLib/EdiabasLibConfigTool/Program.cs index 3c130dd79..219941f1c 100644 --- a/EdiabasLib/EdiabasLibConfigTool/Program.cs +++ b/EdiabasLib/EdiabasLibConfigTool/Program.cs @@ -1,4 +1,5 @@ -using System; +using Microsoft.Win32; +using System; using System.Runtime.Versioning; using System.Text; using System.Windows.Forms; @@ -17,7 +18,100 @@ static void Main() Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); + if (GetNetFrameworkVersion() < 0x480) + { + string message = string.Format(Resources.Strings.NetFrameworkMissing, "4.8"); + MessageBox.Show(message, Resources.Strings.TitleError, MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + Application.Run(new FormMain()); } + + public static int GetNetFrameworkVersion() + { + try + { + using (RegistryKey localMachine32 = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32)) + { + using (RegistryKey ndpKey = localMachine32.OpenSubKey(@"SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\")) + { + if (ndpKey != null) + { + object releaseValue = ndpKey.GetValue("Release"); + if (releaseValue is int releaseKey) + { + return ConvertNetFrameworkVersion(releaseKey); + } + } + } + } + } + catch (Exception) + { + return -1; + } + return -1; + } + + public static int ConvertNetFrameworkVersion(int releaseKey) + { + if (releaseKey >= 533320) + { + return 0x481; + } + + if (releaseKey >= 528040) + { + return 0x480; + } + + if (releaseKey >= 461808) + { + return 0x472; + } + + if (releaseKey >= 461308) + { + return 0x471; + } + + if (releaseKey >= 460798) + { + return 0x470; + } + + if (releaseKey >= 394802) + { + return 0x462; + } + + if (releaseKey >= 394254) + { + return 0x461; + } + + if (releaseKey >= 393295) + { + return 0x460; + } + + if (releaseKey >= 379893) + { + return 0x452; + } + + if (releaseKey >= 378675) + { + return 0x451; + } + + if (releaseKey >= 378389) + { + return 0x450; + } + + return 0x000; + } } } diff --git a/EdiabasLib/EdiabasLibConfigTool/Resources/Strings.Designer.cs b/EdiabasLib/EdiabasLibConfigTool/Resources/Strings.Designer.cs index 0f0329bd0..14824029b 100644 --- a/EdiabasLib/EdiabasLibConfigTool/Resources/Strings.Designer.cs +++ b/EdiabasLib/EdiabasLibConfigTool/Resources/Strings.Designer.cs @@ -286,9 +286,10 @@ internal static string HttpResponseOk { } /// - /// Sucht eine lokalisierte Zeichenfolge, die It's recommended changing the ISTA-D registry key: + /// Sucht eine lokalisierte Zeichenfolge, die It's recommended pointing the ISTA-D registry key: ///'{0}' - ///to point an external EdiabsLib instance. + ///to an external EdiabsLib instance at: + ///'{1}'. ///You you want to to this? ähnelt. /// internal static string IstaRegExtMessage { @@ -333,6 +334,15 @@ internal static string LanguageRu { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die This application requires .NET Framework {0} or higher. ähnelt. + /// + internal static string NetFrameworkMissing { + get { + return ResourceManager.GetString("NetFrameworkMissing", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die EdiabasLib {0} file is missing. ähnelt. /// @@ -613,6 +623,15 @@ internal static string TestOk { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die Error ähnelt. + /// + internal static string TitleError { + get { + return ResourceManager.GetString("TitleError", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die No Wi-Fi adapter found. ähnelt. /// diff --git a/EdiabasLib/EdiabasLibConfigTool/Resources/Strings.de.resx b/EdiabasLib/EdiabasLibConfigTool/Resources/Strings.de.resx index 7023e5aad..70060a7f3 100644 --- a/EdiabasLib/EdiabasLibConfigTool/Resources/Strings.de.resx +++ b/EdiabasLib/EdiabasLibConfigTool/Resources/Strings.de.resx @@ -322,4 +322,10 @@ fehlgeschlagen. Löschen des Registrierungsschlüssels '{0}'. + + Diese Applikation benötigt .NET Framework {0} oder höher. + + + Fehler + \ No newline at end of file diff --git a/EdiabasLib/EdiabasLibConfigTool/Resources/Strings.resx b/EdiabasLib/EdiabasLibConfigTool/Resources/Strings.resx index 0727944bc..e95ca2c89 100644 --- a/EdiabasLib/EdiabasLibConfigTool/Resources/Strings.resx +++ b/EdiabasLib/EdiabasLibConfigTool/Resources/Strings.resx @@ -321,4 +321,10 @@ failed. Removing registry key: '{0}'. + + This application requires .NET Framework {0} or higher. + + + Error + \ No newline at end of file diff --git a/EdiabasLib/EdiabasLibConfigTool/Resources/Strings.ru.resx b/EdiabasLib/EdiabasLibConfigTool/Resources/Strings.ru.resx index f5b159760..70f39b9b4 100644 --- a/EdiabasLib/EdiabasLibConfigTool/Resources/Strings.ru.resx +++ b/EdiabasLib/EdiabasLibConfigTool/Resources/Strings.ru.resx @@ -318,4 +318,10 @@ Ediabas настройки по умолчанию (ediabas.ini). Удаление ключa регистрации '{0}'. + + Для этого приложения требуется .NET Framework {0} или выше. + + + Ошибка + \ No newline at end of file