Skip to content

A Swiss Army knife for developers.

Added a Png/jpg compressor tool (#72)

Etienne Baudoux9acd3f12e269
diff --git a/README.md b/README.md
index f1978ff7b..e73d8949c 100644
--- a/README.md
+++ b/README.md
@@ -32,6 +32,7 @@ Many tools are available.
- RegExp Tester
- Text Comparer
- Json <> Yaml converter
+- PNG/JPG image compressor
- String Utilities
- URL Encoder/Decoder
- HTML Encoder/Decoder
@@ -74,6 +75,7 @@ Here is the list of tool name you can use:
- `jsonformat` Json Formatter
- `jsonyaml` - Json <> Yaml
- `jwt` - JWT Decoder
+- `imgcomp` - PNG/JPG compressor
- `markdown` - Markdown Preview
- `regex` - Regular Expression Tester
- `string` - String Utilities
diff --git a/THIRD-PARTY-NOTICES.md b/THIRD-PARTY-NOTICES.md
index f97092678..3d4a4de31 100644
--- a/THIRD-PARTY-NOTICES.md
+++ b/THIRD-PARTY-NOTICES.md
@@ -13,6 +13,7 @@ This project incorporates components from the projects listed below. The origina
9. Azure Active Directory IdentityModel Extensions for .NET (https://github.com/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet)
10. Markdig (https://github.com/xoofx/markdig)
11. github-markdown-css (https://github.com/sindresorhus/github-markdown-css)
+12. Efficient Compression Tool (https://github.com/fhanau/Efficient-Compression-Tool)
Newtonsoft.Json NOTICES AND INFORMATION BEGIN HERE
=========================================
@@ -230,3 +231,207 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Efficient Compression Tool NOTICES AND INFORMATION BEGIN HERE
+=========================================
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "{}"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+Copyright {yyyy} {name of copyright owner}
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
\ No newline at end of file
diff --git a/src/dev/impl/DevToys.OutOfProcService/API/Core/OOP/IOutOfProcService.cs b/src/dev/impl/DevToys.OutOfProcService/API/Core/OOP/IOutOfProcService.cs
index a22d37bdc..ac56d846a 100644
--- a/src/dev/impl/DevToys.OutOfProcService/API/Core/OOP/IOutOfProcService.cs
+++ b/src/dev/impl/DevToys.OutOfProcService/API/Core/OOP/IOutOfProcService.cs
@@ -1,6 +1,7 @@
#nullable enable
using System;
+using System.Threading;
using System.Threading.Tasks;
using DevToys.Shared.Core.OOP;
@@ -8,8 +9,10 @@ namespace DevToys.OutOfProcService.API.Core.OOP
{
internal interface IOutOfProcService
{
+ Guid MessageId { get; }
+
event EventHandler<AppServiceProgressMessageEventArgs>? ReportProgress;
- Task<AppServiceMessageBase> ProcessMessageAsync(AppServiceMessageBase inputMessage);
+ Task<AppServiceMessageBase> ProcessMessageAsync(AppServiceMessageBase inputMessage, CancellationToken cancellationToken);
}
}
diff --git a/src/dev/impl/DevToys.OutOfProcService/Assets/ect-0.8.3.exe b/src/dev/impl/DevToys.OutOfProcService/Assets/ect-0.8.3.exe
new file mode 100644
index 000000000..2c53c0f1c
Binary files /dev/null and b/src/dev/impl/DevToys.OutOfProcService/Assets/ect-0.8.3.exe differ
diff --git a/src/dev/impl/DevToys.OutOfProcService/Core/Constants.cs b/src/dev/impl/DevToys.OutOfProcService/Core/Constants.cs
new file mode 100644
index 000000000..dcbf213ed
--- /dev/null
+++ b/src/dev/impl/DevToys.OutOfProcService/Core/Constants.cs
@@ -0,0 +1,12 @@
+using System.Diagnostics;
+using System.IO;
+
+namespace DevToys.OutOfProcService.Core
+{
+ internal static class Constants
+ {
+ internal static readonly string AssetsFolderFullPath = Path.Combine(Path.GetDirectoryName(Process.GetCurrentProcess().MainModule!.FileName)!, "Assets");
+
+ internal const string EfficientCompressionToolFileName = "ect-0.8.3.exe";
+ }
+}
diff --git a/src/dev/impl/DevToys.OutOfProcService/Core/OOP/AppService.cs b/src/dev/impl/DevToys.OutOfProcService/Core/OOP/AppService.cs
index 698667f75..defbad465 100644
--- a/src/dev/impl/DevToys.OutOfProcService/Core/OOP/AppService.cs
+++ b/src/dev/impl/DevToys.OutOfProcService/Core/OOP/AppService.cs
@@ -1,6 +1,7 @@
#nullable enable
using System;
+using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Composition;
using System.Diagnostics;
@@ -26,6 +27,8 @@ namespace DevToys.OutOfProcService.Core.OOP
{
private const string PipeName = @"Sessions\{0}\AppContainerNamedObjects\{1}\{2}";
+ private readonly ConcurrentDictionary<Guid, CancellationTokenSource> _inProgressMessages = new();
+ private readonly DisposableSempahore _sempahore = new();
private readonly TaskCompletionSource _appServiceConnectionClosedTask = new();
private readonly IMefProvider _mefProvider;
@@ -156,7 +159,18 @@ namespace DevToys.OutOfProcService.Core.OOP
if (inputMessage.MessageId.HasValue)
{
- ProcessMessageAsync(inputMessage).Forget();
+ CancellationToken cancellationToken = CancellationToken.None;
+ var cancellationTokenSource = new CancellationTokenSource();
+ if (!_inProgressMessages.TryAdd(inputMessage.MessageId.Value, cancellationTokenSource))
+ {
+ cancellationTokenSource.Dispose();
+ }
+ else
+ {
+ cancellationToken = cancellationTokenSource.Token;
+ }
+
+ ProcessMessageAsync(inputMessage, cancellationToken).Forget();
}
else
{
@@ -173,13 +187,20 @@ namespace DevToys.OutOfProcService.Core.OOP
}
}
- private async Task ProcessMessageAsync(AppServiceMessageBase inputMessage)
+ private async Task ProcessMessageAsync(AppServiceMessageBase inputMessage, CancellationToken cancellationToken)
{
ThrowIfNotConnected();
IOutOfProcService? service = null;
try
{
+ if (inputMessage is AppServiceCancelMessage cancelMessage
+ && _inProgressMessages.TryGetValue(cancelMessage.MessageId!.Value, out CancellationTokenSource? cancellationTokenSource))
+ {
+ cancellationTokenSource.Cancel();
+ return;
+ }
+
// Get the service that corresponds to the message.
IEnumerable<Lazy<IOutOfProcService, OutOfProcServiceMetadata>> services
= _mefProvider.ImportMany<Lazy<IOutOfProcService, OutOfProcServiceMetadata>>();
@@ -187,18 +208,31 @@ namespace DevToys.OutOfProcService.Core.OOP
service.ReportProgress += Service_ReportProgress;
// Invoke the service.
- AppServiceMessageBase outputMessage = await service.ProcessMessageAsync(inputMessage);
+ AppServiceMessageBase outputMessage = await service.ProcessMessageAsync(inputMessage, cancellationToken);
outputMessage.MessageId = inputMessage.MessageId;
// Send the service result as a response to the UWP app.
await SendMessageAsync(outputMessage);
}
+ catch (OperationCanceledException)
+ {
+ // Let the UWP app that the message got canceled.
+ await SendMessageAsync(new AppServiceCancelMessage
+ {
+ MessageId = inputMessage.MessageId
+ });
+ }
catch (Exception)
{
// TODO: Log this.
}
finally
{
+ if (_inProgressMessages.TryRemove(inputMessage.MessageId!.Value, out CancellationTokenSource? cancellationTokenSource))
+ {
+ cancellationTokenSource.Dispose();
+ }
+
if (service is not null)
{
service.ReportProgress -= Service_ReportProgress;
@@ -222,14 +256,17 @@ namespace DevToys.OutOfProcService.Core.OOP
private async Task SendMessageAsync(AppServiceMessageBase inputMessage)
{
- ThrowIfNotConnected();
+ using (await _sempahore.WaitAsync(CancellationToken.None))
+ {
+ ThrowIfNotConnected();
- string jsonMessage = JsonConvert.SerializeObject(inputMessage, Shared.Constants.AppServiceJsonSerializerSettings);
- byte[] messageBuffer = Encoding.UTF8.GetBytes(jsonMessage);
+ string jsonMessage = JsonConvert.SerializeObject(inputMessage, Shared.Constants.AppServiceJsonSerializerSettings);
+ byte[] messageBuffer = Encoding.UTF8.GetBytes(jsonMessage);
- await _pipeClientStream!.WriteAsync(messageBuffer, 0, messageBuffer.Length);
- await _pipeClientStream.FlushAsync();
- _pipeClientStream.WaitForPipeDrain();
+ await _pipeClientStream!.WriteAsync(messageBuffer, 0, messageBuffer.Length);
+ await _pipeClientStream.FlushAsync();
+ _pipeClientStream.WaitForPipeDrain();
+ }
}
private static string GetPackageSid()
diff --git a/src/dev/impl/DevToys.OutOfProcService/DevToys.OutOfProcService.csproj b/src/dev/impl/DevToys.OutOfProcService/DevToys.OutOfProcService.csproj
index 807d2f4bd..c51dd100f 100644
--- a/src/dev/impl/DevToys.OutOfProcService/DevToys.OutOfProcService.csproj
+++ b/src/dev/impl/DevToys.OutOfProcService/DevToys.OutOfProcService.csproj
@@ -29,6 +29,12 @@
<Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" />
</ItemGroup>
+ <ItemGroup>
+ <None Update="Assets\ect-0.8.3.exe">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
+ </ItemGroup>
+
<PropertyGroup>
<CsWinRTWindowsMetadata>sdk</CsWinRTWindowsMetadata>
</PropertyGroup>
diff --git a/src/dev/impl/DevToys.OutOfProcService/OutOfProcServices/OutOfProcServiceBase.cs b/src/dev/impl/DevToys.OutOfProcService/OutOfProcServices/OutOfProcServiceBase.cs
index 056bffbd6..27efff4e1 100644
--- a/src/dev/impl/DevToys.OutOfProcService/OutOfProcServices/OutOfProcServiceBase.cs
+++ b/src/dev/impl/DevToys.OutOfProcService/OutOfProcServices/OutOfProcServiceBase.cs
@@ -13,21 +13,26 @@ namespace DevToys.OutOfProcService.OutOfProcServices
where TOutput : AppServiceMessageBase
{
private readonly DisposableSempahore _sempahore = new();
- private Guid? _messageId;
private bool _messageIsProcessing;
+ public Guid MessageId { get; private set; } = Guid.Empty;
+
public event EventHandler<AppServiceProgressMessageEventArgs>? ReportProgress;
- public async Task<AppServiceMessageBase> ProcessMessageAsync(AppServiceMessageBase inputMessage)
+ public async Task<AppServiceMessageBase> ProcessMessageAsync(AppServiceMessageBase inputMessage, CancellationToken cancellationToken)
{
+ Assumes.NotNull(inputMessage.MessageId, nameof(inputMessage.MessageId));
+
_messageIsProcessing = true;
- _messageId = inputMessage.MessageId;
- TOutput result = await ProcessMessageAsync((TInput)inputMessage);
+ MessageId = inputMessage.MessageId!.Value;
+ TOutput result = await ProcessMessageAsync((TInput)inputMessage, cancellationToken);
_messageIsProcessing = false;
+
+ cancellationToken.ThrowIfCancellationRequested();
return result;
}
- protected abstract Task<TOutput> ProcessMessageAsync(TInput inputMessage);
+ protected abstract Task<TOutput> ProcessMessageAsync(TInput inputMessage, CancellationToken cancellationToken);
protected async Task ReportProgressAsync(int progressPercentage, string? message = null)
{
@@ -36,7 +41,7 @@ namespace DevToys.OutOfProcService.OutOfProcServices
using (await _sempahore.WaitAsync(CancellationToken.None))
{
Assumes.IsTrue(_messageIsProcessing, nameof(_messageIsProcessing));
- var eventArgs = new AppServiceProgressMessageEventArgs(_messageId!.Value, progressPercentage, message);
+ var eventArgs = new AppServiceProgressMessageEventArgs(MessageId, progressPercentage, message);
ReportProgress?.Invoke(this, eventArgs);
await eventArgs.MessageCompletedTask.Task;
}
diff --git a/src/dev/impl/DevToys.OutOfProcService/OutOfProcServices/PngJpgCompressor/PngJpgCompressorService.cs b/src/dev/impl/DevToys.OutOfProcService/OutOfProcServices/PngJpgCompressor/PngJpgCompressorService.cs
new file mode 100644
index 000000000..b88fac9d2
--- /dev/null
+++ b/src/dev/impl/DevToys.OutOfProcService/OutOfProcServices/PngJpgCompressor/PngJpgCompressorService.cs
@@ -0,0 +1,113 @@
+using System;
+using System.Composition;
+using System.Diagnostics;
+using System.IO;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using DevToys.OutOfProcService.API.Core.OOP;
+using DevToys.OutOfProcService.Core;
+using DevToys.Shared.AppServiceMessages.PngJpgCompressor;
+using DevToys.Shared.Core;
+using Windows.Storage;
+
+namespace DevToys.OutOfProcService.OutOfProcServices.PngJpgCompressor
+{
+ [Export(typeof(IOutOfProcService))]
+ [InputType(typeof(PngJpgCompressorWorkMessage))]
+ internal class PngJpgCompressorService : OutOfProcServiceBase<PngJpgCompressorWorkMessage, PngJpgCompressorWorkResultMessage>
+ {
+ protected override async Task<PngJpgCompressorWorkResultMessage> ProcessMessageAsync(PngJpgCompressorWorkMessage inputMessage, CancellationToken cancellationToken)
+ {
+ string ectFullPath = Path.Combine(Constants.AssetsFolderFullPath, Constants.EfficientCompressionToolFileName);
+ Assumes.IsTrue(File.Exists(ectFullPath), nameof(ectFullPath));
+
+ Arguments.NotNull(inputMessage, nameof(inputMessage));
+ Arguments.NotNullOrWhiteSpace(inputMessage.FilePath, nameof(inputMessage.FilePath));
+ Assumes.IsTrue(File.Exists(inputMessage.FilePath), nameof(inputMessage.FilePath));
+
+ string? inputFileExtension = Path.GetExtension(inputMessage.FilePath);
+ Assumes.NotNullOrWhiteSpace(inputFileExtension, nameof(inputFileExtension));
+
+ StorageFolder localCacheFolder = ApplicationData.Current.LocalCacheFolder;
+ string localCacheFolderFullPath = localCacheFolder.Path;
+
+ string tempFilePath = Path.Combine(localCacheFolderFullPath, inputMessage.MessageId!.ToString()! + inputFileExtension);
+
+ File.Copy(inputMessage.FilePath, tempFilePath, true);
+
+ try
+ {
+ var oldFileInfo = new FileInfo(tempFilePath);
+ long fileSizeBeforeCompression = oldFileInfo.Length;
+
+ var ectProcessStartInfo = new ProcessStartInfo(ectFullPath)
+ {
+ Arguments = $"-5 --allfilters-c \"{tempFilePath}\"",
+ UseShellExecute = false,
+ CreateNoWindow = true,
+ WindowStyle = ProcessWindowStyle.Hidden,
+ RedirectStandardOutput = true,
+ RedirectStandardError = true
+ };
+
+ var output = new StringBuilder();
+ var errors = new StringBuilder();
+ using (Process ectProcess = Process.Start(ectProcessStartInfo)!)
+ {
+ ectProcess.OutputDataReceived += (s, e) =>
+ {
+ lock (output)
+ {
+ if (e.Data is not null)
+ {
+ output.AppendLine(e.Data);
+ }
+ }
+ };
+
+ ectProcess.ErrorDataReceived += (s, e) =>
+ {
+ lock (errors)
+ {
+ if (e.Data is not null)
+ {
+ errors.AppendLine(e.Data);
+ }
+ }
+ };
+
+ ectProcess.BeginErrorReadLine();
+ ectProcess.BeginOutputReadLine();
+
+ try
+ {
+ await ectProcess.WaitForExitAsync(cancellationToken);
+ }
+ catch (OperationCanceledException)
+ {
+ ectProcess.Kill();
+ throw;
+ }
+ }
+
+ var newFileInfo = new FileInfo(tempFilePath);
+ long fileSizeAfterCompression = newFileInfo.Length;
+
+ return new PngJpgCompressorWorkResultMessage
+ {
+ ErrorMessage = errors.ToString(),
+ NewFileSize = fileSizeAfterCompression,
+ PercentageSaved = 1.0 - (fileSizeAfterCompression / (double)fileSizeBeforeCompression),
+ TempCompressedFilePath = tempFilePath
+ };
+ }
+ catch (Exception)
+ {
+ // cleanup
+ File.Delete(tempFilePath);
+ throw;
+ }
+ }
+ }
+}
diff --git a/src/dev/impl/DevToys.OutOfProcService/OutOfProcServices/ShutdownService.cs b/src/dev/impl/DevToys.OutOfProcService/OutOfProcServices/ShutdownService.cs
index 578337635..5079534c9 100644
--- a/src/dev/impl/DevToys.OutOfProcService/OutOfProcServices/ShutdownService.cs
+++ b/src/dev/impl/DevToys.OutOfProcService/OutOfProcServices/ShutdownService.cs
@@ -1,4 +1,5 @@
using System.Composition;
+using System.Threading;
using System.Threading.Tasks;
using DevToys.OutOfProcService.API.Core.OOP;
using DevToys.OutOfProcService.Core.OOP;
@@ -17,7 +18,7 @@ namespace DevToys.OutOfProcService.OutOfProcServices
_appService = appService;
}
- protected override Task<ShutdownMessage> ProcessMessageAsync(ShutdownMessage inputMessage)
+ protected override Task<ShutdownMessage> ProcessMessageAsync(ShutdownMessage inputMessage, CancellationToken cancellationToken)
{
_appService.IndicateAppServiceConnectionLost();
return Task.FromResult(inputMessage);
diff --git a/src/dev/impl/DevToys/Api/Core/OOP/IAppService.cs b/src/dev/impl/DevToys/Api/Core/OOP/IAppService.cs
index 19dfb71b0..674f08b37 100644
--- a/src/dev/impl/DevToys/Api/Core/OOP/IAppService.cs
+++ b/src/dev/impl/DevToys/Api/Core/OOP/IAppService.cs
@@ -1,4 +1,5 @@
using System;
+using System.Threading;
using System.Threading.Tasks;
using DevToys.Shared.Core.OOP;
@@ -11,6 +12,10 @@ namespace DevToys.Api.Core.OOP
{
Task<T> SendMessageAndGetResponseAsync<T>(AppServiceMessageBase message) where T : AppServiceMessageBase;
+ Task<T> SendMessageAndGetResponseAsync<T>(AppServiceMessageBase message, CancellationToken cancellationToken) where T : AppServiceMessageBase;
+
Task<T> SendMessageAndGetResponseAsync<T>(AppServiceMessageBase message, IProgress<AppServiceProgressMessage> progress) where T : AppServiceMessageBase;
+
+ Task<T> SendMessageAndGetResponseAsync<T>(AppServiceMessageBase message, IProgress<AppServiceProgressMessage> progress, CancellationToken cancellationToken) where T : AppServiceMessageBase;
}
}
diff --git a/src/dev/impl/DevToys/Api/Tools/IToolProviderFactory.cs b/src/dev/impl/DevToys/Api/Tools/IToolProviderFactory.cs
index 135c18458..a79f26cf1 100644
--- a/src/dev/impl/DevToys/Api/Tools/IToolProviderFactory.cs
+++ b/src/dev/impl/DevToys/Api/Tools/IToolProviderFactory.cs
@@ -1,6 +1,7 @@
#nullable enable
using System.Collections.Generic;
+using System.Threading.Tasks;
namespace DevToys.Api.Tools
{
@@ -29,5 +30,10 @@ namespace DevToys.Api.Tools
/// Gets the list of tools available that have the <see cref="IsFooterItemAttribute"/>.
/// </summary>
IEnumerable<MatchedToolProvider> GetFooterTools();
+
+ /// <summary>
+ /// Called when the app is shutting down. Asks ever tools to cleanup resources.
+ /// </summary>
+ Task CleanupAsync();
}
}
diff --git a/src/dev/impl/DevToys/App.xaml.cs b/src/dev/impl/DevToys/App.xaml.cs
index 43385a0e2..ad2e5c74c 100644
--- a/src/dev/impl/DevToys/App.xaml.cs
+++ b/src/dev/impl/DevToys/App.xaml.cs
@@ -7,6 +7,7 @@ using DevToys.Api.Core;
using DevToys.Api.Core.Navigation;
using DevToys.Api.Core.Settings;
using DevToys.Api.Core.Theme;
+using DevToys.Api.Tools;
using DevToys.Core;
using DevToys.Core.Settings;
using DevToys.Core.Threading;
@@ -188,6 +189,8 @@ namespace DevToys
{
Logger.LogFault("Unhandled problem", e.Exception);
await (await _marketingService.GetValueAsync()).NotifyAppEncounteredAProblemAsync();
+
+ await (await _mefComposer).ExportProvider.GetExport<IToolProviderFactory>().CleanupAsync();
}
private async Task<Frame> EnsureWindowIsInitializedAsync()
diff --git a/src/dev/impl/DevToys/Core/Logger.cs b/src/dev/impl/DevToys/Core/Logger.cs
index 2b0a4b690..a01db0dfb 100644
--- a/src/dev/impl/DevToys/Core/Logger.cs
+++ b/src/dev/impl/DevToys/Core/Logger.cs
@@ -41,6 +41,14 @@ namespace DevToys.Core
}
}
+ internal static void Log(string featureName, string message)
+ {
+ lock (_semaphore)
+ {
+ LogFaultAsync(featureName, null, message).ForgetSafely();
+ }
+ }
+
internal static void LogFault(string featureName, Exception ex, string? message = null)
{
lock (_semaphore)
@@ -49,7 +57,7 @@ namespace DevToys.Core
}
}
- private static async Task LogFaultAsync(string featureName, Exception ex, string? message)
+ private static async Task LogFaultAsync(string featureName, Exception? ex, string? message)
{
await TaskScheduler.Default;
@@ -61,18 +69,33 @@ namespace DevToys.Core
StorageFile logFile = await localCacheFolder.CreateFileAsync(LogFileName, CreationCollisionOption.OpenIfExists);
- var logsLine = new List<string>
+ if (ex is null)
+ {
+ var logsLine = new List<string>
+ {
+ $"# - [{DateTime.Now.ToString("G", DateTimeFormatInfo.InvariantInfo)}]",
+ $"Feature name: {featureName}",
+ $"Custom message: {message ?? string.Empty}",
+ string.Empty // empty line
+ };
+
+ await FileIO.AppendLinesAsync(logFile, logsLine);
+ }
+ else
{
- $"# - [{DateTime.Now.ToString("G", DateTimeFormatInfo.InvariantInfo)}]",
- $"Feature name: {featureName}",
- $"Custom message: {message ?? string.Empty}",
- $"Exception message: {ex.Message}",
- $"Exception stack trace:",
- ex.StackTrace,
- string.Empty // empty line
- };
+ var logsLine = new List<string>
+ {
+ $"# - [{DateTime.Now.ToString("G", DateTimeFormatInfo.InvariantInfo)}]",
+ $"Feature name: {featureName}",
+ $"Custom message: {message ?? string.Empty}",
+ $"Exception message: {ex.Message}",
+ $"Exception stack trace:",
+ ex.StackTrace,
+ string.Empty // empty line
+ };
- await FileIO.AppendLinesAsync(logFile, logsLine);
+ await FileIO.AppendLinesAsync(logFile, logsLine);
+ }
}
}
catch (Exception)
diff --git a/src/dev/impl/DevToys/Core/OOP/AppService.cs b/src/dev/impl/DevToys/Core/OOP/AppService.cs
index 83a012ba3..87b792f03 100644
--- a/src/dev/impl/DevToys/Core/OOP/AppService.cs
+++ b/src/dev/impl/DevToys/Core/OOP/AppService.cs
@@ -25,6 +25,7 @@ namespace DevToys.Core.OOP
private const string FullTrustAppContractName = "Windows.ApplicationModel.FullTrustAppContract";
private const string PipeName = "LOCAL\\{0}";
+ private readonly DisposableSempahore _sempahore = new();
private readonly ConcurrentDictionary<Guid, TaskCompletionSource<AppServiceMessageBase>> _inProgressMessages = new();
private readonly ConcurrentDictionary<Guid, IProgress<AppServiceProgressMessage>> _progressReporters = new();
private NamedPipeServerStream? _pipeServerStream;
@@ -37,18 +38,32 @@ namespace DevToys.Core.OOP
public Task<T> SendMessageAndGetResponseAsync<T>(AppServiceMessageBase message) where T : AppServiceMessageBase
{
- return SendMessageAndGetResponseAsync<T>(message, DummyProgress.DefaultInstance);
+ return SendMessageAndGetResponseAsync<T>(message, CancellationToken.None);
}
- public async Task<T> SendMessageAndGetResponseAsync<T>(AppServiceMessageBase message, IProgress<AppServiceProgressMessage> progress) where T : AppServiceMessageBase
+ public Task<T> SendMessageAndGetResponseAsync<T>(AppServiceMessageBase message, CancellationToken cancellationToken) where T : AppServiceMessageBase
+ {
+ return SendMessageAndGetResponseAsync<T>(message, DummyProgress.DefaultInstance, cancellationToken);
+ }
+
+ public Task<T> SendMessageAndGetResponseAsync<T>(AppServiceMessageBase message, IProgress<AppServiceProgressMessage> progress) where T : AppServiceMessageBase
+ {
+ return SendMessageAndGetResponseAsync<T>(message, progress, CancellationToken.None);
+ }
+
+ public async Task<T> SendMessageAndGetResponseAsync<T>(AppServiceMessageBase message, IProgress<AppServiceProgressMessage> progress, CancellationToken cancellationToken) where T : AppServiceMessageBase
{
Arguments.NotNull(progress, nameof(progress));
- AppServiceMessageBase? result = await SendMessageAsync(message, progress);
+ AppServiceMessageBase? result = await InternalSendMessageAndGetResponseAsync(message, progress, cancellationToken);
if (result is null)
{
throw new Exception("Unable to send a message to the app service.");
}
+ else if (result is AppServiceCancelMessage)
+ {
+ throw new OperationCanceledException("The message sent through the app service has been canceled.");
+ }
return (T)result;
}
@@ -65,39 +80,47 @@ namespace DevToys.Core.OOP
deferral.Complete();
}
- private async Task<AppServiceMessageBase?> SendMessageAsync(AppServiceMessageBase message, IProgress<AppServiceProgressMessage> progress)
+ private async Task<AppServiceMessageBase?> InternalSendMessageAndGetResponseAsync(AppServiceMessageBase message, IProgress<AppServiceProgressMessage> progress, CancellationToken cancellationToken)
{
Arguments.NotNull(message, nameof(message));
Arguments.NotNull(progress, nameof(progress));
try
{
- await TaskScheduler.Default;
+ var messageId = Guid.NewGuid();
+ var messageCompletionSource = new TaskCompletionSource<AppServiceMessageBase>();
- // Make sure we're connected to the app service.
- await ConnectAsync();
- ThrowIfNotConnected();
+ using (await _sempahore.WaitAsync(cancellationToken))
+ {
+ await TaskScheduler.Default;
- // Give a unique ID to the message.
- message.MessageId = Guid.NewGuid();
+ // Make sure we're connected to the app service.
+ await ConnectAsync();
+ ThrowIfNotConnected();
+ cancellationToken.ThrowIfCancellationRequested();
- // start tracking the message.
- var messageCompletionSource = new TaskCompletionSource<AppServiceMessageBase>();
- _inProgressMessages.TryAdd(message.MessageId.Value, messageCompletionSource);
- _progressReporters.TryAdd(message.MessageId.Value, progress);
+ // Give a unique ID to the message.
+ message.MessageId = messageId;
- // Send the message.
- string jsonMessage = JsonConvert.SerializeObject(message, Shared.Constants.AppServiceJsonSerializerSettings);
- byte[] messageBuffer = Encoding.UTF8.GetBytes(jsonMessage);
+ // start tracking the message.
+ _inProgressMessages.TryAdd(message.MessageId.Value, messageCompletionSource);
+ _progressReporters.TryAdd(message.MessageId.Value, progress);
- _pipeServerStream!.Write(messageBuffer, 0, messageBuffer.Length);
- _pipeServerStream.Flush();
- _pipeServerStream.WaitForPipeDrain();
+ // Send the message.
+ SendMessage(message);
+ }
// Wait for the answer of the app service.
- AppServiceMessageBase result = await messageCompletionSource.Task;
- _progressReporters.TryRemove(message.MessageId.Value, out _);
- return result;
+ using (CancellationTokenRegistration cancellationTokenRegistration
+ = cancellationToken.Register(() =>
+ {
+ OnSendMessageCanceledAsync(messageId).Forget();
+ }))
+ {
+ AppServiceMessageBase result = await messageCompletionSource.Task;
+ _progressReporters.TryRemove(message.MessageId.Value, out _);
+ return result;
+ }
}
catch (Exception ex)
{
@@ -107,7 +130,33 @@ namespace DevToys.Core.OOP
return null;
}
- internal void Disconnect()
+ private void SendMessage(AppServiceMessageBase message)
+ {
+ string jsonMessage = JsonConvert.SerializeObject(message, Shared.Constants.AppServiceJsonSerializerSettings);
+ byte[] messageBuffer = Encoding.UTF8.GetBytes(jsonMessage);
+
+ _pipeServerStream!.Write(messageBuffer, 0, messageBuffer.Length);
+ _pipeServerStream.Flush();
+ _pipeServerStream.WaitForPipeDrain();
+ }
+
+ private async Task OnSendMessageCanceledAsync(Guid messageId)
+ {
+ ThrowIfNotConnected();
+ using (await _sempahore.WaitAsync(CancellationToken.None))
+ {
+ await TaskScheduler.Default;
+
+ // Send the cancellation message.
+ var message = new AppServiceCancelMessage
+ {
+ MessageId = messageId
+ };
+ SendMessage(message);
+ }
+ }
+
+ private void Disconnect()
{
foreach (TaskCompletionSource<AppServiceMessageBase>? messageCompletionSource in _inProgressMessages.Values)
{
diff --git a/src/dev/impl/DevToys/Core/ToolProviderFactory.cs b/src/dev/impl/DevToys/Core/ToolProviderFactory.cs
index 27cb4c027..8eaff054c 100644
--- a/src/dev/impl/DevToys/Core/ToolProviderFactory.cs
+++ b/src/dev/impl/DevToys/Core/ToolProviderFactory.cs
@@ -4,7 +4,9 @@ using System;
using System.Collections.Generic;
using System.Composition;
using System.Linq;
+using System.Threading.Tasks;
using DevToys.Api.Tools;
+using DevToys.Core;
namespace DevToys.Providers.Impl
{
@@ -19,6 +21,8 @@ namespace DevToys.Providers.Impl
[ImportMany] IEnumerable<Lazy<IToolProvider, ToolProviderMetadata>> providers)
{
_providers = providers;
+
+ App.Current.Suspending += OnAppSuspending; ;
}
public IToolViewModel GetToolViewModel(IToolProvider provider)
@@ -92,5 +96,35 @@ namespace DevToys.Providers.Impl
yield return new MatchedToolProvider(provider.Metadata, provider.Value, matches);
}
}
+
+ public async Task CleanupAsync()
+ {
+ foreach (IToolViewModel toolViewModel in _toolProviderToViewModelCache.Values)
+ {
+ try
+ {
+ if (toolViewModel is IDisposable disposable)
+ {
+ disposable.Dispose();
+ }
+
+ if (toolViewModel is IAsyncDisposable asyncDisposable)
+ {
+ await asyncDisposable.DisposeAsync();
+ }
+ }
+ catch (Exception ex)
+ {
+ Logger.LogFault("ToolProviderFactory", ex, $"Unable to cleanup the tool '{toolViewModel.GetType().Name}'.");
+ }
+ }
+
+ _toolProviderToViewModelCache.Clear();
+ }
+
+ private async void OnAppSuspending(object sender, Windows.ApplicationModel.SuspendingEventArgs e)
+ {
+ await CleanupAsync();
+ }
}
}
diff --git a/src/dev/impl/DevToys/DevToys.csproj b/src/dev/impl/DevToys/DevToys.csproj
index 76d399490..0bf2d4172 100644
--- a/src/dev/impl/DevToys/DevToys.csproj
+++ b/src/dev/impl/DevToys/DevToys.csproj
@@ -24,11 +24,18 @@
<Compile Include="Api\Core\OOP\IAppService.cs" />
<Compile Include="Core\OOP\AppService.cs" />
<Compile Include="Core\Threading\AsyncLazy.cs" />
+ <Compile Include="UI\Converters\BooleanToDoubleConverter.cs" />
<Compile Include="ViewModels\Tools\HtmlEncoderDecoder\HtmlEncoderDecoderToolProvider.cs" />
<Compile Include="ViewModels\Tools\HtmlEncoderDecoder\HtmlEncoderDecoderToolViewModel.cs" />
+ <Compile Include="ViewModels\Tools\PngJpgCompressor\ImageCompressionWorkItem.cs" />
+ <Compile Include="ViewModels\Tools\PngJpgCompressor\PngJpgCompressorToolProvider.cs" />
+ <Compile Include="ViewModels\Tools\PngJpgCompressor\PngJpgCompressorToolViewModel.cs" />
<Compile Include="Views\Tools\HtmlEncoderDecoder\HtmlEncoderDecoderToolPage.xaml.cs">
<DependentUpon>HtmlEncoderDecoderToolPage.xaml</DependentUpon>
</Compile>
+ <Compile Include="Views\Tools\PngJpgCompressor\PngJpgCompressorToolPage.xaml.cs">
+ <DependentUpon>PngJpgCompressorToolPage.xaml</DependentUpon>
+ </Compile>
<Compile Include="Views\Tools\URLEncoderDecoder\UrlEncoderDecoderToolPage.xaml.cs">
<DependentUpon>UrlEncoderDecoderToolPage.xaml</DependentUpon>
</Compile>
@@ -346,6 +353,7 @@
<AppxManifest Include="Package.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
+ <PRIResource Include="Strings\en-US\PngJpgCompressor.resw" />
<Page Include="Themes\Custom.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@@ -406,6 +414,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
+ <Page Include="Views\Tools\PngJpgCompressor\PngJpgCompressorToolPage.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
<Page Include="Views\Tools\RegEx\RegExToolPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
diff --git a/src/dev/impl/DevToys/LanguageManager.cs b/src/dev/impl/DevToys/LanguageManager.cs
index a35383ef7..156fb2f7b 100644
--- a/src/dev/impl/DevToys/LanguageManager.cs
+++ b/src/dev/impl/DevToys/LanguageManager.cs
@@ -34,6 +34,7 @@ namespace DevToys
private readonly JwtDecoderEncoderStrings _jwtdecoderencoder = new JwtDecoderEncoderStrings();
private readonly MainPageStrings _mainpage = new MainPageStrings();
private readonly MarkdownPreviewStrings _markdownpreview = new MarkdownPreviewStrings();
+ private readonly PngJpgCompressorStrings _pngjpgcompressor = new PngJpgCompressorStrings();
private readonly RegExStrings _regex = new RegExStrings();
private readonly SettingsStrings _settings = new SettingsStrings();
private readonly StringUtilitiesStrings _stringutilities = new StringUtilitiesStrings();
@@ -100,6 +101,11 @@ namespace DevToys
/// </summary>
public MarkdownPreviewStrings MarkdownPreview => _markdownpreview;
+ /// <summary>
+ /// Gets the <see cref="PngJpgCompressorStrings"/>.
+ /// </summary>
+ public PngJpgCompressorStrings PngJpgCompressor => _pngjpgcompressor;
+
/// <summary>
/// Gets the <see cref="RegExStrings"/>.
/// </summary>
@@ -241,6 +247,11 @@ namespace DevToys
{
private readonly ResourceLoader _resources = ResourceLoader.GetForViewIndependentUse("Common");
+ /// <summary>
+ /// Gets the resource Bytes.
+ /// </summary>
+ public string Bytes => _resources.GetString("Bytes");
+
/// <summary>
/// Gets the resource Clear.
/// </summary>
@@ -261,6 +272,21 @@ namespace DevToys
/// </summary>
public string Delete => _resources.GetString("Delete");
+ /// <summary>
+ /// Gets the resource Gigabytes.
+ /// </summary>
+ public string Gigabytes => _resources.GetString("Gigabytes");
+
+ /// <summary>
+ /// Gets the resource Kilobytes.
+ /// </summary>
+ public string Kilobytes => _resources.GetString("Kilobytes");
+
+ /// <summary>
+ /// Gets the resource Megabytes.
+ /// </summary>
+ public string Megabytes => _resources.GetString("Megabytes");
+
/// <summary>
/// Gets the resource OpenFile.
/// </summary>
@@ -281,6 +307,11 @@ namespace DevToys
/// </summary>
public string SelectAll => _resources.GetString("SelectAll");
+ /// <summary>
+ /// Gets the resource Terabytes.
+ /// </summary>
+ public string Terabytes => _resources.GetString("Terabytes");
+
/// <summary>
/// Gets the resource ToggleSwitchOff.
/// </summary>
@@ -753,6 +784,86 @@ namespace DevToys
public string ThemeDescription => _resources.GetString("ThemeDescription");
}
+ public class PngJpgCompressorStrings : ObservableObject
+ {
+ private readonly ResourceLoader _resources = ResourceLoader.GetForViewIndependentUse("PngJpgCompressor");
+
+ /// <summary>
+ /// Gets the resource Cancel.
+ /// </summary>
+ public string Cancel => _resources.GetString("Cancel");
+
+ /// <summary>
+ /// Gets the resource Configuration.
+ /// </summary>
+ public string Configuration => _resources.GetString("Configuration");
+
+ /// <summary>
+ /// Gets the resource Delete.
+ /// </summary>
+ public string Delete => _resources.GetString("Delete");
+
+ /// <summary>
+ /// Gets the resource DeleteAll.
+ /// </summary>
+ public string DeleteAll => _resources.GetString("DeleteAll");
+
+ /// <summary>
+ /// Gets the resource DetailsTitle.
+ /// </summary>
+ public string DetailsTitle => _resources.GetString("DetailsTitle");
+
+ /// <summary>
+ /// Gets the resource DisplayName.
+ /// </summary>
+ public string DisplayName => _resources.GetString("DisplayName");
+
+ /// <summary>
+ /// Gets the resource FileSizeDisplay.
+ /// </summary>
+ public string FileSizeDisplay => _resources.GetString("FileSizeDisplay");
+
+ /// <summary>
+ /// Gets the resource InvalidSelectedFiles.
+ /// </summary>
+ public string InvalidSelectedFiles => _resources.GetString("InvalidSelectedFiles");
+
+ /// <summary>
+ /// Gets the resource OK.
+ /// </summary>
+ public string OK => _resources.GetString("OK");
+
+ /// <summary>
+ /// Gets the resource SaveAll.
+ /// </summary>
+ public string SaveAll => _resources.GetString("SaveAll");
+
+ /// <summary>
+ /// Gets the resource SaveAs.
+ /// </summary>
+ public string SaveAs => _resources.GetString("SaveAs");
+
+ /// <summary>
+ /// Gets the resource SeeErrorMessage.
+ /// </summary>
+ public string SeeErrorMessage => _resources.GetString("SeeErrorMessage");
+
+ /// <summary>
+ /// Gets the resource SelectFilesInstruction1.
+ /// </summary>
+ public string SelectFilesInstruction1 => _resources.GetString("SelectFilesInstruction1");
+
+ /// <summary>
+ /// Gets the resource SelectFilesInstruction2.
+ /// </summary>
+ public string SelectFilesInstruction2 => _resources.GetString("SelectFilesInstruction2");
+
+ /// <summary>
+ /// Gets the resource SelectFilesInstruction3.
+ /// </summary>
+ public string SelectFilesInstruction3 => _resources.GetString("SelectFilesInstruction3");
+ }
+
public class RegExStrings : ObservableObject
{
private readonly ResourceLoader _resources = ResourceLoader.GetForViewIndependentUse("RegEx");
diff --git a/src/dev/impl/DevToys/Strings/cs-CZ/Common.resw b/src/dev/impl/DevToys/Strings/cs-CZ/Common.resw
index 0e874df41..b4d9e275c 100644
--- a/src/dev/impl/DevToys/Strings/cs-CZ/Common.resw
+++ b/src/dev/impl/DevToys/Strings/cs-CZ/Common.resw
@@ -117,6 +117,9 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
+ <data name="Bytes" xml:space="preserve">
+ <value>Bytes</value>
+ </data>
<data name="Clear" xml:space="preserve">
<value>Vymazat</value>
</data>
@@ -129,6 +132,15 @@
<data name="Delete" xml:space="preserve">
<value>Odstranit</value>
</data>
+ <data name="Gigabytes" xml:space="preserve">
+ <value>GB</value>
+ </data>
+ <data name="Kilobytes" xml:space="preserve">
+ <value>KB</value>
+ </data>
+ <data name="Megabytes" xml:space="preserve">
+ <value>MB</value>
+ </data>
<data name="OpenFile" xml:space="preserve">
<value>Načíst soubor</value>
</data>
@@ -141,6 +153,9 @@
<data name="SelectAll" xml:space="preserve">
<value>Vybrat vše</value>
</data>
+ <data name="Terabytes" xml:space="preserve">
+ <value>TB</value>
+ </data>
<data name="ToggleSwitchOff" xml:space="preserve">
<value>Vypnuto</value>
</data>
diff --git a/src/dev/impl/DevToys/Strings/cs-CZ/PngJpgCompressor.resw b/src/dev/impl/DevToys/Strings/cs-CZ/PngJpgCompressor.resw
new file mode 100644
index 000000000..b61aef2e6
--- /dev/null
+++ b/src/dev/impl/DevToys/Strings/cs-CZ/PngJpgCompressor.resw
@@ -0,0 +1,166 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <data name="Cancel" xml:space="preserve">
+ <value>Cancel</value>
+ </data>
+ <data name="Configuration" xml:space="preserve">
+ <value>Configuration</value>
+ </data>
+ <data name="Delete" xml:space="preserve">
+ <value>Delete</value>
+ </data>
+ <data name="DeleteAll" xml:space="preserve">
+ <value>Delete all</value>
+ </data>
+ <data name="DetailsTitle" xml:space="preserve">
+ <value>Details</value>
+ </data>
+ <data name="DisplayName" xml:space="preserve">
+ <value>PNG/JPG Compressor</value>
+ </data>
+ <data name="FileSizeDisplay" xml:space="preserve">
+ <value>{0:0.##} {1}</value>
+ <comment>{0} is a decimal number representing a file size. {1} is a unit, like Bytes, KB, MB, GB, TB</comment>
+ </data>
+ <data name="InvalidSelectedFiles" xml:space="preserve">
+ <value>Only .png, .jpg and .jpeg files can be used.</value>
+ </data>
+ <data name="OK" xml:space="preserve">
+ <value>OK</value>
+ </data>
+ <data name="SaveAll" xml:space="preserve">
+ <value>Save all</value>
+ </data>
+ <data name="SaveAs" xml:space="preserve">
+ <value>Save as</value>
+ </data>
+ <data name="SeeErrorMessage" xml:space="preserve">
+ <value>See details</value>
+ </data>
+ <data name="SelectFilesInstruction1" xml:space="preserve">
+ <value>Drag &amp; drop PNG or JPEG files here</value>
+ </data>
+ <data name="SelectFilesInstruction2" xml:space="preserve">
+ <value>or</value>
+ </data>
+ <data name="SelectFilesInstruction3" xml:space="preserve">
+ <value>Browse files</value>
+ </data>
+</root>
\ No newline at end of file
diff --git a/src/dev/impl/DevToys/Strings/en-US/Common.resw b/src/dev/impl/DevToys/Strings/en-US/Common.resw
index eefddf40d..d82823e8b 100644
--- a/src/dev/impl/DevToys/Strings/en-US/Common.resw
+++ b/src/dev/impl/DevToys/Strings/en-US/Common.resw
@@ -117,6 +117,9 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
+ <data name="Bytes" xml:space="preserve">
+ <value>Bytes</value>
+ </data>
<data name="Clear" xml:space="preserve">
<value>Clear</value>
</data>
@@ -129,6 +132,15 @@
<data name="Delete" xml:space="preserve">
<value>Delete</value>
</data>
+ <data name="Gigabytes" xml:space="preserve">
+ <value>GB</value>
+ </data>
+ <data name="Kilobytes" xml:space="preserve">
+ <value>KB</value>
+ </data>
+ <data name="Megabytes" xml:space="preserve">
+ <value>MB</value>
+ </data>
<data name="OpenFile" xml:space="preserve">
<value>Load a file</value>
</data>
@@ -141,6 +153,9 @@
<data name="SelectAll" xml:space="preserve">
<value>Select all</value>
</data>
+ <data name="Terabytes" xml:space="preserve">
+ <value>TB</value>
+ </data>
<data name="ToggleSwitchOff" xml:space="preserve">
<value>Off</value>
</data>
diff --git a/src/dev/impl/DevToys/Strings/en-US/PngJpgCompressor.resw b/src/dev/impl/DevToys/Strings/en-US/PngJpgCompressor.resw
new file mode 100644
index 000000000..b61aef2e6
--- /dev/null
+++ b/src/dev/impl/DevToys/Strings/en-US/PngJpgCompressor.resw
@@ -0,0 +1,166 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <data name="Cancel" xml:space="preserve">
+ <value>Cancel</value>
+ </data>
+ <data name="Configuration" xml:space="preserve">
+ <value>Configuration</value>
+ </data>
+ <data name="Delete" xml:space="preserve">
+ <value>Delete</value>
+ </data>
+ <data name="DeleteAll" xml:space="preserve">
+ <value>Delete all</value>
+ </data>
+ <data name="DetailsTitle" xml:space="preserve">
+ <value>Details</value>
+ </data>
+ <data name="DisplayName" xml:space="preserve">
+ <value>PNG/JPG Compressor</value>
+ </data>
+ <data name="FileSizeDisplay" xml:space="preserve">
+ <value>{0:0.##} {1}</value>
+ <comment>{0} is a decimal number representing a file size. {1} is a unit, like Bytes, KB, MB, GB, TB</comment>
+ </data>
+ <data name="InvalidSelectedFiles" xml:space="preserve">
+ <value>Only .png, .jpg and .jpeg files can be used.</value>
+ </data>
+ <data name="OK" xml:space="preserve">
+ <value>OK</value>
+ </data>
+ <data name="SaveAll" xml:space="preserve">
+ <value>Save all</value>
+ </data>
+ <data name="SaveAs" xml:space="preserve">
+ <value>Save as</value>
+ </data>
+ <data name="SeeErrorMessage" xml:space="preserve">
+ <value>See details</value>
+ </data>
+ <data name="SelectFilesInstruction1" xml:space="preserve">
+ <value>Drag &amp; drop PNG or JPEG files here</value>
+ </data>
+ <data name="SelectFilesInstruction2" xml:space="preserve">
+ <value>or</value>
+ </data>
+ <data name="SelectFilesInstruction3" xml:space="preserve">
+ <value>Browse files</value>
+ </data>
+</root>
\ No newline at end of file
diff --git a/src/dev/impl/DevToys/Strings/fr-FR/Common.resw b/src/dev/impl/DevToys/Strings/fr-FR/Common.resw
index 3484ac0cb..299e15d45 100644
--- a/src/dev/impl/DevToys/Strings/fr-FR/Common.resw
+++ b/src/dev/impl/DevToys/Strings/fr-FR/Common.resw
@@ -117,6 +117,9 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
+ <data name="Bytes" xml:space="preserve">
+ <value>Bytes</value>
+ </data>
<data name="Clear" xml:space="preserve">
<value>Effacer</value>
</data>
@@ -129,6 +132,15 @@
<data name="Delete" xml:space="preserve">
<value>Supprimer</value>
</data>
+ <data name="Gigabytes" xml:space="preserve">
+ <value>GO</value>
+ </data>
+ <data name="Kilobytes" xml:space="preserve">
+ <value>KO</value>
+ </data>
+ <data name="Megabytes" xml:space="preserve">
+ <value>MO</value>
+ </data>
<data name="OpenFile" xml:space="preserve">
<value>Ouvrir un fichier</value>
</data>
@@ -141,6 +153,9 @@
<data name="SelectAll" xml:space="preserve">
<value>Sélectionner tout</value>
</data>
+ <data name="Terabytes" xml:space="preserve">
+ <value>TO</value>
+ </data>
<data name="ToggleSwitchOff" xml:space="preserve">
<value>Désactivé</value>
</data>
diff --git a/src/dev/impl/DevToys/Strings/fr-FR/PngJpgCompressor.resw b/src/dev/impl/DevToys/Strings/fr-FR/PngJpgCompressor.resw
new file mode 100644
index 000000000..f120ab806
--- /dev/null
+++ b/src/dev/impl/DevToys/Strings/fr-FR/PngJpgCompressor.resw
@@ -0,0 +1,166 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <data name="Cancel" xml:space="preserve">
+ <value>Annuler</value>
+ </data>
+ <data name="Configuration" xml:space="preserve">
+ <value>Configuration</value>
+ </data>
+ <data name="Delete" xml:space="preserve">
+ <value>Supprimer</value>
+ </data>
+ <data name="DeleteAll" xml:space="preserve">
+ <value>Supprimer tout</value>
+ </data>
+ <data name="DetailsTitle" xml:space="preserve">
+ <value>Détails</value>
+ </data>
+ <data name="DisplayName" xml:space="preserve">
+ <value>Compresseur de PNG/JPG</value>
+ </data>
+ <data name="FileSizeDisplay" xml:space="preserve">
+ <value>{0:0.##} {1}</value>
+ <comment>{0} is a decimal number representing a file size. {1} is a unit, like Bytes, KB, MB, GB, TB</comment>
+ </data>
+ <data name="InvalidSelectedFiles" xml:space="preserve">
+ <value>Seul des fichiers .png, .jpg et .jpeg peuvent être utilisés.</value>
+ </data>
+ <data name="OK" xml:space="preserve">
+ <value>OK</value>
+ </data>
+ <data name="SaveAll" xml:space="preserve">
+ <value>Enregistrer tout</value>
+ </data>
+ <data name="SaveAs" xml:space="preserve">
+ <value>Enregistrer-sous</value>
+ </data>
+ <data name="SeeErrorMessage" xml:space="preserve">
+ <value>Voir les détails</value>
+ </data>
+ <data name="SelectFilesInstruction1" xml:space="preserve">
+ <value>Glissez &amp; déposez des fichiers PNG ou JPEG ici</value>
+ </data>
+ <data name="SelectFilesInstruction2" xml:space="preserve">
+ <value>ou</value>
+ </data>
+ <data name="SelectFilesInstruction3" xml:space="preserve">
+ <value>Selectionner des fichiers</value>
+ </data>
+</root>
\ No newline at end of file
diff --git a/src/dev/impl/DevToys/Strings/pl-PL/Common.resw b/src/dev/impl/DevToys/Strings/pl-PL/Common.resw
index e19bb6a5c..ec01ade21 100644
--- a/src/dev/impl/DevToys/Strings/pl-PL/Common.resw
+++ b/src/dev/impl/DevToys/Strings/pl-PL/Common.resw
@@ -117,6 +117,9 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
+ <data name="Bytes" xml:space="preserve">
+ <value>Bytes</value>
+ </data>
<data name="Clear" xml:space="preserve">
<value>Wyczyść</value>
</data>
@@ -129,6 +132,15 @@
<data name="Delete" xml:space="preserve">
<value>Usuń</value>
</data>
+ <data name="Gigabytes" xml:space="preserve">
+ <value>GB</value>
+ </data>
+ <data name="Kilobytes" xml:space="preserve">
+ <value>KB</value>
+ </data>
+ <data name="Megabytes" xml:space="preserve">
+ <value>MB</value>
+ </data>
<data name="OpenFile" xml:space="preserve">
<value>Wczyaj plik</value>
</data>
@@ -141,6 +153,9 @@
<data name="SelectAll" xml:space="preserve">
<value>Zaznacz wszystko</value>
</data>
+ <data name="Terabytes" xml:space="preserve">
+ <value>TB</value>
+ </data>
<data name="ToggleSwitchOff" xml:space="preserve">
<value>Wyłączone</value>
</data>
diff --git a/src/dev/impl/DevToys/Strings/pl-PL/PngJpgCompressor.resw b/src/dev/impl/DevToys/Strings/pl-PL/PngJpgCompressor.resw
new file mode 100644
index 000000000..b61aef2e6
--- /dev/null
+++ b/src/dev/impl/DevToys/Strings/pl-PL/PngJpgCompressor.resw
@@ -0,0 +1,166 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <data name="Cancel" xml:space="preserve">
+ <value>Cancel</value>
+ </data>
+ <data name="Configuration" xml:space="preserve">
+ <value>Configuration</value>
+ </data>
+ <data name="Delete" xml:space="preserve">
+ <value>Delete</value>
+ </data>
+ <data name="DeleteAll" xml:space="preserve">
+ <value>Delete all</value>
+ </data>
+ <data name="DetailsTitle" xml:space="preserve">
+ <value>Details</value>
+ </data>
+ <data name="DisplayName" xml:space="preserve">
+ <value>PNG/JPG Compressor</value>
+ </data>
+ <data name="FileSizeDisplay" xml:space="preserve">
+ <value>{0:0.##} {1}</value>
+ <comment>{0} is a decimal number representing a file size. {1} is a unit, like Bytes, KB, MB, GB, TB</comment>
+ </data>
+ <data name="InvalidSelectedFiles" xml:space="preserve">
+ <value>Only .png, .jpg and .jpeg files can be used.</value>
+ </data>
+ <data name="OK" xml:space="preserve">
+ <value>OK</value>
+ </data>
+ <data name="SaveAll" xml:space="preserve">
+ <value>Save all</value>
+ </data>
+ <data name="SaveAs" xml:space="preserve">
+ <value>Save as</value>
+ </data>
+ <data name="SeeErrorMessage" xml:space="preserve">
+ <value>See details</value>
+ </data>
+ <data name="SelectFilesInstruction1" xml:space="preserve">
+ <value>Drag &amp; drop PNG or JPEG files here</value>
+ </data>
+ <data name="SelectFilesInstruction2" xml:space="preserve">
+ <value>or</value>
+ </data>
+ <data name="SelectFilesInstruction3" xml:space="preserve">
+ <value>Browse files</value>
+ </data>
+</root>
\ No newline at end of file
diff --git a/src/dev/impl/DevToys/Strings/ru-RU/Common.resw b/src/dev/impl/DevToys/Strings/ru-RU/Common.resw
index e577b0c95..3295b99b8 100644
--- a/src/dev/impl/DevToys/Strings/ru-RU/Common.resw
+++ b/src/dev/impl/DevToys/Strings/ru-RU/Common.resw
@@ -117,6 +117,9 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
+ <data name="Bytes" xml:space="preserve">
+ <value>Bytes</value>
+ </data>
<data name="Clear" xml:space="preserve">
<value>Очистить</value>
</data>
@@ -129,6 +132,15 @@
<data name="Delete" xml:space="preserve">
<value>Удалить</value>
</data>
+ <data name="Gigabytes" xml:space="preserve">
+ <value>GB</value>
+ </data>
+ <data name="Kilobytes" xml:space="preserve">
+ <value>KB</value>
+ </data>
+ <data name="Megabytes" xml:space="preserve">
+ <value>MB</value>
+ </data>
<data name="OpenFile" xml:space="preserve">
<value>Выбрать файл</value>
</data>
@@ -141,6 +153,9 @@
<data name="SelectAll" xml:space="preserve">
<value>Выбрать все</value>
</data>
+ <data name="Terabytes" xml:space="preserve">
+ <value>TB</value>
+ </data>
<data name="ToggleSwitchOff" xml:space="preserve">
<value>Откл.</value>
</data>
diff --git a/src/dev/impl/DevToys/Strings/ru-RU/PngJpgCompressor.resw b/src/dev/impl/DevToys/Strings/ru-RU/PngJpgCompressor.resw
new file mode 100644
index 000000000..b61aef2e6
--- /dev/null
+++ b/src/dev/impl/DevToys/Strings/ru-RU/PngJpgCompressor.resw
@@ -0,0 +1,166 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <data name="Cancel" xml:space="preserve">
+ <value>Cancel</value>
+ </data>
+ <data name="Configuration" xml:space="preserve">
+ <value>Configuration</value>
+ </data>
+ <data name="Delete" xml:space="preserve">
+ <value>Delete</value>
+ </data>
+ <data name="DeleteAll" xml:space="preserve">
+ <value>Delete all</value>
+ </data>
+ <data name="DetailsTitle" xml:space="preserve">
+ <value>Details</value>
+ </data>
+ <data name="DisplayName" xml:space="preserve">
+ <value>PNG/JPG Compressor</value>
+ </data>
+ <data name="FileSizeDisplay" xml:space="preserve">
+ <value>{0:0.##} {1}</value>
+ <comment>{0} is a decimal number representing a file size. {1} is a unit, like Bytes, KB, MB, GB, TB</comment>
+ </data>
+ <data name="InvalidSelectedFiles" xml:space="preserve">
+ <value>Only .png, .jpg and .jpeg files can be used.</value>
+ </data>
+ <data name="OK" xml:space="preserve">
+ <value>OK</value>
+ </data>
+ <data name="SaveAll" xml:space="preserve">
+ <value>Save all</value>
+ </data>
+ <data name="SaveAs" xml:space="preserve">
+ <value>Save as</value>
+ </data>
+ <data name="SeeErrorMessage" xml:space="preserve">
+ <value>See details</value>
+ </data>
+ <data name="SelectFilesInstruction1" xml:space="preserve">
+ <value>Drag &amp; drop PNG or JPEG files here</value>
+ </data>
+ <data name="SelectFilesInstruction2" xml:space="preserve">
+ <value>or</value>
+ </data>
+ <data name="SelectFilesInstruction3" xml:space="preserve">
+ <value>Browse files</value>
+ </data>
+</root>
\ No newline at end of file
diff --git a/src/dev/impl/DevToys/Strings/zh-CN/Common.resw b/src/dev/impl/DevToys/Strings/zh-CN/Common.resw
index 86c4271d3..ac55970bb 100644
--- a/src/dev/impl/DevToys/Strings/zh-CN/Common.resw
+++ b/src/dev/impl/DevToys/Strings/zh-CN/Common.resw
@@ -117,6 +117,9 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
+ <data name="Bytes" xml:space="preserve">
+ <value>Bytes</value>
+ </data>
<data name="Clear" xml:space="preserve">
<value>清空</value>
</data>
@@ -129,6 +132,15 @@
<data name="Delete" xml:space="preserve">
<value>删除</value>
</data>
+ <data name="Gigabytes" xml:space="preserve">
+ <value>GB</value>
+ </data>
+ <data name="Kilobytes" xml:space="preserve">
+ <value>KB</value>
+ </data>
+ <data name="Megabytes" xml:space="preserve">
+ <value>MB</value>
+ </data>
<data name="OpenFile" xml:space="preserve">
<value>打开文件</value>
</data>
@@ -141,6 +153,9 @@
<data name="SelectAll" xml:space="preserve">
<value>选择全部</value>
</data>
+ <data name="Terabytes" xml:space="preserve">
+ <value>TB</value>
+ </data>
<data name="ToggleSwitchOff" xml:space="preserve">
<value>关</value>
</data>
diff --git a/src/dev/impl/DevToys/Strings/zh-CN/PngJpgCompressor.resw b/src/dev/impl/DevToys/Strings/zh-CN/PngJpgCompressor.resw
new file mode 100644
index 000000000..b61aef2e6
--- /dev/null
+++ b/src/dev/impl/DevToys/Strings/zh-CN/PngJpgCompressor.resw
@@ -0,0 +1,166 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <data name="Cancel" xml:space="preserve">
+ <value>Cancel</value>
+ </data>
+ <data name="Configuration" xml:space="preserve">
+ <value>Configuration</value>
+ </data>
+ <data name="Delete" xml:space="preserve">
+ <value>Delete</value>
+ </data>
+ <data name="DeleteAll" xml:space="preserve">
+ <value>Delete all</value>
+ </data>
+ <data name="DetailsTitle" xml:space="preserve">
+ <value>Details</value>
+ </data>
+ <data name="DisplayName" xml:space="preserve">
+ <value>PNG/JPG Compressor</value>
+ </data>
+ <data name="FileSizeDisplay" xml:space="preserve">
+ <value>{0:0.##} {1}</value>
+ <comment>{0} is a decimal number representing a file size. {1} is a unit, like Bytes, KB, MB, GB, TB</comment>
+ </data>
+ <data name="InvalidSelectedFiles" xml:space="preserve">
+ <value>Only .png, .jpg and .jpeg files can be used.</value>
+ </data>
+ <data name="OK" xml:space="preserve">
+ <value>OK</value>
+ </data>
+ <data name="SaveAll" xml:space="preserve">
+ <value>Save all</value>
+ </data>
+ <data name="SaveAs" xml:space="preserve">
+ <value>Save as</value>
+ </data>
+ <data name="SeeErrorMessage" xml:space="preserve">
+ <value>See details</value>
+ </data>
+ <data name="SelectFilesInstruction1" xml:space="preserve">
+ <value>Drag &amp; drop PNG or JPEG files here</value>
+ </data>
+ <data name="SelectFilesInstruction2" xml:space="preserve">
+ <value>or</value>
+ </data>
+ <data name="SelectFilesInstruction3" xml:space="preserve">
+ <value>Browse files</value>
+ </data>
+</root>
\ No newline at end of file
diff --git a/src/dev/impl/DevToys/UI/Converters/BooleanToDoubleConverter.cs b/src/dev/impl/DevToys/UI/Converters/BooleanToDoubleConverter.cs
new file mode 100644
index 000000000..7296ffe12
--- /dev/null
+++ b/src/dev/impl/DevToys/UI/Converters/BooleanToDoubleConverter.cs
@@ -0,0 +1,40 @@
+#nullable enable
+
+using System;
+using Windows.UI.Xaml;
+using Windows.UI.Xaml.Data;
+
+namespace DevToys.UI.Converters
+{
+ /// <summary>
+ /// Convert a <see cref="bool"/> to a <see cref="double"/> value.
+ /// </summary>
+ public sealed class BooleanToDoubleConverter : IValueConverter
+ {
+ /// <summary>
+ /// Gets or sets the value to apply when the input is true.
+ /// </summary>
+ public double ValueOnTrue { get; set; }
+
+ /// <summary>
+ /// Gets or sets the value to apply when the input is false.
+ /// </summary>
+ public double ValueOnFalse { get; set; }
+
+ public object Convert(object value, Type targetType, object parameter, string language)
+ {
+ bool? valueBool = value as bool?;
+ if (valueBool == null)
+ {
+ return DependencyProperty.UnsetValue;
+ }
+
+ return valueBool.Value ? ValueOnTrue : ValueOnFalse;
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, string language)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/src/dev/impl/DevToys/ViewModels/Tools/PngJpgCompressor/ImageCompressionWorkItem.cs b/src/dev/impl/DevToys/ViewModels/Tools/PngJpgCompressor/ImageCompressionWorkItem.cs
new file mode 100644
index 000000000..5be2c4f39
--- /dev/null
+++ b/src/dev/impl/DevToys/ViewModels/Tools/PngJpgCompressor/ImageCompressionWorkItem.cs
@@ -0,0 +1,310 @@
+#nullable enable
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Threading;
+using System.Threading.Tasks;
+using DevToys.Api.Core.OOP;
+using DevToys.Core;
+using DevToys.Core.Threading;
+using DevToys.Shared.AppServiceMessages.PngJpgCompressor;
+using DevToys.Shared.Core;
+using DevToys.Shared.Core.Threading;
+using Microsoft.Toolkit.Mvvm.ComponentModel;
+using Microsoft.Toolkit.Mvvm.Input;
+using Windows.Storage;
+using Windows.Storage.FileProperties;
+using Windows.Storage.Pickers;
+using Windows.UI.Xaml.Controls;
+
+namespace DevToys.ViewModels.Tools.PngJpgCompressor
+{
+ internal sealed class ImageCompressionWorkItem : ObservableRecipient, IDisposable
+ {
+ private static readonly string[] SizesStrings
+ = {
+ LanguageManager.Instance.Common.Bytes,
+ LanguageManager.Instance.Common.Kilobytes,
+ LanguageManager.Instance.Common.Megabytes,
+ LanguageManager.Instance.Common.Gigabytes,
+ LanguageManager.Instance.Common.Terabytes
+ };
+
+ private readonly CancellationTokenSource _cancellationTokenSource = new();
+ private int _progressionPercentage;
+ private string _originalFileSize = string.Empty;
+ private string _newFileSize = string.Empty;
+ private string _compressionRatio = string.Empty;
+ private bool _isDone;
+ private bool _hasFailed;
+ private bool _canCancel;
+ private bool _canDelete;
+
+ internal PngJpgCompressorStrings Strings => LanguageManager.Instance.PngJpgCompressor;
+
+ internal string FileName { get; }
+
+ internal string FilePath { get; }
+
+ internal string OriginalFileSize
+ {
+ get => _originalFileSize;
+ private set
+ {
+ ThreadHelper.ThrowIfNotOnUIThread();
+ SetProperty(ref _originalFileSize, value);
+ }
+ }
+
+ internal string NewFileSize
+ {
+ get => _newFileSize;
+ private set
+ {
+ ThreadHelper.ThrowIfNotOnUIThread();
+ SetProperty(ref _newFileSize, value);
+ }
+ }
+
+ internal string CompressionRatio
+ {
+ get => _compressionRatio;
+ private set
+ {
+ ThreadHelper.ThrowIfNotOnUIThread();
+ SetProperty(ref _compressionRatio, value);
+ }
+ }
+
+ internal int ProgressPercentage
+ {
+ get => _progressionPercentage;
+ private set
+ {
+ ThreadHelper.ThrowIfNotOnUIThread();
+ SetProperty(ref _progressionPercentage, value);
+ }
+ }
+
+ internal bool IsDone
+ {
+ get => _isDone;
+ private set
+ {
+ ThreadHelper.ThrowIfNotOnUIThread();
+ SetProperty(ref _isDone, value);
+ }
+ }
+
+ internal bool HasFailed
+ {
+ get => _hasFailed;
+ private set
+ {
+ ThreadHelper.ThrowIfNotOnUIThread();
+ SetProperty(ref _hasFailed, value);
+ }
+ }
+
+ internal bool CanCancel
+ {
+ get => _canCancel;
+ private set
+ {
+ ThreadHelper.ThrowIfNotOnUIThread();
+ SetProperty(ref _canCancel, value);
+ }
+ }
+
+ internal bool CanDelete
+ {
+ get => _canDelete;
+ private set
+ {
+ ThreadHelper.ThrowIfNotOnUIThread();
+ SetProperty(ref _canDelete, value);
+ }
+ }
+
+ internal string? ErrorMessage { get; private set; }
+
+ internal string? TempCompressedFilePath { get; private set; }
+
+ internal event EventHandler? DeleteItemRequested;
+
+ internal ImageCompressionWorkItem(IAppService appService, StorageFile file)
+ {
+ Arguments.NotNull(appService, nameof(appService));
+ Arguments.NotNull(file, nameof(file));
+
+ FileName = file.Name;
+ FilePath = file.Path;
+ CanCancel = true;
+
+ DeleteCommand = new RelayCommand(ExecuteDeleteCommand);
+ SaveCommand = new AsyncRelayCommand(ExecuteSaveCommandAsync);
+ CancelCommand = new RelayCommand(ExecuteCancelCommand);
+ ShowErrorMessageCommand = new AsyncRelayCommand(ExecuteShowErrorMessageCommandAsync);
+
+ ComputePropertiesAsync(file).Forget();
+ ConvertAsync(appService).Forget();
+ }
+
+ public void Dispose()
+ {
+ try
+ {
+ if (!string.IsNullOrWhiteSpace(TempCompressedFilePath) && File.Exists(TempCompressedFilePath))
+ {
+ File.Delete(TempCompressedFilePath);
+ }
+ }
+ catch (Exception ex)
+ {
+ Logger.LogFault(nameof(ImageCompressionWorkItem), ex, "Unable to dispose the the work item");
+ }
+ }
+
+ #region DeleteCommand
+
+ public IRelayCommand DeleteCommand { get; }
+
+ private void ExecuteDeleteCommand()
+ {
+ DeleteItemRequested?.Invoke(this, EventArgs.Empty);
+ }
+
+ #endregion
+
+ #region SaveCommand
+
+ public IAsyncRelayCommand SaveCommand { get; }
+
+ private async Task ExecuteSaveCommandAsync()
+ {
+ string? fileExtension = Path.GetExtension(FilePath);
+
+ var savePicker = new FileSavePicker();
+ savePicker.SuggestedStartLocation = PickerLocationId.ComputerFolder;
+ savePicker.FileTypeChoices.Add(
+ fileExtension.Replace(".", string.Empty).ToUpperInvariant(),
+ new List<string>() { fileExtension!.ToLowerInvariant() });
+
+ StorageFile? newFile = await savePicker.PickSaveFileAsync();
+ if (newFile is not null)
+ {
+ StorageFile tempCompressedFile = await StorageFile.GetFileFromPathAsync(TempCompressedFilePath);
+ await tempCompressedFile.CopyAndReplaceAsync(newFile);
+
+ DeleteCommand.Execute(this);
+ }
+ }
+
+ #endregion
+
+ #region CancelCommand
+
+ public IRelayCommand CancelCommand { get; }
+
+ private void ExecuteCancelCommand()
+ {
+ _cancellationTokenSource.Cancel();
+ }
+
+ #endregion
+
+ #region ShowErrorMessageCommand
+
+ public IAsyncRelayCommand ShowErrorMessageCommand { get; }
+
+ private async Task ExecuteShowErrorMessageCommandAsync()
+ {
+ var dialog = new ContentDialog
+ {
+ Title = Strings.DetailsTitle,
+ CloseButtonText = Strings.OK,
+ DefaultButton = ContentDialogButton.Close,
+ Content = ErrorMessage!
+ };
+
+ await dialog.ShowAsync();
+ }
+
+ #endregion
+
+ private async Task ConvertAsync(IAppService appService)
+ {
+ await TaskScheduler.Default;
+
+ var message = new PngJpgCompressorWorkMessage
+ {
+ FilePath = FilePath,
+ };
+
+ try
+ {
+ PngJpgCompressorWorkResultMessage result
+ = await appService.SendMessageAndGetResponseAsync<PngJpgCompressorWorkResultMessage>(
+ message,
+ _cancellationTokenSource.Token);
+
+ TempCompressedFilePath = result.TempCompressedFilePath;
+
+ await ThreadHelper.RunOnUIThreadAsync(() =>
+ {
+ CanCancel = false;
+ ProgressPercentage = 0;
+ if (string.IsNullOrEmpty(result.ErrorMessage))
+ {
+ IsDone = true;
+ CompressionRatio = result.PercentageSaved.ToString("P");
+ NewFileSize = HumanizeFileSize(result.NewFileSize);
+ }
+ else
+ {
+ HasFailed = true;
+ ErrorMessage = result.ErrorMessage ?? string.Empty;
+ Logger.Log("PNG/JPG Compressor", ErrorMessage);
+ }
+ CanDelete = true;
+ });
+ }
+ catch (OperationCanceledException)
+ {
+ await ThreadHelper.RunOnUIThreadAsync(() =>
+ {
+ CanCancel = false;
+ IsDone = true;
+ CanDelete = true;
+ DeleteCommand.Execute(null);
+ });
+ }
+ }
+
+ private async Task ComputePropertiesAsync(StorageFile file)
+ {
+ BasicProperties fileProperties = await file.GetBasicPropertiesAsync();
+
+ string fileSize = HumanizeFileSize(fileProperties.Size);
+
+ await ThreadHelper.RunOnUIThreadAsync(() =>
+ {
+ OriginalFileSize = fileSize;
+ });
+ }
+
+ private string HumanizeFileSize(double fileSize)
+ {
+ int order = 0;
+ while (fileSize >= 1024 && order < SizesStrings.Length - 1)
+ {
+ order++;
+ fileSize /= 1024;
+ }
+
+ string fileSizeString = string.Format(Strings.FileSizeDisplay, fileSize, SizesStrings[order]);
+ return fileSizeString;
+ }
+ }
+}
diff --git a/src/dev/impl/DevToys/ViewModels/Tools/PngJpgCompressor/PngJpgCompressorToolProvider.cs b/src/dev/impl/DevToys/ViewModels/Tools/PngJpgCompressor/PngJpgCompressorToolProvider.cs
new file mode 100644
index 000000000..ce8a9d01a
--- /dev/null
+++ b/src/dev/impl/DevToys/ViewModels/Tools/PngJpgCompressor/PngJpgCompressorToolProvider.cs
@@ -0,0 +1,49 @@
+#nullable enable
+
+using System.Composition;
+using DevToys.Shared.Api.Core;
+using DevToys.Api.Tools;
+using DevToys.Core.Threading;
+using Windows.UI.Xaml.Controls;
+using System.Threading.Tasks;
+
+namespace DevToys.ViewModels.Tools.PngJpgCompressor
+{
+ [Export(typeof(IToolProvider))]
+ [Name("PNG/JPG Compressor")]
+ [ProtocolName("imgcomp")]
+ [Order(4)]
+ internal sealed class PngJpgCompressorToolProvider : ToolProviderBase, IToolProvider
+ {
+ private readonly IMefProvider _mefProvider;
+
+ public string DisplayName => LanguageManager.Instance.PngJpgCompressor.DisplayName;
+
+ public object IconSource
+ => new TaskCompletionNotifier<IconElement>(
+ ThreadHelper.RunOnUIThreadAsync(() =>
+ {
+ return Task.FromResult<IconElement>(
+ new FontIcon
+ {
+ Glyph = "\uF488"
+ });
+ }));
+
+ [ImportingConstructor]
+ public PngJpgCompressorToolProvider(IMefProvider mefProvider)
+ {
+ _mefProvider = mefProvider;
+ }
+
+ public bool CanBeTreatedByTool(string data)
+ {
+ return false;
+ }
+
+ public IToolViewModel CreateTool()
+ {
+ return _mefProvider.Import<PngJpgCompressorToolViewModel>();
+ }
+ }
+}
diff --git a/src/dev/impl/DevToys/ViewModels/Tools/PngJpgCompressor/PngJpgCompressorToolViewModel.cs b/src/dev/impl/DevToys/ViewModels/Tools/PngJpgCompressor/PngJpgCompressorToolViewModel.cs
new file mode 100644
index 000000000..aa42e37c8
--- /dev/null
+++ b/src/dev/impl/DevToys/ViewModels/Tools/PngJpgCompressor/PngJpgCompressorToolViewModel.cs
@@ -0,0 +1,264 @@
+#nullable enable
+
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Composition;
+using System.IO;
+using System.Linq;
+using System.Threading.Tasks;
+using DevToys.Api.Core.OOP;
+using DevToys.Api.Tools;
+using DevToys.Core.Threading;
+using DevToys.Shared.Core;
+using DevToys.Views.Tools.PngJpgCompressor;
+using Microsoft.Toolkit.Mvvm.ComponentModel;
+using Microsoft.Toolkit.Mvvm.Input;
+using Windows.ApplicationModel.DataTransfer;
+using Windows.Storage;
+using Windows.Storage.Pickers;
+using Windows.UI.Xaml;
+
+namespace DevToys.ViewModels.Tools.PngJpgCompressor
+{
+ [Export(typeof(PngJpgCompressorToolViewModel))]
+ public sealed class PngJpgCompressorToolViewModel : ObservableRecipient, IToolViewModel, IDisposable
+ {
+ private static readonly string[] SupportedFileExtensions = new[] { ".png", ".jpg", ".jpeg" };
+
+ private readonly IAppService _appService;
+
+ private bool _isSelectFilesAreaHighlithed;
+ private bool _hasInvalidFilesSelected;
+
+ public Type View { get; } = typeof(PngJpgCompressorToolPage);
+
+ internal PngJpgCompressorStrings Strings => LanguageManager.Instance.PngJpgCompressor;
+
+ internal bool IsSelectFilesAreaHighlithed
+ {
+ get => _isSelectFilesAreaHighlithed;
+ set => SetProperty(ref _isSelectFilesAreaHighlithed, value);
+ }
+
+ internal bool HasInvalidFilesSelected
+ {
+ get => _hasInvalidFilesSelected;
+ set => SetProperty(ref _hasInvalidFilesSelected, value);
+ }
+
+ internal ObservableCollection<ImageCompressionWorkItem> CompressionWorkQueue { get; } = new();
+
+ [ImportingConstructor]
+ public PngJpgCompressorToolViewModel(IAppService appService)
+ {
+ _appService = appService;
+
+ SelectFilesAreaDragOverCommand = new RelayCommand<DragEventArgs>(ExecuteSelectFilesAreaDragOverCommand);
+ SelectFilesAreaDragLeaveCommand = new RelayCommand<DragEventArgs>(ExecuteSelectFilesAreaDragLeaveCommand);
+ SelectFilesAreaDragDropCommand = new AsyncRelayCommand<DragEventArgs>(ExecuteSelectFilesAreaDragDropCommandAsync);
+ SelectFilesBrowseCommand = new AsyncRelayCommand(ExecuteSelectFilesBrowseCommandAsync);
+ DeleteAllCommand = new RelayCommand(ExecuteDeleteAllCommand);
+ SaveAllCommand = new AsyncRelayCommand(ExecuteSaveAllCommandAsync);
+ }
+
+ public void Dispose()
+ {
+ // Cancel all compression work in progress.
+ var works = CompressionWorkQueue.ToList();
+ foreach (ImageCompressionWorkItem work in works)
+ {
+ work.CancelCommand.Execute(null);
+ }
+
+ // Delete all completed compression work.
+ DeleteAllCommand.Execute(null);
+ }
+
+ #region SelectFilesAreaDragOverCommand
+
+ public IRelayCommand<DragEventArgs> SelectFilesAreaDragOverCommand { get; }
+
+ private void ExecuteSelectFilesAreaDragOverCommand(DragEventArgs? parameters)
+ {
+ Arguments.NotNull(parameters, nameof(parameters));
+ if (parameters!.DataView.Contains(StandardDataFormats.StorageItems))
+ {
+ parameters.AcceptedOperation = DataPackageOperation.Copy;
+ parameters.Handled = false;
+ }
+
+ IsSelectFilesAreaHighlithed = true;
+ HasInvalidFilesSelected = false;
+ }
+
+ #endregion
+
+ #region SelectFilesAreaDragLeaveCommand
+
+ public IRelayCommand<DragEventArgs> SelectFilesAreaDragLeaveCommand { get; }
+
+ private void ExecuteSelectFilesAreaDragLeaveCommand(DragEventArgs? parameters)
+ {
+ IsSelectFilesAreaHighlithed = false;
+ HasInvalidFilesSelected = false;
+ }
+
+ #endregion
+
+ #region SelectFilesAreaDragDropCommand
+
+ public IAsyncRelayCommand<DragEventArgs> SelectFilesAreaDragDropCommand { get; }
+
+ private async Task ExecuteSelectFilesAreaDragDropCommandAsync(DragEventArgs? parameters)
+ {
+ Arguments.NotNull(parameters, nameof(parameters));
+
+ await ThreadHelper.RunOnUIThreadAsync(async () =>
+ {
+ IsSelectFilesAreaHighlithed = false;
+ if (!parameters!.DataView.Contains(StandardDataFormats.StorageItems))
+ {
+ return;
+ }
+
+ IReadOnlyList<IStorageItem>? storageItems = await parameters.DataView.GetStorageItemsAsync();
+ if (storageItems is null || storageItems.Count == 0)
+ {
+ return;
+ }
+
+ for (int i = 0; i < storageItems.Count; i++)
+ {
+ IStorageItem storageItem = storageItems[i];
+ if (storageItem is StorageFile file)
+ {
+ string fileExtension = Path.GetExtension(file.Name);
+
+ if (SupportedFileExtensions.Any(ext => string.Equals(ext, fileExtension, StringComparison.OrdinalIgnoreCase)))
+ {
+ QueueNewConversion(file);
+ }
+ else
+ {
+ HasInvalidFilesSelected = true;
+ }
+ }
+ else
+ {
+ HasInvalidFilesSelected = true;
+ }
+ }
+ }).ConfigureAwait(false);
+ }
+
+ #endregion
+
+ #region SelectFilesBrowseCommand
+
+ public IAsyncRelayCommand SelectFilesBrowseCommand { get; }
+
+ private async Task ExecuteSelectFilesBrowseCommandAsync()
+ {
+ await ThreadHelper.RunOnUIThreadAsync(async () =>
+ {
+ HasInvalidFilesSelected = false;
+
+ var filePicker = new FileOpenPicker
+ {
+ ViewMode = PickerViewMode.List,
+ SuggestedStartLocation = PickerLocationId.ComputerFolder
+ };
+
+ for (int i = 0; i < SupportedFileExtensions.Length; i++)
+ {
+ filePicker.FileTypeFilter.Add(SupportedFileExtensions[i]);
+ }
+
+ IReadOnlyList<StorageFile> files = await filePicker.PickMultipleFilesAsync();
+ for (int i = 0; i < files.Count; i++)
+ {
+ QueueNewConversion(files[i]);
+ }
+ });
+ }
+
+ #endregion
+
+ #region DeleteAllCommand
+
+ public IRelayCommand DeleteAllCommand { get; }
+
+ private void ExecuteDeleteAllCommand()
+ {
+ int i = 0;
+ while (i < CompressionWorkQueue.Count)
+ {
+ ImageCompressionWorkItem workItem = CompressionWorkQueue[i];
+ if (workItem.CanDelete)
+ {
+ CompressionWorkQueue.Remove(workItem);
+ workItem.Dispose();
+ }
+ else
+ {
+ i++;
+ }
+ }
+ }
+
+ #endregion
+
+ #region SaveAllCommand
+
+ public IAsyncRelayCommand SaveAllCommand { get; }
+
+ private async Task ExecuteSaveAllCommandAsync()
+ {
+ var works = CompressionWorkQueue.ToList();
+
+ if (works.Any(work => work.IsDone))
+ {
+ var folderPicker = new FolderPicker();
+ folderPicker.ViewMode = PickerViewMode.List;
+ StorageFolder? selectedFolder = await folderPicker.PickSingleFolderAsync();
+ if (selectedFolder is not null)
+ {
+ foreach (ImageCompressionWorkItem work in works)
+ {
+ if (work.IsDone)
+ {
+ StorageFile newFile = await selectedFolder.CreateFileAsync(work.FileName, CreationCollisionOption.ReplaceExisting);
+ StorageFile tempCompressedFile = await StorageFile.GetFileFromPathAsync(work.TempCompressedFilePath);
+ await tempCompressedFile.CopyAndReplaceAsync(newFile);
+
+ work.DeleteCommand.Execute(null);
+ }
+ }
+ }
+ }
+ }
+
+ #endregion
+
+ private void QueueNewConversion(StorageFile file)
+ {
+ ThreadHelper.ThrowIfNotOnUIThread();
+
+ if (!CompressionWorkQueue.Any(item => string.Equals(item.FilePath, file.Path, StringComparison.OrdinalIgnoreCase)))
+ {
+ var workItem = new ImageCompressionWorkItem(_appService, file);
+ workItem.DeleteItemRequested += WorkItem_DeleteItemRequested;
+ CompressionWorkQueue.Insert(0, workItem);
+ }
+ }
+
+ private void WorkItem_DeleteItemRequested(object sender, EventArgs e)
+ {
+ var workItem = (ImageCompressionWorkItem)sender;
+ workItem.DeleteItemRequested -= WorkItem_DeleteItemRequested;
+ CompressionWorkQueue.Remove(workItem);
+ workItem.Dispose();
+ }
+ }
+}
diff --git a/src/dev/impl/DevToys/Views/Tools/JwtDecoderEncoder/JwtDecoderEncoderToolPage.xaml b/src/dev/impl/DevToys/Views/Tools/JwtDecoderEncoder/JwtDecoderEncoderToolPage.xaml
index bcc77f130..706ccac41 100644
--- a/src/dev/impl/DevToys/Views/Tools/JwtDecoderEncoder/JwtDecoderEncoderToolPage.xaml
+++ b/src/dev/impl/DevToys/Views/Tools/JwtDecoderEncoder/JwtDecoderEncoderToolPage.xaml
@@ -22,6 +22,7 @@
</Grid.RowDefinitions>
<controls:CustomTextBox
+ Margin="0,12,0,0"
Header="{x:Bind ViewModel.Strings.JwtTokenLabel}"
Height="150"
AcceptsReturn="True"
diff --git a/src/dev/impl/DevToys/Views/Tools/PngJpgCompressor/PngJpgCompressorToolPage.xaml b/src/dev/impl/DevToys/Views/Tools/PngJpgCompressor/PngJpgCompressorToolPage.xaml
new file mode 100644
index 000000000..e1fcd38fa
--- /dev/null
+++ b/src/dev/impl/DevToys/Views/Tools/PngJpgCompressor/PngJpgCompressorToolPage.xaml
@@ -0,0 +1,261 @@
+<Page
+ x:Class="DevToys.Views.Tools.PngJpgCompressor.PngJpgCompressorToolPage"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:converters="using:DevToys.UI.Converters"
+ xmlns:local="using:DevToys.ViewModels.Tools.PngJpgCompressor"
+ xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
+ xmlns:core="using:Microsoft.Xaml.Interactions.Core"
+ xmlns:i="using:Microsoft.Xaml.Interactivity"
+ mc:Ignorable="d"
+ NavigationCacheMode="Required">
+ <Page.Resources>
+ <converters:BooleanToVisibilityConverter x:Name="BooleanToVisibilityConverter"/>
+ <converters:BooleanToDoubleConverter x:Name="BooleanToDoubleConverter" ValueOnFalse="0.0" ValueOnTrue="1.0"/>
+
+ <Style x:Key="CompressionWorkItemBackgroundGridStyle" TargetType="Grid">
+ <Setter Property="CornerRadius" Value="4" />
+ <Setter Property="Background" Value="{ThemeResource ExpanderHeaderBackground}" />
+ <Setter Property="BorderBrush" Value="{ThemeResource ExpanderHeaderBorderBrush}" />
+ <Setter Property="BorderThickness" Value="{ThemeResource ExpanderHeaderBorderThickness}" />
+ <Setter Property="HorizontalAlignment" Value="Stretch" />
+ <Setter Property="MinHeight" Value="{StaticResource ExpanderMinHeight}" />
+ <Setter Property="Padding" Value="{StaticResource ExpanderContentPadding}" />
+ </Style>
+ </Page.Resources>
+
+ <StackPanel Margin="0,0,0,16" Spacing="12">
+ <VisualStateManager.VisualStateGroups>
+ <VisualStateGroup>
+ <VisualState x:Name="SelectFilesPointerHover">
+ <VisualState.StateTriggers>
+ <StateTrigger IsActive="{x:Bind ViewModel.IsSelectFilesAreaHighlithed, Mode=OneWay}"/>
+ </VisualState.StateTriggers>
+ <VisualState.Setters>
+ <Setter Target="SelectFilesRectangle.Stroke" Value="{ThemeResource TextControlHeaderForeground}" />
+ <Setter Target="SelectFilesRectangle.Fill" Value="{ThemeResource ButtonBackgroundPointerOver}" />
+ </VisualState.Setters>
+ </VisualState>
+ </VisualStateGroup>
+ </VisualStateManager.VisualStateGroups>
+
+ <StackPanel.ChildrenTransitions>
+ <TransitionCollection>
+ <EntranceThemeTransition IsStaggeringEnabled="True" FromVerticalOffset="50"/>
+ </TransitionCollection>
+ </StackPanel.ChildrenTransitions>
+
+ <Grid
+ Margin="0,12,0,0"
+ AllowDrop="True"
+ Background="Transparent"
+ CornerRadius="4">
+ <i:Interaction.Behaviors>
+ <core:EventTriggerBehavior EventName="DragOver">
+ <core:InvokeCommandAction
+ Command="{x:Bind ViewModel.SelectFilesAreaDragOverCommand}"/>
+ </core:EventTriggerBehavior>
+ <core:EventTriggerBehavior EventName="DragLeave">
+ <core:InvokeCommandAction
+ Command="{x:Bind ViewModel.SelectFilesAreaDragLeaveCommand}"/>
+ </core:EventTriggerBehavior>
+ <core:EventTriggerBehavior EventName="Drop">
+ <core:InvokeCommandAction
+ Command="{x:Bind ViewModel.SelectFilesAreaDragDropCommand}"/>
+ </core:EventTriggerBehavior>
+ </i:Interaction.Behaviors>
+ <Rectangle
+ x:Name="SelectFilesRectangle"
+ Stroke="{ThemeResource TextControlHeaderForegroundDisabled}"
+ StrokeDashArray="4 4"
+ StrokeThickness="2"
+ Fill="Transparent">
+ </Rectangle>
+ <StackPanel
+ Spacing="8"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Margin="24">
+ <TextBlock
+ Text="{x:Bind ViewModel.Strings.SelectFilesInstruction1}"
+ TextTrimming="CharacterEllipsis"
+ TextWrapping="WrapWholeWords"
+ HorizontalAlignment="Center"/>
+ <TextBlock
+ Text="{x:Bind ViewModel.Strings.SelectFilesInstruction2}"
+ HorizontalAlignment="Center"/>
+ <Button
+ Style="{StaticResource AccentButtonStyle}"
+ Content="{x:Bind ViewModel.Strings.SelectFilesInstruction3}"
+ HorizontalAlignment="Center"
+ Command="{x:Bind ViewModel.SelectFilesBrowseCommand}"/>
+ <TextBlock
+ Text="{x:Bind ViewModel.Strings.InvalidSelectedFiles}"
+ HorizontalAlignment="Center"
+ FontSize="11"
+ Foreground="Red"
+ Visibility="{x:Bind ViewModel.HasInvalidFilesSelected, Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverter}}"/>
+ </StackPanel>
+ </Grid>
+
+ <StackPanel
+ Orientation="Horizontal"
+ Spacing="8"
+ HorizontalAlignment="Right">
+ <Button
+ Style="{StaticResource AccentButtonStyle}"
+ Command="{x:Bind ViewModel.SaveAllCommand}">
+ <StackPanel Orientation="Horizontal" Spacing="4">
+ <FontIcon Glyph="&#xF67F;"/>
+ <TextBlock VerticalAlignment="Center" Text="{x:Bind ViewModel.Strings.SaveAll}"/>
+ </StackPanel>
+ </Button>
+ <Button
+ Command="{x:Bind ViewModel.DeleteAllCommand}">
+ <StackPanel Orientation="Horizontal" Spacing="4">
+ <FontIcon Glyph="&#xF34C;"/>
+ <TextBlock VerticalAlignment="Center" Text="{x:Bind ViewModel.Strings.DeleteAll}"/>
+ </StackPanel>
+ </Button>
+ </StackPanel>
+
+ <ItemsControl
+ ItemsSource="{x:Bind ViewModel.CompressionWorkQueue}">
+ <ItemsControl.ItemContainerTransitions>
+ <TransitionCollection>
+ <AddDeleteThemeTransition />
+ </TransitionCollection>
+ </ItemsControl.ItemContainerTransitions>
+ <ItemsControl.ItemTemplate>
+ <DataTemplate x:DataType="local:ImageCompressionWorkItem">
+ <Grid Style="{StaticResource CompressionWorkItemBackgroundGridStyle}" Margin="0,4,0,0">
+ <Grid
+ HorizontalAlignment="Stretch"
+ VerticalAlignment="Center">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto"/>
+ <ColumnDefinition Width="*"/>
+ <ColumnDefinition Width="Auto"/>
+ <ColumnDefinition Width="Auto"/>
+ </Grid.ColumnDefinitions>
+ <Grid
+ Grid.Column="0">
+ <FontIcon
+ Grid.Column="0"
+ x:Name="IsDoneIndication"
+ x:Load="{x:Bind IsDone, Mode=OneWay}"
+ Opacity="{x:Bind IsDone, Mode=OneWay, Converter={StaticResource BooleanToDoubleConverter}}"
+ FontFamily="{StaticResource FluentSystemIcons}"
+ HorizontalAlignment="Left"
+ Width="42"
+ Height="42"
+ FontSize="42"
+ Foreground="Green"
+ Glyph="&#xF298;">
+ <FontIcon.OpacityTransition>
+ <ScalarTransition/>
+ </FontIcon.OpacityTransition>
+ </FontIcon>
+ <FontIcon
+ Grid.Column="0"
+ x:Name="HasFailedIndication"
+ x:Load="{x:Bind HasFailed, Mode=OneWay}"
+ Opacity="{x:Bind HasFailed, Mode=OneWay, Converter={StaticResource BooleanToDoubleConverter}}"
+ FontFamily="{StaticResource FluentSystemIcons}"
+ HorizontalAlignment="Left"
+ Width="42"
+ Height="42"
+ FontSize="42"
+ Foreground="Red"
+ Glyph="&#xF36D;">
+ <FontIcon.OpacityTransition>
+ <ScalarTransition/>
+ </FontIcon.OpacityTransition>
+ </FontIcon>
+ <muxc:ProgressRing
+ Grid.Column="0"
+ HorizontalAlignment="Left"
+ Width="42"
+ Height="42"
+ IsIndeterminate="{x:Bind CanCancel, Mode=OneWay}"
+ Value="{x:Bind ProgressPercentage, Mode=OneWay}"/>
+ </Grid>
+ <StackPanel
+ Grid.Column="1"
+ Margin="12,0,0,0"
+ Spacing="4"
+ VerticalAlignment="Center">
+ <TextBlock
+ Text="{x:Bind FileName}"
+ TextWrapping="Wrap" />
+ <TextBlock
+ Text="{x:Bind OriginalFileSize, Mode=OneWay}"
+ Opacity="0.75"/>
+ </StackPanel>
+ <StackPanel
+ Grid.Column="2"
+ Margin="12,0,0,0"
+ Spacing="4"
+ VerticalAlignment="Center">
+ <TextBlock
+ HorizontalAlignment="Right"
+ Text="{x:Bind CompressionRatio, Mode=OneWay}" />
+ <TextBlock
+ Text="{x:Bind NewFileSize, Mode=OneWay}"
+ Opacity="0.75"/>
+ </StackPanel>
+ <StackPanel
+ Grid.Column="3"
+ Margin="12,0,0,0"
+ VerticalAlignment="Center"
+ Orientation="Horizontal">
+ <Button
+ x:Name="CancelButton"
+ x:Load="{x:Bind CanCancel, Mode=OneWay}"
+ Style="{StaticResource CommandBarFlyoutEllipsisButtonStyle}"
+ Command="{x:Bind CancelCommand}"
+ ToolTipService.ToolTip="{x:Bind Strings.Cancel}">
+ <FontIcon
+ FontFamily="{StaticResource FluentSystemIcons}"
+ Glyph="&#xF75A;"/>
+ </Button>
+ <Button
+ x:Name="SaveButton"
+ x:Load="{x:Bind IsDone, Mode=OneWay}"
+ Style="{StaticResource CommandBarFlyoutEllipsisButtonStyle}"
+ Command="{x:Bind SaveCommand}"
+ ToolTipService.ToolTip="{x:Bind Strings.SaveAs}">
+ <FontIcon
+ FontFamily="{StaticResource FluentSystemIcons}"
+ Glyph="&#xF67F;"/>
+ </Button>
+ <Button
+ x:Name="ErrorMessageButton"
+ x:Load="{x:Bind HasFailed, Mode=OneWay}"
+ Style="{StaticResource CommandBarFlyoutEllipsisButtonStyle}"
+ Command="{x:Bind ShowErrorMessageCommand}"
+ ToolTipService.ToolTip="{x:Bind Strings.SeeErrorMessage}">
+ <FontIcon
+ FontFamily="{StaticResource FluentSystemIcons}"
+ Glyph="&#xF350;"/>
+ </Button>
+ <Button
+ x:Name="DeleteButton"
+ x:Load="{x:Bind CanDelete, Mode=OneWay}"
+ Style="{StaticResource CommandBarFlyoutEllipsisButtonStyle}"
+ Command="{x:Bind DeleteCommand}"
+ ToolTipService.ToolTip="{x:Bind Strings.Delete}">
+ <FontIcon
+ FontFamily="{StaticResource FluentSystemIcons}"
+ Glyph="&#xF34C;"/>
+ </Button>
+ </StackPanel>
+ </Grid>
+ </Grid>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
+ </StackPanel>
+</Page>
diff --git a/src/dev/impl/DevToys/Views/Tools/PngJpgCompressor/PngJpgCompressorToolPage.xaml.cs b/src/dev/impl/DevToys/Views/Tools/PngJpgCompressor/PngJpgCompressorToolPage.xaml.cs
new file mode 100644
index 000000000..dcb0bb05a
--- /dev/null
+++ b/src/dev/impl/DevToys/Views/Tools/PngJpgCompressor/PngJpgCompressorToolPage.xaml.cs
@@ -0,0 +1,52 @@
+#nullable enable
+
+using DevToys.Api.Core.Navigation;
+using DevToys.Shared.Core;
+using DevToys.ViewModels.Tools.PngJpgCompressor;
+using Windows.UI.Xaml;
+using Windows.UI.Xaml.Controls;
+using Windows.UI.Xaml.Navigation;
+
+namespace DevToys.Views.Tools.PngJpgCompressor
+{
+ /// <summary>
+ /// An empty page that can be used on its own or navigated to within a Frame.
+ /// </summary>
+ public sealed partial class PngJpgCompressorToolPage : Page
+ {
+ public static readonly DependencyProperty ViewModelProperty
+ = DependencyProperty.Register(
+ nameof(ViewModel),
+ typeof(PngJpgCompressorToolViewModel),
+ typeof(PngJpgCompressorToolPage),
+ new PropertyMetadata(null));
+
+ /// <summary>
+ /// Gets the page's view model.
+ /// </summary>
+ public PngJpgCompressorToolViewModel ViewModel
+ {
+ get => (PngJpgCompressorToolViewModel)GetValue(ViewModelProperty);
+ set => SetValue(ViewModelProperty, value);
+ }
+ public PngJpgCompressorToolPage()
+ {
+ InitializeComponent();
+ }
+
+ protected override void OnNavigatedTo(NavigationEventArgs e)
+ {
+ var parameters = (NavigationParameter)e.Parameter;
+
+ if (ViewModel is null)
+ {
+ // Set the view model
+ Assumes.NotNull(parameters.ViewModel, nameof(parameters.ViewModel));
+ ViewModel = (PngJpgCompressorToolViewModel)parameters.ViewModel!;
+ DataContext = ViewModel;
+ }
+
+ base.OnNavigatedTo(e);
+ }
+ }
+}
diff --git a/src/dev/impl/DevToys/Views/Tools/Settings/SettingsToolPage.xaml b/src/dev/impl/DevToys/Views/Tools/Settings/SettingsToolPage.xaml
index e49f5d261..3d1dd9c68 100644
--- a/src/dev/impl/DevToys/Views/Tools/Settings/SettingsToolPage.xaml
+++ b/src/dev/impl/DevToys/Views/Tools/Settings/SettingsToolPage.xaml
@@ -13,7 +13,7 @@
<converters:EnumToBooleanConverter x:Key="EnumToBooleanConverter"/>
</Page.Resources>
- <StackPanel Margin="0,0,0,16" Spacing="4">
+ <StackPanel Margin="0,12,0,16" Spacing="4">
<StackPanel.ChildrenTransitions>
<TransitionCollection>
<EntranceThemeTransition IsStaggeringEnabled="True" FromVerticalOffset="50"/>
diff --git a/src/dev/shared/DevToys.Shared/AppServiceMessages/PngJpgCompressor/PngJpgCompressorWorkMessage.cs b/src/dev/shared/DevToys.Shared/AppServiceMessages/PngJpgCompressor/PngJpgCompressorWorkMessage.cs
new file mode 100644
index 000000000..fa67f96bd
--- /dev/null
+++ b/src/dev/shared/DevToys.Shared/AppServiceMessages/PngJpgCompressor/PngJpgCompressorWorkMessage.cs
@@ -0,0 +1,11 @@
+using DevToys.Shared.Core.OOP;
+using Newtonsoft.Json;
+
+namespace DevToys.Shared.AppServiceMessages.PngJpgCompressor
+{
+ internal sealed class PngJpgCompressorWorkMessage : AppServiceMessageBase
+ {
+ [JsonProperty]
+ internal string FilePath { get; set; } = null!;
+ }
+}
diff --git a/src/dev/shared/DevToys.Shared/AppServiceMessages/PngJpgCompressor/PngJpgCompressorWorkResultMessage.cs b/src/dev/shared/DevToys.Shared/AppServiceMessages/PngJpgCompressor/PngJpgCompressorWorkResultMessage.cs
new file mode 100644
index 000000000..3e690dfa7
--- /dev/null
+++ b/src/dev/shared/DevToys.Shared/AppServiceMessages/PngJpgCompressor/PngJpgCompressorWorkResultMessage.cs
@@ -0,0 +1,20 @@
+using DevToys.Shared.Core.OOP;
+using Newtonsoft.Json;
+
+namespace DevToys.Shared.AppServiceMessages.PngJpgCompressor
+{
+ internal sealed class PngJpgCompressorWorkResultMessage : AppServiceMessageBase
+ {
+ [JsonProperty]
+ internal string? ErrorMessage { get; set; }
+
+ [JsonProperty]
+ internal long NewFileSize { get; set; }
+
+ [JsonProperty]
+ internal double PercentageSaved { get; set; }
+
+ [JsonProperty]
+ internal string TempCompressedFilePath { get; set; } = string.Empty;
+ }
+}
diff --git a/src/dev/shared/DevToys.Shared/Core/OOP/AppServiceCancelMessage.cs b/src/dev/shared/DevToys.Shared/Core/OOP/AppServiceCancelMessage.cs
new file mode 100644
index 000000000..822c48443
--- /dev/null
+++ b/src/dev/shared/DevToys.Shared/Core/OOP/AppServiceCancelMessage.cs
@@ -0,0 +1,8 @@
+#nullable enable
+
+namespace DevToys.Shared.Core.OOP
+{
+ public sealed class AppServiceCancelMessage : AppServiceMessageBase
+ {
+ }
+}