Skip to content

A Swiss Army knife for developers.

Feature/check sum generator (#234)

João Felíciob64391d3afaf
diff --git a/README.md b/README.md
index d7000e105..17677ac69 100644
--- a/README.md
+++ b/README.md
@@ -41,6 +41,7 @@ Many tools are available.
- Hash (MD5, SHA1, SHA256, SHA512)
- UUID 1 and 4
- Lorem Ipsum
+ - Check Sum
- Text
- Inspector & Case Converter
- Regex Tester
@@ -97,6 +98,7 @@ Here is the list of tool name you can use:
- `hash` - Hash Generator
- `uuid` - UUID Generator
- `loremipsum` - Lorem Ipsum Generator
+- `checksum` - CheckSum File
- `jsonformat` Json Formatter
- `jsonyaml` - Json <> Yaml
- `jwt` - JWT Decoder
diff --git a/src/dev/impl/DevToys/DevToys.csproj b/src/dev/impl/DevToys/DevToys.csproj
index c96af0d11..90c5b5ea1 100644
--- a/src/dev/impl/DevToys/DevToys.csproj
+++ b/src/dev/impl/DevToys/DevToys.csproj
@@ -31,10 +31,14 @@
<Compile Include="Helpers\StorageFileHelper.cs" />
<Compile Include="Helpers\ImageHelper.cs" />
<Compile Include="Helpers\ColorBlindnessSimulatorHelper.cs" />
+ <Compile Include="Helpers\HashingHelper.cs" />
<Compile Include="Helpers\NumberBaseHelper.cs" />
<Compile Include="Messages\PinToolToStartMessage.cs" />
<Compile Include="Messages\OpenToolInNewWindowMessage.cs" />
<Compile Include="Messages\ChangeSelectedMenuItemMessage.cs" />
+ <Compile Include="Models\HashingAlgorithm.cs" />
+ <Compile Include="Models\HashingAlgorithmDisplayPair.cs" />
+ <Compile Include="Models\HashingProgress.cs" />
<Compile Include="Models\NoResultFoundMockToolProvider.cs" />
<Compile Include="Models\Radix.cs" />
<Compile Include="Models\NumberBaseFormat.cs" />
@@ -53,6 +57,8 @@
<Compile Include="ViewModels\Tools\Converters\JsonYaml\DecimalJsonConverter.cs" />
<Compile Include="ViewModels\Tools\Converters\JsonYaml\DecimalYamlTypeResolver.cs" />
<Compile Include="ViewModels\Tools\EncodersDecoders\EncodersDecodersGroupToolProvider.cs" />
+ <Compile Include="ViewModels\Tools\Generators\CheckSumGenerator\CheckSumGeneratorToolProvider.cs" />
+ <Compile Include="ViewModels\Tools\Generators\CheckSumGenerator\CheckSumGeneratorToolViewModel.cs" />
<Compile Include="ViewModels\Tools\Generators\GeneratorsGroupToolProvider.cs" />
<Compile Include="ViewModels\Tools\Generators\LoremIpsumGenerator\LoremIpsumGeneratorToolProvider.cs" />
<Compile Include="ViewModels\Tools\Generators\LoremIpsumGenerator\LoremIpsumGeneratorToolViewModel.cs" />
@@ -79,6 +85,9 @@
<Compile Include="Views\Tools\EncodersDecoders\GZipEncoderDecoder\GZipEncoderDecoderToolPage.xaml.cs">
<DependentUpon>GZipEncoderDecoderToolPage.xaml</DependentUpon>
</Compile>
+ <Compile Include="Views\Tools\Generators\CheckSumGenerator\CheckSumGeneratorToolPage.xaml.cs">
+ <DependentUpon>CheckSumGeneratorToolPage.xaml</DependentUpon>
+ </Compile>
<Compile Include="Views\Tools\Graphic\ColorBlindnessSimulator\ColorBlindnessSimulatorToolPage.xaml.cs">
<DependentUpon>ColorBlindnessSimulatorToolPage.xaml</DependentUpon>
</Compile>
@@ -525,6 +534,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
+ <Page Include="Views\Tools\Generators\CheckSumGenerator\CheckSumGeneratorToolPage.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
<Page Include="Views\Tools\Graphic\ColorBlindnessSimulator\ColorBlindnessSimulatorToolPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
diff --git a/src/dev/impl/DevToys/Helpers/HashingHelper.cs b/src/dev/impl/DevToys/Helpers/HashingHelper.cs
new file mode 100644
index 000000000..921935d6e
--- /dev/null
+++ b/src/dev/impl/DevToys/Helpers/HashingHelper.cs
@@ -0,0 +1,72 @@
+#nullable enable
+
+using System;
+using System.IO;
+using System.Security.Cryptography;
+using System.Threading;
+using System.Threading.Tasks;
+using DevToys.Models;
+using DevToys.Shared.Core;
+
+namespace DevToys.Helpers
+{
+ internal static class HashingHelper
+ {
+ internal static async Task<byte[]> ComputeHashAsync(
+ HashAlgorithm hashAlgorithm,
+ Stream stream,
+ IProgress<HashingProgress> progress,
+ CancellationToken cancellationToken,
+ int bufferSize = 1024 * 1024)
+ {
+ Arguments.NotNull(stream, nameof(stream));
+ Arguments.NotNull(hashAlgorithm, nameof(hashAlgorithm));
+
+ byte[] readAheadBuffer = new byte[bufferSize];
+ byte[] buffer;
+
+ int readAheadBytes = await stream.ReadAsync(readAheadBuffer, 0, bufferSize, cancellationToken);
+ int bytesRead;
+ long totalBytesRead = readAheadBytes;
+
+ while (readAheadBytes != 0)
+ {
+ bytesRead = readAheadBytes;
+ buffer = readAheadBuffer;
+
+ readAheadBytes = await stream.ReadAsync(readAheadBuffer, 0, bufferSize, cancellationToken);
+ totalBytesRead += readAheadBytes;
+
+ if (readAheadBytes == 0)
+ {
+ hashAlgorithm.TransformFinalBlock(buffer, 0, bytesRead);
+ }
+ else
+ {
+ hashAlgorithm.TransformBlock(buffer, 0, bytesRead, buffer, 0);
+ }
+
+ progress.Report(new HashingProgress(stream.Length, totalBytesRead));
+ cancellationToken.ThrowIfCancellationRequested();
+ }
+ return hashAlgorithm.Hash ?? Array.Empty<byte>();
+ }
+
+ internal static int ComputeHashIterations(Stream stream, int bufferSize = 1024 * 1024)
+ {
+ Arguments.NotNull(stream, nameof(stream));
+ Arguments.NotZeroOrBelow(bufferSize, nameof(bufferSize));
+
+ if(stream.Length == 0)
+ {
+ return 0;
+ }
+ else if(bufferSize >= stream.Length)
+ {
+ return 1;
+ }
+
+ return (int)(stream.Length / bufferSize);
+ }
+ }
+}
diff --git a/src/dev/impl/DevToys/LanguageManager.cs b/src/dev/impl/DevToys/LanguageManager.cs
index 1c73c1809..4dfdf6aad 100644
--- a/src/dev/impl/DevToys/LanguageManager.cs
+++ b/src/dev/impl/DevToys/LanguageManager.cs
@@ -26,6 +26,7 @@ namespace DevToys
private readonly AllToolsStrings _alltools = new AllToolsStrings();
private readonly Base64EncoderDecoderStrings _base64encoderdecoder = new Base64EncoderDecoderStrings();
+ private readonly CheckSumGeneratorStrings _checksumgenerator = new CheckSumGeneratorStrings();
private readonly ColorBlindnessSimulatorStrings _colorblindnesssimulator = new ColorBlindnessSimulatorStrings();
private readonly CommonStrings _common = new CommonStrings();
private readonly GuidGeneratorStrings _guidgenerator = new GuidGeneratorStrings();
@@ -69,6 +70,11 @@ namespace DevToys
/// </summary>
public Base64EncoderDecoderStrings Base64EncoderDecoder => _base64encoderdecoder;
+ /// <summary>
+ /// Gets the <see cref="CheckSumGeneratorStrings"/>.
+ /// </summary>
+ public CheckSumGeneratorStrings CheckSumGenerator => _checksumgenerator;
+
/// <summary>
/// Gets the <see cref="ColorBlindnessSimulatorStrings"/>.
/// </summary>
@@ -321,6 +327,96 @@ namespace DevToys
public string SearchDisplayName => _resources.GetString("SearchDisplayName");
}
+ public class CheckSumGeneratorStrings : ObservableObject
+ {
+ private readonly ResourceLoader _resources = ResourceLoader.GetForViewIndependentUse("CheckSumGenerator");
+
+ /// <summary>
+ /// Gets the resource AccessibleName.
+ /// </summary>
+ public string AccessibleName => _resources.GetString("AccessibleName");
+
+ /// <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 Description.
+ /// </summary>
+ public string Description => _resources.GetString("Description");
+
+ /// <summary>
+ /// Gets the resource HashingAlgorithmDescription.
+ /// </summary>
+ public string HashingAlgorithmDescription => _resources.GetString("HashingAlgorithmDescription");
+
+ /// <summary>
+ /// Gets the resource HashingAlgorithmTitle.
+ /// </summary>
+ public string HashingAlgorithmTitle => _resources.GetString("HashingAlgorithmTitle");
+
+ /// <summary>
+ /// Gets the resource Input.
+ /// </summary>
+ public string Input => _resources.GetString("Input");
+
+ /// <summary>
+ /// Gets the resource MenuDisplayName.
+ /// </summary>
+ public string MenuDisplayName => _resources.GetString("MenuDisplayName");
+
+ /// <summary>
+ /// Gets the resource Output.
+ /// </summary>
+ public string Output => _resources.GetString("Output");
+
+ /// <summary>
+ /// Gets the resource OutputComparer.
+ /// </summary>
+ public string OutputComparer => _resources.GetString("OutputComparer");
+
+ /// <summary>
+ /// Gets the resource SaveAs.
+ /// </summary>
+ public string SaveAs => _resources.GetString("SaveAs");
+
+ /// <summary>
+ /// Gets the resource SearchDisplayName.
+ /// </summary>
+ public string SearchDisplayName => _resources.GetString("SearchDisplayName");
+
+ /// <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");
+
+ /// <summary>
+ /// Gets the resource SelectFilesInstruction4.
+ /// </summary>
+ public string SelectFilesInstruction4 => _resources.GetString("SelectFilesInstruction4");
+
+ /// <summary>
+ /// Gets the resource Uppercase.
+ /// </summary>
+ public string Uppercase => _resources.GetString("Uppercase");
+ }
+
public class ColorBlindnessSimulatorStrings : ObservableObject
{
private readonly ResourceLoader _resources = ResourceLoader.GetForViewIndependentUse("ColorBlindnessSimulator");
diff --git a/src/dev/impl/DevToys/Models/HashingAlgorithm.cs b/src/dev/impl/DevToys/Models/HashingAlgorithm.cs
new file mode 100644
index 000000000..9d16aa0a1
--- /dev/null
+++ b/src/dev/impl/DevToys/Models/HashingAlgorithm.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DevToys.Models
+{
+ public enum HashingAlgorithm
+ {
+ MD5,
+ SHA1,
+ SHA256,
+ SHA384,
+ SHA512
+ }
+}
diff --git a/src/dev/impl/DevToys/Models/HashingAlgorithmDisplayPair.cs b/src/dev/impl/DevToys/Models/HashingAlgorithmDisplayPair.cs
new file mode 100644
index 000000000..e0c91ef46
--- /dev/null
+++ b/src/dev/impl/DevToys/Models/HashingAlgorithmDisplayPair.cs
@@ -0,0 +1,25 @@
+using System;
+
+namespace DevToys.Models
+{
+ public sealed class HashingAlgorithmDisplayPair : IEquatable<HashingAlgorithmDisplayPair>
+ {
+ public static readonly HashingAlgorithmDisplayPair MD5 = new(nameof(MD5), HashingAlgorithm.MD5);
+ public static readonly HashingAlgorithmDisplayPair SHA1 = new(nameof(SHA1), HashingAlgorithm.SHA1);
+ public static readonly HashingAlgorithmDisplayPair SHA256 = new(nameof(SHA256), HashingAlgorithm.SHA256);
+ public static readonly HashingAlgorithmDisplayPair SHA384 = new(nameof(SHA384), HashingAlgorithm.SHA384);
+ public static readonly HashingAlgorithmDisplayPair SHA512 = new(nameof(SHA512), HashingAlgorithm.SHA512);
+
+ public string DisplayName { get; }
+
+ public HashingAlgorithm Value { get; }
+
+ private HashingAlgorithmDisplayPair(string displayName, HashingAlgorithm value)
+ {
+ DisplayName = displayName;
+ Value = value;
+ }
+
+ public bool Equals(HashingAlgorithmDisplayPair other) => other.Value == Value;
+ }
+}
diff --git a/src/dev/impl/DevToys/Models/HashingProgress.cs b/src/dev/impl/DevToys/Models/HashingProgress.cs
new file mode 100644
index 000000000..52d426dc0
--- /dev/null
+++ b/src/dev/impl/DevToys/Models/HashingProgress.cs
@@ -0,0 +1,18 @@
+using System;
+
+namespace DevToys.Models
+{
+ public class HashingProgress
+ {
+ public long TotalBytes { get; }
+ public long CompletedBytes { get; }
+
+ public int GetPercentage() => (int)Math.Floor(100f * CompletedBytes / TotalBytes);
+
+ public HashingProgress(long totalBytes, long completedBytes = 0)
+ {
+ TotalBytes = totalBytes;
+ CompletedBytes = completedBytes;
+ }
+ }
+}
diff --git a/src/dev/impl/DevToys/Strings/cs-CZ/CheckSumGenerator.resw b/src/dev/impl/DevToys/Strings/cs-CZ/CheckSumGenerator.resw
new file mode 100644
index 000000000..022282b02
--- /dev/null
+++ b/src/dev/impl/DevToys/Strings/cs-CZ/CheckSumGenerator.resw
@@ -0,0 +1,168 @@
+<?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="AccessibleName" xml:space="preserve">
+ <value>CheckSum Generator tool</value>
+ </data>
+ <data name="Cancel" xml:space="preserve">
+ <value>Cancel</value>
+ </data>
+ <data name="Configuration" xml:space="preserve">
+ <value>Configuration</value>
+ </data>
+ <data name="Description" xml:space="preserve">
+ <value>Generate an hash with CheckSum based on a file</value>
+ </data>
+ <data name="HashingAlgorithmDescription" xml:space="preserve">
+ <value>Select which hashing algorithm you want to use</value>
+ </data>
+ <data name="HashingAlgorithmTitle" xml:space="preserve">
+ <value>Hashing Algorithm</value>
+ </data>
+ <data name="Input" xml:space="preserve">
+ <value>Input</value>
+ </data>
+ <data name="MenuDisplayName" xml:space="preserve">
+ <value>CheckSum</value>
+ </data>
+ <data name="Output" xml:space="preserve">
+ <value>Output</value>
+ </data>
+ <data name="OutputComparer" xml:space="preserve">
+ <value>Output Comparer</value>
+ </data>
+ <data name="SearchDisplayName" xml:space="preserve">
+ <value>CheckSum</value>
+ </data>
+ <data name="SelectFilesInstruction1" xml:space="preserve">
+ <value>Drag &amp; drop a file here</value>
+ </data>
+ <data name="SelectFilesInstruction2" xml:space="preserve">
+ <value>or</value>
+ </data>
+ <data name="SelectFilesInstruction3" xml:space="preserve">
+ <value>Browse files</value>
+ </data>
+ <data name="SelectFilesInstruction4" xml:space="preserve">
+ <value>Paste</value>
+ </data>
+ <data name="Uppercase" xml:space="preserve">
+ <value>Uppercase</value>
+ </data>
+</root>
\ No newline at end of file
diff --git a/src/dev/impl/DevToys/Strings/en-US/CheckSumGenerator.resw b/src/dev/impl/DevToys/Strings/en-US/CheckSumGenerator.resw
new file mode 100644
index 000000000..508515613
--- /dev/null
+++ b/src/dev/impl/DevToys/Strings/en-US/CheckSumGenerator.resw
@@ -0,0 +1,171 @@
+<?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="AccessibleName" xml:space="preserve">
+ <value>CheckSum Generator tool</value>
+ </data>
+ <data name="Cancel" xml:space="preserve">
+ <value>Cancel</value>
+ </data>
+ <data name="Configuration" xml:space="preserve">
+ <value>Configuration</value>
+ </data>
+ <data name="Description" xml:space="preserve">
+ <value>Generate an hash with CheckSum based on a file</value>
+ </data>
+ <data name="HashingAlgorithmDescription" xml:space="preserve">
+ <value>Select which hashing algorithm you want to use</value>
+ </data>
+ <data name="HashingAlgorithmTitle" xml:space="preserve">
+ <value>Hashing Algorithm</value>
+ </data>
+ <data name="Input" xml:space="preserve">
+ <value>Input</value>
+ </data>
+ <data name="MenuDisplayName" xml:space="preserve">
+ <value>CheckSum</value>
+ </data>
+ <data name="Output" xml:space="preserve">
+ <value>Output</value>
+ </data>
+ <data name="OutputComparer" xml:space="preserve">
+ <value>Output Comparer</value>
+ </data>
+ <data name="SaveAs" xml:space="preserve">
+ <value>Save as</value>
+ </data>
+ <data name="SearchDisplayName" xml:space="preserve">
+ <value>CheckSum</value>
+ </data>
+ <data name="SelectFilesInstruction1" xml:space="preserve">
+ <value>Drag &amp; drop a file here</value>
+ </data>
+ <data name="SelectFilesInstruction2" xml:space="preserve">
+ <value>or</value>
+ </data>
+ <data name="SelectFilesInstruction3" xml:space="preserve">
+ <value>Browse files</value>
+ </data>
+ <data name="SelectFilesInstruction4" xml:space="preserve">
+ <value>Paste</value>
+ </data>
+ <data name="Uppercase" xml:space="preserve">
+ <value>Uppercase</value>
+ </data>
+</root>
\ No newline at end of file
diff --git a/src/dev/impl/DevToys/Strings/fr-FR/CheckSumGenerator.resw b/src/dev/impl/DevToys/Strings/fr-FR/CheckSumGenerator.resw
new file mode 100644
index 000000000..022282b02
--- /dev/null
+++ b/src/dev/impl/DevToys/Strings/fr-FR/CheckSumGenerator.resw
@@ -0,0 +1,168 @@
+<?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="AccessibleName" xml:space="preserve">
+ <value>CheckSum Generator tool</value>
+ </data>
+ <data name="Cancel" xml:space="preserve">
+ <value>Cancel</value>
+ </data>
+ <data name="Configuration" xml:space="preserve">
+ <value>Configuration</value>
+ </data>
+ <data name="Description" xml:space="preserve">
+ <value>Generate an hash with CheckSum based on a file</value>
+ </data>
+ <data name="HashingAlgorithmDescription" xml:space="preserve">
+ <value>Select which hashing algorithm you want to use</value>
+ </data>
+ <data name="HashingAlgorithmTitle" xml:space="preserve">
+ <value>Hashing Algorithm</value>
+ </data>
+ <data name="Input" xml:space="preserve">
+ <value>Input</value>
+ </data>
+ <data name="MenuDisplayName" xml:space="preserve">
+ <value>CheckSum</value>
+ </data>
+ <data name="Output" xml:space="preserve">
+ <value>Output</value>
+ </data>
+ <data name="OutputComparer" xml:space="preserve">
+ <value>Output Comparer</value>
+ </data>
+ <data name="SearchDisplayName" xml:space="preserve">
+ <value>CheckSum</value>
+ </data>
+ <data name="SelectFilesInstruction1" xml:space="preserve">
+ <value>Drag &amp; drop a file here</value>
+ </data>
+ <data name="SelectFilesInstruction2" xml:space="preserve">
+ <value>or</value>
+ </data>
+ <data name="SelectFilesInstruction3" xml:space="preserve">
+ <value>Browse files</value>
+ </data>
+ <data name="SelectFilesInstruction4" xml:space="preserve">
+ <value>Paste</value>
+ </data>
+ <data name="Uppercase" xml:space="preserve">
+ <value>Uppercase</value>
+ </data>
+</root>
\ No newline at end of file
diff --git a/src/dev/impl/DevToys/Strings/pl-PL/CheckSumGenerator.resw b/src/dev/impl/DevToys/Strings/pl-PL/CheckSumGenerator.resw
new file mode 100644
index 000000000..022282b02
--- /dev/null
+++ b/src/dev/impl/DevToys/Strings/pl-PL/CheckSumGenerator.resw
@@ -0,0 +1,168 @@
+<?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="AccessibleName" xml:space="preserve">
+ <value>CheckSum Generator tool</value>
+ </data>
+ <data name="Cancel" xml:space="preserve">
+ <value>Cancel</value>
+ </data>
+ <data name="Configuration" xml:space="preserve">
+ <value>Configuration</value>
+ </data>
+ <data name="Description" xml:space="preserve">
+ <value>Generate an hash with CheckSum based on a file</value>
+ </data>
+ <data name="HashingAlgorithmDescription" xml:space="preserve">
+ <value>Select which hashing algorithm you want to use</value>
+ </data>
+ <data name="HashingAlgorithmTitle" xml:space="preserve">
+ <value>Hashing Algorithm</value>
+ </data>
+ <data name="Input" xml:space="preserve">
+ <value>Input</value>
+ </data>
+ <data name="MenuDisplayName" xml:space="preserve">
+ <value>CheckSum</value>
+ </data>
+ <data name="Output" xml:space="preserve">
+ <value>Output</value>
+ </data>
+ <data name="OutputComparer" xml:space="preserve">
+ <value>Output Comparer</value>
+ </data>
+ <data name="SearchDisplayName" xml:space="preserve">
+ <value>CheckSum</value>
+ </data>
+ <data name="SelectFilesInstruction1" xml:space="preserve">
+ <value>Drag &amp; drop a file here</value>
+ </data>
+ <data name="SelectFilesInstruction2" xml:space="preserve">
+ <value>or</value>
+ </data>
+ <data name="SelectFilesInstruction3" xml:space="preserve">
+ <value>Browse files</value>
+ </data>
+ <data name="SelectFilesInstruction4" xml:space="preserve">
+ <value>Paste</value>
+ </data>
+ <data name="Uppercase" xml:space="preserve">
+ <value>Uppercase</value>
+ </data>
+</root>
\ No newline at end of file
diff --git a/src/dev/impl/DevToys/Strings/pt-PT/CheckSumGenerator.resw b/src/dev/impl/DevToys/Strings/pt-PT/CheckSumGenerator.resw
new file mode 100644
index 000000000..a8906c2af
--- /dev/null
+++ b/src/dev/impl/DevToys/Strings/pt-PT/CheckSumGenerator.resw
@@ -0,0 +1,168 @@
+<?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="AccessibleName" xml:space="preserve">
+ <value>Ferramenta geradora de CheckSum</value>
+ </data>
+ <data name="Cancel" xml:space="preserve">
+ <value>Cancelar</value>
+ </data>
+ <data name="Configuration" xml:space="preserve">
+ <value>Configuração</value>
+ </data>
+ <data name="Description" xml:space="preserve">
+ <value>Gerar um hash com CheckSum baseado num ficheiro</value>
+ </data>
+ <data name="HashingAlgorithmDescription" xml:space="preserve">
+ <value>Selecione o algoritmo de hash que deseja utilisar</value>
+ </data>
+ <data name="HashingAlgorithmTitle" xml:space="preserve">
+ <value>Algoritmo de hash</value>
+ </data>
+ <data name="Input" xml:space="preserve">
+ <value>Entrada</value>
+ </data>
+ <data name="MenuDisplayName" xml:space="preserve">
+ <value>CheckSum</value>
+ </data>
+ <data name="Output" xml:space="preserve">
+ <value>Resultado</value>
+ </data>
+ <data name="OutputComparer" xml:space="preserve">
+ <value>Comparador de resultado</value>
+ </data>
+ <data name="SearchDisplayName" xml:space="preserve">
+ <value>CheckSum</value>
+ </data>
+ <data name="SelectFilesInstruction1" xml:space="preserve">
+ <value>Arraste e largue um ficheiro aqui</value>
+ </data>
+ <data name="SelectFilesInstruction2" xml:space="preserve">
+ <value>ou</value>
+ </data>
+ <data name="SelectFilesInstruction3" xml:space="preserve">
+ <value>Procurar ficheiros</value>
+ </data>
+ <data name="SelectFilesInstruction4" xml:space="preserve">
+ <value>Colar</value>
+ </data>
+ <data name="Uppercase" xml:space="preserve">
+ <value>Maiúsculas</value>
+ </data>
+</root>
\ No newline at end of file
diff --git a/src/dev/impl/DevToys/Strings/ru-RU/CheckSumGenerator.resw b/src/dev/impl/DevToys/Strings/ru-RU/CheckSumGenerator.resw
new file mode 100644
index 000000000..022282b02
--- /dev/null
+++ b/src/dev/impl/DevToys/Strings/ru-RU/CheckSumGenerator.resw
@@ -0,0 +1,168 @@
+<?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="AccessibleName" xml:space="preserve">
+ <value>CheckSum Generator tool</value>
+ </data>
+ <data name="Cancel" xml:space="preserve">
+ <value>Cancel</value>
+ </data>
+ <data name="Configuration" xml:space="preserve">
+ <value>Configuration</value>
+ </data>
+ <data name="Description" xml:space="preserve">
+ <value>Generate an hash with CheckSum based on a file</value>
+ </data>
+ <data name="HashingAlgorithmDescription" xml:space="preserve">
+ <value>Select which hashing algorithm you want to use</value>
+ </data>
+ <data name="HashingAlgorithmTitle" xml:space="preserve">
+ <value>Hashing Algorithm</value>
+ </data>
+ <data name="Input" xml:space="preserve">
+ <value>Input</value>
+ </data>
+ <data name="MenuDisplayName" xml:space="preserve">
+ <value>CheckSum</value>
+ </data>
+ <data name="Output" xml:space="preserve">
+ <value>Output</value>
+ </data>
+ <data name="OutputComparer" xml:space="preserve">
+ <value>Output Comparer</value>
+ </data>
+ <data name="SearchDisplayName" xml:space="preserve">
+ <value>CheckSum</value>
+ </data>
+ <data name="SelectFilesInstruction1" xml:space="preserve">
+ <value>Drag &amp; drop a file here</value>
+ </data>
+ <data name="SelectFilesInstruction2" xml:space="preserve">
+ <value>or</value>
+ </data>
+ <data name="SelectFilesInstruction3" xml:space="preserve">
+ <value>Browse files</value>
+ </data>
+ <data name="SelectFilesInstruction4" xml:space="preserve">
+ <value>Paste</value>
+ </data>
+ <data name="Uppercase" xml:space="preserve">
+ <value>Uppercase</value>
+ </data>
+</root>
\ No newline at end of file
diff --git a/src/dev/impl/DevToys/Strings/zh-Hans/CheckSumGenerator.resw b/src/dev/impl/DevToys/Strings/zh-Hans/CheckSumGenerator.resw
new file mode 100644
index 000000000..022282b02
--- /dev/null
+++ b/src/dev/impl/DevToys/Strings/zh-Hans/CheckSumGenerator.resw
@@ -0,0 +1,168 @@
+<?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="AccessibleName" xml:space="preserve">
+ <value>CheckSum Generator tool</value>
+ </data>
+ <data name="Cancel" xml:space="preserve">
+ <value>Cancel</value>
+ </data>
+ <data name="Configuration" xml:space="preserve">
+ <value>Configuration</value>
+ </data>
+ <data name="Description" xml:space="preserve">
+ <value>Generate an hash with CheckSum based on a file</value>
+ </data>
+ <data name="HashingAlgorithmDescription" xml:space="preserve">
+ <value>Select which hashing algorithm you want to use</value>
+ </data>
+ <data name="HashingAlgorithmTitle" xml:space="preserve">
+ <value>Hashing Algorithm</value>
+ </data>
+ <data name="Input" xml:space="preserve">
+ <value>Input</value>
+ </data>
+ <data name="MenuDisplayName" xml:space="preserve">
+ <value>CheckSum</value>
+ </data>
+ <data name="Output" xml:space="preserve">
+ <value>Output</value>
+ </data>
+ <data name="OutputComparer" xml:space="preserve">
+ <value>Output Comparer</value>
+ </data>
+ <data name="SearchDisplayName" xml:space="preserve">
+ <value>CheckSum</value>
+ </data>
+ <data name="SelectFilesInstruction1" xml:space="preserve">
+ <value>Drag &amp; drop a file here</value>
+ </data>
+ <data name="SelectFilesInstruction2" xml:space="preserve">
+ <value>or</value>
+ </data>
+ <data name="SelectFilesInstruction3" xml:space="preserve">
+ <value>Browse files</value>
+ </data>
+ <data name="SelectFilesInstruction4" xml:space="preserve">
+ <value>Paste</value>
+ </data>
+ <data name="Uppercase" xml:space="preserve">
+ <value>Uppercase</value>
+ </data>
+</root>
\ No newline at end of file
diff --git a/src/dev/impl/DevToys/ViewModels/Tools/Generators/CheckSumGenerator/CheckSumGeneratorToolProvider.cs b/src/dev/impl/DevToys/ViewModels/Tools/Generators/CheckSumGenerator/CheckSumGeneratorToolProvider.cs
new file mode 100644
index 000000000..b365e06d7
--- /dev/null
+++ b/src/dev/impl/DevToys/ViewModels/Tools/Generators/CheckSumGenerator/CheckSumGeneratorToolProvider.cs
@@ -0,0 +1,47 @@
+#nullable enable
+
+using System.Composition;
+using DevToys.Api.Tools;
+using DevToys.Core.Threading;
+using DevToys.Shared.Api.Core;
+using Windows.UI.Xaml.Controls;
+
+namespace DevToys.ViewModels.Tools.CheckSumGenerator
+{
+ [Export(typeof(IToolProvider))]
+ [Name("CheckSum Generator")]
+ [Parent(GeneratorsGroupToolProvider.InternalName)]
+ [ProtocolName("checksum")]
+ [Order(3)]
+ [CompactOverlaySize(width: 400, height: 500)]
+ internal sealed class CheckSumGeneratorToolProvider : ToolProviderBase, IToolProvider
+ {
+ private readonly IMefProvider _mefProvider;
+
+ public string MenuDisplayName => LanguageManager.Instance.CheckSumGenerator.MenuDisplayName;
+
+ public string? SearchDisplayName => LanguageManager.Instance.CheckSumGenerator.SearchDisplayName;
+
+ public string? Description => LanguageManager.Instance.CheckSumGenerator.Description;
+
+ public string AccessibleName => LanguageManager.Instance.CheckSumGenerator.AccessibleName;
+
+ public TaskCompletionNotifier<IconElement> IconSource => CreateFontIcon("\uF56F");
+
+ [ImportingConstructor]
+ public CheckSumGeneratorToolProvider(IMefProvider mefProvider)
+ {
+ _mefProvider = mefProvider;
+ }
+
+ public bool CanBeTreatedByTool(string data)
+ {
+ return false;
+ }
+
+ public IToolViewModel CreateTool()
+ {
+ return _mefProvider.Import<CheckSumGeneratorToolViewModel>();
+ }
+ }
+}
diff --git a/src/dev/impl/DevToys/ViewModels/Tools/Generators/CheckSumGenerator/CheckSumGeneratorToolViewModel.cs b/src/dev/impl/DevToys/ViewModels/Tools/Generators/CheckSumGenerator/CheckSumGeneratorToolViewModel.cs
new file mode 100644
index 000000000..c43b4e4a1
--- /dev/null
+++ b/src/dev/impl/DevToys/ViewModels/Tools/Generators/CheckSumGenerator/CheckSumGeneratorToolViewModel.cs
@@ -0,0 +1,432 @@
+#nullable enable
+
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Composition;
+using System.IO;
+using System.Security.Cryptography;
+using System.Threading.Tasks;
+using DevToys.Api.Core;
+using DevToys.Api.Core.Settings;
+using DevToys.Api.Tools;
+using DevToys.Core.Threading;
+using DevToys.Models;
+using DevToys.Shared.Core;
+using DevToys.Views.Tools.CheckSumGenerator;
+using Microsoft.Toolkit.Mvvm.ComponentModel;
+using Microsoft.Toolkit.Mvvm.Input;
+using Windows.ApplicationModel.DataTransfer;
+using Windows.Storage;
+using DevToys.Shared.Core.Threading;
+using Windows.Storage.Pickers;
+using Windows.UI.Xaml;
+using System.Linq;
+using DevToys.Core;
+using Clipboard = Windows.ApplicationModel.DataTransfer.Clipboard;
+using DevToys.Helpers;
+using System.Threading;
+
+namespace DevToys.ViewModels.Tools.CheckSumGenerator
+{
+ [Export(typeof(CheckSumGeneratorToolViewModel))]
+ public sealed class CheckSumGeneratorToolViewModel : ObservableRecipient, IToolViewModel
+ {
+ /// <summary>
+ /// Whether the generated hash should be uppercase or lowercase.
+ /// </summary>
+ private static readonly SettingDefinition<bool> UppercaseSetting
+ = new(
+ name: $"{nameof(CheckSumGeneratorToolViewModel)}.{nameof(UppercaseSetting)}",
+ isRoaming: true,
+ defaultValue: false);
+
+ /// <summary>
+ /// The hashing algorithm to be used in the generation.
+ /// </summary>
+ private static readonly SettingDefinition<HashingAlgorithm> HashingAlgorithmSetting
+ = new(
+ name: $"{nameof(CheckSumGeneratorToolViewModel)}.{nameof(HashingAlgorithmSetting)}",
+ isRoaming: true,
+ defaultValue: HashingAlgorithm.MD5);
+
+ private readonly IMarketingService _marketingService;
+ private readonly ISettingsProvider _settingsProvider;
+ private readonly int _displayAboveIterations = 124;
+
+ private readonly object _lockObject = new();
+ private CancellationTokenSource _cancellationTokenSource = new();
+ private bool _isSelectFilesAreaHighlighted;
+ private bool _isCalculationInProgress;
+ private IStorageFile? _inputFile;
+ private int _progress;
+ private string? _output;
+ private string? _outputComparer;
+ private bool _toolSuccessfullyWorked;
+ private bool _hasCancelledCalculation;
+ private bool _shouldDisplayProgress;
+ private HashingAlgorithmDisplayPair? _outputHashingAlgorithm;
+
+ internal CheckSumGeneratorStrings Strings => LanguageManager.Instance.CheckSumGenerator;
+
+ public Type View => typeof(CheckSumGeneratorToolPage);
+
+ internal bool IsUppercase
+ {
+ get => _settingsProvider.GetSetting(UppercaseSetting);
+ set
+ {
+ if (IsUppercase != value)
+ {
+ _settingsProvider.SetSetting(UppercaseSetting, value);
+ OnPropertyChanged();
+ UpdateOutputCase();
+ }
+ }
+ }
+
+ internal HashingAlgorithmDisplayPair InputHashingAlgorithm
+ {
+ get
+ {
+ HashingAlgorithm settingValue = _settingsProvider.GetSetting(HashingAlgorithmSetting);
+ return HashingAlgorithms.FirstOrDefault(x => x.Value == settingValue) ?? HashingAlgorithmDisplayPair.MD5;
+ }
+
+ set
+ {
+ if (InputHashingAlgorithm != value)
+ {
+ _settingsProvider.SetSetting(HashingAlgorithmSetting, value.Value);
+ OnPropertyChanged();
+ if (!_hasCancelledCalculation)
+ {
+ CheckSum();
+ }
+ }
+ }
+ }
+
+ internal int Progress
+ {
+ get => _progress;
+ set => SetProperty(ref _progress, value);
+ }
+
+ internal IStorageFile? InputFile
+ {
+ get => _inputFile;
+ set
+ {
+ if (InputFile != value)
+ {
+ SetProperty(ref _inputFile, value);
+ CheckSum();
+ }
+ }
+ }
+
+ internal bool IsSelectFilesAreaHighlighted
+ {
+ get => _isSelectFilesAreaHighlighted;
+ set => SetProperty(ref _isSelectFilesAreaHighlighted, value);
+ }
+
+ internal bool ShouldDisplayProgress
+ {
+ get => _shouldDisplayProgress;
+ set => SetProperty(ref _shouldDisplayProgress, value);
+ }
+
+ internal string? Output
+ {
+ get => _output;
+ set => SetProperty(ref _output, value);
+ }
+
+ internal string? OutputComparer
+ {
+ get => _outputComparer;
+ set => SetProperty(ref _outputComparer, value);
+ }
+
+ /// <summary>
+ /// Get a list of supported Hashing Algorithms
+ /// </summary>
+ internal IReadOnlyList<HashingAlgorithmDisplayPair> HashingAlgorithms = new ObservableCollection<HashingAlgorithmDisplayPair>
+ {
+ HashingAlgorithmDisplayPair.MD5,
+ HashingAlgorithmDisplayPair.SHA1,
+ HashingAlgorithmDisplayPair.SHA256,
+ HashingAlgorithmDisplayPair.SHA384,
+ HashingAlgorithmDisplayPair.SHA512,
+ };
+
+
+ [ImportingConstructor]
+ public CheckSumGeneratorToolViewModel(ISettingsProvider settingsProvider, IMarketingService marketingService)
+ {
+ _settingsProvider = settingsProvider;
+ _marketingService = marketingService;
+ SelectFilesAreaDragOverCommand = new RelayCommand<DragEventArgs>(ExecuteSelectFilesAreaDragOverCommand);
+ SelectFilesAreaDragLeaveCommand = new RelayCommand<DragEventArgs>(ExecuteSelectFilesAreaDragLeaveCommand);
+ SelectFilesAreaDragDropCommand = new AsyncRelayCommand<DragEventArgs>(ExecuteSelectFilesAreaDragDropCommandAsync);
+ SelectFilesBrowseCommand = new AsyncRelayCommand(ExecuteSelectFilesBrowseCommandAsync);
+ SelectFilesPasteCommand = new AsyncRelayCommand(ExecuteSelectFilesPasteCommandAsync);
+ CancelCommand = new RelayCommand(() => ExecuteCancelCommand(shouldRevertHashingAlgo: true));
+ }
+
+ #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;
+ }
+
+ IsSelectFilesAreaHighlighted = true;
+ }
+
+ #endregion
+
+ #region SelectFilesAreaDragLeaveCommand
+
+ public IRelayCommand<DragEventArgs> SelectFilesAreaDragLeaveCommand { get; }
+
+ private void ExecuteSelectFilesAreaDragLeaveCommand(DragEventArgs? parameters)
+ {
+ IsSelectFilesAreaHighlighted = false;
+ }
+
+ #endregion
+
+ #region SelectFilesAreaDragDropCommand
+
+ public IAsyncRelayCommand<DragEventArgs> SelectFilesAreaDragDropCommand { get; }
+
+ private async Task ExecuteSelectFilesAreaDragDropCommandAsync(DragEventArgs? parameters)
+ {
+ Arguments.NotNull(parameters, nameof(parameters));
+
+ await ThreadHelper.RunOnUIThreadAsync(async () =>
+ {
+ IsSelectFilesAreaHighlighted = false;
+
+ IStorageItem? storageItem = await ExtractStorageItem(parameters!.DataView);
+ if (storageItem is StorageFile file)
+ {
+ InputFile = file;
+ }
+ }).ConfigureAwait(false);
+ }
+
+ #endregion
+
+ #region SelectFilesBrowseCommand
+
+ public IAsyncRelayCommand SelectFilesBrowseCommand { get; }
+
+ private async Task ExecuteSelectFilesBrowseCommandAsync()
+ {
+ var filePicker = new FileOpenPicker
+ {
+ ViewMode = PickerViewMode.List,
+ SuggestedStartLocation = PickerLocationId.ComputerFolder,
+ };
+ filePicker.FileTypeFilter.Add("*");
+
+ await ThreadHelper.RunOnUIThreadAsync(async () =>
+ {
+ StorageFile file = await filePicker.PickSingleFileAsync();
+ if (file != null)
+ {
+ InputFile = file;
+ }
+ });
+ }
+
+ #endregion
+
+ #region SelectFilesPasteCommand
+
+ public IAsyncRelayCommand SelectFilesPasteCommand { get; }
+
+ private async Task ExecuteSelectFilesPasteCommandAsync()
+ {
+ await ThreadHelper.RunOnUIThreadAsync(async () =>
+ {
+ DataPackageView? dataPackageView = Clipboard.GetContent();
+
+ IStorageItem? storageItem = await ExtractStorageItem(dataPackageView);
+ if (storageItem is StorageFile file)
+ {
+ InputFile = file;
+ }
+ }).ConfigureAwait(false);
+ }
+
+ #endregion
+
+ #region CancelCommand
+
+ public IRelayCommand CancelCommand { get; }
+
+ private void ExecuteCancelCommand(bool shouldRevertHashingAlgo)
+ {
+ lock (_lockObject)
+ {
+ _hasCancelledCalculation = true;
+ _cancellationTokenSource.Cancel();
+ _cancellationTokenSource.Dispose();
+
+ _cancellationTokenSource = new CancellationTokenSource();
+
+ if (shouldRevertHashingAlgo && _outputHashingAlgorithm != null)
+ {
+ InputHashingAlgorithm = _outputHashingAlgorithm;
+ }
+
+ _isCalculationInProgress = false;
+ _hasCancelledCalculation = false;
+ ShouldDisplayProgress = false;
+ ResetProgress();
+ }
+ }
+
+ #endregion
+
+ private void UpdateOutputCase()
+ {
+ if (string.IsNullOrWhiteSpace(Output))
+ {
+ return;
+ }
+
+ if (IsUppercase)
+ {
+ Output = Output!.ToUpperInvariant();
+ }
+ else
+ {
+ Output = Output!.ToLowerInvariant();
+ }
+ }
+
+ private void CheckSum()
+ {
+ lock (_lockObject)
+ {
+ ExecuteCancelCommand(shouldRevertHashingAlgo: false);
+ CheckSumAsync().Forget();
+ }
+ }
+
+ private async Task CheckSumAsync()
+ {
+ if (_isCalculationInProgress || InputFile is null)
+ {
+ return;
+ }
+
+ _isCalculationInProgress = true;
+
+ await TaskScheduler.Default;
+
+ using Stream? fileStream = await InputFile.OpenStreamForReadAsync();
+
+ await ThreadHelper.RunOnUIThreadAsync(() => ShouldDisplayProgress = HashingHelper.ComputeHashIterations(fileStream) > _displayAboveIterations);
+
+ string? hashOutput = await CalculateFileHash(InputHashingAlgorithm.Value, fileStream);
+
+ await ThreadHelper.RunOnUIThreadAsync(() =>
+ {
+ if (hashOutput != null)
+ {
+ Output = hashOutput;
+ _outputHashingAlgorithm = InputHashingAlgorithm;
+ }
+
+ _isCalculationInProgress = false;
+ ShouldDisplayProgress = false;
+
+ if (!_toolSuccessfullyWorked)
+ {
+ _toolSuccessfullyWorked = true;
+ _marketingService.NotifyToolSuccessfullyWorked();
+ }
+ });
+ }
+
+ private async Task<string?> CalculateFileHash(HashingAlgorithm inputHashingAlgorithm, Stream fileStream)
+ {
+ try
+ {
+ using HashAlgorithm? hashAlgo = CreateHashAlgorithm(inputHashingAlgorithm);
+
+ byte[]? fileHash = await HashingHelper.ComputeHashAsync(
+ hashAlgo,
+ fileStream,
+ new Progress<HashingProgress>(UpdateProgress),
+ _cancellationTokenSource.Token);
+
+ string? fileHashString = BitConverter
+ .ToString(fileHash)
+ .Replace("-", string.Empty);
+
+ if (!IsUppercase)
+ {
+ return fileHashString.ToLowerInvariant();
+ }
+ return fileHashString;
+ }
+ catch (OperationCanceledException)
+ {
+ return null;
+ }
+ catch (Exception ex)
+ {
+ Logger.LogFault("CheckSum Generator", ex, $"Failed to calculate FileHash, algorithm used: {inputHashingAlgorithm}");
+ return ex.Message;
+ }
+ }
+
+ private void UpdateProgress(HashingProgress hashingProgress) =>
+ ThreadHelper.RunOnUIThreadAsync(() => Progress = hashingProgress.GetPercentage()).ForgetSafely();
+
+ private void ResetProgress() => ThreadHelper.RunOnUIThreadAsync(() => Progress = 0).ForgetSafely();
+
+ private async Task<IStorageItem?> ExtractStorageItem(DataPackageView data)
+ {
+ if (data?.Contains(StandardDataFormats.StorageItems) != true)
+ {
+ return null;
+ }
+
+ IReadOnlyList<IStorageItem>? copiedFile = await data.GetStorageItemsAsync();
+ if (copiedFile is null || copiedFile.Count != 1)
+ {
+ return null;
+ }
+
+ return copiedFile[0];
+ }
+
+ private HashAlgorithm CreateHashAlgorithm(HashingAlgorithm hashingAlgorithm) =>
+ hashingAlgorithm switch
+ {
+ HashingAlgorithm.MD5 => MD5.Create(),
+ HashingAlgorithm.SHA1 => SHA1.Create(),
+ HashingAlgorithm.SHA256 => SHA256.Create(),
+ HashingAlgorithm.SHA384 => SHA384.Create(),
+ HashingAlgorithm.SHA512 => SHA512.Create(),
+ _ => throw new ArgumentException("Hash Algorithm not supported", nameof(HashingAlgorithm))
+ };
+
+ }
+}
diff --git a/src/dev/impl/DevToys/ViewModels/Tools/Graphic/ColorBlindnessSimulator/ColorBlindnessSimulatorToolViewModel.cs b/src/dev/impl/DevToys/ViewModels/Tools/Graphic/ColorBlindnessSimulator/ColorBlindnessSimulatorToolViewModel.cs
index 6373cb620..e56262849 100644
--- a/src/dev/impl/DevToys/ViewModels/Tools/Graphic/ColorBlindnessSimulator/ColorBlindnessSimulatorToolViewModel.cs
+++ b/src/dev/impl/DevToys/ViewModels/Tools/Graphic/ColorBlindnessSimulator/ColorBlindnessSimulatorToolViewModel.cs
@@ -35,7 +35,7 @@ namespace DevToys.ViewModels.Tools.ColorBlindnessSimulator
private CancellationTokenSource? _cancellationTokenSource;
private DateTime _timeSinceLastprogressUpdate;
- private bool _isSelectFilesAreaHighlithed;
+ private bool _isSelectFilesAreaHighlighted;
private bool _hasInvalidFilesSelected;
private bool _isResultGridVisible;
private bool _isProgressGridVisible;
@@ -52,10 +52,10 @@ namespace DevToys.ViewModels.Tools.ColorBlindnessSimulator
internal ColorBlindnessSimulatorStrings Strings => LanguageManager.Instance.ColorBlindnessSimulator;
- internal bool IsSelectFilesAreaHighlithed
+ internal bool IsSelectFilesAreaHighlighted
{
- get => _isSelectFilesAreaHighlithed;
- set => SetProperty(ref _isSelectFilesAreaHighlithed, value);
+ get => _isSelectFilesAreaHighlighted;
+ set => SetProperty(ref _isSelectFilesAreaHighlighted, value);
}
internal bool HasInvalidFilesSelected
@@ -149,7 +149,7 @@ namespace DevToys.ViewModels.Tools.ColorBlindnessSimulator
parameters.Handled = false;
}
- IsSelectFilesAreaHighlithed = true;
+ IsSelectFilesAreaHighlighted = true;
HasInvalidFilesSelected = false;
}
@@ -161,7 +161,7 @@ namespace DevToys.ViewModels.Tools.ColorBlindnessSimulator
private void ExecuteSelectFilesAreaDragLeaveCommand(DragEventArgs? parameters)
{
- IsSelectFilesAreaHighlithed = false;
+ IsSelectFilesAreaHighlighted = false;
HasInvalidFilesSelected = false;
}
@@ -177,7 +177,7 @@ namespace DevToys.ViewModels.Tools.ColorBlindnessSimulator
await ThreadHelper.RunOnUIThreadAsync(async () =>
{
- IsSelectFilesAreaHighlithed = false;
+ IsSelectFilesAreaHighlighted = false;
if (!parameters!.DataView.Contains(StandardDataFormats.StorageItems))
{
return;
diff --git a/src/dev/impl/DevToys/ViewModels/Tools/Graphic/PngJpgCompressor/PngJpgCompressorToolViewModel.cs b/src/dev/impl/DevToys/ViewModels/Tools/Graphic/PngJpgCompressor/PngJpgCompressorToolViewModel.cs
index 719e4b2b8..9474f8cca 100644
--- a/src/dev/impl/DevToys/ViewModels/Tools/Graphic/PngJpgCompressor/PngJpgCompressorToolViewModel.cs
+++ b/src/dev/impl/DevToys/ViewModels/Tools/Graphic/PngJpgCompressor/PngJpgCompressorToolViewModel.cs
@@ -27,17 +27,17 @@ namespace DevToys.ViewModels.Tools.PngJpgCompressor
private readonly IAppService _appService;
- private bool _isSelectFilesAreaHighlithed;
+ private bool _isSelectFilesAreaHighlighted;
private bool _hasInvalidFilesSelected;
public Type View { get; } = typeof(PngJpgCompressorToolPage);
internal PngJpgCompressorStrings Strings => LanguageManager.Instance.PngJpgCompressor;
- internal bool IsSelectFilesAreaHighlithed
+ internal bool IsSelectFilesAreaHighlighted
{
- get => _isSelectFilesAreaHighlithed;
- set => SetProperty(ref _isSelectFilesAreaHighlithed, value);
+ get => _isSelectFilesAreaHighlighted;
+ set => SetProperty(ref _isSelectFilesAreaHighlighted, value);
}
internal bool HasInvalidFilesSelected
@@ -87,7 +87,7 @@ namespace DevToys.ViewModels.Tools.PngJpgCompressor
parameters.Handled = false;
}
- IsSelectFilesAreaHighlithed = true;
+ IsSelectFilesAreaHighlighted = true;
HasInvalidFilesSelected = false;
}
@@ -99,7 +99,7 @@ namespace DevToys.ViewModels.Tools.PngJpgCompressor
private void ExecuteSelectFilesAreaDragLeaveCommand(DragEventArgs? parameters)
{
- IsSelectFilesAreaHighlithed = false;
+ IsSelectFilesAreaHighlighted = false;
HasInvalidFilesSelected = false;
}
@@ -115,7 +115,7 @@ namespace DevToys.ViewModels.Tools.PngJpgCompressor
await ThreadHelper.RunOnUIThreadAsync(async () =>
{
- IsSelectFilesAreaHighlithed = false;
+ IsSelectFilesAreaHighlighted = false;
if (!parameters!.DataView.Contains(StandardDataFormats.StorageItems))
{
return;
diff --git a/src/dev/impl/DevToys/Views/Tools/Generators/CheckSumGenerator/CheckSumGeneratorToolPage.xaml b/src/dev/impl/DevToys/Views/Tools/Generators/CheckSumGenerator/CheckSumGeneratorToolPage.xaml
new file mode 100644
index 000000000..6171f3504
--- /dev/null
+++ b/src/dev/impl/DevToys/Views/Tools/Generators/CheckSumGenerator/CheckSumGeneratorToolPage.xaml
@@ -0,0 +1,161 @@
+<Page
+ x:Class="DevToys.Views.Tools.CheckSumGenerator.CheckSumGeneratorToolPage"
+ 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:controls="using:DevToys.UI.Controls"
+ xmlns:core="using:Microsoft.Xaml.Interactions.Core"
+ xmlns:i="using:Microsoft.Xaml.Interactivity"
+ xmlns:converters="using:DevToys.UI.Converters"
+ xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
+ mc:Ignorable="d"
+ NavigationCacheMode="Required">
+
+ <Page.Resources>
+ <converters:BooleanToVisibilityConverter x:Name="BooleanToVisibilityConverter"/>
+ <converters:InvertedBooleanConverter x:Name="InvertedBooleanConverter"/>
+ </Page.Resources>
+
+ <StackPanel Margin="0,0,0,16" Spacing="12">
+ <VisualStateManager.VisualStateGroups>
+ <VisualStateGroup>
+ <VisualState x:Name="SelectFilesPointerHover">
+ <VisualState.StateTriggers>
+ <StateTrigger IsActive="{x:Bind ViewModel.IsSelectFilesAreaHighlighted, 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>
+
+ <StackPanel Spacing="4" >
+ <TextBlock Style="{StaticResource SubTitleTextBlock}" Text="{x:Bind ViewModel.Strings.Configuration}" />
+
+ <controls:ExpandableSettingControl
+ Title="{x:Bind ViewModel.Strings.Uppercase}">
+ <controls:ExpandableSettingControl.Icon>
+ <FontIcon Glyph="&#xF7B2;" />
+ </controls:ExpandableSettingControl.Icon>
+ <ToggleSwitch
+ Style="{StaticResource RightAlignedToggleSwitchStyle}"
+ IsOn="{x:Bind ViewModel.IsUppercase, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
+ </controls:ExpandableSettingControl>
+ <controls:ExpandableSettingControl
+ Grid.Row="1"
+ Title="{x:Bind ViewModel.Strings.HashingAlgorithmTitle}"
+ Description="{x:Bind ViewModel.Strings.HashingAlgorithmDescription}">
+ <controls:ExpandableSettingControl.Icon>
+ <FontIcon Glyph="&#xF18D;" />
+ </controls:ExpandableSettingControl.Icon>
+ <ComboBox
+ ItemsSource="{x:Bind ViewModel.HashingAlgorithms}"
+ DisplayMemberPath="DisplayName"
+ IsEnabled="{x:Bind ViewModel.ShouldDisplayProgress, Mode=OneWay, Converter={StaticResource InvertedBooleanConverter}}"
+ SelectedValue="{x:Bind ViewModel.InputHashingAlgorithm, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
+ </ComboBox>
+ </controls:ExpandableSettingControl>
+ </StackPanel>
+
+ <Grid
+ Grid.Row="0"
+ 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"/>
+ <StackPanel
+ Orientation="Horizontal"
+ HorizontalAlignment="Center"
+ Spacing="6">
+ <Button
+ x:Name="BrowseFileButton"
+ Style="{StaticResource AccentButtonStyle}"
+ VerticalAlignment="Center"
+ MinWidth="100"
+ Content="{x:Bind ViewModel.Strings.SelectFilesInstruction3}"
+ Command="{x:Bind ViewModel.SelectFilesBrowseCommand}"/>
+ <TextBlock
+ Text="/"
+ VerticalAlignment="Center"/>
+ <Button
+ Style="{StaticResource AccentButtonStyle}"
+ VerticalAlignment="Center"
+ MinWidth="100"
+ Content="{x:Bind ViewModel.Strings.SelectFilesInstruction4}"
+ Command="{x:Bind ViewModel.SelectFilesPasteCommand}"/>
+ </StackPanel>
+ </StackPanel>
+ </Grid>
+
+ <Grid Grid.Row="1" Margin="0,20,0,0" Visibility="{x:Bind ViewModel.ShouldDisplayProgress, Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverter}}">
+ <muxc:ProgressRing
+ Height="64"
+ Width="64"
+ IsIndeterminate="False"
+ Value="{x:Bind ViewModel.Progress, Mode=OneWay}"/>
+ <Button
+ Style="{StaticResource CommandBarFlyoutEllipsisButtonStyle}"
+ Margin="3,-1,0,0"
+ Command="{x:Bind ViewModel.CancelCommand}"
+ ToolTipService.ToolTip="{x:Bind ViewModel.Strings.Cancel}"
+ AutomationProperties.Name="{x:Bind ViewModel.Strings.Cancel}">
+ <FontIcon Glyph="&#xF75A;"/>
+ </Button>
+ </Grid>
+
+
+ <controls:CustomTextBox
+ Header="{x:Bind ViewModel.Strings.Output}"
+ IsReadOnly="True"
+ Text="{x:Bind ViewModel.Output, Mode=OneWay}"/>
+
+ <controls:CustomTextBox
+ Header="{x:Bind ViewModel.Strings.OutputComparer}"
+ Height="50"
+ AcceptsReturn="True"
+ Text="{x:Bind ViewModel.OutputComparer, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
+ </StackPanel>
+</Page>
diff --git a/src/dev/impl/DevToys/Views/Tools/Generators/CheckSumGenerator/CheckSumGeneratorToolPage.xaml.cs b/src/dev/impl/DevToys/Views/Tools/Generators/CheckSumGenerator/CheckSumGeneratorToolPage.xaml.cs
new file mode 100644
index 000000000..027848892
--- /dev/null
+++ b/src/dev/impl/DevToys/Views/Tools/Generators/CheckSumGenerator/CheckSumGeneratorToolPage.xaml.cs
@@ -0,0 +1,50 @@
+#nullable enable
+
+using DevToys.Api.Core.Navigation;
+using DevToys.Shared.Core;
+using DevToys.ViewModels.Tools.CheckSumGenerator;
+using Windows.UI.Xaml;
+using Windows.UI.Xaml.Controls;
+using Windows.UI.Xaml.Navigation;
+
+namespace DevToys.Views.Tools.CheckSumGenerator
+{
+ public sealed partial class CheckSumGeneratorToolPage : Page
+ {
+ public static readonly DependencyProperty ViewModelProperty
+ = DependencyProperty.Register(
+ nameof(ViewModel),
+ typeof(CheckSumGeneratorToolViewModel),
+ typeof(CheckSumGeneratorToolPage),
+ new PropertyMetadata(null));
+
+ /// <summary>
+ /// Gets the page's view model.
+ /// </summary>
+ public CheckSumGeneratorToolViewModel ViewModel
+ {
+ get => (CheckSumGeneratorToolViewModel)GetValue(ViewModelProperty);
+ set => SetValue(ViewModelProperty, value);
+ }
+
+ public CheckSumGeneratorToolPage()
+ {
+ InitializeComponent();
+ }
+
+ protected override void OnNavigatedTo(NavigationEventArgs e)
+ {
+ if (ViewModel is null)
+ {
+ var parameters = (NavigationParameter)e.Parameter;
+
+ // Set the view model
+ Assumes.NotNull(parameters.ViewModel, nameof(parameters.ViewModel));
+ ViewModel = (CheckSumGeneratorToolViewModel)parameters.ViewModel!;
+ DataContext = ViewModel;
+ }
+
+ base.OnNavigatedTo(e);
+ }
+ }
+}
diff --git a/src/dev/impl/DevToys/Views/Tools/Graphic/ColorBlindnessSimulator/ColorBlindnessSimulatorToolPage.xaml b/src/dev/impl/DevToys/Views/Tools/Graphic/ColorBlindnessSimulator/ColorBlindnessSimulatorToolPage.xaml
index b0b083519..91a40212e 100644
--- a/src/dev/impl/DevToys/Views/Tools/Graphic/ColorBlindnessSimulator/ColorBlindnessSimulatorToolPage.xaml
+++ b/src/dev/impl/DevToys/Views/Tools/Graphic/ColorBlindnessSimulator/ColorBlindnessSimulatorToolPage.xaml
@@ -20,7 +20,7 @@
<VisualStateGroup>
<VisualState x:Name="SelectFilesPointerHover">
<VisualState.StateTriggers>
- <StateTrigger IsActive="{x:Bind ViewModel.IsSelectFilesAreaHighlithed, Mode=OneWay}"/>
+ <StateTrigger IsActive="{x:Bind ViewModel.IsSelectFilesAreaHighlighted, Mode=OneWay}"/>
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="SelectFilesRectangle.Stroke" Value="{ThemeResource TextControlHeaderForeground}" />
diff --git a/src/dev/impl/DevToys/Views/Tools/Graphic/PngJpgCompressor/PngJpgCompressorToolPage.xaml b/src/dev/impl/DevToys/Views/Tools/Graphic/PngJpgCompressor/PngJpgCompressorToolPage.xaml
index 47f10dfc6..748fe111c 100644
--- a/src/dev/impl/DevToys/Views/Tools/Graphic/PngJpgCompressor/PngJpgCompressorToolPage.xaml
+++ b/src/dev/impl/DevToys/Views/Tools/Graphic/PngJpgCompressor/PngJpgCompressorToolPage.xaml
@@ -31,7 +31,7 @@
<VisualStateGroup>
<VisualState x:Name="SelectFilesPointerHover">
<VisualState.StateTriggers>
- <StateTrigger IsActive="{x:Bind ViewModel.IsSelectFilesAreaHighlithed, Mode=OneWay}"/>
+ <StateTrigger IsActive="{x:Bind ViewModel.IsSelectFilesAreaHighlighted, Mode=OneWay}"/>
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="SelectFilesRectangle.Stroke" Value="{ThemeResource TextControlHeaderForeground}" />
diff --git a/src/dev/shared/DevToys.Shared/Core/Arguments.cs b/src/dev/shared/DevToys.Shared/Core/Arguments.cs
index db8e9b871..8dab21d92 100644
--- a/src/dev/shared/DevToys.Shared/Core/Arguments.cs
+++ b/src/dev/shared/DevToys.Shared/Core/Arguments.cs
@@ -33,5 +33,15 @@ namespace DevToys.Shared.Core
return value!;
}
+
+ public static long NotZeroOrBelow(long value, string argumentName)
+ {
+ if (value <= 0)
+ {
+ throw new ArgumentException("Value can't be zero or below zero", argumentName);
+ }
+
+ return value;
+ }
}
}
diff --git a/src/tests/DevToys.Tests/DevToys.Tests.csproj b/src/tests/DevToys.Tests/DevToys.Tests.csproj
index 352c8e93c..43a2a1ab3 100644
--- a/src/tests/DevToys.Tests/DevToys.Tests.csproj
+++ b/src/tests/DevToys.Tests/DevToys.Tests.csproj
@@ -47,6 +47,7 @@
<Compile Include="Providers\Tools\BaseNumberFormatterTests.cs" />
<Compile Include="Core\Threading\AsyncLazyTests.cs" />
<Compile Include="Core\Threading\TaskCompletionNotifierTests.cs" />
+ <Compile Include="Helpers\HashingHelperTests.cs" />
<Compile Include="Helpers\YamlHelperTests.cs" />
<Compile Include="Helpers\JsonHelperTests.cs" />
<Compile Include="MefBaseTest.cs" />
diff --git a/src/tests/DevToys.Tests/Helpers/HashingHelperTests.cs b/src/tests/DevToys.Tests/Helpers/HashingHelperTests.cs
new file mode 100644
index 000000000..868976020
--- /dev/null
+++ b/src/tests/DevToys.Tests/Helpers/HashingHelperTests.cs
@@ -0,0 +1,172 @@
+using System;
+using System.IO;
+using System.Security.Cryptography;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using DevToys.Helpers;
+using DevToys.Models;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace DevToys.Tests.Helpers
+{
+ [TestClass]
+ public class HashingHelperTests
+ {
+ [TestMethod]
+ public void ComputeHashShouldThrowIfStreamIsNull()
+ {
+ ArgumentException ex = Assert.ThrowsException<ArgumentException>(async () =>
+ await HashingHelper.ComputeHashAsync(MD5.Create(), null, new Progress<HashingProgress>((_) => { }), new CancellationToken()));
+ Assert.AreEqual(ex.ParamName, "stream");
+ }
+
+ [TestMethod]
+ public void ComputeHashShouldThrowIfHashingAlgorithmIsNull()
+ {
+ using(var stream = new MemoryStream())
+ {
+ ArgumentException ex = Assert.ThrowsException<ArgumentException>(async () =>
+ await HashingHelper.ComputeHashAsync(null, stream, new Progress<HashingProgress>((_) => { }), new CancellationToken()));
+ Assert.AreEqual(ex.ParamName, "hashAlgorithm");
+ }
+ }
+
+ [DataTestMethod]
+ [DataRow("", "")]
+ [DataRow(" ", "7215EE9C7D9DC229D2921A40E899EC5F")]
+ [DataRow("Hello World", "B10A8DB164E0754105B7A99BE72E3FE5")]
+ [DataRow("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam cursus nec metus vel sagittis. Donec auctor nulla tortor. Praesent pretium, nunc vel porttitor tempor, metus eros pharetra orci, vitae lobortis ligula massa eu libero. Maecenas faucibus dolor ante, non ullamcorper urna blandit nec. Maecenas at pulvinar neque, a fermentum sapien. Curabitur mattis massa leo, a hendrerit lectus condimentum eget. Etiam nec scelerisque tellus. Quisque ligula erat, porttitor quis mi id, vehicula feugiat est.", "02868AD2F0787EF5323B221DBD14BAB2")]
+ public async Task ComputeHashMD5(string input, string expectedResult)
+ {
+ using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(input)))
+ {
+ byte[] bytesResult = await HashingHelper.ComputeHashAsync(MD5.Create(), stream, new Progress<HashingProgress>((_) => { }), new CancellationToken());
+
+ string result = FormatResult(BitConverter.ToString(bytesResult));
+
+ Assert.AreEqual(expectedResult, result);
+ }
+ }
+
+ [DataTestMethod]
+ [DataRow("", "")]
+ [DataRow(" ", "B858CB282617FB0956D960215C8E84D1CCF909C6")]
+ [DataRow("Hello World", "0A4D55A8D778E5022FAB701977C5D840BBC486D0")]
+ [DataRow("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam cursus nec metus vel sagittis. Donec auctor nulla tortor. Praesent pretium, nunc vel porttitor tempor, metus eros pharetra orci, vitae lobortis ligula massa eu libero. Maecenas faucibus dolor ante, non ullamcorper urna blandit nec. Maecenas at pulvinar neque, a fermentum sapien. Curabitur mattis massa leo, a hendrerit lectus condimentum eget. Etiam nec scelerisque tellus. Quisque ligula erat, porttitor quis mi id, vehicula feugiat est.", "DBFE62B3C0817383AC870AACC61DD016BC599689")]
+ public async Task ComputeHashSHA1(string input, string expectedResult)
+ {
+ using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(input)))
+ {
+ byte[] bytesResult = await HashingHelper.ComputeHashAsync(SHA1.Create(), stream, new Progress<HashingProgress>((_) => { }), new CancellationToken());
+
+ string result = FormatResult(BitConverter.ToString(bytesResult));
+
+ Assert.AreEqual(expectedResult, result);
+ }
+ }
+
+ [DataTestMethod]
+ [DataRow("", "")]
+ [DataRow(" ", "36A9E7F1C95B82FFB99743E0C5C4CE95D83C9A430AAC59F84EF3CBFAB6145068")]
+ [DataRow("Hello World", "A591A6D40BF420404A011733CFB7B190D62C65BF0BCDA32B57B277D9AD9F146E")]
+ [DataRow("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam cursus nec metus vel sagittis. Donec auctor nulla tortor. Praesent pretium, nunc vel porttitor tempor, metus eros pharetra orci, vitae lobortis ligula massa eu libero. Maecenas faucibus dolor ante, non ullamcorper urna blandit nec. Maecenas at pulvinar neque, a fermentum sapien. Curabitur mattis massa leo, a hendrerit lectus condimentum eget. Etiam nec scelerisque tellus. Quisque ligula erat, porttitor quis mi id, vehicula feugiat est.", "FD5800A6B0C7EE959AFE2CC011DFD9E9A48E9E4FB80828412F7AFC77A3A97782")]
+ public async Task ComputeHashSHA256(string input, string expectedResult)
+ {
+ using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(input)))
+ {
+ byte[] bytesResult = await HashingHelper.ComputeHashAsync(SHA256.Create(), stream, new Progress<HashingProgress>((_) => { }), new CancellationToken());
+
+ string result = FormatResult(BitConverter.ToString(bytesResult));
+
+ Assert.AreEqual(expectedResult, result);
+ }
+ }
+
+ [DataTestMethod]
+ [DataRow("", "")]
+ [DataRow(" ", "588016EB10045DD85834D67D187D6B97858F38C58C690320C4A64E0C2F92EEBD9F1BD74DE256E8268815905159449566")]
+ [DataRow("Hello World", "99514329186B2F6AE4A1329E7EE6C610A729636335174AC6B740F9028396FCC803D0E93863A7C3D90F86BEEE782F4F3F")]
+ [DataRow("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam cursus nec metus vel sagittis. Donec auctor nulla tortor. Praesent pretium, nunc vel porttitor tempor, metus eros pharetra orci, vitae lobortis ligula massa eu libero. Maecenas faucibus dolor ante, non ullamcorper urna blandit nec. Maecenas at pulvinar neque, a fermentum sapien. Curabitur mattis massa leo, a hendrerit lectus condimentum eget. Etiam nec scelerisque tellus. Quisque ligula erat, porttitor quis mi id, vehicula feugiat est.", "D775DFC327D966FE31F96B82A618A3F41CBB5FD9A05106CCD60F433D8079B8EA67546E6BA0501E29A6C9D6355A11A00C")]
+ public async Task ComputeHashSHA384(string input, string expectedResult)
+ {
+ using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(input)))
+ {
+ byte[] bytesResult = await HashingHelper.ComputeHashAsync(SHA384.Create(), stream, new Progress<HashingProgress>((_) => { }), new CancellationToken());
+
+ string result = FormatResult(BitConverter.ToString(bytesResult));
+
+ Assert.AreEqual(expectedResult, result);
+ }
+ }
+
+ [DataTestMethod]
+ [DataRow("", "")]
+ [DataRow(" ", "F90DDD77E400DFE6A3FCF479B00B1EE29E7015C5BB8CD70F5F15B4886CC339275FF553FC8A053F8DDC7324F45168CFFAF81F8C3AC93996F6536EEF38E5E40768")]
+ [DataRow("Hello World", "2C74FD17EDAFD80E8447B0D46741EE243B7EB74DD2149A0AB1B9246FB30382F27E853D8585719E0E67CBDA0DAA8F51671064615D645AE27ACB15BFB1447F459B")]
+ [DataRow("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam cursus nec metus vel sagittis. Donec auctor nulla tortor. Praesent pretium, nunc vel porttitor tempor, metus eros pharetra orci, vitae lobortis ligula massa eu libero. Maecenas faucibus dolor ante, non ullamcorper urna blandit nec. Maecenas at pulvinar neque, a fermentum sapien. Curabitur mattis massa leo, a hendrerit lectus condimentum eget. Etiam nec scelerisque tellus. Quisque ligula erat, porttitor quis mi id, vehicula feugiat est.", "9BE8DB4FE9A776337D500BAA2E99A23C41CDEA2E0D0F445EB72DC8C6BEFAADF9FB5FA4C14BA81E93716F24C004477F08ABF684B3E50F0365C63AE602136E56B5")]
+ public async Task ComputeHashSHA512(string input, string expectedResult)
+ {
+ using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(input)))
+ {
+ byte[] bytesResult = await HashingHelper.ComputeHashAsync(SHA512.Create(), stream, new Progress<HashingProgress>((_) => { }), new CancellationToken());
+
+ string result = FormatResult(BitConverter.ToString(bytesResult));
+
+ Assert.AreEqual(expectedResult, result);
+ }
+ }
+
+ [DataTestMethod]
+ [DataRow(0)]
+ [DataRow(-1)]
+ [DataRow(-100)]
+ [DataRow(int.MinValue)]
+ public void ComputeHashIterationsShouldThrowIfBufferSizeIsZeroOrBelow(int bufferSize)
+ {
+ byte[] byteArray = Array.Empty<byte>();
+ using (var stream = new MemoryStream(byteArray))
+ {
+ ArgumentException ex = Assert.ThrowsException<ArgumentException>(() =>
+ HashingHelper.ComputeHashIterations(stream, bufferSize));
+ Assert.AreEqual(ex.ParamName, "bufferSize");
+ }
+ }
+
+ [DataTestMethod]
+ [DataRow(100, 10, 10)]
+ [DataRow(1000, 10, 100)]
+ [DataRow(10000, 100, 100)]
+ [DataRow(0, 10, 0)]
+ [DataRow(1, 1, 1)]
+ [DataRow(1, 10, 1)]
+ public void ComputeHashIterations(int streamSize, int bufferSize, int expectedResult)
+ {
+ byte[] byteArray = new byte[streamSize];
+ using (var stream = new MemoryStream(byteArray))
+ {
+ long iterations = HashingHelper.ComputeHashIterations(stream, bufferSize);
+
+ Assert.AreEqual(expectedResult, iterations);
+ }
+ }
+
+ [DataTestMethod]
+ [DataRow(1048576, 1)]
+ [DataRow(5242880, 5)]
+ [DataRow(10485760, 10)]
+ [DataRow(104857600, 100)]
+ public void ComputeHashingIterationsWithDefaultBufferSize(long streamSize, int expectedResult)
+ {
+ byte[] byteArray = new byte[streamSize];
+ using (var stream = new MemoryStream(byteArray))
+ {
+ long iterations = HashingHelper.ComputeHashIterations(stream);
+
+ Assert.AreEqual(expectedResult, iterations);
+ }
+ }
+
+ private string FormatResult(string input) => input.Replace("-", string.Empty);
+ }
+}