-
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.
General cleanup and very minor changes in advance of release.
- Loading branch information
1 parent
410fbed
commit d40898d
Showing
64 changed files
with
199 additions
and
557 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
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 was deleted.
Oops, something went wrong.
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,64 @@ | ||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Linq; | ||
using RandomizerCore.Logic; | ||
using RandomizerCore.StringLogic; | ||
|
||
namespace RandomizerCore.Json | ||
{ | ||
public class LMConverter : JsonConverter<LogicManager> | ||
{ | ||
public override LogicManager ReadJson(JsonReader reader, Type objectType, LogicManager existingValue, bool hasExistingValue, JsonSerializer serializer) | ||
{ | ||
LogicManagerBuilder lmb = new(); | ||
JObject lm = JObject.Load(reader); | ||
lmb.LP = lm[nameof(LogicManager.LP)].ToObject<LogicProcessor>(); | ||
lmb.VariableResolver = lm[nameof(LogicManager.VariableResolver)].ToObject<VariableResolver>(); | ||
|
||
lmb.DeserializeJson(LogicManagerBuilder.JsonType.Terms, lm["Terms"]); | ||
lmb.DeserializeJson(LogicManagerBuilder.JsonType.Waypoints, lm["Waypoints"]); | ||
lmb.DeserializeJson(LogicManagerBuilder.JsonType.Transitions, lm["Transitions"]); | ||
lmb.DeserializeJson(LogicManagerBuilder.JsonType.Locations, lm["Logic"]); | ||
lmb.DeserializeJson(LogicManagerBuilder.JsonType.Items, lm["Items"]); | ||
|
||
return new(lmb); | ||
} | ||
|
||
public override void WriteJson(JsonWriter writer, LogicManager value, JsonSerializer serializer) | ||
{ | ||
writer.WriteStartObject(); | ||
|
||
TermConverter tc = new() { LM = value }; | ||
LogicDefConverter ldc = new() { LM = value }; | ||
serializer.Converters.Add(tc); | ||
serializer.Converters.Add(ldc); | ||
|
||
writer.WritePropertyName("Terms"); | ||
serializer.Serialize(writer, value.Terms); | ||
|
||
writer.WritePropertyName("Variables"); | ||
serializer.Serialize(writer, value.Variables); | ||
|
||
writer.WritePropertyName("Logic"); | ||
serializer.Serialize(writer, value.LogicLookup.Values.Select(l => new RawLogicDef(l.Name, l.ToInfix()))); | ||
|
||
writer.WritePropertyName("Items"); | ||
serializer.Serialize(writer, value.ItemLookup.Values); | ||
|
||
writer.WritePropertyName("Transitions"); | ||
serializer.Serialize(writer, value.TransitionLookup.Values.Select(t => t.ToRaw())); | ||
|
||
writer.WritePropertyName("Waypoints"); | ||
serializer.Serialize(writer, value.Waypoints.Select(w => new RawLogicDef(w.Name, w.logic.ToInfix()))); | ||
|
||
writer.WritePropertyName(nameof(value.LP)); | ||
serializer.Serialize(writer, value.LP); | ||
|
||
writer.WritePropertyName(nameof(value.VariableResolver)); | ||
serializer.Serialize(writer, value.VariableResolver); | ||
|
||
writer.WriteEndObject(); | ||
serializer.Converters.Remove(ldc); | ||
serializer.Converters.Remove(tc); | ||
} | ||
} | ||
} |
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,5 +1,4 @@ | ||
using System; | ||
using System.Diagnostics; | ||
using System.Diagnostics; | ||
|
||
namespace RandomizerCore | ||
{ | ||
|
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 was deleted.
Oops, something went wrong.
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.