From 1a5871379bd1065a883a2724ff40bb60ad6372a4 Mon Sep 17 00:00:00 2001 From: tombogle Date: Mon, 2 Feb 2026 15:22:06 -0500 Subject: [PATCH 1/2] Added v. 9.0.0 to CHANGELOG Replaced use of deprecated CodeBase with Location (in tests) --- CHANGELOG.md | 2 ++ Directory.Build.props | 2 +- src/L10NSharp.Windows.Forms.Tests/ILocalizableComponentTests.cs | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 50673cd..cb72680 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +## [9.0.0] - 2026-02-02 + ### Changed - BREAKING CHANGE: Move code that depends on Windows.Forms or System.Drawing into an L10NSharp.Windows.Forms namespace. Rename L10NSharp.UI as L10NSharp.Windows.Forms.UIComponents. Move L10NExtender out of UI subfolder into L10NSharp.Windows.Forms. Move Winforms related tests to L10NSharp.Windows.Forms.Tests. Change the folder for L10NSharp tests to match its namespace L10NSharp.Tests. diff --git a/Directory.Build.props b/Directory.Build.props index 765299d..7903aad 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -4,7 +4,7 @@ SIL SIL Global L10NSharp - Copyright © 2010-2025 SIL Global + Copyright © 2010-2026 SIL Global prompt 4 MIT diff --git a/src/L10NSharp.Windows.Forms.Tests/ILocalizableComponentTests.cs b/src/L10NSharp.Windows.Forms.Tests/ILocalizableComponentTests.cs index fbc02dc..c2096be 100644 --- a/src/L10NSharp.Windows.Forms.Tests/ILocalizableComponentTests.cs +++ b/src/L10NSharp.Windows.Forms.Tests/ILocalizableComponentTests.cs @@ -26,7 +26,7 @@ public class ILocalizableComponentXLiffTests /// ------------------------------------------------------------------------------------ protected void TestSetup(string installedTranslationDir) { - var dir = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath); + var dir = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().Location).LocalPath); m_manager = LocalizationManagerWinforms.Create("en", "LocalizableComponentTest", "LocalizableComponentTest", "1.0", Path.Combine(dir, installedTranslationDir), "", null, "", new string[] { }) From 3b428069e6ec4074b9f3ddbe534116f136f8f0c2 Mon Sep 17 00:00:00 2001 From: tombogle Date: Mon, 2 Feb 2026 16:00:36 -0500 Subject: [PATCH 2/2] Replaced remaining uses of deprecated CodeBase with Location (in tests) Also minor code cleanup in TempFile.cs --- .../LocalizationManagerXliffTests.cs | 2 +- src/L10NSharp.Tests/TempFile.cs | 21 ++++++++----------- .../XLiffSchemaValidationTests.cs | 2 +- src/L10NSharp.Tests/XLiffUtilsTests.cs | 6 ++---- 4 files changed, 13 insertions(+), 18 deletions(-) diff --git a/src/L10NSharp.Tests/LocalizationManagerXliffTests.cs b/src/L10NSharp.Tests/LocalizationManagerXliffTests.cs index 47ff2f7..f897f5d 100644 --- a/src/L10NSharp.Tests/LocalizationManagerXliffTests.cs +++ b/src/L10NSharp.Tests/LocalizationManagerXliffTests.cs @@ -38,7 +38,7 @@ public void Create_PreferredUiLanguageIsGenericVariant_CreatesLocalizationManage string genericLocaleId, string countrySpecificLocalId) { LocalizationManager.ClearLoadedManagers(); - var dir = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath); + var dir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); var lm = LocalizationManager.Create(genericLocaleId, "Test", "Test", "1.0", Path.Combine(dir, "../../../src/L10NSharp.Tests/TestXliff2"), "", "", new string[] {}); diff --git a/src/L10NSharp.Tests/TempFile.cs b/src/L10NSharp.Tests/TempFile.cs index d1be0ae..ee59c5c 100644 --- a/src/L10NSharp.Tests/TempFile.cs +++ b/src/L10NSharp.Tests/TempFile.cs @@ -54,10 +54,7 @@ public TempFile(string[] contentLines) File.WriteAllLines(_path, contentLines); } - public string Path - { - get { return _path; } - } + public string Path => _path; // See comment on class above regarding Dispose public void Dispose() @@ -97,7 +94,7 @@ public static TempFile CreateAndGetPathButDontMakeTheFile() /// /// Use this one when it's important to have a certain file extension /// - /// with or with out '.', will work the same + /// with or without '.', will work the same public static TempFile WithExtension(string extension) { extension = extension.TrimStart('.'); @@ -109,16 +106,16 @@ public static TempFile WithExtension(string extension) /// /// Use this one when it's important to have a certain file name (with, or without extension). /// - /// with or with out an extension, will work the same + /// with or without an extension, will work the same public static TempFile WithFilename(string filename) { if(filename == null) - throw new ArgumentNullException("filename"); + throw new ArgumentNullException(nameof(filename)); if(filename == string.Empty) - throw new ArgumentException("Filename has no content", "filename"); + throw new ArgumentException("Filename has no content", nameof(filename)); filename = filename.Trim(); if(filename == string.Empty) - throw new ArgumentException("Filename has only whitespace", "filename"); + throw new ArgumentException("Filename has only whitespace", nameof(filename)); var pathname = System.IO.Path.Combine(System.IO.Path.GetTempPath(), filename); File.Create(pathname).Close(); @@ -136,7 +133,7 @@ public static TempFile WithFilenameInTempFolder(string fileName) var tempFolder = System.IO.Path.Combine(System.IO.Path.GetTempPath(), System.IO.Path.GetRandomFileName()); Directory.CreateDirectory(tempFolder); var path = System.IO.Path.Combine(tempFolder, fileName); - var result = TempFile.TrackExisting(path); + var result = TrackExisting(path); result._folderToDelete = tempFolder; return result; } @@ -145,7 +142,7 @@ public static TempFile WithFilenameInTempFolder(string fileName) /// Used to make a real file out of a resource for the purpose of testing /// /// e.g., an audio resource - /// with or with out '.', will work the same + /// with or without '.', will work the same public static TempFile FromResource(Stream resource, string extension) { var f = WithExtension(extension); @@ -159,7 +156,7 @@ public static TempFile FromResource(Stream resource, string extension) /// Used to make a real file out of a resource for the purpose of testing /// /// e.g., a video resource - /// with or with out '.', will work the same + /// with or without '.', will work the same public static TempFile FromResource(byte[] resource, string extension) { var f = WithExtension(extension); diff --git a/src/L10NSharp.Tests/XLiffSchemaValidationTests.cs b/src/L10NSharp.Tests/XLiffSchemaValidationTests.cs index 706dd12..2b3f173 100644 --- a/src/L10NSharp.Tests/XLiffSchemaValidationTests.cs +++ b/src/L10NSharp.Tests/XLiffSchemaValidationTests.cs @@ -18,7 +18,7 @@ private static string SchemaLocation { get { - var dir = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath); + var dir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); var installedXliffDir = "../../../src/L10NSharp.Tests/TestXliff"; var schemaLocation = Path.Combine(dir, installedXliffDir, diff --git a/src/L10NSharp.Tests/XLiffUtilsTests.cs b/src/L10NSharp.Tests/XLiffUtilsTests.cs index 6bd68ba..398fd05 100644 --- a/src/L10NSharp.Tests/XLiffUtilsTests.cs +++ b/src/L10NSharp.Tests/XLiffUtilsTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Reflection; using NUnit.Framework; @@ -13,9 +13,7 @@ public class XLiffUtilsTests public XLiffUtilsTests() { - var asmFile = Assembly.GetExecutingAssembly().CodeBase.Replace("file://", String.Empty); - if (Environment.OSVersion.Platform == PlatformID.Win32NT) - asmFile = asmFile.TrimStart('/'); + var asmFile = Assembly.GetExecutingAssembly().Location; var folder = Path.GetDirectoryName(asmFile); // will be something like /output/Debug folder = Path.GetDirectoryName(folder); folder = Path.GetDirectoryName(folder);