CloseDeserialize() public method

public CloseDeserialize ( ) : void
return void
コード例 #1
0
	public void DeserializeGraphs (byte[] bytes) {
		
		AstarPath.active.AddWorkItem (new AstarPath.AstarWorkItem (delegate (bool force) {
			Pathfinding.Serialization.AstarSerializer sr = new Pathfinding.Serialization.AstarSerializer(script.astarData);
			if (sr.OpenDeserialize(bytes)) {
				script.astarData.DeserializeGraphsPart (sr);
				
				//Make sure every graph has a graph editor
				CheckGraphEditors ();
				sr.DeserializeEditorSettings (graphEditors);
				
				sr.CloseDeserialize();
			} else {
				Debug.LogWarning ("Invalid data file (cannot read zip).\nThe data is either corrupt or it was saved using a 3.0.x or earlier version of the system");
				//Make sure every graph has a graph editor
				CheckGraphEditors ();
			}
			return true;
		}));
		
		//Make sure the above work item is run directly
		AstarPath.active.FlushWorkItems();
	}
コード例 #2
0
ファイル: AstarData.cs プロジェクト: Marchys/fanalet
		/** Deserializes graphs from the specified byte array additively.
		 * If an error ocurred, it will try to deserialize using the old deserializer.
		 * A warning will be logged if all deserializers failed.
		 * This function will add loaded graphs to the current ones
		  */
		public void DeserializeGraphsAdditive (byte[] bytes) {
			
			AstarPath.active.BlockUntilPathQueueBlocked();
			
			try {
				if (bytes != null) {
					var sr = new AstarSerializer(this);
					
					if (sr.OpenDeserialize(bytes)) {
						DeserializeGraphsPartAdditive (sr);
						sr.CloseDeserialize();
					} else {
						Debug.Log ("Invalid data file (cannot read zip).");
					}
				} else {
					throw new ArgumentNullException ("Bytes should not be null when passed to DeserializeGraphs");
				}
				active.VerifyIntegrity ();
			} catch (Exception e) {
				Debug.LogWarning ("Caught exception while deserializing data.\n"+e);
			}
			
		}
コード例 #3
0
	public void DeserializeGraphs (byte[] bytes) {
		
		Pathfinding.Serialization.AstarSerializer sr = new Pathfinding.Serialization.AstarSerializer(script.astarData);
		if (sr.OpenDeserialize(bytes)) {
			script.astarData.DeserializeGraphsPart (sr);
			
			//Make sure every graph has a graph editor
			CheckGraphEditors ();
			sr.DeserializeEditorSettings (graphEditors);
			
			sr.CloseDeserialize();
		} else {
			Debug.Log ("Invalid data file (cannot read zip). Trying to load with old deserializer (pre 3.1)...");
			AstarSerializer serializer = new AstarSerializer (script);
			script.astarData.DeserializeGraphs_oldInternal (serializer,bytes);
			
			//Make sure every graph has a graph editor
			CheckGraphEditors ();
		}
		
		
		/*serializer = serializer.OpenDeserialize (data);
		
		//Deserialize the main bulk of the data
		script.astarData.DeserializeGraphsPart (serializer);
		
		CheckGraphEditors ();
		
		//Deserialize editor data
		for (int i=0;i<script.graphs.Length;i++) {
			NavGraph graph = script.graphs[i];
			
			GraphEditor graphEditor = graphEditors[i];
			
			if (serializer.MoveToAnchor ("EditorSettings_"+i)) {
				ISerializableGraphEditor serializableEditor = graphEditor as ISerializableGraphEditor;
				if (serializableEditor != null) {
					//Set an unique prefix for all variables in this graph
					serializer.sPrefix = i.ToString ()+"E";
					serializer.DeSerializeEditorSettings (graph,serializableEditor,script);
					//serializableEditor.DeSerializeSettings (graph,serializer);
				}
			}
		}
		
		serializer.Close ();*/
		
		//script.astarData.DeserializeGraphs(data);
	}
コード例 #4
0
ファイル: AstarData.cs プロジェクト: Marchys/fanalet
		/** Deserializes graphs from the specified byte array.
		 * If an error occured, it will try to deserialize using the old deserializer.
		 * A warning will be logged if all deserializers failed.
		  */
		public void DeserializeGraphs (byte[] bytes) {
			
			AstarPath.active.BlockUntilPathQueueBlocked();
			
			try {
				if (bytes != null) {
					var sr = new AstarSerializer(this);
					
					if (sr.OpenDeserialize(bytes)) {
						DeserializeGraphsPart (sr);
						sr.CloseDeserialize();
						UpdateShortcuts ();
					} else {
						Debug.Log ("Invalid data file (cannot read zip).\nThe data is either corrupt or it was saved using a 3.0.x or earlier version of the system");
					}
				} else {
					throw new ArgumentNullException ("Bytes should not be null when passed to DeserializeGraphs");
				}
				active.VerifyIntegrity ();
			} catch (Exception e) {
				Debug.LogWarning ("Caught exception while deserializing data.\n"+e);
				data_backup = bytes;
			}
			
		}