summaryrefslogtreecommitdiff
path: root/grapher/Models/Serialized/LookupTable.cs
diff options
context:
space:
mode:
authora1xd <[email protected]>2021-04-06 01:21:42 -0400
committera1xd <[email protected]>2021-04-06 01:21:42 -0400
commit7c1f14845bc948e9ea25908e96099203d9433a69 (patch)
treeeadfae6ec0a775a35c29807bde3c20be8160e034 /grapher/Models/Serialized/LookupTable.cs
parentLUT text layout (diff)
downloadrawaccel-7c1f14845bc948e9ea25908e96099203d9433a69.tar.xz
rawaccel-7c1f14845bc948e9ea25908e96099203d9433a69.zip
update wrapper + writer to handle lut
grapher is building but applying options still broken for the most part
Diffstat (limited to 'grapher/Models/Serialized/LookupTable.cs')
-rw-r--r--grapher/Models/Serialized/LookupTable.cs50
1 files changed, 0 insertions, 50 deletions
diff --git a/grapher/Models/Serialized/LookupTable.cs b/grapher/Models/Serialized/LookupTable.cs
deleted file mode 100644
index d373461..0000000
--- a/grapher/Models/Serialized/LookupTable.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-using Newtonsoft.Json;
-using Newtonsoft.Json.Linq;
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace grapher.Models.Serialized
-{
- [Serializable]
- public static class LookupTable
- {
- public static void Deserialize(string lutFile, ref DriverSettings settings)
- {
- if (!File.Exists(lutFile))
- {
- throw new Exception($"LUT file does not exist at {lutFile}.");
- }
-
- JObject lutJObject = JObject.Parse(File.ReadAllText(lutFile));
-
- var spacedLut = lutJObject.ToObject<SpacedTable>(JsonSerializer.Create(RawAccelSettings.SerializerSettings));
-
- if (spacedLut is null)
- {
- var arbitraryLut = lutJObject.ToObject<ArbitraryTable>(JsonSerializer.Create(RawAccelSettings.SerializerSettings));
-
- if (arbitraryLut is null || arbitraryLut.points is null)
- {
- throw new Exception($"{lutFile} does not contain valid lookuptable json.");
- }
-
- settings.ArbitraryTable = arbitraryLut;
- settings.args.x.lutArgs.type = TableType.arbitrary;
- }
- else
- {
- if (spacedLut.points is null)
- {
- throw new Exception($"{lutFile} does not contain valid lookuptable json.");
- }
-
- settings.SpacedTable = spacedLut;
- settings.args.x.lutArgs = spacedLut.args;
- }
- }
- }
-}