//private static FreeControllerV3.RotationState DeserializeIntoRotationState(string value) //{ // if (value == null) return FreeControllerV3.RotationState.On; // return (FreeControllerV3.RotationState)Enum.Parse(typeof(FreeControllerV3.RotationState), value); //} //private static FreeControllerV3.PositionState DeserializeIntoPositionState(string value) //{ // if (value == null) return FreeControllerV3.PositionState.On; // return (FreeControllerV3.PositionState)Enum.Parse(typeof(FreeControllerV3.PositionState), value); // //switch (value) // //{ // // case FreeControllerV3.PositionState.On + "": return FreeControllerV3.PositionState.On; // //} //} public static JSONNode SerializeStoredAtom(StoredAtom storedAtom) { var newJson = new JSONClass(); newJson.Add("Active", new JSONData(storedAtom.Active)); newJson.Add("AtomName", new JSONData(storedAtom.AtomName)); newJson.Add("AtomType", new JSONData(storedAtom.AtomType)); newJson.Add("FullAtom", storedAtom.FullAtom); JSONArray storables = new JSONArray(); storedAtom.Storables.ForEach(storables.Add); newJson.Add("Storables", storables); return(newJson); }
public static StoredAtom DeserializeIntoStoredAtom(JSONClass inputObject) { var keys = inputObject.Keys.ToList(); var mutationComponent = new StoredAtom() { Active = bool.Parse(inputObject.Childs.ElementAt(keys.IndexOf("Active")).Value), AtomType = inputObject.Childs.ElementAt(keys.IndexOf("AtomType")).Value, AtomName = inputObject.Childs.ElementAt(keys.IndexOf("AtomName")).Value, FullAtom = inputObject["FullAtom"].AsObject, Storables = inputObject.Childs.ElementAt(keys.IndexOf("Storables")) .Childs .Select(i => i.AsObject) .ToList(), }; return(mutationComponent); }
private static Catalog GetV3_0_1FromV3_0_0(Catalog catalog) { foreach (var entry in catalog.Entries) { if (entry.CatalogEntryMode != CatalogModeEnum.CATALOG_MODE_SESSION) { continue; } var mutation = entry.Mutation; var storedAtom = new StoredAtom() { Active = true, AtomName = mutation.AtomName, AtomType = mutation.AtomType, Storables = mutation.Storables }; mutation.StoredAtoms = new List <StoredAtom>() { storedAtom }; } catalog.PluginVersion = "3.0.1"; return(catalog); }