public void DeserializeEditorSettings(GraphEditorBase[] graphEditors) { if (graphEditors == null) { return; } for (int i = 0; i < graphEditors.Length; i++) { if (graphEditors[i] != null) { for (int j = 0; j < this.graphs.Length; j++) { if (graphEditors[i].target == this.graphs[j]) { int num = this.graphIndexInZip[this.graphs[j]]; ZipEntry entry = this.GetEntry("graph" + num + "_editor.json"); if (entry != null) { TinyJsonDeserializer.Deserialize(AstarSerializer.GetString(entry), graphEditors[i].GetType(), graphEditors[i]); break; } } } } } }
public void DeserializeEditorSettings(GraphEditorBase[] graphEditors) { if (graphEditors == null) { return; } for (int i = 0; i < graphEditors.Length; i++) { if (graphEditors[i] != null) { for (int j = 0; j < this.graphs.Length; j++) { if (graphEditors[i].target == this.graphs[j]) { int num = this.graphIndexInZip[this.graphs[j]]; ZipEntry zipEntry = this.zip["graph" + num + "_editor.json"]; if (zipEntry != null) { string @string = AstarSerializer.GetString(zipEntry); JsonReader jsonReader = new JsonReader(@string, this.readerSettings); GraphEditorBase graphEditorBase = graphEditors[i]; jsonReader.PopulateObject <GraphEditorBase>(ref graphEditorBase); graphEditors[i] = graphEditorBase; break; } } } } } }
private GraphMeta DeserializeMeta(ZipEntry entry) { if (entry == null) { throw new Exception("No metadata found in serialized data."); } string @string = AstarSerializer.GetString(entry); JsonReader jsonReader = new JsonReader(@string, this.readerSettings); return((GraphMeta)jsonReader.Deserialize(typeof(GraphMeta))); }
// Token: 0x0600285B RID: 10331 RVA: 0x001BBF3C File Offset: 0x001BA13C public void DeserializeEditorSettingsCompatibility() { for (int i = 0; i < this.graphs.Length; i++) { int num = this.graphIndexInZip[this.graphs[i]]; ZipEntry entry = this.GetEntry("graph" + num + "_editor.json"); if (entry != null) { ((IGraphInternals)this.graphs[i]).SerializedEditorSettings = AstarSerializer.GetString(entry); } } }
private NavGraph DeserializeGraph(int zipIndex, int graphIndex) { Type graphType = this.meta.GetGraphType(zipIndex); if (object.Equals(graphType, null)) { return(null); } NavGraph navGraph = this.data.CreateGraph(graphType); navGraph.graphIndex = (uint)graphIndex; string name = "graph" + zipIndex + ".json"; string name2 = "graph" + zipIndex + ".binary"; if (this.ContainsEntry(name)) { TinyJsonDeserializer.Deserialize(AstarSerializer.GetString(this.GetEntry(name)), graphType, navGraph); } else { if (!this.ContainsEntry(name2)) { throw new FileNotFoundException(string.Concat(new object[] { "Could not find data for graph ", zipIndex, " in zip. Entry 'graph", zipIndex, ".json' does not exist" })); } BinaryReader binaryReader = AstarSerializer.GetBinaryReader(this.GetEntry(name2)); GraphSerializationContext ctx = new GraphSerializationContext(binaryReader, null, navGraph.graphIndex, this.meta); navGraph.DeserializeSettingsCompatibility(ctx); } if (navGraph.guid.ToString() != this.meta.guids[zipIndex]) { throw new Exception(string.Concat(new object[] { "Guid in graph file not equal to guid defined in meta file. Have you edited the data manually?\n", navGraph.guid, " != ", this.meta.guids[zipIndex] })); } return(navGraph); }
private NavGraph DeserializeGraph(int zipIndex, int graphIndex) { Type graphType = this.meta.GetGraphType(zipIndex); if (object.Equals(graphType, null)) { return(null); } ZipEntry zipEntry = this.zip["graph" + zipIndex + ".json"]; if (zipEntry == null) { throw new FileNotFoundException(string.Concat(new object[] { "Could not find data for graph ", zipIndex, " in zip. Entry 'graph", zipIndex, ".json' does not exist" })); } NavGraph navGraph = this.data.CreateGraph(graphType); navGraph.graphIndex = (uint)graphIndex; string @string = AstarSerializer.GetString(zipEntry); JsonReader jsonReader = new JsonReader(@string, this.readerSettings); jsonReader.PopulateObject <NavGraph>(ref navGraph); if (navGraph.guid.ToString() != this.meta.guids[zipIndex]) { throw new Exception(string.Concat(new object[] { "Guid in graph file not equal to guid defined in meta file. Have you edited the data manually?\n", navGraph.guid, " != ", this.meta.guids[zipIndex] })); } return(navGraph); }
private GraphMeta DeserializeMeta(ZipEntry entry) { return(TinyJsonDeserializer.Deserialize(AstarSerializer.GetString(entry), typeof(GraphMeta), null) as GraphMeta); }