From 2e2fa383c56f1bfdd16041fa9966e5fc0ea1275e Mon Sep 17 00:00:00 2001 From: Ivandro Jao Date: Fri, 27 Sep 2024 22:44:56 +0100 Subject: [PATCH 1/8] Switch to SDK-style project and add MSTest references Converted Test.csproj to SDK-style format for modern .NET framework targeting and project simplification. Added MSTest.TestAdapter and MSTest.TestFramework package references and their versions to Directory.Packages.props. Signed-off-by: Ivandro Jao --- Directory.Packages.props | 2 + src/Test/Test.csproj | 134 ++++----------------------------------- 2 files changed, 16 insertions(+), 120 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index f60829c74..4695ee432 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -3,6 +3,8 @@ true + + diff --git a/src/Test/Test.csproj b/src/Test/Test.csproj index 84f43b6e3..7ead01f83 100644 --- a/src/Test/Test.csproj +++ b/src/Test/Test.csproj @@ -1,123 +1,18 @@ - - - + - Properties - Test - Debug - 512 + net48 Library - AnyCPU - {7BE5B8E8-9469-4C7C-89D7-E8C884DEFC0E} - {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Test - v4.8 win - - + false + true + true AllRules.ruleset - true - full - DEBUG;TRACE - prompt - false - bin\Debug\ - AnyCPU - 4 - false - - - AllRules.ruleset - pdbonly - TRACE - prompt - true - bin\Release\ - AnyCPU - 4 - false False - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -182,25 +77,24 @@ - - {d6f64cd3-c3ea-4b36-b575-9b3b8a3ca13f} - LibSE - - - {511a5b59-1c35-4719-8536-23b19af9b21a} - SubtitleEdit - + + + + + - - + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + From 40f69b2f06f83b69f45a38bd6e270d931e53b43b Mon Sep 17 00:00:00 2001 From: Ivandro Jao Date: Fri, 27 Sep 2024 22:58:14 +0100 Subject: [PATCH 3/8] Remove obsolete import statements from Test.csproj Deleted commented-out import statements that are no longer needed. This cleanup helps maintain code clarity and reduces confusion about dependencies. Signed-off-by: Ivandro Jao --- src/Test/Test.csproj | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/Test/Test.csproj b/src/Test/Test.csproj index de29e78d5..54a17f167 100644 --- a/src/Test/Test.csproj +++ b/src/Test/Test.csproj @@ -99,9 +99,6 @@ - - - + From 18efd14123b1174a872fcdfc22e3a3d463101ffb Mon Sep 17 00:00:00 2001 From: Ivandro Jao Date: Mon, 30 Sep 2024 20:33:46 +0100 Subject: [PATCH 5/8] Remove redundant MSTest package references Consolidate MSTest package versions for simplicity and to avoid conflicts. Removed individual MSTest related references from the project file and centralized the version management in Directory.Packages.props. Signed-off-by: Ivandro Jao --- Directory.Packages.props | 4 ---- src/Test/Test.csproj | 11 ----------- 2 files changed, 15 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 1b760892d..4e4e20841 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -3,12 +3,8 @@ true - - - - diff --git a/src/Test/Test.csproj b/src/Test/Test.csproj index 59f3affe4..614f0a7e8 100644 --- a/src/Test/Test.csproj +++ b/src/Test/Test.csproj @@ -9,9 +9,6 @@ AllRules.ruleset - - False - @@ -81,15 +78,7 @@ - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - From b85d33123941e2adfe22bb00ad41dd5ee61427a5 Mon Sep 17 00:00:00 2001 From: Ivandro Jao Date: Mon, 30 Sep 2024 20:35:08 +0100 Subject: [PATCH 6/8] Remove MSTest.Sdk package version The MSTest.Sdk package version entry was redundant since it is not being used in the project. This cleanup helps to simplify the package management and reduce potential confusion. Signed-off-by: Ivandro Jao --- Directory.Packages.props | 1 - 1 file changed, 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 4e4e20841..d231a2cf1 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -4,7 +4,6 @@ - From a6bc467dab300f3abb9423b2ac162dea24f10826 Mon Sep 17 00:00:00 2001 From: Ivandro Jao Date: Mon, 30 Sep 2024 20:42:42 +0100 Subject: [PATCH 7/8] Refactor: Consolidate multiple ItemGroup sections in .csproj This change merges several separate ItemGroup sections in the Test.csproj file into fewer ones. It improves the structure and readability of the project file without altering its functionality. This will make future updates to the project file simpler and more efficient. Signed-off-by: Ivandro Jao --- src/Test/Test.csproj | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/Test/Test.csproj b/src/Test/Test.csproj index 614f0a7e8..10ac662f0 100644 --- a/src/Test/Test.csproj +++ b/src/Test/Test.csproj @@ -14,16 +14,12 @@ - - PreserveNewest - - PreserveNewest @@ -39,36 +35,24 @@ PreserveNewest - - PreserveNewest - - PreserveNewest - - PreserveNewest - - PreserveNewest - - PreserveNewest PreserveNewest - - PreserveNewest From 1a38183344f1da17e036fe3db57512cbaa270fd0 Mon Sep 17 00:00:00 2001 From: Ivandro Jao Date: Mon, 30 Sep 2024 20:50:02 +0100 Subject: [PATCH 8/8] Create missing directories for dictionary files Updated InterjectionsRepository to check if the dictionary directory exists before attempting to save files. If the directory does not exist, it will now be created automatically. This change prevents potential errors during file saving operations. Signed-off-by: Ivandro Jao --- src/libse/Common/InterjectionsRepository.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/libse/Common/InterjectionsRepository.cs b/src/libse/Common/InterjectionsRepository.cs index 898292c99..1a72c4b81 100644 --- a/src/libse/Common/InterjectionsRepository.cs +++ b/src/libse/Common/InterjectionsRepository.cs @@ -87,6 +87,11 @@ namespace Nikse.SubtitleEdit.Core.Common } } + if (!Directory.Exists(Configuration.DictionariesDirectory)) + { + Directory.CreateDirectory(Configuration.DictionariesDirectory); + } + var fullFileName = Path.Combine(Configuration.DictionariesDirectory, userFileName); xmlDocument.Save(fullFileName); }