Skip to content

A Swiss Army knife for developers.

Added hex converter toys (#86)

BenjaminT29d190d3dfc7
diff --git a/src/dev/impl/DevToys/DevToys.csproj b/src/dev/impl/DevToys/DevToys.csproj
index 2418f3982..a9a5499d1 100644
--- a/src/dev/impl/DevToys/DevToys.csproj
+++ b/src/dev/impl/DevToys/DevToys.csproj
@@ -24,6 +24,8 @@
<Compile Include="Api\Core\OOP\IAppService.cs" />
<Compile Include="Core\OOP\AppService.cs" />
<Compile Include="Core\Threading\AsyncLazy.cs" />
+ <Compile Include="Models\Radix.cs" />
+ <Compile Include="Models\NumberBaseFormat.cs" />
<Compile Include="UI\Converters\BooleanToDoubleConverter.cs" />
<Compile Include="UI\Converters\BooleanToIntegerConverter.cs" />
<Compile Include="ViewModels\Tools\HtmlEncoderDecoder\HtmlEncoderDecoderToolProvider.cs" />
@@ -31,6 +33,9 @@
<Compile Include="ViewModels\Tools\PngJpgCompressor\ImageCompressionWorkItem.cs" />
<Compile Include="ViewModels\Tools\PngJpgCompressor\PngJpgCompressorToolProvider.cs" />
<Compile Include="ViewModels\Tools\PngJpgCompressor\PngJpgCompressorToolViewModel.cs" />
+ <Compile Include="Views\Tools\GuidGenerator\GuidGeneratorToolPage.xaml.cs">
+ <DependentUpon>GuidGeneratorToolPage.xaml</DependentUpon>
+ </Compile>
<Compile Include="Views\Tools\HtmlEncoderDecoder\HtmlEncoderDecoderToolPage.xaml.cs">
<DependentUpon>HtmlEncoderDecoderToolPage.xaml</DependentUpon>
</Compile>
@@ -198,6 +203,7 @@
<Compile Include="Core\Clipboard.cs" />
<Compile Include="Core\Collections\OrderedObservableCollection.cs" />
<Compile Include="Core\Constants.cs" />
+ <Compile Include="ViewModels\Tools\NumberBaseConverter\NumberBaseFormatter.cs" />
<Compile Include="Core\Logger.cs" />
<Compile Include="Core\MarketingService.cs" />
<Compile Include="Core\Navigation\WindowManager.cs" />
@@ -224,6 +230,8 @@
<Compile Include="UI\Converters\NullToVisibilityConverter.cs" />
<Compile Include="Helpers\JsonHelper.cs" />
<Compile Include="Helpers\YamlHelper.cs" />
+ <Compile Include="ViewModels\Tools\NumberBaseConverter\NumberBaseConverterToolProvider.cs" />
+ <Compile Include="ViewModels\Tools\NumberBaseConverter\NumberBaseConverterToolViewModel.cs" />
<Compile Include="ViewModels\Tools\GuidGenerator\GuidGeneratorToolProvider.cs" />
<Compile Include="ViewModels\Tools\GuidGenerator\GuidGeneratorToolViewModel.cs" />
<Compile Include="ViewModels\Tools\JsonYaml\JsonYamlToolProvider.cs" />
@@ -294,8 +302,8 @@
<Compile Include="Views\Tools\Base64EncoderDecoder\Base64EncoderDecoderToolPage.xaml.cs">
<DependentUpon>Base64EncoderDecoderToolPage.xaml</DependentUpon>
</Compile>
- <Compile Include="Views\Tools\GuidGenerator\GuidGeneratorToolPage.xaml.cs">
- <DependentUpon>GuidGeneratorToolPage.xaml</DependentUpon>
+ <Compile Include="Views\Tools\NumberBaseConverter\NumberBaseConverterToolPage.xaml.cs">
+ <DependentUpon>NumberBaseConverterToolPage.xaml</DependentUpon>
</Compile>
<Compile Include="Views\Tools\HashGenerator\HashGeneratorToolPage.xaml.cs">
<DependentUpon>HashGeneratorToolPage.xaml</DependentUpon>
@@ -354,7 +362,7 @@
<AppxManifest Include="Package.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
- <PRIResource Include="Strings\en-US\PngJpgCompressor.resw" />
+ <PRIResource Include="Strings\*\*.resw" />
<Page Include="Themes\Custom.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@@ -395,6 +403,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
+ <Page Include="Views\Tools\NumberBaseConverter\NumberBaseConverterToolPage.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
+ </Page>
<Page Include="Views\Tools\HashGenerator\HashGeneratorToolPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@@ -447,7 +459,6 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
- <PRIResource Include="Strings\*\*.resw" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="GitInfo" Version="$(Nuget_GitInfo)" />
@@ -481,6 +492,9 @@
<Name>Windows Desktop Extensions for the UWP</Name>
</SDKReference>
</ItemGroup>
+ <ItemGroup>
+ <Folder Include="Core\Formatter\" />
+ </ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
diff --git a/src/dev/impl/DevToys/LanguageManager.cs b/src/dev/impl/DevToys/LanguageManager.cs
index 99dcf02c9..74caca0ca 100644
--- a/src/dev/impl/DevToys/LanguageManager.cs
+++ b/src/dev/impl/DevToys/LanguageManager.cs
@@ -34,6 +34,7 @@ namespace DevToys
private readonly JwtDecoderEncoderStrings _jwtdecoderencoder = new JwtDecoderEncoderStrings();
private readonly MainPageStrings _mainpage = new MainPageStrings();
private readonly MarkdownPreviewStrings _markdownpreview = new MarkdownPreviewStrings();
+ private readonly NumberBaseConverterStrings _numberbaseconverter = new NumberBaseConverterStrings();
private readonly PngJpgCompressorStrings _pngjpgcompressor = new PngJpgCompressorStrings();
private readonly RegExStrings _regex = new RegExStrings();
private readonly SettingsStrings _settings = new SettingsStrings();
@@ -101,6 +102,11 @@ namespace DevToys
/// </summary>
public MarkdownPreviewStrings MarkdownPreview => _markdownpreview;
+ /// <summary>
+ /// Gets the <see cref="NumberBaseConverterStrings"/>.
+ /// </summary>
+ public NumberBaseConverterStrings NumberBaseConverter => _numberbaseconverter;
+
/// <summary>
/// Gets the <see cref="PngJpgCompressorStrings"/>.
/// </summary>
@@ -829,6 +835,86 @@ namespace DevToys
public string ThemeDescription => _resources.GetString("ThemeDescription");
}
+ public class NumberBaseConverterStrings : ObservableObject
+ {
+ private readonly ResourceLoader _resources = ResourceLoader.GetForViewIndependentUse("NumberBaseConverter");
+
+ /// <summary>
+ /// Gets the resource AccessibleName.
+ /// </summary>
+ public string AccessibleName => _resources.GetString("AccessibleName");
+
+ /// <summary>
+ /// Gets the resource BinaryLabel.
+ /// </summary>
+ public string BinaryLabel => _resources.GetString("BinaryLabel");
+
+ /// <summary>
+ /// Gets the resource ConfigurationTitle.
+ /// </summary>
+ public string ConfigurationTitle => _resources.GetString("ConfigurationTitle");
+
+ /// <summary>
+ /// Gets the resource DecimalLabel.
+ /// </summary>
+ public string DecimalLabel => _resources.GetString("DecimalLabel");
+
+ /// <summary>
+ /// Gets the resource DisplayName.
+ /// </summary>
+ public string DisplayName => _resources.GetString("DisplayName");
+
+ /// <summary>
+ /// Gets the resource Format.
+ /// </summary>
+ public string Format => _resources.GetString("Format");
+
+ /// <summary>
+ /// Gets the resource HexadecimalLabel.
+ /// </summary>
+ public string HexadecimalLabel => _resources.GetString("HexadecimalLabel");
+
+ /// <summary>
+ /// Gets the resource Input.
+ /// </summary>
+ public string Input => _resources.GetString("Input");
+
+ /// <summary>
+ /// Gets the resource InputTypeBinary.
+ /// </summary>
+ public string InputTypeBinary => _resources.GetString("InputTypeBinary");
+
+ /// <summary>
+ /// Gets the resource InputTypeDecimal.
+ /// </summary>
+ public string InputTypeDecimal => _resources.GetString("InputTypeDecimal");
+
+ /// <summary>
+ /// Gets the resource InputTypeDescription.
+ /// </summary>
+ public string InputTypeDescription => _resources.GetString("InputTypeDescription");
+
+ /// <summary>
+ /// Gets the resource InputTypeHexadecimal.
+ /// </summary>
+ public string InputTypeHexadecimal => _resources.GetString("InputTypeHexadecimal");
+
+ /// <summary>
+ /// Gets the resource InputTypeOctal.
+ /// </summary>
+ public string InputTypeOctal => _resources.GetString("InputTypeOctal");
+
+ /// <summary>
+ /// Gets the resource InputTypeTitle.
+ /// </summary>
+ public string InputTypeTitle => _resources.GetString("InputTypeTitle");
+
+ /// <summary>
+ /// Gets the resource OctalLabel.
+ /// </summary>
+ public string OctalLabel => _resources.GetString("OctalLabel");
+ }
+
public class PngJpgCompressorStrings : ObservableObject
{
private readonly ResourceLoader _resources = ResourceLoader.GetForViewIndependentUse("PngJpgCompressor");
diff --git a/src/dev/impl/DevToys/Models/NumberBaseFormat.cs b/src/dev/impl/DevToys/Models/NumberBaseFormat.cs
new file mode 100644
index 000000000..a6594e9ce
--- /dev/null
+++ b/src/dev/impl/DevToys/Models/NumberBaseFormat.cs
@@ -0,0 +1,62 @@
+using System;
+using System.Globalization;
+
+namespace DevToys.Models
+{
+ public class NumberBaseFormat : IEquatable<NumberBaseFormat>
+ {
+ private static NumberBaseConverterStrings Strings => LanguageManager.Instance.NumberBaseConverter;
+
+ public static readonly NumberBaseFormat Octal = new(
+ displayName: Strings.OctalLabel,
+ value: Radix.Octal,
+ baseNumber:8,
+ groupSize: CultureInfo.CurrentCulture.NumberFormat.NumberGroupSizes[0],
+ groupSeparator: ' ');
+
+ public static readonly NumberBaseFormat Binary = new(
+ displayName: Strings.BinaryLabel,
+ value: Radix.Binary,
+ baseNumber: 2,
+ groupSize: 4,
+ groupSeparator: ' ');
+
+ public static readonly NumberBaseFormat Decimal = new(
+ displayName: Strings.DecimalLabel,
+ value: Radix.Decimal,
+ baseNumber: 10,
+ groupSize: CultureInfo.CurrentCulture.NumberFormat.NumberGroupSizes[0],
+ groupSeparator: Convert.ToChar(CultureInfo.CurrentCulture.NumberFormat.NumberGroupSeparator));
+
+ public static readonly NumberBaseFormat Hexadecimal = new(
+ displayName: Strings.HexadecimalLabel,
+ value: Radix.Hexdecimal,
+ baseNumber: 16,
+ groupSize: 4,
+ groupSeparator: ' ');
+
+ public string DisplayName { get; }
+
+ public Radix Value { get; }
+
+ public int BaseNumber { get; }
+
+ public int GroupSize { get; }
+
+ public char GroupSeparator { get; }
+
+ private NumberBaseFormat(string displayName, Radix value, int baseNumber, int groupSize, char groupSeparator)
+ {
+ DisplayName = displayName;
+ Value = value;
+ BaseNumber = baseNumber;
+ GroupSize = groupSize;
+ GroupSeparator = groupSeparator;
+ }
+
+ public bool Equals(NumberBaseFormat other)
+ {
+ return other.Value == Value;
+ }
+ }
+}
diff --git a/src/dev/impl/DevToys/Models/Radix.cs b/src/dev/impl/DevToys/Models/Radix.cs
new file mode 100644
index 000000000..3ac33a43b
--- /dev/null
+++ b/src/dev/impl/DevToys/Models/Radix.cs
@@ -0,0 +1,10 @@
+namespace DevToys.Models
+{
+ public enum Radix
+ {
+ Octal,
+ Binary,
+ Decimal,
+ Hexdecimal
+ }
+}
diff --git a/src/dev/impl/DevToys/Strings/cs-CZ/NumberBaseConverter.resw b/src/dev/impl/DevToys/Strings/cs-CZ/NumberBaseConverter.resw
new file mode 100644
index 000000000..0a162a510
--- /dev/null
+++ b/src/dev/impl/DevToys/Strings/cs-CZ/NumberBaseConverter.resw
@@ -0,0 +1,165 @@
+<?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>Number Base Converter tool</value>
+ </data>
+ <data name="BinaryLabel" xml:space="preserve">
+ <value>Binary</value>
+ </data>
+ <data name="ConfigurationTitle" xml:space="preserve">
+ <value>Configuration</value>
+ </data>
+ <data name="DecimalLabel" xml:space="preserve">
+ <value>Decimal</value>
+ </data>
+ <data name="DisplayName" xml:space="preserve">
+ <value>Number Base Converter</value>
+ </data>
+ <data name="Format" xml:space="preserve">
+ <value>Format number</value>
+ </data>
+ <data name="HexadecimalLabel" xml:space="preserve">
+ <value>Hexadecimal</value>
+ </data>
+ <data name="Input" xml:space="preserve">
+ <value>Input</value>
+ </data>
+ <data name="InputTypeBinary" xml:space="preserve">
+ <value>Binary</value>
+ </data>
+ <data name="InputTypeDecimal" xml:space="preserve">
+ <value>Decimal</value>
+ </data>
+ <data name="InputTypeDescription" xml:space="preserve">
+ <value>Select which Input type you want to use</value>
+ </data>
+ <data name="InputTypeHexadecimal" xml:space="preserve">
+ <value>Hexadecimal</value>
+ </data>
+ <data name="InputTypeOctal" xml:space="preserve">
+ <value>Octal</value>
+ </data>
+ <data name="InputTypeTitle" xml:space="preserve">
+ <value>Input type</value>
+ </data>
+ <data name="OctalLabel" xml:space="preserve">
+ <value>Octal</value>
+ </data>
+</root>
\ No newline at end of file
diff --git a/src/dev/impl/DevToys/Strings/en-US/NumberBaseConverter.resw b/src/dev/impl/DevToys/Strings/en-US/NumberBaseConverter.resw
new file mode 100644
index 000000000..0a162a510
--- /dev/null
+++ b/src/dev/impl/DevToys/Strings/en-US/NumberBaseConverter.resw
@@ -0,0 +1,165 @@
+<?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>Number Base Converter tool</value>
+ </data>
+ <data name="BinaryLabel" xml:space="preserve">
+ <value>Binary</value>
+ </data>
+ <data name="ConfigurationTitle" xml:space="preserve">
+ <value>Configuration</value>
+ </data>
+ <data name="DecimalLabel" xml:space="preserve">
+ <value>Decimal</value>
+ </data>
+ <data name="DisplayName" xml:space="preserve">
+ <value>Number Base Converter</value>
+ </data>
+ <data name="Format" xml:space="preserve">
+ <value>Format number</value>
+ </data>
+ <data name="HexadecimalLabel" xml:space="preserve">
+ <value>Hexadecimal</value>
+ </data>
+ <data name="Input" xml:space="preserve">
+ <value>Input</value>
+ </data>
+ <data name="InputTypeBinary" xml:space="preserve">
+ <value>Binary</value>
+ </data>
+ <data name="InputTypeDecimal" xml:space="preserve">
+ <value>Decimal</value>
+ </data>
+ <data name="InputTypeDescription" xml:space="preserve">
+ <value>Select which Input type you want to use</value>
+ </data>
+ <data name="InputTypeHexadecimal" xml:space="preserve">
+ <value>Hexadecimal</value>
+ </data>
+ <data name="InputTypeOctal" xml:space="preserve">
+ <value>Octal</value>
+ </data>
+ <data name="InputTypeTitle" xml:space="preserve">
+ <value>Input type</value>
+ </data>
+ <data name="OctalLabel" xml:space="preserve">
+ <value>Octal</value>
+ </data>
+</root>
\ No newline at end of file
diff --git a/src/dev/impl/DevToys/Strings/fr-FR/NumberBaseConverter.resw b/src/dev/impl/DevToys/Strings/fr-FR/NumberBaseConverter.resw
new file mode 100644
index 000000000..3c39690b0
--- /dev/null
+++ b/src/dev/impl/DevToys/Strings/fr-FR/NumberBaseConverter.resw
@@ -0,0 +1,165 @@
+<?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>Outil de conversion de base de nombres</value>
+ </data>
+ <data name="BinaryLabel" xml:space="preserve">
+ <value>Binaire</value>
+ </data>
+ <data name="ConfigurationTitle" xml:space="preserve">
+ <value>Configuration</value>
+ </data>
+ <data name="DecimalLabel" xml:space="preserve">
+ <value>Décimal</value>
+ </data>
+ <data name="DisplayName" xml:space="preserve">
+ <value>Convertisseur de base de nombres</value>
+ </data>
+ <data name="Format" xml:space="preserve">
+ <value>Format du numéro</value>
+ </data>
+ <data name="HexadecimalLabel" xml:space="preserve">
+ <value>Hexadécimal</value>
+ </data>
+ <data name="Input" xml:space="preserve">
+ <value>Entrée</value>
+ </data>
+ <data name="InputTypeBinary" xml:space="preserve">
+ <value>Binaire</value>
+ </data>
+ <data name="InputTypeDecimal" xml:space="preserve">
+ <value>Décimal</value>
+ </data>
+ <data name="InputTypeDescription" xml:space="preserve">
+ <value>Sélectionnez le type d'entrée que vous souhaitez utiliser</value>
+ </data>
+ <data name="InputTypeHexadecimal" xml:space="preserve">
+ <value>Hexadécimal</value>
+ </data>
+ <data name="InputTypeOctal" xml:space="preserve">
+ <value>Octal</value>
+ </data>
+ <data name="InputTypeTitle" xml:space="preserve">
+ <value>Type d'entrée</value>
+ </data>
+ <data name="OctalLabel" xml:space="preserve">
+ <value>Octal</value>
+ </data>
+</root>
\ No newline at end of file
diff --git a/src/dev/impl/DevToys/Strings/pl-PL/NumberBaseConverter.resw b/src/dev/impl/DevToys/Strings/pl-PL/NumberBaseConverter.resw
new file mode 100644
index 000000000..0a162a510
--- /dev/null
+++ b/src/dev/impl/DevToys/Strings/pl-PL/NumberBaseConverter.resw
@@ -0,0 +1,165 @@
+<?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>Number Base Converter tool</value>
+ </data>
+ <data name="BinaryLabel" xml:space="preserve">
+ <value>Binary</value>
+ </data>
+ <data name="ConfigurationTitle" xml:space="preserve">
+ <value>Configuration</value>
+ </data>
+ <data name="DecimalLabel" xml:space="preserve">
+ <value>Decimal</value>
+ </data>
+ <data name="DisplayName" xml:space="preserve">
+ <value>Number Base Converter</value>
+ </data>
+ <data name="Format" xml:space="preserve">
+ <value>Format number</value>
+ </data>
+ <data name="HexadecimalLabel" xml:space="preserve">
+ <value>Hexadecimal</value>
+ </data>
+ <data name="Input" xml:space="preserve">
+ <value>Input</value>
+ </data>
+ <data name="InputTypeBinary" xml:space="preserve">
+ <value>Binary</value>
+ </data>
+ <data name="InputTypeDecimal" xml:space="preserve">
+ <value>Decimal</value>
+ </data>
+ <data name="InputTypeDescription" xml:space="preserve">
+ <value>Select which Input type you want to use</value>
+ </data>
+ <data name="InputTypeHexadecimal" xml:space="preserve">
+ <value>Hexadecimal</value>
+ </data>
+ <data name="InputTypeOctal" xml:space="preserve">
+ <value>Octal</value>
+ </data>
+ <data name="InputTypeTitle" xml:space="preserve">
+ <value>Input type</value>
+ </data>
+ <data name="OctalLabel" xml:space="preserve">
+ <value>Octal</value>
+ </data>
+</root>
\ No newline at end of file
diff --git a/src/dev/impl/DevToys/Strings/ru-RU/NumberBaseConverter.resw b/src/dev/impl/DevToys/Strings/ru-RU/NumberBaseConverter.resw
new file mode 100644
index 000000000..0a162a510
--- /dev/null
+++ b/src/dev/impl/DevToys/Strings/ru-RU/NumberBaseConverter.resw
@@ -0,0 +1,165 @@
+<?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>Number Base Converter tool</value>
+ </data>
+ <data name="BinaryLabel" xml:space="preserve">
+ <value>Binary</value>
+ </data>
+ <data name="ConfigurationTitle" xml:space="preserve">
+ <value>Configuration</value>
+ </data>
+ <data name="DecimalLabel" xml:space="preserve">
+ <value>Decimal</value>
+ </data>
+ <data name="DisplayName" xml:space="preserve">
+ <value>Number Base Converter</value>
+ </data>
+ <data name="Format" xml:space="preserve">
+ <value>Format number</value>
+ </data>
+ <data name="HexadecimalLabel" xml:space="preserve">
+ <value>Hexadecimal</value>
+ </data>
+ <data name="Input" xml:space="preserve">
+ <value>Input</value>
+ </data>
+ <data name="InputTypeBinary" xml:space="preserve">
+ <value>Binary</value>
+ </data>
+ <data name="InputTypeDecimal" xml:space="preserve">
+ <value>Decimal</value>
+ </data>
+ <data name="InputTypeDescription" xml:space="preserve">
+ <value>Select which Input type you want to use</value>
+ </data>
+ <data name="InputTypeHexadecimal" xml:space="preserve">
+ <value>Hexadecimal</value>
+ </data>
+ <data name="InputTypeOctal" xml:space="preserve">
+ <value>Octal</value>
+ </data>
+ <data name="InputTypeTitle" xml:space="preserve">
+ <value>Input type</value>
+ </data>
+ <data name="OctalLabel" xml:space="preserve">
+ <value>Octal</value>
+ </data>
+</root>
\ No newline at end of file
diff --git a/src/dev/impl/DevToys/Strings/zh-CN/NumberBaseConverter.resw b/src/dev/impl/DevToys/Strings/zh-CN/NumberBaseConverter.resw
new file mode 100644
index 000000000..0a162a510
--- /dev/null
+++ b/src/dev/impl/DevToys/Strings/zh-CN/NumberBaseConverter.resw
@@ -0,0 +1,165 @@
+<?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>Number Base Converter tool</value>
+ </data>
+ <data name="BinaryLabel" xml:space="preserve">
+ <value>Binary</value>
+ </data>
+ <data name="ConfigurationTitle" xml:space="preserve">
+ <value>Configuration</value>
+ </data>
+ <data name="DecimalLabel" xml:space="preserve">
+ <value>Decimal</value>
+ </data>
+ <data name="DisplayName" xml:space="preserve">
+ <value>Number Base Converter</value>
+ </data>
+ <data name="Format" xml:space="preserve">
+ <value>Format number</value>
+ </data>
+ <data name="HexadecimalLabel" xml:space="preserve">
+ <value>Hexadecimal</value>
+ </data>
+ <data name="Input" xml:space="preserve">
+ <value>Input</value>
+ </data>
+ <data name="InputTypeBinary" xml:space="preserve">
+ <value>Binary</value>
+ </data>
+ <data name="InputTypeDecimal" xml:space="preserve">
+ <value>Decimal</value>
+ </data>
+ <data name="InputTypeDescription" xml:space="preserve">
+ <value>Select which Input type you want to use</value>
+ </data>
+ <data name="InputTypeHexadecimal" xml:space="preserve">
+ <value>Hexadecimal</value>
+ </data>
+ <data name="InputTypeOctal" xml:space="preserve">
+ <value>Octal</value>
+ </data>
+ <data name="InputTypeTitle" xml:space="preserve">
+ <value>Input type</value>
+ </data>
+ <data name="OctalLabel" xml:space="preserve">
+ <value>Octal</value>
+ </data>
+</root>
\ No newline at end of file
diff --git a/src/dev/impl/DevToys/ViewModels/Tools/NumberBaseConverter/NumberBaseConverterToolProvider.cs b/src/dev/impl/DevToys/ViewModels/Tools/NumberBaseConverter/NumberBaseConverterToolProvider.cs
new file mode 100644
index 000000000..77bed7568
--- /dev/null
+++ b/src/dev/impl/DevToys/ViewModels/Tools/NumberBaseConverter/NumberBaseConverterToolProvider.cs
@@ -0,0 +1,53 @@
+#nullable enable
+
+using System.Composition;
+using System.Threading.Tasks;
+using DevToys.Api.Tools;
+using DevToys.Core.Threading;
+using DevToys.Shared.Api.Core;
+using Windows.UI.Xaml.Controls;
+
+namespace DevToys.ViewModels.Tools.NumberBaseConverter
+{
+ [Export(typeof(IToolProvider))]
+ [Name("Number Base Converter")]
+ [ProtocolName("baseconverter")]
+ [Order(0)]
+ [CompactOverlaySize(width: 400, height: 500)]
+ internal sealed class NumberBaseConverterToolProvider : ToolProviderBase, IToolProvider
+ {
+ private readonly IMefProvider _mefProvider;
+
+ public string DisplayName => LanguageManager.Instance.NumberBaseConverter.DisplayName;
+
+ public string AccessibleName => LanguageManager.Instance.NumberBaseConverter.AccessibleName;
+
+
+ public object IconSource
+ => new TaskCompletionNotifier<IconElement>(
+ ThreadHelper.RunOnUIThreadAsync(() =>
+ {
+ return Task.FromResult<IconElement>(
+ new FontIcon
+ {
+ Glyph = "\uFE2C"
+ });
+ }));
+
+ [ImportingConstructor]
+ public NumberBaseConverterToolProvider(IMefProvider mefProvider)
+ {
+ _mefProvider = mefProvider;
+ }
+
+ public bool CanBeTreatedByTool(string data)
+ {
+ return false;
+ }
+
+ public IToolViewModel CreateTool()
+ {
+ return _mefProvider.Import<NumberBaseConverterToolViewModel>();
+ }
+ }
+}
diff --git a/src/dev/impl/DevToys/ViewModels/Tools/NumberBaseConverter/NumberBaseConverterToolViewModel.cs b/src/dev/impl/DevToys/ViewModels/Tools/NumberBaseConverter/NumberBaseConverterToolViewModel.cs
new file mode 100644
index 000000000..bc95fdf1f
--- /dev/null
+++ b/src/dev/impl/DevToys/ViewModels/Tools/NumberBaseConverter/NumberBaseConverterToolViewModel.cs
@@ -0,0 +1,243 @@
+#nullable enable
+
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Composition;
+using System.Linq;
+using System.Threading.Tasks;
+using DevToys.Api.Core;
+using DevToys.Api.Core.Settings;
+using DevToys.Api.Tools;
+using DevToys.Core;
+using DevToys.Core.Formatter;
+using DevToys.Core.Threading;
+using DevToys.Models;
+using DevToys.Shared.Core.Threading;
+using DevToys.Views.Tools.NumberBaseConverter;
+using Microsoft.Toolkit.Mvvm.ComponentModel;
+
+namespace DevToys.ViewModels.Tools.NumberBaseConverter
+{
+ [Export(typeof(NumberBaseConverterToolViewModel))]
+ public sealed class NumberBaseConverterToolViewModel : ObservableRecipient, IToolViewModel
+ {
+ /// <summary>
+ /// Which format is the input number.
+ /// </summary>
+ private static readonly SettingDefinition<Radix> BaseNumber
+ = new(
+ name: $"{nameof(NumberBaseConverterToolViewModel)}.{nameof(BaseNumber)}",
+ isRoaming: true,
+ defaultValue: Radix.Decimal);
+
+ /// <summary>
+ /// Whether the value should be formatted or not.
+ /// </summary>
+ private static readonly SettingDefinition<bool> Formatted
+ = new(
+ name: $"{nameof(NumberBaseConverterToolViewModel)}.{nameof(Formatted)}",
+ isRoaming: true,
+ defaultValue: true);
+
+ private readonly Queue<string> _convertQueue = new();
+ private readonly ISettingsProvider _settingsProvider;
+ private readonly IMarketingService _marketingService;
+
+ private string? _inputValue;
+ private string? _octalValue;
+ private string? _binaryValue;
+ private string? _decimalValue;
+ private string? _hexadecimalValue;
+ private string? _infoBarMessage;
+ private bool _isInfoBarOpen;
+ private bool _conversionInProgress;
+ private bool _toolSuccessfullyWorked;
+
+ internal NumberBaseConverterStrings Strings => LanguageManager.Instance.NumberBaseConverter;
+
+ public Type View { get; } = typeof(NumberBaseConverterToolPage);
+
+ /// <summary>
+ /// Gets or sets the input text.
+ /// </summary>
+ internal string? InputValue
+ {
+ get => _inputValue;
+ set
+ {
+ SetProperty(ref _inputValue, value);
+ QueueFormatting();
+ }
+ }
+
+ internal string? OctalValue
+ {
+ get => _octalValue;
+ private set => SetProperty(ref _octalValue, value);
+ }
+
+ internal string? BinaryValue
+ {
+ get => _binaryValue;
+ private set => SetProperty(ref _binaryValue, value);
+ }
+
+ internal string? DecimalValue
+ {
+ get => _decimalValue;
+ private set => SetProperty(ref _decimalValue, value);
+ }
+
+ internal string? HexaDecimalValue
+ {
+ get => _hexadecimalValue;
+ private set => SetProperty(ref _hexadecimalValue, value);
+ }
+
+ internal bool IsInfoBarOpen
+ {
+ get => _isInfoBarOpen;
+ private set => SetProperty(ref _isInfoBarOpen, value);
+ }
+
+ internal string? InfoBarMessage
+ {
+ get => _infoBarMessage;
+ private set => SetProperty(ref _infoBarMessage, value);
+ }
+
+ internal NumberBaseFormat InputBaseNumber
+ {
+ get
+ {
+ Radix settingsValue = _settingsProvider.GetSetting(BaseNumber);
+ NumberBaseFormat? baseNumberFormat = BaseNumbers.FirstOrDefault(x => x.Value == settingsValue);
+ return baseNumberFormat ?? NumberBaseFormat.Decimal;
+ }
+ set
+ {
+ if (InputBaseNumber != value)
+ {
+ _settingsProvider.SetSetting(BaseNumber, value.Value);
+
+ if (InputBaseNumber == NumberBaseFormat.Octal)
+ {
+ InputValue = NumberBaseFormatter.RemoveFormatting(OctalValue).ToString();
+ }
+ else if (InputBaseNumber == NumberBaseFormat.Binary)
+ {
+ InputValue = NumberBaseFormatter.RemoveFormatting(BinaryValue).ToString();
+ }
+ else if (InputBaseNumber == NumberBaseFormat.Hexadecimal)
+ {
+ InputValue = NumberBaseFormatter.RemoveFormatting(HexaDecimalValue).ToString();
+ }
+ else
+ {
+ InputValue = NumberBaseFormatter.RemoveFormatting(DecimalValue).ToString();
+ }
+ OnPropertyChanged();
+ QueueFormatting();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Get a list of supported BaseNumbers
+ /// </summary>
+ internal IReadOnlyList<NumberBaseFormat> BaseNumbers = new ObservableCollection<NumberBaseFormat> {
+ NumberBaseFormat.Octal,
+ NumberBaseFormat.Binary,
+ NumberBaseFormat.Decimal,
+ NumberBaseFormat.Hexadecimal,
+ };
+
+ internal bool IsFormatted
+ {
+ get => _settingsProvider.GetSetting(Formatted);
+ set
+ {
+ if (_settingsProvider.GetSetting(Formatted) != value)
+ {
+ _settingsProvider.SetSetting(Formatted, value);
+ OnPropertyChanged();
+ QueueFormatting();
+ }
+ }
+ }
+
+ [ImportingConstructor]
+ public NumberBaseConverterToolViewModel(ISettingsProvider settingsProvider, IMarketingService marketingService)
+ {
+ _settingsProvider = settingsProvider;
+ _marketingService = marketingService;
+ }
+
+ private void QueueFormatting()
+ {
+ _convertQueue.Enqueue(InputValue ?? string.Empty);
+ TreatQueueAsync().Forget();
+ }
+
+ private async Task TreatQueueAsync()
+ {
+ if (_conversionInProgress)
+ {
+ return;
+ }
+
+ _conversionInProgress = true;
+
+ await TaskScheduler.Default;
+
+ while (_convertQueue.TryDequeue(out string value))
+ {
+ string octalValue = string.Empty;
+ string binaryValue = string.Empty;
+ string decimalValue = string.Empty;
+ string hexaDecimalValue = string.Empty;
+ string infoBarMessage = string.Empty;
+ bool isInfoBarOpen = false;
+ try
+ {
+ long? baseValue = NumberBaseFormatter.StringToBase(value, InputBaseNumber);
+ if (baseValue != null)
+ {
+ octalValue = NumberBaseFormatter.LongToBase(baseValue.Value, NumberBaseFormat.Octal, IsFormatted);
+ binaryValue = NumberBaseFormatter.LongToBase(baseValue.Value, NumberBaseFormat.Binary, IsFormatted);
+ decimalValue = NumberBaseFormatter.LongToBase(baseValue.Value, NumberBaseFormat.Decimal, IsFormatted);
+ hexaDecimalValue = NumberBaseFormatter.LongToBase(baseValue.Value, NumberBaseFormat.Hexadecimal, IsFormatted);
+ }
+ }
+ catch (OverflowException exception)
+ {
+ isInfoBarOpen = true;
+ infoBarMessage = exception.Message;
+ }
+ catch (Exception ex)
+ {
+ Logger.LogFault("NumberBaseConverter", ex, $"Input base number: {InputBaseNumber}");
+ }
+
+ ThreadHelper.RunOnUIThreadAsync(ThreadPriority.Low, () =>
+ {
+ OctalValue = octalValue;
+ BinaryValue = binaryValue;
+ DecimalValue = decimalValue;
+ HexaDecimalValue = hexaDecimalValue;
+ InfoBarMessage = infoBarMessage;
+ IsInfoBarOpen = isInfoBarOpen;
+
+ if (!_toolSuccessfullyWorked)
+ {
+ _toolSuccessfullyWorked = true;
+ _marketingService.NotifyToolSuccessfullyWorked();
+ }
+ }).ForgetSafely();
+ }
+
+ _conversionInProgress = false;
+ }
+ }
+}
diff --git a/src/dev/impl/DevToys/ViewModels/Tools/NumberBaseConverter/NumberBaseFormatter.cs b/src/dev/impl/DevToys/ViewModels/Tools/NumberBaseConverter/NumberBaseFormatter.cs
new file mode 100644
index 000000000..a67ee65f2
--- /dev/null
+++ b/src/dev/impl/DevToys/ViewModels/Tools/NumberBaseConverter/NumberBaseFormatter.cs
@@ -0,0 +1,248 @@
+using System;
+using System.Globalization;
+using System.Text;
+using DevToys.Models;
+
+namespace DevToys.Core.Formatter
+{
+ internal static class NumberBaseFormatter
+ {
+ /// <summary>
+ /// Based on <see cref="System.ParseNumbers"/>
+ /// https://github.com/dotnet/runtime/blob/main/src/libraries/System.Private.CoreLib/src/System/ParseNumbers.cs
+ /// </summary>
+ /// <param name="value">Current value</param>
+ /// <param name="baseNumber">Current base number <see cref="NumberBaseFormat"/></param>
+ /// <returns>Value converted to <see cref="NumberBaseFormat.Decimal"/></returns>
+ public static long? StringToBase(string value, NumberBaseFormat baseNumber)
+ {
+ if (value.Length <= 0)
+ {
+ return null;
+ }
+
+ int length = value.Length;
+ int index = 0;
+
+ Span<char> unformattedValue = RemoveFormatting(value);
+
+ // Check for a sign
+ int sign = 1;
+ if (unformattedValue[index] == '-')
+ {
+ if (baseNumber != NumberBaseFormat.Decimal)
+ {
+ throw new ArgumentException($"Base {baseNumber} can't have a negative number");
+ }
+
+ sign = -1;
+ index++;
+ }
+ else if (unformattedValue[index] == '+')
+ {
+ index++;
+ }
+
+ long result = 0;
+ long maxVal;
+
+ // Allow all non-decimal numbers to set the sign bit.
+ if (baseNumber == NumberBaseFormat.Decimal)
+ {
+ maxVal = 0x7FFFFFFFFFFFFFFF / 10;
+
+ // Read all of the digits and convert to a number
+ while (index < length && IsDigit(unformattedValue[index], baseNumber.BaseNumber, out int current))
+ {
+ // Check for overflows - this is sufficient & correct.
+ if (result > maxVal || result < 0)
+ {
+ throw new OverflowException($"Unable to parse the current value exceded max value ({long.MaxValue})");
+ }
+
+ result = result * baseNumber.BaseNumber + current;
+ index++;
+ }
+
+ if (result is < 0 and not 0x800000000000000)
+ {
+ throw new OverflowException($"Unable to parse the current value exceded max value ({long.MaxValue})");
+ }
+ }
+ else
+ {
+ maxVal =
+ baseNumber.BaseNumber == 10 ? 0xfffffffffffffff / 10 :
+ baseNumber.BaseNumber == 16 ? 0xfffffffffffffff / 16 :
+ baseNumber.BaseNumber == 8 ? 0xfffffffffffffff / 8 :
+ 0xfffffffffffffff / 2;
+
+ // Read all of the digits and convert to a number
+ while (index < unformattedValue.Length && IsDigit(unformattedValue[index], baseNumber.BaseNumber, out int current))
+ {
+ // Check for overflows - this is sufficient & correct.
+ if (result > maxVal)
+ {
+ throw new OverflowException($"Unable to parse the current value exceded max value ({long.MaxValue})");
+ }
+
+ long temp = result * baseNumber.BaseNumber + current;
+
+ if (temp < result) // this means overflow as well
+ {
+ throw new OverflowException($"Unable to parse the current value exceded max value ({long.MaxValue})");
+ }
+
+ result = temp;
+ index++;
+ }
+ }
+
+ if (baseNumber == NumberBaseFormat.Decimal)
+ {
+ result *= sign;
+ }
+
+ return result;
+ }
+
+ /// <summary>
+ /// Based on <see cref="System.ParseNumbers"/>
+ /// https://github.com/dotnet/runtime/blob/main/src/libraries/System.Private.CoreLib/src/System/ParseNumbers.cs
+ /// </summary>
+ /// <param name="number">Current number to convert</param>
+ /// <param name="baseNumber"></param>
+ /// <param name="isFormatted">Define if the number need to base formatted</param>
+ /// <returns></returns>
+ public static string LongToBase(long number, NumberBaseFormat baseNumber, bool isFormatted)
+ {
+ Span<char> buffer = stackalloc char[67]; // Longest possible string length for an integer in binary notation with prefix
+
+ // If the number is negative, make it positive and remember the sign.
+ long ul;
+ bool isNegative = false;
+ if (number < 0)
+ {
+ isNegative = true;
+
+ // For base 10, write out -num, but other bases write out the
+ // 2's complement bit pattern
+ ul = (10 == baseNumber.BaseNumber) ? -number : number;
+ }
+ else
+ {
+ ul = number;
+ }
+
+ // Special case the 0.
+ int index;
+ if (0 == ul)
+ {
+ buffer[0] = '0';
+ index = 1;
+ }
+ else
+ {
+ index = 0;
+ for (int i = 0; i < buffer.Length; i++) // for loop instead of do{...}while(l!=0) to help JIT eliminate span bounds checks
+ {
+ long div = ul / baseNumber.BaseNumber; // TODO https://github.com/dotnet/runtime/issues/5213
+ int charVal = (int)(ul - (div * baseNumber.BaseNumber));
+ ul = div;
+
+ buffer[i] = (charVal < 10) ?
+ (char)(charVal + '0') :
+ (char)(charVal + 'a' - 10);
+
+ if (ul == 0)
+ {
+ index = i + 1;
+ break;
+ }
+ }
+ }
+
+ if (baseNumber == NumberBaseFormat.Decimal)
+ {
+ // If it was negative, append the sign.
+ if (isNegative)
+ {
+ buffer[index++] = '-';
+ }
+ }
+
+ var builder = new StringBuilder();
+
+ for (int builderIndex = --index; builderIndex >= 0; builderIndex--)
+ {
+ builder.Append(buffer[builderIndex]);
+ if (isFormatted && builderIndex != 0 && builderIndex % baseNumber.GroupSize == 0)
+ {
+ builder.Append(baseNumber.GroupSeparator);
+ }
+ }
+
+ // Add padding left for Binary Format
+ if (baseNumber == NumberBaseFormat.Binary)
+ {
+ int reminder = ++index % baseNumber.GroupSize;
+ for (int padIndex = 0; reminder != 0 && padIndex < baseNumber.GroupSize - reminder; padIndex++)
+ {
+ builder.Insert(0, '0');
+ }
+ }
+
+ return builder.ToString().ToUpperInvariant();
+ }
+
+ /// <summary>
+ /// Remove formatting (whitespace and Culture separator)
+ /// </summary>
+ /// <param name="value"></param>
+ /// <returns></returns>
+ public static Span<char> RemoveFormatting(string value)
+ {
+ if (string.IsNullOrWhiteSpace(value))
+ {
+ return Span<char>.Empty;
+ }
+
+ string currentCulture = CultureInfo.CurrentCulture.NumberFormat.NumberGroupSeparator;
+ Span<char> values = new char[value.Length];
+ int valueIndex = 0;
+ for (int i = 0; i < values.Length; i++)
+ {
+ if (!char.IsWhiteSpace(value[i]) && value[i] != Convert.ToChar(currentCulture))
+ {
+ values[valueIndex] = value[i];
+ valueIndex++;
+ }
+ }
+ return values;
+ }
+
+ private static bool IsDigit(char c, int radix, out int result)
+ {
+ int tmp;
+ if ((uint)(c - '0') <= 9)
+ {
+ result = tmp = c - '0';
+ }
+ else if ((uint)(c - 'A') <= 'Z' - 'A')
+ {
+ result = tmp = c - 'A' + 10;
+ }
+ else if ((uint)(c - 'a') <= 'z' - 'a')
+ {
+ result = tmp = c - 'a' + 10;
+ }
+ else
+ {
+ result = -1;
+ return false;
+ }
+
+ return tmp < radix;
+ }
+ }
+}
diff --git a/src/dev/impl/DevToys/Views/Tools/GuidGenerator/GuidGeneratorToolPage.xaml - Copy.cs b/src/dev/impl/DevToys/Views/Tools/GuidGenerator/GuidGeneratorToolPage.xaml - Copy.cs
new file mode 100644
index 000000000..68dacc596
--- /dev/null
+++ b/src/dev/impl/DevToys/Views/Tools/GuidGenerator/GuidGeneratorToolPage.xaml - Copy.cs
@@ -0,0 +1,52 @@
+#nullable enable
+
+using DevToys.Api.Core.Navigation;
+using DevToys.Shared.Core;
+using DevToys.ViewModels.Tools.GuidGenerator;
+using Windows.UI.Xaml;
+using Windows.UI.Xaml.Controls;
+using Windows.UI.Xaml.Navigation;
+
+namespace DevToys.Views.Tools.GuidGenerator
+{
+ public sealed partial class GuidGeneratorToolPage : Page
+ {
+ public static readonly DependencyProperty ViewModelProperty
+ = DependencyProperty.Register(
+ nameof(ViewModel),
+ typeof(GuidGeneratorToolViewModel),
+ typeof(GuidGeneratorToolPage),
+ new PropertyMetadata(null));
+
+ /// <summary>
+ /// Gets the page's view model.
+ /// </summary>
+ public GuidGeneratorToolViewModel ViewModel
+ {
+ get => (GuidGeneratorToolViewModel)GetValue(ViewModelProperty);
+ set => SetValue(ViewModelProperty, value);
+ }
+
+ public GuidGeneratorToolPage()
+ {
+ 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 = (GuidGeneratorToolViewModel)parameters.ViewModel!;
+ DataContext = ViewModel;
+
+ ViewModel.OutputTextBox = OutputTextBox;
+ }
+
+ base.OnNavigatedTo(e);
+ }
+ }
+}
diff --git a/src/dev/impl/DevToys/Views/Tools/NumberBaseConverter/NumberBaseConverterToolPage.xaml b/src/dev/impl/DevToys/Views/Tools/NumberBaseConverter/NumberBaseConverterToolPage.xaml
new file mode 100644
index 000000000..46054efa3
--- /dev/null
+++ b/src/dev/impl/DevToys/Views/Tools/NumberBaseConverter/NumberBaseConverterToolPage.xaml
@@ -0,0 +1,74 @@
+<Page
+ x:Class="DevToys.Views.Tools.NumberBaseConverter.NumberBaseConverterToolPage"
+ 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:muxc="using:Microsoft.UI.Xaml.Controls"
+ mc:Ignorable="d"
+ NavigationCacheMode="Required">
+
+ <StackPanel Margin="0,0,0,16" Spacing="12">
+ <StackPanel.ChildrenTransitions>
+ <TransitionCollection>
+ <EntranceThemeTransition IsStaggeringEnabled="True" FromVerticalOffset="50"/>
+ </TransitionCollection>
+ </StackPanel.ChildrenTransitions>
+
+ <StackPanel Spacing="4" >
+ <TextBlock Style="{StaticResource SubTitleTextBlock}" Text="{x:Bind ViewModel.Strings.ConfigurationTitle}" />
+ <controls:ExpandableSettingControl
+ Title="{x:Bind ViewModel.Strings.Format}">
+ <controls:ExpandableSettingControl.Icon>
+ <FontIcon Glyph="&#xF7B2;" />
+ </controls:ExpandableSettingControl.Icon>
+ <ToggleSwitch
+ Style="{StaticResource RightAlignedToggleSwitchStyle}"
+ IsOn="{x:Bind ViewModel.IsFormatted, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
+ </controls:ExpandableSettingControl>
+ <controls:ExpandableSettingControl
+ Grid.Row="1"
+ Title="{x:Bind ViewModel.Strings.InputTypeTitle}"
+ Description="{x:Bind ViewModel.Strings.InputTypeDescription}">
+ <controls:ExpandableSettingControl.Icon>
+ <FontIcon Glyph="&#xF18D;" />
+ </controls:ExpandableSettingControl.Icon>
+ <ComboBox
+ ItemsSource="{x:Bind ViewModel.BaseNumbers}"
+ DisplayMemberPath="DisplayName"
+ SelectedValue="{x:Bind ViewModel.InputBaseNumber, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
+ </ComboBox>
+ </controls:ExpandableSettingControl>
+ </StackPanel>
+
+ <controls:CustomTextBox
+ Header="{x:Bind ViewModel.Strings.Input}"
+ AcceptsReturn="False"
+ Text="{x:Bind ViewModel.InputValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
+
+ <muxc:InfoBar
+ IsOpen="{x:Bind ViewModel.IsInfoBarOpen, Mode=OneWay}"
+ Severity="Warning"
+ Message="{x:Bind ViewModel.InfoBarMessage, Mode=OneWay}" />
+
+ <controls:CustomTextBox
+ Header="{x:Bind ViewModel.Strings.HexadecimalLabel}"
+ IsReadOnly="True"
+ Text="{x:Bind ViewModel.HexaDecimalValue, Mode=OneWay}"/>
+
+ <controls:CustomTextBox
+ Header="{x:Bind ViewModel.Strings.DecimalLabel}"
+ IsReadOnly="True"
+ Text="{x:Bind ViewModel.DecimalValue, Mode=OneWay}"/>
+
+ <controls:CustomTextBox
+ Header="{x:Bind ViewModel.Strings.OctalLabel}"
+ IsReadOnly="True"
+ Text="{x:Bind ViewModel.OctalValue, Mode=OneWay}"/>
+
+ <controls:CustomTextBox
+ Header="{x:Bind ViewModel.Strings.BinaryLabel}"
+ IsReadOnly="True"
+ Text="{x:Bind ViewModel.BinaryValue, Mode=OneWay}"/>
+ </StackPanel>
+</Page>
diff --git a/src/dev/impl/DevToys/Views/Tools/NumberBaseConverter/NumberBaseConverterToolPage.xaml.cs b/src/dev/impl/DevToys/Views/Tools/NumberBaseConverter/NumberBaseConverterToolPage.xaml.cs
new file mode 100644
index 000000000..f5ac4ed19
--- /dev/null
+++ b/src/dev/impl/DevToys/Views/Tools/NumberBaseConverter/NumberBaseConverterToolPage.xaml.cs
@@ -0,0 +1,50 @@
+#nullable enable
+
+using DevToys.Api.Core.Navigation;
+using DevToys.Shared.Core;
+using DevToys.ViewModels.Tools.NumberBaseConverter;
+using Windows.UI.Xaml;
+using Windows.UI.Xaml.Controls;
+using Windows.UI.Xaml.Navigation;
+
+namespace DevToys.Views.Tools.NumberBaseConverter
+{
+ public sealed partial class NumberBaseConverterToolPage : Page
+ {
+ public static readonly DependencyProperty ViewModelProperty
+ = DependencyProperty.Register(
+ nameof(ViewModel),
+ typeof(NumberBaseConverterToolViewModel),
+ typeof(NumberBaseConverterToolPage),
+ new PropertyMetadata(null));
+
+ /// <summary>
+ /// Gets the page's view model.
+ /// </summary>
+ public NumberBaseConverterToolViewModel ViewModel
+ {
+ get => (NumberBaseConverterToolViewModel)GetValue(ViewModelProperty);
+ set => SetValue(ViewModelProperty, value);
+ }
+
+ public NumberBaseConverterToolPage()
+ {
+ 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 = (NumberBaseConverterToolViewModel)parameters.ViewModel!;
+ DataContext = ViewModel;
+ }
+
+ base.OnNavigatedTo(e);
+ }
+ }
+}
diff --git a/src/tests/DevToys.Tests/Core/Formatter/BaseNumberFormatterTests.cs b/src/tests/DevToys.Tests/Core/Formatter/BaseNumberFormatterTests.cs
new file mode 100644
index 000000000..e4ec486e6
--- /dev/null
+++ b/src/tests/DevToys.Tests/Core/Formatter/BaseNumberFormatterTests.cs
@@ -0,0 +1,62 @@
+using DevToys.Core.Formatter;
+using DevToys.Models;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace DevToys.Tests.Core.Formatter
+{
+ [TestClass]
+ public class BaseNumberFormatterTests
+ {
+ [DataTestMethod]
+ [DataRow("C6AEA155", 3333333333, false)]
+ [DataRow("C6AE A155", 3333333333, true)]
+ public void HexadecimalToDecimal(string input, long expectedResult, bool isFormatted)
+ {
+ Assert.AreEqual(expectedResult, NumberBaseFormatter.StringToBase(input, NumberBaseFormat.Hexadecimal));
+ }
+
+ [DataTestMethod]
+ [DataRow("30653520525", 3333333333, false)]
+ [DataRow("30 653 520 525", 3333333333, true)]
+ public void OctalToDecimal(string input, long expectedResult, bool isFormatted)
+ {
+ Assert.AreEqual(expectedResult, NumberBaseFormatter.StringToBase(input, NumberBaseFormat.Octal));
+ }
+
+ [DataTestMethod]
+ [DataRow("000101001101", 333, false)]
+ [DataRow("0001 0100 1101", 333, true)]
+ [DataRow("11000110101011101010000101010101", 3333333333, false)]
+ [DataRow("1100 0110 1010 1110 1010 0001 0101 0101", 3333333333, true)]
+ public void BinaryToDecimal(string input, long expectedResult, bool isFormatted)
+ {
+ Assert.AreEqual(expectedResult, NumberBaseFormatter.StringToBase(input, NumberBaseFormat.Binary));
+ }
+
+ [DataTestMethod]
+ [DataRow(3333333333, "C6AEA155", false)]
+ [DataRow(3333333333, "C6AE A155", true)]
+ public void DecimalToHexadecimal(long input, string expectedResult, bool isFormatted)
+ {
+ Assert.AreEqual(expectedResult, NumberBaseFormatter.LongToBase(input, NumberBaseFormat.Hexadecimal, isFormatted));
+ }
+
+ [DataTestMethod]
+ [DataRow(3333333333, "30653520525", false)]
+ [DataRow(3333333333, "30 653 520 525", true)]
+ public void DecimalToOctal(long input, string expectedResult, bool isFormatted)
+ {
+ Assert.AreEqual(expectedResult, NumberBaseFormatter.LongToBase(input, NumberBaseFormat.Octal, isFormatted));
+ }
+
+ [DataTestMethod]
+ [DataRow(333, "000101001101", false)]
+ [DataRow(333, "0001 0100 1101", true)]
+ [DataRow(3333333333, "11000110101011101010000101010101", false)]
+ [DataRow(3333333333, "1100 0110 1010 1110 1010 0001 0101 0101", true)]
+ public void DecimalToBinary(long input, string expectedResult, bool isFormatted)
+ {
+ Assert.AreEqual(expectedResult, NumberBaseFormatter.LongToBase(input, NumberBaseFormat.Binary, isFormatted));
+ }
+ }
+}
diff --git a/src/tests/DevToys.Tests/DevToys.Tests.csproj b/src/tests/DevToys.Tests/DevToys.Tests.csproj
index 8b6221b0a..9d4d9d9e4 100644
--- a/src/tests/DevToys.Tests/DevToys.Tests.csproj
+++ b/src/tests/DevToys.Tests/DevToys.Tests.csproj
@@ -44,6 +44,7 @@
<SDKReference Include="TestPlatform.Universal, Version=$(UnitTestPlatformVersion)" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="Core\Formatter\BaseNumberFormatterTests.cs" />
<Compile Include="Helpers\YamlHelperTests.cs" />
<Compile Include="Helpers\JsonHelperTests.cs" />
<Compile Include="MefBaseTest.cs" />
@@ -88,7 +89,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\dev\impl\DevToys\DevToys.csproj">
- <Project>{E3E4E200-B380-4207-9A7E-4C9421904502}</Project>
+ <Project>{e3e4e200-b380-4207-9a7e-4c9421904502}</Project>
<Name>DevToys</Name>
</ProjectReference>
<ProjectReference Include="..\..\dev\shared\DevToys.Shared\DevToys.Shared.csproj">