-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #66 from phmatray/features/vogen
use Vogen and Intellenum in domain project
- Loading branch information
Showing
14 changed files
with
84 additions
and
183 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
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,3 @@ | ||
// Global using directives | ||
|
||
global using Vogen; |
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
4 changes: 4 additions & 0 deletions
4
geometrix-api/Geometrix.Domain/ValueObjects/CellWidthPixel.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,4 @@ | ||
namespace Geometrix.Domain.ValueObjects; | ||
|
||
[ValueObject<int>] | ||
public readonly partial struct CellWidthPixel; |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
namespace Geometrix.Domain.ValueObjects; | ||
|
||
public record PatternSeed(string Seed); | ||
[ValueObject<string>] | ||
public readonly partial struct PatternSeed; |
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
90 changes: 11 additions & 79 deletions
90
geometrix-api/Geometrix.Domain/ValueObjects/ThemeColor.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 |
---|---|---|
@@ -1,81 +1,13 @@ | ||
namespace Geometrix.Domain.ValueObjects; | ||
|
||
public readonly struct ThemeColor(string value) | ||
: IEquatable<ThemeColor> | ||
{ | ||
public string Value { get; } = value; | ||
|
||
public override bool Equals(object? obj) | ||
=> obj is ThemeColor o && Equals(o); | ||
|
||
public bool Equals(ThemeColor other) | ||
=> Value == other.Value; | ||
|
||
public override int GetHashCode() | ||
=> HashCode.Combine(Value); | ||
|
||
public static bool operator ==(ThemeColor left, ThemeColor right) | ||
=> left.Equals(right); | ||
|
||
public static bool operator !=(ThemeColor left, ThemeColor right) | ||
=> !(left == right); | ||
|
||
/// <summary> | ||
/// Light. | ||
/// </summary> | ||
/// <returns>ThemeColor.</returns> | ||
public static readonly ThemeColor Light = new("light"); | ||
|
||
/// <summary> | ||
/// Dark. | ||
/// </summary> | ||
/// <returns>ThemeColor.</returns> | ||
public static readonly ThemeColor Dark = new("dark"); | ||
|
||
/// <summary> | ||
/// Red. | ||
/// </summary> | ||
/// <returns>ThemeColor.</returns> | ||
public static readonly ThemeColor Red = new("red"); | ||
|
||
/// <summary> | ||
/// Yellow. | ||
/// </summary> | ||
/// <returns>ThemeColor.</returns> | ||
public static readonly ThemeColor Yellow = new("yellow"); | ||
|
||
/// <summary> | ||
/// Green. | ||
/// </summary> | ||
/// <returns>ThemeColor.</returns> | ||
public static readonly ThemeColor Green = new("green"); | ||
|
||
/// <summary> | ||
/// Blue. | ||
/// </summary> | ||
/// <returns>ThemeColor.</returns> | ||
public static readonly ThemeColor Blue = new("blue"); | ||
|
||
/// <summary> | ||
/// Indigo. | ||
/// </summary> | ||
/// <returns>ThemeColor.</returns> | ||
public static readonly ThemeColor Indigo = new("indigo"); | ||
|
||
/// <summary> | ||
/// Purple. | ||
/// </summary> | ||
/// <returns>ThemeColor.</returns> | ||
public static readonly ThemeColor Purple = new("purple"); | ||
|
||
/// <summary> | ||
/// Pink. | ||
/// </summary> | ||
/// <returns>ThemeColor.</returns> | ||
public static readonly ThemeColor Pink = new("pink"); | ||
|
||
public override string ToString() | ||
{ | ||
return Value; | ||
} | ||
} | ||
[ValueObject<string>] | ||
[Instance("Light", "light")] | ||
[Instance("Dark", "dark")] | ||
[Instance("Red", "red")] | ||
[Instance("Yellow", "yellow")] | ||
[Instance("Green", "green")] | ||
[Instance("Blue", "blue")] | ||
[Instance("Indigo", "indigo")] | ||
[Instance("Purple", "purple")] | ||
[Instance("Pink", "pink")] | ||
public readonly partial struct ThemeColor; |
96 changes: 34 additions & 62 deletions
96
geometrix-api/Geometrix.Domain/ValueObjects/TriangleDirection.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 |
---|---|---|
@@ -1,78 +1,50 @@ | ||
namespace Geometrix.Domain.ValueObjects; | ||
|
||
public readonly struct TriangleDirection(TriangleDirection.Direction value) | ||
: IEquatable<TriangleDirection> | ||
using Intellenum; | ||
|
||
namespace Geometrix.Domain.ValueObjects; | ||
|
||
[Intellenum] | ||
[Member("None", 0)] | ||
[Member("TopLeft", 1)] | ||
[Member("TopRight", 2)] | ||
[Member("BottomLeft", 3)] | ||
[Member("BottomRight", 4)] | ||
[Member("Filled", 5)] | ||
public partial class TriangleDirection | ||
{ | ||
public Direction Value { get; } = value; | ||
|
||
public override bool Equals(object? obj) | ||
=> obj is TriangleDirection other && Equals(other); | ||
|
||
public bool Equals(TriangleDirection other) | ||
=> Value == other.Value; | ||
|
||
public override int GetHashCode() | ||
=> (int) Value; | ||
|
||
public static bool operator ==(TriangleDirection left, TriangleDirection right) | ||
=> left.Equals(right); | ||
|
||
public static bool operator !=(TriangleDirection left, TriangleDirection right) | ||
=> !(left == right); | ||
|
||
public static readonly TriangleDirection None = new(Direction.None); | ||
public static readonly TriangleDirection TopLeft = new(Direction.TopLeft); | ||
public static readonly TriangleDirection TopRight = new(Direction.TopRight); | ||
public static readonly TriangleDirection BottomLeft = new(Direction.BottomLeft); | ||
public static readonly TriangleDirection BottomRight = new(Direction.BottomRight); | ||
public static readonly TriangleDirection Filled = new(Direction.Filled); | ||
|
||
public static TriangleDirection MirrorRight(TriangleDirection direction) | ||
=> direction.Value switch | ||
{ | ||
return direction.Value switch | ||
{ | ||
Direction.None => None, | ||
Direction.TopLeft => TopRight, | ||
Direction.TopRight => TopLeft, | ||
Direction.BottomLeft => BottomRight, | ||
Direction.BottomRight => BottomLeft, | ||
Direction.Filled => Filled, | ||
0 => None, | ||
1 => TopRight, | ||
2 => TopLeft, | ||
3 => BottomRight, | ||
4 => BottomLeft, | ||
5 => Filled, | ||
_ => throw new ArgumentOutOfRangeException(nameof(direction)) | ||
}; | ||
} | ||
|
||
public static TriangleDirection MirrorDown(TriangleDirection direction) | ||
=> direction.Value switch | ||
{ | ||
return direction.Value switch | ||
{ | ||
Direction.None => None, | ||
Direction.TopLeft => BottomLeft, | ||
Direction.TopRight => BottomRight, | ||
Direction.BottomLeft => TopLeft, | ||
Direction.BottomRight => TopRight, | ||
Direction.Filled => Filled, | ||
0 => None, | ||
1 => BottomLeft, | ||
2 => BottomRight, | ||
3 => TopLeft, | ||
4 => TopRight, | ||
5 => Filled, | ||
_ => throw new ArgumentOutOfRangeException(nameof(direction)) | ||
}; | ||
} | ||
|
||
public static TriangleDirection CreateRandom(Random random, bool includeEmptyAndFill) | ||
{ | ||
var direction = includeEmptyAndFill | ||
? (Direction) random.Next(6) | ||
: (Direction) (random.Next(4) + 1); | ||
|
||
var triangleDirection = new TriangleDirection(direction); | ||
return triangleDirection; | ||
} | ||
? random.Next(6) | ||
: random.Next(4) + 1; | ||
|
||
public override string ToString() | ||
{ | ||
return $"{nameof(Value)}: {Value}"; | ||
} | ||
|
||
public enum Direction | ||
{ | ||
None = 0, | ||
TopLeft = 1, | ||
TopRight = 2, | ||
BottomLeft = 3, | ||
BottomRight = 4, | ||
Filled = 5 | ||
return FromValue(direction); | ||
} | ||
} | ||
} |
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
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"sdk": { | ||
"version": "8.0.0", | ||
"rollForward": "latestMajor", | ||
"allowPrerelease": true | ||
"rollForward": "feature", | ||
"allowPrerelease": false | ||
} | ||
} |