diff --git a/Documentation/Topics/Automatic-Translations.md b/Documentation/Topics/Automatic-Translations.md
index c6129a1f..9edcfdd1 100644
--- a/Documentation/Topics/Automatic-Translations.md
+++ b/Documentation/Topics/Automatic-Translations.md
@@ -31,11 +31,35 @@ The API URL for Deepl is https://api.deepl.com/v2/translate, but for the free ve
#### Configuration
- Add a new Azure OpenAI resource using the portal or CLI.
-- Model availability may vary depending on e.g. region, check the model availabilty [here](https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/models#gpt-4-and-gpt-4-turbo-preview-model-availability)
-- Deploy the "gpt-3.5-turbo-instruct" (completion based) or "gpt-3.5-turbo"/"gpt-4-turbo" (chat based) model.
-- Copy the API key, URL to the endpoint and name of the deployment and model into the settings of the translator
-
-#### Addtional Settings
+- Model availability may vary depending on e.g. region, check the model availability [here](https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/models#gpt-4-and-gpt-4-turbo-preview-model-availability)
+- Deploy one of the supported models (see below).
+- Copy the API key, URL to the endpoint, deployment name, and model name into the settings of the translator.
+
+**Important: Understanding Model Name vs. Model Deployment Name**
+- **Model Name**: This is the base model identifier used by OpenAI (e.g., "gpt-3.5-turbo", "gpt-4", "gpt-4o"). This is used internally for tokenization and determining which API endpoint to use.
+- **Model Deployment Name**: This is the custom name YOU chose when deploying the model in Azure (e.g., "my-gpt4-deployment"). This is what Azure uses to route your API requests.
+
+> A list of supported model names can be found [here](https://github.com/dotnet/machinelearning/blob/4c8b3579d1053257b213ca54be2681359b66cf65/src/Microsoft.ML.Tokenizers/Model/TiktokenTokenizer.cs#L1069-L1146)
+
+**Supported Models**:
+- **GPT-3.5 Models**:
+ - `gpt-3.5-turbo-instruct` (completion-based, legacy)
+ - `gpt-3.5-turbo` (chat-based, recommended for GPT-3.5)
+ - Note: You can also use `gpt-35-turbo` or `gpt-35-turbo-instruct` (Azure naming), which will be automatically mapped.
+
+- **GPT-4 Models**:
+ - `gpt-4` (chat-based)
+ - `gpt-4-turbo` (chat-based, faster and more cost-effective)
+ - `gpt-4o` (chat-based, latest multimodal model)
+ - `gpt-4o-mini` (chat-based, smaller and faster variant)
+
+**Example Configuration**:
+- If you deployed GPT-4 Turbo in Azure with deployment name "my-translation-model":
+ - **Model Name**: `gpt-4-turbo`
+ - **Model Deployment Name**: `my-translation-model`
+ - **Endpoint URL**: `https://your-resource-name.openai.azure.com`
+
+#### Additional Settings
- You can add a custom prompt to your request to improve the translation quality or behavior, e.g. "preserve the html tags in the results"
- You can include the comments in your resources in the prompt, to guide the model with additional hints about the context
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
index 3931b936..9ec59a73 100644
--- a/src/Directory.Build.props
+++ b/src/Directory.Build.props
@@ -1,7 +1,7 @@
- 1.105.0.0
+ 1.106.0.0
tom-englert.de
ResXManager
Copyright (c) .NET Foundation and Contributors.
@@ -27,7 +27,7 @@
-
+
diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props
index 7c6172c0..ea7613f1 100644
--- a/src/Directory.Packages.props
+++ b/src/Directory.Packages.props
@@ -1,52 +1,47 @@
true
- false
+ true
-
-
+
+
-
-
-
+
+
+
+
+
-
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
+
-
-
+
\ No newline at end of file
diff --git a/src/ResXManager.Infrastructure/ResXManager.Infrastructure.csproj b/src/ResXManager.Infrastructure/ResXManager.Infrastructure.csproj
index 084063f4..977c7faa 100644
--- a/src/ResXManager.Infrastructure/ResXManager.Infrastructure.csproj
+++ b/src/ResXManager.Infrastructure/ResXManager.Infrastructure.csproj
@@ -14,7 +14,7 @@
-
+
diff --git a/src/ResXManager.Model/ExcelExtensions.cs b/src/ResXManager.Model/ExcelExtensions.cs
index 891aa85e..b15317c4 100644
--- a/src/ResXManager.Model/ExcelExtensions.cs
+++ b/src/ResXManager.Model/ExcelExtensions.cs
@@ -27,7 +27,7 @@ public enum ExcelExportMode
public static partial class ResourceEntityExtensions
{
- private static readonly string[] _singleSheetFixedColumnHeaders = { "Project", "File", "Key" };
+ private static readonly string[] _singleSheetFixedColumnHeaders = ["Project", "File", "Key"];
public static void ExportExcelFile(this ResourceManager resourceManager, string filePath, IResourceScope? scope, ExcelExportMode exportMode)
{
@@ -256,12 +256,12 @@ private static IEnumerable GetRows(this Sheet sheet, WorkbookPart workbookP
{
var sheetId = sheet.Id;
- if ((sheetId is not { Value: {} value}) || string.IsNullOrEmpty(value))
- return Enumerable.Empty();
+ if ((sheetId is not { Value: { } value }) || string.IsNullOrEmpty(value))
+ return [];
var worksheetPart = (WorksheetPart)workbookPart.GetPartById(value);
- return worksheetPart.Worksheet.ChildElements.OfType().FirstOrDefault()?.OfType() ?? Enumerable.Empty();
+ return worksheetPart.Worksheet?.ChildElements.OfType().FirstOrDefault()?.OfType() ?? [];
}
private static ResourceEntity FindResourceEntity(this IEnumerable entities, Sheet sheet)
@@ -286,7 +286,7 @@ public DataAppender(int numberOfFixedColumns)
public SheetData AppendRow(SheetData sheetData, IEnumerable rowData)
{
- var row = (sheetData.ChildElements?.OfType()?.Count() ?? 0) + 1;
+ var row = (sheetData.ChildElements.OfType()?.Count() ?? 0) + 1;
var column = 1;
return sheetData.AppendItem(rowData.Aggregate(new Row(), (seed, item) => seed.AppendItem(CreateCell(item, row, column++))));
}
@@ -707,4 +707,4 @@ public static void AddStylesToWorkbookPart(WorkbookPart part)
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/ResXManager.Model/ResXManager.Model.csproj b/src/ResXManager.Model/ResXManager.Model.csproj
index 1b5b842c..0e67e0ca 100644
--- a/src/ResXManager.Model/ResXManager.Model.csproj
+++ b/src/ResXManager.Model/ResXManager.Model.csproj
@@ -22,7 +22,7 @@
-
+
diff --git a/src/ResXManager.Tests/WebExporterOutput/src/resources.it.json b/src/ResXManager.Tests/WebExporterOutput/src/resources.it.json
index 9bbbd58a..c75428de 100644
--- a/src/ResXManager.Tests/WebExporterOutput/src/resources.it.json
+++ b/src/ResXManager.Tests/WebExporterOutput/src/resources.it.json
@@ -1,8 +1,4 @@
{
"_comment": "Auto-generated; do not modify!",
- "WebExportTest": {
- "SimpleString": "",
- "WithInterpolation_TEMPLATE": "",
- "WithBadInterpolation_TEMPLATE": ""
- }
+ "WebExportTest": {}
}
\ No newline at end of file
diff --git a/src/ResXManager.Tests/WebExporterOutput/src/resources.zh-Hans.json b/src/ResXManager.Tests/WebExporterOutput/src/resources.zh-Hans.json
index 9bbbd58a..c75428de 100644
--- a/src/ResXManager.Tests/WebExporterOutput/src/resources.zh-Hans.json
+++ b/src/ResXManager.Tests/WebExporterOutput/src/resources.zh-Hans.json
@@ -1,8 +1,4 @@
{
"_comment": "Auto-generated; do not modify!",
- "WebExportTest": {
- "SimpleString": "",
- "WithInterpolation_TEMPLATE": "",
- "WithBadInterpolation_TEMPLATE": ""
- }
+ "WebExportTest": {}
}
\ No newline at end of file
diff --git a/src/ResXManager.Translators/ResXManager.Translators.csproj b/src/ResXManager.Translators/ResXManager.Translators.csproj
index 882bb7e5..f1a77502 100644
--- a/src/ResXManager.Translators/ResXManager.Translators.csproj
+++ b/src/ResXManager.Translators/ResXManager.Translators.csproj
@@ -53,13 +53,13 @@
+
+
-
+
-
-
diff --git a/src/ResXManager.VSIX.Compatibility.Shared/ResXManager.VSIX.Compatibility.Shared.projitems b/src/ResXManager.VSIX.Compatibility.Shared/ResXManager.VSIX.Compatibility.Shared.projitems
deleted file mode 100644
index 523f97bc..00000000
--- a/src/ResXManager.VSIX.Compatibility.Shared/ResXManager.VSIX.Compatibility.Shared.projitems
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
- $(MSBuildAllProjects);$(MSBuildThisFileFullPath)
- true
- cc3f887f-9602-43f4-aa73-7557b7c6ab1d
-
-
- ResXManager.VSIX.Compatibility.Shared
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/ResXManager.VSIX.Compatibility.Shared/ResXManager.VSIX.Compatibility.Shared.shproj b/src/ResXManager.VSIX.Compatibility.Shared/ResXManager.VSIX.Compatibility.Shared.shproj
deleted file mode 100644
index a186be3f..00000000
--- a/src/ResXManager.VSIX.Compatibility.Shared/ResXManager.VSIX.Compatibility.Shared.shproj
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
- cc3f887f-9602-43f4-aa73-7557b7c6ab1d
- 14.0
-
-
-
-
-
-
-
-
diff --git a/src/ResXManager.VSIX.Compatibility.Shared/CustomToolRunner.cs b/src/ResXManager.VSIX.Compatibility.x64/CustomToolRunner.cs
similarity index 95%
rename from src/ResXManager.VSIX.Compatibility.Shared/CustomToolRunner.cs
rename to src/ResXManager.VSIX.Compatibility.x64/CustomToolRunner.cs
index 1b3b49f8..a04dd603 100644
--- a/src/ResXManager.VSIX.Compatibility.Shared/CustomToolRunner.cs
+++ b/src/ResXManager.VSIX.Compatibility.x64/CustomToolRunner.cs
@@ -1,4 +1,4 @@
-namespace ResXManager.VSIX;
+namespace ResXManager.VSIX.Compatibility.x64;
using System;
using System.Collections.Generic;
@@ -44,4 +44,4 @@ public void Dispose()
{
RunCustomTool();
}
-}
\ No newline at end of file
+}
diff --git a/src/ResXManager.VSIX.Compatibility.Shared/DteConfiguration.cs b/src/ResXManager.VSIX.Compatibility.x64/DteConfiguration.cs
similarity index 96%
rename from src/ResXManager.VSIX.Compatibility.Shared/DteConfiguration.cs
rename to src/ResXManager.VSIX.Compatibility.x64/DteConfiguration.cs
index 43f6a358..1938f33a 100644
--- a/src/ResXManager.VSIX.Compatibility.Shared/DteConfiguration.cs
+++ b/src/ResXManager.VSIX.Compatibility.x64/DteConfiguration.cs
@@ -1,4 +1,4 @@
-namespace ResXManager.VSIX;
+namespace ResXManager.VSIX.Compatibility.x64;
using System;
using System.ComponentModel;
@@ -14,7 +14,7 @@
using static Microsoft.VisualStudio.Shell.ThreadHelper;
-using Configuration = ResXManager.Model.Configuration;
+using Configuration = Model.Configuration;
[Shared]
[Export(typeof(IConfiguration))]
@@ -48,16 +48,16 @@ public DteConfiguration(DteSolution solution, ITracer tracer)
var solutionKey = GetSolutionKey(key);
- if (!TryGetValueFromSolutionGlobals(solutionKey, out var value))
+ if (!TryGetValueFromSolutionGlobals(solutionKey, out var value))
return base.InternalGetValue(defaultValue, key);
Tracer.WriteLine("Convert old solution settings to new file based settings for key {0}, value {1}", solutionKey, value);
// Convert old solution settings to new ones.
TryClearValueFromSolutionGlobals(solutionKey);
-
+
base.InternalSetValue(value, key, false);
-
+
return value;
}
@@ -66,7 +66,7 @@ public DteConfiguration(DteSolution solution, ITracer tracer)
ThrowIfNotOnUIThread();
TryClearValueFromSolutionGlobals(GetSolutionKey(key));
-
+
base.InternalSetValue(value, key, forceGlobal);
}
diff --git a/src/ResXManager.VSIX.Compatibility.Shared/DteExtensions.cs b/src/ResXManager.VSIX.Compatibility.x64/DteExtensions.cs
similarity index 99%
rename from src/ResXManager.VSIX.Compatibility.Shared/DteExtensions.cs
rename to src/ResXManager.VSIX.Compatibility.x64/DteExtensions.cs
index 3ce56c75..9fd428ef 100644
--- a/src/ResXManager.VSIX.Compatibility.Shared/DteExtensions.cs
+++ b/src/ResXManager.VSIX.Compatibility.x64/DteExtensions.cs
@@ -1,4 +1,4 @@
-namespace ResXManager.VSIX;
+namespace ResXManager.VSIX.Compatibility.x64;
using System;
using System.Collections.Generic;
@@ -10,14 +10,13 @@
using Community.VisualStudio.Toolkit;
using Microsoft.VisualStudio;
-
using Microsoft.VisualStudio.Shell.Interop;
-using static Microsoft.VisualStudio.Shell.ThreadHelper;
-
using ResXManager.View;
using ResXManager.VSIX.Compatibility;
+using static Microsoft.VisualStudio.Shell.ThreadHelper;
+
internal static class DteExtensions
{
public static EnvDTE.Document? TryGetDocument(this EnvDTE.ProjectItem? projectItem)
diff --git a/src/ResXManager.VSIX.Compatibility.Shared/DteProjectFile.cs b/src/ResXManager.VSIX.Compatibility.x64/DteProjectFile.cs
similarity index 96%
rename from src/ResXManager.VSIX.Compatibility.Shared/DteProjectFile.cs
rename to src/ResXManager.VSIX.Compatibility.x64/DteProjectFile.cs
index 1091d1e4..df1634b0 100644
--- a/src/ResXManager.VSIX.Compatibility.Shared/DteProjectFile.cs
+++ b/src/ResXManager.VSIX.Compatibility.x64/DteProjectFile.cs
@@ -1,12 +1,10 @@
-namespace ResXManager.VSIX;
+namespace ResXManager.VSIX.Compatibility.x64;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
-using EnvDTE;
-
using ResXManager.Model;
using ResXManager.VSIX.Compatibility;
using ResXManager.VSIX.Compatibility.Properties;
@@ -186,6 +184,9 @@ private void SetCodeGenerator(CodeGenerator value)
case CodeGenerator.Unknown:
case CodeGenerator.WinForms:
break;
+
+ default:
+ throw new ArgumentOutOfRangeException(nameof(value), value, null);
}
}
}
@@ -233,12 +234,12 @@ private void SetTextTemplateCodeGenerator(EnvDTE.ProjectItem projectItem)
item.RunCustomTool();
}
- private static void ReferenceDataAnnotations(ProjectItem projectItem)
+ private static void ReferenceDataAnnotations(EnvDTE.ProjectItem projectItem)
{
try
{
ThrowIfNotOnUIThread();
-
+
const string dataAnnotations = "System.ComponentModel.DataAnnotations";
ThrowIfNotOnUIThread();
@@ -269,4 +270,4 @@ private static void SetCustomToolCodeGenerator(EnvDTE.ProjectItem projectItem, C
projectItem.SetCustomTool(value.ToString());
}
-}
\ No newline at end of file
+}
diff --git a/src/ResXManager.VSIX.Compatibility.Shared/DteSolution.cs b/src/ResXManager.VSIX.Compatibility.x64/DteSolution.cs
similarity index 97%
rename from src/ResXManager.VSIX.Compatibility.Shared/DteSolution.cs
rename to src/ResXManager.VSIX.Compatibility.x64/DteSolution.cs
index a60ecd58..f2143e32 100644
--- a/src/ResXManager.VSIX.Compatibility.Shared/DteSolution.cs
+++ b/src/ResXManager.VSIX.Compatibility.x64/DteSolution.cs
@@ -1,4 +1,4 @@
-namespace ResXManager.VSIX;
+namespace ResXManager.VSIX.Compatibility.x64;
using System;
using System.Collections.Generic;
@@ -116,7 +116,14 @@ public IEnumerable GetProjectFiles(IFileFilter fileFilter)
}
// ReSharper disable once SuspiciousTypeConversion.Global
- private Solution2? Solution => _dte.Solution as Solution2;
+ private Solution2? Solution
+ {
+ get
+ {
+ ThrowIfNotOnUIThread();
+ return _dte.Solution as Solution2;
+ }
+ }
public Globals? Globals
{
@@ -311,4 +318,4 @@ private void GetProjectFiles(string? projectName, ProjectItem projectItem, IDict
return null;
}
-}
\ No newline at end of file
+}
diff --git a/src/ResXManager.VSIX.Compatibility.Shared/DteSourceFilesProvider.cs b/src/ResXManager.VSIX.Compatibility.x64/DteSourceFilesProvider.cs
similarity index 94%
rename from src/ResXManager.VSIX.Compatibility.Shared/DteSourceFilesProvider.cs
rename to src/ResXManager.VSIX.Compatibility.x64/DteSourceFilesProvider.cs
index 6c6c66c7..efb4d66e 100644
--- a/src/ResXManager.VSIX.Compatibility.Shared/DteSourceFilesProvider.cs
+++ b/src/ResXManager.VSIX.Compatibility.x64/DteSourceFilesProvider.cs
@@ -1,52 +1,52 @@
-namespace ResXManager.VSIX;
-
-using System.Collections.Generic;
-using System.Composition;
-using System.Linq;
-using System.Threading;
-using System.Threading.Tasks;
-
-using ResXManager.Model;
-using ResXManager.View.Tools;
-
-using TomsToolbox.Composition;
-
-using static Microsoft.VisualStudio.Shell.ThreadHelper;
-
-[Shared, Export(typeof(ISourceFilesProvider))]
-internal sealed class DteSourceFilesProvider : ISourceFilesProvider
-{
- private readonly PerformanceTracer _performanceTracer;
- private readonly IConfiguration _configuration;
- private readonly DteSolution _solution;
-
- [ImportingConstructor]
- public DteSourceFilesProvider(IExportProvider exportProvider)
- {
- _performanceTracer = exportProvider.GetExportedValue();
- _configuration = exportProvider.GetExportedValue();
- _solution = exportProvider.GetExportedValue();
- }
-
- public async Task> GetSourceFilesAsync(CancellationToken? cancellationToken)
- {
- using (_performanceTracer.Start("Enumerate source files"))
- {
- await JoinableTaskFactory.SwitchToMainThreadAsync();
-
- return await Task.FromResult(_solution.GetProjectFiles(new FileFilter(_configuration)).ToList().AsReadOnly()).ConfigureAwait(false);
- }
- }
-
- ///
- /// Gets the solution folder.
- ///
- public string SolutionFolder
- {
- get
- {
- ThrowIfNotOnUIThread();
- return _solution.SolutionFolder;
- }
- }
-}
+namespace ResXManager.VSIX.Compatibility.x64;
+
+using System.Collections.Generic;
+using System.Composition;
+using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
+
+using ResXManager.Model;
+using ResXManager.View.Tools;
+
+using TomsToolbox.Composition;
+
+using static Microsoft.VisualStudio.Shell.ThreadHelper;
+
+[Shared, Export(typeof(ISourceFilesProvider))]
+internal sealed class DteSourceFilesProvider : ISourceFilesProvider
+{
+ private readonly PerformanceTracer _performanceTracer;
+ private readonly IConfiguration _configuration;
+ private readonly DteSolution _solution;
+
+ [ImportingConstructor]
+ public DteSourceFilesProvider(IExportProvider exportProvider)
+ {
+ _performanceTracer = exportProvider.GetExportedValue();
+ _configuration = exportProvider.GetExportedValue();
+ _solution = exportProvider.GetExportedValue();
+ }
+
+ public async Task> GetSourceFilesAsync(CancellationToken? cancellationToken)
+ {
+ using (_performanceTracer.Start("Enumerate source files"))
+ {
+ await JoinableTaskFactory.SwitchToMainThreadAsync();
+
+ return await Task.FromResult(_solution.GetProjectFiles(new FileFilter(_configuration)).ToList().AsReadOnly()).ConfigureAwait(false);
+ }
+ }
+
+ ///
+ /// Gets the solution folder.
+ ///
+ public string SolutionFolder
+ {
+ get
+ {
+ ThrowIfNotOnUIThread();
+ return _solution.SolutionFolder;
+ }
+ }
+}
diff --git a/src/ResXManager.VSIX.Compatibility.Shared/ErrorListProviderService.cs b/src/ResXManager.VSIX.Compatibility.x64/ErrorListProviderService.cs
similarity index 98%
rename from src/ResXManager.VSIX.Compatibility.Shared/ErrorListProviderService.cs
rename to src/ResXManager.VSIX.Compatibility.x64/ErrorListProviderService.cs
index d3f6c0c8..709f9976 100644
--- a/src/ResXManager.VSIX.Compatibility.Shared/ErrorListProviderService.cs
+++ b/src/ResXManager.VSIX.Compatibility.x64/ErrorListProviderService.cs
@@ -1,4 +1,4 @@
-namespace ResXManager.VSIX;
+namespace ResXManager.VSIX.Compatibility.x64;
using System;
using System.Collections.Generic;
@@ -115,4 +115,4 @@ public void Dispose()
{
_errorListProvider.Dispose();
}
-}
\ No newline at end of file
+}
diff --git a/src/ResXManager.VSIX.Compatibility.Shared/ICustomToolRunner.cs b/src/ResXManager.VSIX.Compatibility.x64/ICustomToolRunner.cs
similarity index 76%
rename from src/ResXManager.VSIX.Compatibility.Shared/ICustomToolRunner.cs
rename to src/ResXManager.VSIX.Compatibility.x64/ICustomToolRunner.cs
index 0b34a276..5f0c902f 100644
--- a/src/ResXManager.VSIX.Compatibility.Shared/ICustomToolRunner.cs
+++ b/src/ResXManager.VSIX.Compatibility.x64/ICustomToolRunner.cs
@@ -1,4 +1,4 @@
-namespace ResXManager.VSIX;
+namespace ResXManager.VSIX.Compatibility.x64;
using System;
using System.Collections.Generic;
@@ -6,4 +6,4 @@
public interface ICustomToolRunner : IDisposable
{
void Enqueue(IEnumerable? projectItems);
-}
\ No newline at end of file
+}
diff --git a/src/ResXManager.VSIX.Compatibility.Shared/PreBuildService.cs b/src/ResXManager.VSIX.Compatibility.x64/PreBuildService.cs
similarity index 95%
rename from src/ResXManager.VSIX.Compatibility.Shared/PreBuildService.cs
rename to src/ResXManager.VSIX.Compatibility.x64/PreBuildService.cs
index 218a96e6..57f4f231 100644
--- a/src/ResXManager.VSIX.Compatibility.Shared/PreBuildService.cs
+++ b/src/ResXManager.VSIX.Compatibility.x64/PreBuildService.cs
@@ -1,121 +1,121 @@
-namespace ResXManager.VSIX;
-
-using System;
-using System.Collections.Specialized;
-using System.Composition;
-using System.Linq;
-using System.Threading.Tasks;
-using System.Windows.Threading;
-
-using Community.VisualStudio.Toolkit;
-
-using ResXManager.Infrastructure;
-using ResXManager.Model;
-using ResXManager.View.Tools;
-using ResXManager.View.Visuals;
-using ResXManager.VSIX.Compatibility;
-
-using static Microsoft.VisualStudio.Shell.ThreadHelper;
-
-[Shared]
-[Export(typeof(IService))]
-internal sealed class PreBuildService : IService, IDisposable
-{
- private readonly IErrorListProvider _errorListProvider;
- private readonly ResourceManager _resourceManager;
- private readonly ResourceViewModel _resourceViewModel;
- private readonly XlfSynchronizer _xlfSynchronizer;
- private readonly IVsixShellViewModel _shellViewModel;
- private readonly IDteConfiguration _configuration;
-
- [ImportingConstructor]
- public PreBuildService(
- ResourceManager resourceManager,
- ResourceViewModel resourceViewModel,
- XlfSynchronizer xlfSynchronizer,
- IVsixShellViewModel shellViewModel,
- IErrorListProvider errorListProvider,
- IDteConfiguration configuration)
- {
- _errorListProvider = errorListProvider;
- _resourceManager = resourceManager;
- _resourceViewModel = resourceViewModel;
- _xlfSynchronizer = xlfSynchronizer;
- _shellViewModel = shellViewModel;
- _configuration = configuration;
-
- resourceManager.TableEntries.CollectionChanged += TableEntries_CollectionChanged;
- errorListProvider.Navigate += Provider_Navigate;
-
- VS.Events.BuildEvents.SolutionBuildStarted += BuildEvents_SolutionBuildStarted;
- }
-
- public void Start()
- {
- }
-
- private void TableEntries_CollectionChanged(object? sender, NotifyCollectionChangedEventArgs e)
- {
- if (e.Action != NotifyCollectionChangedAction.Remove)
- return;
-
- foreach (var entry in e.OldItems.OfType())
- {
- _errorListProvider.Remove(entry);
- }
- }
-
- private void Await(Func action)
- {
- var frame = new DispatcherFrame();
-
- void TaskCompleted()
- {
- frame.Continue = false;
- }
-
- action().GetAwaiter().OnCompleted(TaskCompleted);
-
- Dispatcher.PushFrame(frame);
- }
-
- private void BuildEvents_SolutionBuildStarted(object? sender, EventArgs e)
- {
- if (!_configuration.EnableXlifSync && !_configuration.ShowErrorsInErrorList)
- return;
-
- Await(_resourceViewModel.ReloadAsync);
-
- if (_configuration.EnableXlifSync)
- {
- Await(_xlfSynchronizer.UpdateFromXlfAsync);
- }
-
- if (!_configuration.ShowErrorsInErrorList)
- {
- _errorListProvider.Clear();
- }
- else
- {
- var errorCategory = _configuration.TaskErrorCategory;
- var cultures = _resourceManager.Cultures;
- var entries = _resourceManager.TableEntries;
-
- _errorListProvider.SetEntries(entries, cultures, (int)errorCategory);
- }
- }
-
- private void Provider_Navigate(ResourceTableEntry entry)
- {
- ThrowIfNotOnUIThread();
-
- _shellViewModel.SelectEntry(entry);
- }
-
- public void Dispose()
- {
- _errorListProvider.Dispose();
-
- VS.Events.BuildEvents.SolutionBuildStarted -= BuildEvents_SolutionBuildStarted;
- }
-}
\ No newline at end of file
+namespace ResXManager.VSIX.Compatibility.x64;
+
+using System;
+using System.Collections.Specialized;
+using System.Composition;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows.Threading;
+
+using Community.VisualStudio.Toolkit;
+
+using ResXManager.Infrastructure;
+using ResXManager.Model;
+using ResXManager.View.Tools;
+using ResXManager.View.Visuals;
+using ResXManager.VSIX.Compatibility;
+
+using static Microsoft.VisualStudio.Shell.ThreadHelper;
+
+[Shared]
+[Export(typeof(IService))]
+internal sealed class PreBuildService : IService, IDisposable
+{
+ private readonly IErrorListProvider _errorListProvider;
+ private readonly ResourceManager _resourceManager;
+ private readonly ResourceViewModel _resourceViewModel;
+ private readonly XlfSynchronizer _xlfSynchronizer;
+ private readonly IVsixShellViewModel _shellViewModel;
+ private readonly IDteConfiguration _configuration;
+
+ [ImportingConstructor]
+ public PreBuildService(
+ ResourceManager resourceManager,
+ ResourceViewModel resourceViewModel,
+ XlfSynchronizer xlfSynchronizer,
+ IVsixShellViewModel shellViewModel,
+ IErrorListProvider errorListProvider,
+ IDteConfiguration configuration)
+ {
+ _errorListProvider = errorListProvider;
+ _resourceManager = resourceManager;
+ _resourceViewModel = resourceViewModel;
+ _xlfSynchronizer = xlfSynchronizer;
+ _shellViewModel = shellViewModel;
+ _configuration = configuration;
+
+ resourceManager.TableEntries.CollectionChanged += TableEntries_CollectionChanged;
+ errorListProvider.Navigate += Provider_Navigate;
+
+ VS.Events.BuildEvents.SolutionBuildStarted += BuildEvents_SolutionBuildStarted;
+ }
+
+ public void Start()
+ {
+ }
+
+ private void TableEntries_CollectionChanged(object? sender, NotifyCollectionChangedEventArgs e)
+ {
+ if (e.Action != NotifyCollectionChangedAction.Remove)
+ return;
+
+ foreach (var entry in e.OldItems.OfType())
+ {
+ _errorListProvider.Remove(entry);
+ }
+ }
+
+ private void Await(Func action)
+ {
+ var frame = new DispatcherFrame();
+
+ void TaskCompleted()
+ {
+ frame.Continue = false;
+ }
+
+ action().GetAwaiter().OnCompleted(TaskCompleted);
+
+ Dispatcher.PushFrame(frame);
+ }
+
+ private void BuildEvents_SolutionBuildStarted(object? sender, EventArgs e)
+ {
+ if (!_configuration.EnableXlifSync && !_configuration.ShowErrorsInErrorList)
+ return;
+
+ Await(_resourceViewModel.ReloadAsync);
+
+ if (_configuration.EnableXlifSync)
+ {
+ Await(_xlfSynchronizer.UpdateFromXlfAsync);
+ }
+
+ if (!_configuration.ShowErrorsInErrorList)
+ {
+ _errorListProvider.Clear();
+ }
+ else
+ {
+ var errorCategory = _configuration.TaskErrorCategory;
+ var cultures = _resourceManager.Cultures;
+ var entries = _resourceManager.TableEntries;
+
+ _errorListProvider.SetEntries(entries, cultures, (int)errorCategory);
+ }
+ }
+
+ private void Provider_Navigate(ResourceTableEntry entry)
+ {
+ ThrowIfNotOnUIThread();
+
+ _shellViewModel.SelectEntry(entry);
+ }
+
+ public void Dispose()
+ {
+ _errorListProvider.Dispose();
+
+ VS.Events.BuildEvents.SolutionBuildStarted -= BuildEvents_SolutionBuildStarted;
+ }
+}
diff --git a/src/ResXManager.VSIX.Compatibility.x64/Properties/AssemblyInfo.cs b/src/ResXManager.VSIX.Compatibility.x64/Properties/AssemblyInfo.cs
new file mode 100644
index 00000000..3ea9332b
--- /dev/null
+++ b/src/ResXManager.VSIX.Compatibility.x64/Properties/AssemblyInfo.cs
@@ -0,0 +1,5 @@
+namespace ResXManager.VSIX.Compatibility.x64.Properties;
+
+public static class AssemblyKey
+{
+}
diff --git a/src/ResXManager.VSIX.Compatibility.Shared/Refactorings.cs b/src/ResXManager.VSIX.Compatibility.x64/Refactorings.cs
similarity index 99%
rename from src/ResXManager.VSIX.Compatibility.Shared/Refactorings.cs
rename to src/ResXManager.VSIX.Compatibility.x64/Refactorings.cs
index 3f9eb123..eb598705 100644
--- a/src/ResXManager.VSIX.Compatibility.Shared/Refactorings.cs
+++ b/src/ResXManager.VSIX.Compatibility.x64/Refactorings.cs
@@ -1,4 +1,4 @@
-namespace ResXManager.VSIX;
+namespace ResXManager.VSIX.Compatibility.x64;
using System;
using System.Collections.Generic;
@@ -14,7 +14,6 @@
using Microsoft.VisualStudio.Shell;
using ResXManager.Model;
-using ResXManager.View.Behaviors;
using ResXManager.View.Visuals;
using ResXManager.VSIX.Compatibility;
@@ -23,7 +22,6 @@
using static Microsoft.VisualStudio.Shell.ThreadHelper;
-using Settings = View.Properties.Settings;
using Resources = Compatibility.Properties.Resources;
[Export(typeof(IRefactorings))]
diff --git a/src/ResXManager.VSIX.Compatibility.x64/ResXManager.VSIX.Compatibility.x64.csproj b/src/ResXManager.VSIX.Compatibility.x64/ResXManager.VSIX.Compatibility.x64.csproj
index fdfbe87e..53fe73a9 100644
--- a/src/ResXManager.VSIX.Compatibility.x64/ResXManager.VSIX.Compatibility.x64.csproj
+++ b/src/ResXManager.VSIX.Compatibility.x64/ResXManager.VSIX.Compatibility.x64.csproj
@@ -3,12 +3,11 @@
net472
true
-
-
-
+
+
@@ -18,4 +17,7 @@
+
+
+
\ No newline at end of file
diff --git a/src/ResXManager.VSIX.Compatibility.Shared/VsixCompatibility.cs b/src/ResXManager.VSIX.Compatibility.x64/VsixCompatibility.cs
similarity index 94%
rename from src/ResXManager.VSIX.Compatibility.Shared/VsixCompatibility.cs
rename to src/ResXManager.VSIX.Compatibility.x64/VsixCompatibility.cs
index 4cbfa60e..b4ed548c 100644
--- a/src/ResXManager.VSIX.Compatibility.Shared/VsixCompatibility.cs
+++ b/src/ResXManager.VSIX.Compatibility.x64/VsixCompatibility.cs
@@ -1,4 +1,4 @@
-namespace ResXManager.VSIX.Compatibility.Shared;
+namespace ResXManager.VSIX.Compatibility.x64;
using System;
using System.Collections.Generic;
@@ -26,7 +26,7 @@
using static Microsoft.VisualStudio.Shell.ThreadHelper;
using MessageBox = System.Windows.MessageBox;
-using Resources = Properties.Resources;
+using Resources = Compatibility.Properties.Resources;
[Export(typeof(IVsixCompatibility))]
internal sealed class VsixCompatibility : IVsixCompatibility
@@ -241,7 +241,7 @@ private static void ActivateWindow(EnvDTE.Window? window)
ThrowIfNotOnUIThread();
if (ServiceProvider.GlobalProvider?.GetService(typeof(DTE)) is not DTE2 dte)
- return Array.Empty>();
+ return [];
try
{
@@ -254,19 +254,19 @@ private static void ActivateWindow(EnvDTE.Window? window)
.ToDictionary(window => window.Document);
var items = from l in languages
- let file = l.FileName
- let projectFile = l.ProjectFile as DteProjectFile
- let documents = projectFile?.ProjectItems.Select(item => item.TryGetDocument()).Where(doc => doc != null)
- let window = documents?.Select(doc => openDocuments?.GetValueOrDefault(doc)).FirstOrDefault(win => win != null)
- where window != null
- select Tuple.Create(file, window);
+ let file = l.FileName
+ let projectFile = l.ProjectFile as DteProjectFile
+ let documents = projectFile?.ProjectItems.Select(item => item.TryGetDocument()).Where(doc => doc != null)
+ let window = documents?.Select(doc => openDocuments?.GetValueOrDefault(doc)).FirstOrDefault(win => win != null)
+ where window != null
+ select Tuple.Create(file, window);
#pragma warning restore VSTHRD010 // Accessing ... should only be done on the main thread.
return items.ToArray();
}
catch
{
- return Array.Empty>();
+ return [];
}
}
diff --git a/src/ResXManager.VSIX.Compatibility.x86/FodyWeavers.xml b/src/ResXManager.VSIX.Compatibility.x86/FodyWeavers.xml
deleted file mode 100644
index 781e5ea3..00000000
--- a/src/ResXManager.VSIX.Compatibility.x86/FodyWeavers.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/src/ResXManager.VSIX.Compatibility.x86/FodyWeavers.xsd b/src/ResXManager.VSIX.Compatibility.x86/FodyWeavers.xsd
deleted file mode 100644
index 794a989e..00000000
--- a/src/ResXManager.VSIX.Compatibility.x86/FodyWeavers.xsd
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
- 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.
-
-
-
-
- A comma-separated list of error codes that can be safely ignored in assembly verification.
-
-
-
-
- 'false' to turn off automatic generation of the XML Schema file.
-
-
-
-
-
\ No newline at end of file
diff --git a/src/ResXManager.VSIX.Compatibility.x86/ResXManager.VSIX.Compatibility.x86.csproj b/src/ResXManager.VSIX.Compatibility.x86/ResXManager.VSIX.Compatibility.x86.csproj
deleted file mode 100644
index d4bb3f07..00000000
--- a/src/ResXManager.VSIX.Compatibility.x86/ResXManager.VSIX.Compatibility.x86.csproj
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
- net472
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/ResXManager.VSIX/MyToolWindow.cs b/src/ResXManager.VSIX/MyToolWindow.cs
index aecb7af7..486e45f8 100644
--- a/src/ResXManager.VSIX/MyToolWindow.cs
+++ b/src/ResXManager.VSIX/MyToolWindow.cs
@@ -98,7 +98,7 @@ protected override void OnCreate()
var folder = Path.GetDirectoryName(executingAssembly.Location);
// ReSharper disable once AssignNullToNotNullAttribute
- _tracer.WriteLine(Resources.AssemblyLocation, folder);
+ _tracer.WriteLine(Resources.AssemblyLocation, $"{folder}, {File.GetCreationTime(executingAssembly.Location)}");
_tracer.WriteLine(Resources.Version, new AssemblyName(executingAssembly.FullName).Version);
_tracer.WriteLine(".NET Framework Version: {0} (https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed)", FrameworkVersion());
diff --git a/src/ResXManager.VSIX/Properties/AssemblyInfo.cs b/src/ResXManager.VSIX/Properties/AssemblyInfo.cs
index 4cea7b70..34b48abf 100644
--- a/src/ResXManager.VSIX/Properties/AssemblyInfo.cs
+++ b/src/ResXManager.VSIX/Properties/AssemblyInfo.cs
@@ -22,10 +22,14 @@
[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\Community.VisualStudio.Toolkit.dll")]
[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\DataGridExtensions.dll")]
[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\DocumentFormat.OpenXml.dll")]
+[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\DocumentFormat.OpenXml.Framework.dll")]
[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\Microsoft.Bcl.AsyncInterfaces.dll")]
[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\Microsoft.Bcl.HashCode.dll")]
+[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\Microsoft.Bcl.Memory.dll")]
[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\Microsoft.ML.Tokenizers.dll")]
+[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\Microsoft.ML.Tokenizers.Data.CL100KBase.dll")]
+[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\Microsoft.ML.Tokenizers.Data.O200KBase.dll")]
[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\Microsoft.Xaml.Behaviors.dll")]
[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\System.Buffers.dll")]
@@ -35,10 +39,7 @@
[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\System.Memory.dll")]
[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\System.Numerics.Vectors.dll")]
[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\System.Runtime.CompilerServices.Unsafe.dll")]
-[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\System.Security.Cryptography.Pkcs.dll")]
-[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\System.ServiceModel.Http.dll")]
[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\System.ServiceModel.Primitives.dll")]
[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\System.Text.Encodings.Web.dll")]
[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\System.Text.Json.dll")]
[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\System.Threading.Tasks.Extensions.dll")]
-// [assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\System.ValueTuple.dll")]
diff --git a/src/ResXManager.VSIX/ResXManager.VSIX.csproj b/src/ResXManager.VSIX/ResXManager.VSIX.csproj
index c5b66699..0927004d 100644
--- a/src/ResXManager.VSIX/ResXManager.VSIX.csproj
+++ b/src/ResXManager.VSIX/ResXManager.VSIX.csproj
@@ -5,6 +5,7 @@
net472
16.0
..\ResourceManager.ico
+ true
Program
@@ -57,10 +58,9 @@
BuiltProjectOutputGroup;BuiltProjectOutputGroupDependencies;GetCopyToOutputDirectoryItems;SatelliteDllsProjectOutputGroup;DebugSymbolsProjectOutputGroup;
-
-
-
-
+
+ BuiltProjectOutputGroup;BuiltProjectOutputGroupDependencies;GetCopyToOutputDirectoryItems;SatelliteDllsProjectOutputGroup;DebugSymbolsProjectOutputGroup;
+
@@ -72,7 +72,7 @@
-
+
@@ -80,10 +80,6 @@
-
-
-
-
diff --git a/src/ResXManager.VSIX/VSPackage.cs b/src/ResXManager.VSIX/VSPackage.cs
index 7595432a..71d2acd4 100644
--- a/src/ResXManager.VSIX/VSPackage.cs
+++ b/src/ResXManager.VSIX/VSPackage.cs
@@ -20,8 +20,6 @@
using Ninject;
-using Resourcer;
-
using ResXManager.Infrastructure;
using ResXManager.Model;
using ResXManager.View.Tools;
@@ -50,10 +48,10 @@
// This attribute tells the PkgDef creation utility (CreatePkgDef.exe) that this class is a package.
[SuppressMessage("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable", Justification = "Package already handles this.")]
[PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)]
-// This attribute is used to register the information needed to show the this package in the Help/About dialog of Visual Studio.
-[InstalledProductRegistration(@"#110", @"#112", "ResXManager", IconResourceID = 400)]
+// This attribute is used to register the information needed to show this package in the Help/About dialog of Visual Studio.
+[InstalledProductRegistration("#110", "#112", "ResXManager", IconResourceID = 400)]
// This attribute is needed to let the shell know that this package exposes some menus.
-[ProvideMenuResource(@"Menus.ctmenu", 1)]
+[ProvideMenuResource("Menus.ctmenu", 1)]
// This attribute registers a tool window exposed by this package.
[ProvideToolWindow(typeof(MyToolWindow))]
[Guid(GuidList.guidResXManager_VSIXPkgString)]
@@ -96,6 +94,22 @@ public static VsPackage Instance
private ITracer Tracer { get; }
+ public override IVsAsyncToolWindowFactory? GetAsyncToolWindowFactory(Guid toolWindowType)
+ {
+ return toolWindowType == typeof(MyToolWindow).GUID ? this : null;
+ }
+
+ protected override string GetToolWindowTitle(Type toolWindowType, int id)
+ {
+ return toolWindowType == typeof(MyToolWindow) ? "ResX Manager" : base.GetToolWindowTitle(toolWindowType, id);
+ }
+
+ protected override Task