-
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.
Format from/to custom number base (#430)
* Number conversion using custom bases functionalities and few tests * Functionalities to format numbers using any base and dictionary * Add new language text * Change models to fit new features * Add new communication messages between number converter view models * Add views and functionalities to allow custom dictionaries * Activate model to receive messages * Include language generated component * Rebase and cleanup code * Update InfoBar message to show/hide it correctly * Remove remaining code generating compile errors * Code refactoring * Fix test cases * Added the possibility to Favorite/Unfavorite a tool. (#437) * Added the possibility to Favorite/Unfavorite a tool. * Updated localization * addressed feedback * Fix README.md minor typo (#441) * Update japanese translation. (#444) * Bumped up version number * Feature/add refresh button lorem ipsum (#413) * Add StartWithLoremIpsum option * Updated language bundles * Added refresh buttom for lorem ipsum * Replaced click handler with Refresh ICommand * Fixing error Co-authored-by: Guus Beltman <[email protected]> * Added some assets * Updated chocolatey * updated wikiUrl in Chocolatey * Update Traditional Chinese translation (#442) * Updates to cs-CZ localization (#447) * feature: 💬 add new lang (Portuguese-Brazil) (#449) * Update japanese translation. (lorem ipsum) (#450) * Update japanese translation. (lorem ipsum) * Fix typo. * Update chinese translation (#451) * Added String Escape / Unescape tool (#446) * Set nullable * Set nullable and change to string dictionaries * Fix errors, inject view models and improve code * Add translations * Number conversion using custom bases functionalities and few tests * Functionalities to format numbers using any base and dictionary * Add new language text * Change models to fit new features * Add new communication messages between number converter view models * Add views and functionalities to allow custom dictionaries * Activate model to receive messages * Include language generated component * Rebase and cleanup code * Update InfoBar message to show/hide it correctly * Remove remaining code generating compile errors * Code refactoring * Fix test cases * Set nullable * Set nullable and change to string dictionaries * Fix errors, inject view models and improve code * Add translations * Automatic input when navigating to the tool Co-authored-by: Etienne BAUDOUX <[email protected]> Co-authored-by: kspc1000 <[email protected]> Co-authored-by: Sou Niyari <[email protected]> Co-authored-by: Guus Beltman <[email protected]> Co-authored-by: Guus Beltman <[email protected]> Co-authored-by: SiderealArt <[email protected]> Co-authored-by: Morning4coffe <[email protected]> Co-authored-by: Rafael Andrade de Oliveira <[email protected]> Co-authored-by: Boring3 <[email protected]>
- Loading branch information
1 parent
3e8b744
commit 646ceca
Showing
38 changed files
with
1,617 additions
and
317 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
21 changes: 21 additions & 0 deletions
21
src/dev/impl/DevToys/Messages/ChangeInfoBarStatusMessage.cs
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,21 @@ | ||
#nullable enable | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace DevToys.Messages | ||
{ | ||
public sealed class ChangeInfoBarStatusMessage | ||
{ | ||
public string Message { get; set; } | ||
public bool IsOpen { get; set; } | ||
|
||
public ChangeInfoBarStatusMessage(bool isOpen, string message) | ||
{ | ||
Message = message; | ||
IsOpen = isOpen; | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/dev/impl/DevToys/Messages/ChangeNumberFormattingMessage.cs
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,19 @@ | ||
#nullable enable | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace DevToys.Messages | ||
{ | ||
public sealed class ChangeNumberFormattingMessage | ||
{ | ||
public bool IsFormatted { get; set; } | ||
|
||
public ChangeNumberFormattingMessage(bool formatted) | ||
{ | ||
IsFormatted = formatted; | ||
} | ||
} | ||
} |
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,69 @@ | ||
#nullable enable | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace DevToys.Models | ||
{ | ||
public class NumberBaseDictionary : IEquatable<NumberBaseDictionary> | ||
{ | ||
public static readonly NumberBaseDictionary Base16Dictionary = new( | ||
_dictionary: "0123456789ABCDEF", | ||
formatting: true); | ||
|
||
public static readonly NumberBaseDictionary RFC4648Base32Dictionary = new( | ||
_dictionary: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", | ||
formatting: false); | ||
|
||
public static readonly NumberBaseDictionary RFC4648Base32ExHexDictionary = new( | ||
_dictionary: "0123456789ABCDEFGHIJKLMNOPQRSTUV", | ||
formatting: false); | ||
|
||
public static readonly NumberBaseDictionary RFC4648Base64Dictionary = new( | ||
_dictionary: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", | ||
formatting: false); | ||
|
||
public static readonly NumberBaseDictionary RFC4648Base64UrlEncodeDictionary = new( | ||
_dictionary: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_", | ||
formatting: false); | ||
public static NumberBaseDictionary DefaultDictionary { get; } = RFC4648Base64Dictionary; | ||
|
||
public string Dictionary { get; } | ||
public bool AllowsFormatting { get; } | ||
|
||
public NumberBaseDictionary(string _dictionary, bool formatting) | ||
{ | ||
Dictionary = _dictionary; | ||
AllowsFormatting = formatting; | ||
} | ||
|
||
public static implicit operator NumberBaseDictionary(string dict) | ||
{ | ||
return new NumberBaseDictionary(dict, dict.All(c => char.IsLower(c))); | ||
} | ||
|
||
public char this[int index] | ||
{ | ||
get | ||
{ | ||
return Dictionary[index]; | ||
} | ||
} | ||
|
||
public override bool Equals(object obj) | ||
{ | ||
if (obj is not NumberBaseDictionary other) | ||
{ | ||
return false; | ||
} | ||
return Equals(other); | ||
} | ||
|
||
public bool Equals(NumberBaseDictionary other) | ||
{ | ||
return AllowsFormatting == other.AllowsFormatting && Dictionary.SequenceEqual(other.Dictionary); | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -5,6 +5,8 @@ public enum Radix | |
Octal, | ||
Binary, | ||
Decimal, | ||
Hexdecimal | ||
Hexdecimal, | ||
RFC4648Standard, | ||
Custom | ||
} | ||
} |
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
Oops, something went wrong.