-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
74 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
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,25 @@ | ||
using System; | ||
using Microsoft.CodeAnalysis.Diagnostics; | ||
|
||
namespace Entitas.Generators; | ||
|
||
public readonly struct EntitasAnalyzerConfigOptions : IEquatable<EntitasAnalyzerConfigOptions> | ||
{ | ||
public const string TestValueKey = "entitas_test_option"; | ||
|
||
public readonly bool TestValue; | ||
|
||
public EntitasAnalyzerConfigOptions(AnalyzerConfigOptions options) | ||
{ | ||
TestValue = IsTrue(options, TestValueKey); | ||
} | ||
|
||
static bool IsTrue(AnalyzerConfigOptions options, string key) | ||
{ | ||
return options.TryGetValue(key, out var value) && value.Equals("true", StringComparison.OrdinalIgnoreCase); | ||
} | ||
|
||
public bool Equals(EntitasAnalyzerConfigOptions other) => TestValue == other.TestValue; | ||
public override bool Equals(object? obj) => obj is EntitasAnalyzerConfigOptions other && Equals(other); | ||
public override int GetHashCode() => TestValue.GetHashCode(); | ||
} |
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