From 66e04e3a71dc8e49b775bd983f47ef6300d9cb19 Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Fri, 3 Jul 2026 00:04:01 +0700 Subject: [PATCH 1/2] Replace System.Web with System.Net.WebUtility in data migration (#384) Co-authored-by: Cursor --- .../DataMigration/DataMigration7000037.cs | 6 +- src/SIL.LCModel/SIL.LCModel.csproj | 4 - .../DataMigration7000037Tests.cs | 4 +- .../DataMigration7000040Tests.cs | 79 ------------------- .../SIL.LCModel.Tests.csproj | 4 - 5 files changed, 5 insertions(+), 92 deletions(-) diff --git a/src/SIL.LCModel/DomainServices/DataMigration/DataMigration7000037.cs b/src/SIL.LCModel/DomainServices/DataMigration/DataMigration7000037.cs index afadbc820..5a621fe1d 100644 --- a/src/SIL.LCModel/DomainServices/DataMigration/DataMigration7000037.cs +++ b/src/SIL.LCModel/DomainServices/DataMigration/DataMigration7000037.cs @@ -7,8 +7,8 @@ using System; using System.IO; +using System.Net; using System.Text; -using System.Web; using System.Xml.Linq; using System.Xml.XPath; using SIL.LCModel.Utils; @@ -66,7 +66,7 @@ private bool FixExternalLinks(XElement xel, string projectName) value = kFwUrlPrefix.Substring(0, 1) + value; if (!value.StartsWith(kFwUrlPrefix)) continue; - string query = HttpUtility.UrlDecode(value.Substring(kFwUrlPrefix.Length)); + string query = WebUtility.UrlDecode(value.Substring(kFwUrlPrefix.Length)); string[] rgsProps = query.Split(new char[] {'&'}, StringSplitOptions.RemoveEmptyEntries); string database = null; int idxDatabase = -1; @@ -130,7 +130,7 @@ private bool FixExternalLinks(XElement xel, string projectName) if (!fChange) continue; - value = kFwUrlPrefix + HttpUtility.UrlEncode(string.Join("&", rgsProps)); + value = kFwUrlPrefix + WebUtility.UrlEncode(string.Join("&", rgsProps)); if (attrLink.Value != value) { attrLink.Value = value; diff --git a/src/SIL.LCModel/SIL.LCModel.csproj b/src/SIL.LCModel/SIL.LCModel.csproj index 23d125937..e3ca684e5 100644 --- a/src/SIL.LCModel/SIL.LCModel.csproj +++ b/src/SIL.LCModel/SIL.LCModel.csproj @@ -108,10 +108,6 @@ - - - - diff --git a/tests/SIL.LCModel.Tests/DomainServices/DataMigration/DataMigration7000037Tests.cs b/tests/SIL.LCModel.Tests/DomainServices/DataMigration/DataMigration7000037Tests.cs index 8239e010d..5f6846519 100644 --- a/tests/SIL.LCModel.Tests/DomainServices/DataMigration/DataMigration7000037Tests.cs +++ b/tests/SIL.LCModel.Tests/DomainServices/DataMigration/DataMigration7000037Tests.cs @@ -4,7 +4,7 @@ using System; using System.Collections.Generic; -using System.Web; +using System.Net; using System.Xml.Linq; using System.Xml.XPath; using NUnit.Framework; @@ -122,7 +122,7 @@ private void CheckForValidLinkValue(string externalLink) } Assert.IsTrue(externalLink.StartsWith(FwUrlPrefix), "silfw link should start with " + FwUrlPrefix); - string query = HttpUtility.UrlDecode(externalLink.Substring(FwUrlPrefix.Length)); + string query = WebUtility.UrlDecode(externalLink.Substring(FwUrlPrefix.Length)); string[] rgsProps = query.Split(new char[] { '&' }, StringSplitOptions.RemoveEmptyEntries); string tool = null; Guid guid = Guid.Empty; diff --git a/tests/SIL.LCModel.Tests/DomainServices/DataMigration/DataMigration7000040Tests.cs b/tests/SIL.LCModel.Tests/DomainServices/DataMigration/DataMigration7000040Tests.cs index 8f5cf5310..c9f300501 100644 --- a/tests/SIL.LCModel.Tests/DomainServices/DataMigration/DataMigration7000040Tests.cs +++ b/tests/SIL.LCModel.Tests/DomainServices/DataMigration/DataMigration7000040Tests.cs @@ -5,9 +5,7 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Web; using System.Xml.Linq; -using System.Xml.XPath; using NUnit.Framework; using SIL.LCModel.Utils; @@ -23,8 +21,6 @@ namespace SIL.LCModel.DomainServices.DataMigration [TestFixture] public class DataMigration7000040Tests : DataMigrationTestsBase { - private const string FwUrlPrefix = "silfw://localhost/link?"; - ///-------------------------------------------------------------------------------------- /// /// Test the migration from version 7000039 to 7000040. @@ -100,80 +96,5 @@ private void VerifyObjSur(IEnumerable osElements, int index, string gu Assert.That(objsur.Attribute("guid").Value, Is.EqualTo(guid)); Assert.That(objsur.Attribute("t").Value, Is.EqualTo("r")); } - - int m_cLinks; - List m_rgsOtherLinks = new List(); - - private void CollectionNonSilfwLinks(IDomainObjectDTORepository dtoRepos) - { - foreach (var dto in dtoRepos.AllInstancesWithValidClasses()) - { - string xml = dto.Xml; - Assert.IsTrue(xml.Contains("externalLink"), "Every object in the test has an externalLink"); - var dtoXML = XElement.Parse(xml); - foreach (var run in dtoXML.XPathSelectElements("//Run")) - { - var externalLinkAttr = run.Attribute("externalLink"); - if (externalLinkAttr != null) - { - string value = externalLinkAttr.Value; - if (value.StartsWith("http://") || value.StartsWith("libronixdls:")) - m_rgsOtherLinks.Add(value); - ++m_cLinks; - } - } - } - - } - - private void CheckForValidLinkValue(string externalLink) - { - int idxColon = externalLink.IndexOf(':'); - Assert.Greater(idxColon, 0, "links must have a colon to separate off the type of link"); - string linkType = externalLink.Substring(0, idxColon); - switch (linkType) - { - case "http": - case "libronixdls": - Assert.IsTrue(m_rgsOtherLinks.Contains(externalLink), - "Migration should not affect http or libronix links"); - return; - default: - Assert.AreEqual("silfw", linkType); - break; - } - Assert.IsTrue(externalLink.StartsWith(FwUrlPrefix), - "silfw link should start with " + FwUrlPrefix); - string query = HttpUtility.UrlDecode(externalLink.Substring(FwUrlPrefix.Length)); - string[] rgsProps = query.Split(new char[] { '&' }, StringSplitOptions.RemoveEmptyEntries); - string tool = null; - Guid guid = Guid.Empty; - for (int i = 0; i < rgsProps.Length; ++i) - { - string[] propPair = rgsProps[i].Split('='); - switch (propPair[0]) - { - case "app": - Assert.AreEqual("flex", propPair[1], "silfw link - app should equal \"flex\""); - break; - case "server": - Assert.That(propPair[1], Is.Null.Or.Empty, "silfw link - server should be empty"); - break; - case "database": - Assert.AreEqual("this$", propPair[1], "silfw link - database should equal \"this$\""); - break; - case "tool": - tool = propPair[1]; - break; - case "guid": - guid = new Guid(propPair[1]); - break; - default: - break; - } - } - Assert.That(tool, Is.Not.Null.And.Not.Empty, "silfw link - tool should have a value"); - Assert.AreNotEqual(Guid.Empty, guid, "silfw link - guid should have a value"); - } } } diff --git a/tests/SIL.LCModel.Tests/SIL.LCModel.Tests.csproj b/tests/SIL.LCModel.Tests/SIL.LCModel.Tests.csproj index 8c2fdc073..a6afe657f 100644 --- a/tests/SIL.LCModel.Tests/SIL.LCModel.Tests.csproj +++ b/tests/SIL.LCModel.Tests/SIL.LCModel.Tests.csproj @@ -24,10 +24,6 @@ This package provides unit tests for SIL.LCModel. - - - - From a581a64b40ebab104cacfeb84f9c73264758ecd8 Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Fri, 3 Jul 2026 00:20:58 +0700 Subject: [PATCH 2/2] Add net8.0 target to SIL.LCModel, Utils, and FixData (#385) Co-authored-by: Cursor --- src/SIL.LCModel.FixData/SIL.LCModel.FixData.csproj | 2 +- src/SIL.LCModel.Utils/SIL.LCModel.Utils.csproj | 4 ++-- src/SIL.LCModel/SIL.LCModel.csproj | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/SIL.LCModel.FixData/SIL.LCModel.FixData.csproj b/src/SIL.LCModel.FixData/SIL.LCModel.FixData.csproj index 93107b30a..da8ee8e01 100644 --- a/src/SIL.LCModel.FixData/SIL.LCModel.FixData.csproj +++ b/src/SIL.LCModel.FixData/SIL.LCModel.FixData.csproj @@ -1,7 +1,7 @@  - net462;netstandard2.0 + netstandard2.0;net462;net8.0 SIL.LCModel.FixData The liblcm library is the core FieldWorks model for linguistic analyses of languages. Tools in this library provide the ability to store and interact with language and culture data, including anthropological, text corpus, and linguistics data. SIL.LCModel.FixData provides functionality to fix errors in a FieldWorks data XML file. diff --git a/src/SIL.LCModel.Utils/SIL.LCModel.Utils.csproj b/src/SIL.LCModel.Utils/SIL.LCModel.Utils.csproj index 68e3c49ad..a5f8b5130 100644 --- a/src/SIL.LCModel.Utils/SIL.LCModel.Utils.csproj +++ b/src/SIL.LCModel.Utils/SIL.LCModel.Utils.csproj @@ -1,7 +1,7 @@  - net462;netstandard2.0 + netstandard2.0;net462;net8.0 SIL.LCModel.Utils The liblcm library is the core FieldWorks model for linguistic analyses of languages. Tools in this library provide the ability to store and interact with language and culture data, including anthropological, text corpus, and linguistics data. SIL.LCModel.Utils provides utility classes. @@ -17,7 +17,7 @@ SIL.LCModel.Utils provides utility classes. - + diff --git a/src/SIL.LCModel/SIL.LCModel.csproj b/src/SIL.LCModel/SIL.LCModel.csproj index e3ca684e5..fcb5e0995 100644 --- a/src/SIL.LCModel/SIL.LCModel.csproj +++ b/src/SIL.LCModel/SIL.LCModel.csproj @@ -1,7 +1,7 @@ - net462;netstandard2.0 + netstandard2.0;net462;net8.0 SIL.LCModel The liblcm library is the core FieldWorks model for linguistic analyses of languages. Tools in this library provide the ability to store and interact with language and culture data, including anthropological, text corpus, and linguistics data. SIL.LCModel is the main library.