-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes
cost
and level
not working, hopefully
Updates nightly steps
- Loading branch information
1 parent
24d36bd
commit a3d22bb
Showing
5 changed files
with
96 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Montage.Weiss.Tools.GUI.Utilities; | ||
internal static class Parsers | ||
{ | ||
/// <summary> | ||
/// Implements Parse, but also handles typical exceptions from the System variant, except for FormatException. | ||
/// </summary> | ||
/// <param name="text">Text to format</param> | ||
/// <param name="style">Style</param> | ||
/// <param name="provider">Provider if provided</param> | ||
/// <returns></returns> | ||
internal static int? ParseInt(ReadOnlySpan<char> text, System.Globalization.NumberStyles style = System.Globalization.NumberStyles.Integer, IFormatProvider? provider = null) | ||
{ | ||
try | ||
{ | ||
return int.Parse(text, style, provider); | ||
} | ||
catch (OverflowException e) | ||
{ | ||
return int.MaxValue; | ||
} | ||
catch (FormatException e) | ||
{ | ||
return null; | ||
} catch (ArgumentNullException e) | ||
{ | ||
return null; | ||
} | ||
} | ||
} |
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,20 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Montage.Weiss.Tools.GUI.Utilities; | ||
internal static class Strings | ||
{ | ||
internal static string? Or(params Func<string>[] values) // will be turned into Span/IEnumerable in .NET 9 | ||
{ | ||
foreach (var span in values) | ||
{ | ||
var possibleResult = span(); | ||
if (!String.IsNullOrWhiteSpace(possibleResult)) | ||
return possibleResult; | ||
} | ||
return null; | ||
} | ||
} |
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