-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added hexconverter toy * added french localization and Accessibility name * renamed HexConverter to NumberBaseConverter * cleaned csproj *.resw
- Loading branch information
Showing
18 changed files
with
1,950 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace DevToys.Models | ||
{ | ||
public enum Radix | ||
{ | ||
Octal, | ||
Binary, | ||
Decimal, | ||
Hexdecimal | ||
} | ||
} |
Oops, something went wrong.