diff --git a/X10D/src/Endianness.cs b/X10D/src/Endianness.cs
index eb9f54d..9fde0ee 100644
--- a/X10D/src/Endianness.cs
+++ b/X10D/src/Endianness.cs
@@ -1,22 +1,21 @@
using System.ComponentModel;
-namespace X10D
+namespace X10D;
+
+///
+/// Represents an enumeration of endianness values.
+///
+public enum Endianness
{
///
- /// Represents an enumeration of endianness values.
+ /// The value should be read as though it uses little endian encoding.
///
- public enum Endianness
- {
- ///
- /// The value should be read as though it uses little endian encoding.
- ///
- [Description("The value should be read as though it uses little endian encoding.")]
- LittleEndian,
+ [Description("The value should be read as though it uses little endian encoding.")]
+ LittleEndian,
- ///
- /// The value should be read as though it uses big endian encoding.
- ///
- [Description("The value should be read as though it uses big endian encoding.")]
- BigEndian
- }
-}
+ ///
+ /// The value should be read as though it uses big endian encoding.
+ ///
+ [Description("The value should be read as though it uses big endian encoding.")]
+ BigEndian
+}
\ No newline at end of file
diff --git a/X10D/src/MathUtils.cs b/X10D/src/MathUtils.cs
index ae9719e..ff51660 100644
--- a/X10D/src/MathUtils.cs
+++ b/X10D/src/MathUtils.cs
@@ -1,40 +1,39 @@
-namespace X10D
+namespace X10D;
+
+///
+/// Provides static helpers methods for mathematical functions not found in the .NET class.
+///
+public static class MathUtils
{
///
- /// Provides static helpers methods for mathematical functions not found in the .NET class.
+ /// Linearly interpolates from one value to a target using a specified alpha.
///
- public static class MathUtils
+ /// The interpolation source.
+ /// The interpolation target.
+ /// The interpolation alpha.
+ ///
+ /// The interpolation result as determined by (1 - alpha) * value + alpha * target.
+ ///
+ public static float Lerp(float value, float target, float alpha)
{
- ///
- /// Linearly interpolates from one value to a target using a specified alpha.
- ///
- /// The interpolation source.
- /// The interpolation target.
- /// The interpolation alpha.
- ///
- /// The interpolation result as determined by (1 - alpha) * value + alpha * target.
- ///
- public static float Lerp(float value, float target, float alpha)
- {
- // rookie mistake: a + t * (b - a)
- // "precise" method: (1 - t) * a + t * b
- return ((1.0f - alpha) * value) + (alpha * target);
- }
+ // rookie mistake: a + t * (b - a)
+ // "precise" method: (1 - t) * a + t * b
+ return ((1.0f - alpha) * value) + (alpha * target);
+ }
- ///
- /// Linearly interpolates from one value to a target using a specified alpha.
- ///
- /// The interpolation source.
- /// The interpolation target.
- /// The interpolation alpha.
- ///
- /// The interpolation result as determined by (1 - alpha) * value + alpha * target.
- ///
- public static double Lerp(double value, double target, double alpha)
- {
- // rookie mistake: a + t * (b - a)
- // "precise" method: (1 - t) * a + t * b
- return ((1.0 - alpha) * value) + (alpha * target);
- }
+ ///
+ /// Linearly interpolates from one value to a target using a specified alpha.
+ ///
+ /// The interpolation source.
+ /// The interpolation target.
+ /// The interpolation alpha.
+ ///
+ /// The interpolation result as determined by (1 - alpha) * value + alpha * target.
+ ///
+ public static double Lerp(double value, double target, double alpha)
+ {
+ // rookie mistake: a + t * (b - a)
+ // "precise" method: (1 - t) * a + t * b
+ return ((1.0 - alpha) * value) + (alpha * target);
}
}
diff --git a/X10D/src/TimeSpanParser.cs b/X10D/src/TimeSpanParser.cs
index c95d643..9f53f0d 100644
--- a/X10D/src/TimeSpanParser.cs
+++ b/X10D/src/TimeSpanParser.cs
@@ -1,103 +1,102 @@
using System.Globalization;
using System.Text.RegularExpressions;
-namespace X10D
+namespace X10D;
+
+///
+/// Represents a class which contains a parser which converts into .
+///
+public static class TimeSpanParser
{
+ private const string RealNumberPattern = @"(\d*\.\d+|\d+)";
+
+ private static readonly string Pattern = $"^(?:{RealNumberPattern} *y)? *" +
+ $"^(?:{RealNumberPattern} *mo)? *" +
+ $"^(?:{RealNumberPattern} *w)? *" +
+ $"(?:{RealNumberPattern} *d)? *" +
+ $"(?:{RealNumberPattern} *h)? *" +
+ $"(?:{RealNumberPattern} *m)? *" +
+ $"(?:{RealNumberPattern} *s)? *" +
+ $"(?:{RealNumberPattern} *ms)?$";
+
+ private static readonly Regex Regex = new(Pattern, RegexOptions.Compiled | RegexOptions.IgnoreCase);
+
///
- /// Represents a class which contains a parser which converts into .
+ /// Attempts to parses a shorthand time span string (e.g. 3w 2d 1.5h), converting it to an instance of
+ /// which represents that duration of time.
///
- public static class TimeSpanParser
+ /// The input string.
+ /// The parsed result.
+ /// The format provider.
+ /// if the parse was successful, otherwise.
+ public static bool TryParse(string input, out TimeSpan result, IFormatProvider? provider = null)
{
- private const string RealNumberPattern = @"(\d*\.\d+|\d+)";
+ result = default;
- private static readonly string Pattern = $"^(?:{RealNumberPattern} *y)? *" +
- $"^(?:{RealNumberPattern} *mo)? *" +
- $"^(?:{RealNumberPattern} *w)? *" +
- $"(?:{RealNumberPattern} *d)? *" +
- $"(?:{RealNumberPattern} *h)? *" +
- $"(?:{RealNumberPattern} *m)? *" +
- $"(?:{RealNumberPattern} *s)? *" +
- $"(?:{RealNumberPattern} *ms)?$";
+ Match? match = Regex.Match(input);
- private static readonly Regex Regex = new(Pattern, RegexOptions.Compiled | RegexOptions.IgnoreCase);
-
- ///
- /// Attempts to parses a shorthand time span string (e.g. 3w 2d 1.5h), converting it to an instance of
- /// which represents that duration of time.
- ///
- /// The input string.
- /// The parsed result.
- /// The format provider.
- /// if the parse was successful, otherwise.
- public static bool TryParse(string input, out TimeSpan result, IFormatProvider? provider = null)
+ if (!match.Success)
{
- result = default;
-
- Match? match = Regex.Match(input);
-
- if (!match.Success)
- {
- return false;
- }
-
- bool TryParseAt(int group, out double parsedResult)
- {
- parsedResult = 0;
-
- return match.Groups[group].Success
- && double.TryParse(match.Groups[group].Value, NumberStyles.Number, provider, out parsedResult);
- }
-
- if (!TryParseAt(1, out double years))
- {
- return false;
- }
-
- if (!TryParseAt(2, out double months))
- {
- return false;
- }
-
- if (!TryParseAt(3, out double weeks))
- {
- return false;
- }
-
- if (!TryParseAt(4, out double days))
- {
- return false;
- }
-
- if (!TryParseAt(5, out double hours))
- {
- return false;
- }
-
- if (!TryParseAt(6, out double minutes))
- {
- return false;
- }
-
- if (!TryParseAt(7, out double seconds))
- {
- return false;
- }
-
- if (!TryParseAt(8, out double milliseconds))
- {
- return false;
- }
-
- result += TimeSpan.FromDays(years * 365);
- result += TimeSpan.FromDays(months * 30);
- result += TimeSpan.FromDays(weeks * 7);
- result += TimeSpan.FromDays(days);
- result += TimeSpan.FromHours(hours);
- result += TimeSpan.FromMinutes(minutes);
- result += TimeSpan.FromSeconds(seconds);
- result += TimeSpan.FromMilliseconds(milliseconds);
-
- return true;
+ return false;
}
+
+ bool TryParseAt(int group, out double parsedResult)
+ {
+ parsedResult = 0;
+
+ return match.Groups[group].Success
+ && double.TryParse(match.Groups[group].Value, NumberStyles.Number, provider, out parsedResult);
+ }
+
+ if (!TryParseAt(1, out double years))
+ {
+ return false;
+ }
+
+ if (!TryParseAt(2, out double months))
+ {
+ return false;
+ }
+
+ if (!TryParseAt(3, out double weeks))
+ {
+ return false;
+ }
+
+ if (!TryParseAt(4, out double days))
+ {
+ return false;
+ }
+
+ if (!TryParseAt(5, out double hours))
+ {
+ return false;
+ }
+
+ if (!TryParseAt(6, out double minutes))
+ {
+ return false;
+ }
+
+ if (!TryParseAt(7, out double seconds))
+ {
+ return false;
+ }
+
+ if (!TryParseAt(8, out double milliseconds))
+ {
+ return false;
+ }
+
+ result += TimeSpan.FromDays(years * 365);
+ result += TimeSpan.FromDays(months * 30);
+ result += TimeSpan.FromDays(weeks * 7);
+ result += TimeSpan.FromDays(days);
+ result += TimeSpan.FromHours(hours);
+ result += TimeSpan.FromMinutes(minutes);
+ result += TimeSpan.FromSeconds(seconds);
+ result += TimeSpan.FromMilliseconds(milliseconds);
+
+ return true;
}
-}
+}
\ No newline at end of file