-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create shortcut attributes for serializing against version. Reduces a…
… lot of noise in the codebase!
- Loading branch information
Showing
13 changed files
with
85 additions
and
107 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
ME3Tweaks.Wwiser/Attributes/SerializeWhenVersionAttribute.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,12 @@ | ||
using BinarySerialization; | ||
|
||
namespace ME3Tweaks.Wwiser.Attributes; | ||
|
||
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = true)] | ||
public class SerializeWhenVersionAttribute : SerializeWhenAttribute | ||
{ | ||
public SerializeWhenVersionAttribute(object value, ComparisonOperator @operator = ComparisonOperator.Equal) : base(nameof(BankSerializationContext.Version), value, @operator) | ||
{ | ||
RelativeSourceMode = RelativeSourceMode.SerializationContext; | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
ME3Tweaks.Wwiser/Attributes/SerializeWhenVersionBetweenAttribute.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,15 @@ | ||
using BinarySerialization; | ||
using ME3Tweaks.Wwiser.Converters; | ||
|
||
namespace ME3Tweaks.Wwiser.Attributes; | ||
|
||
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = true)] | ||
public class SerializeWhenVersionBetweenAttribute : SerializeWhenVersionAttribute | ||
{ | ||
public SerializeWhenVersionBetweenAttribute(uint low, uint high, ComparisonOperator @operator = ComparisonOperator.Equal) : base(true, @operator) | ||
{ | ||
RelativeSourceMode = RelativeSourceMode.SerializationContext; | ||
ConverterType = typeof(BetweenConverter); | ||
ConverterParameter = new[] { low, high }; | ||
} | ||
} |
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
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
Oops, something went wrong.