コード例 #1
0
        /** 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)
                {
                    Pathfinding.Serialization.AstarSerializer sr = new Pathfinding.Serialization.AstarSerializer(this);

                    if (sr.OpenDeserialize(bytes))
                    {
                        DeserializeGraphsPartAdditive(sr);
                        sr.CloseDeserialize();
                    }
                    else
                    {
                        Debug.Log("Invalid data file (cannot read zip).");
                    }
                }
                else
                {
                    throw new System.ArgumentNullException("Bytes should not be null when passed to DeserializeGraphs");
                }
                active.VerifyIntegrity();
            } catch (System.Exception e) {
                Debug.LogWarning("Caught exception while deserializing data.\n" + e);
            }
        }
コード例 #2
0
        /** Deserializes graphs from the specified byte array additively.
         * An error will be logged if deserialization fails.
         * This function will add loaded graphs to the current ones.
         */
        public void DeserializeGraphsAdditive(byte[] bytes)
        {
            var graphLock = AssertSafe();

            try
            {
                if (bytes != null)
                {
                    var sr = new Pathfinding.Serialization.AstarSerializer(this);

                    if (sr.OpenDeserialize(bytes))
                    {
                        DeserializeGraphsPartAdditive(sr);
                        sr.CloseDeserialize();
                    }
                    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 System.ArgumentNullException("bytes");
                }
                active.VerifyIntegrity();
            }
            catch (System.Exception e)
            {
                Debug.LogError("Caught exception while deserializing data.\n" + e);
                graphs = new NavGraph[0];
            }

            UpdateShortcuts();
            graphLock.Release();
        }
コード例 #3
0
        /** Deserializes graphs from the specified byte array.
         * If an error ocurred, 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)
                {
                    Pathfinding.Serialization.AstarSerializer sr = new Pathfinding.Serialization.AstarSerializer(this);

                    if (sr.OpenDeserialize(bytes))
                    {
                        DeserializeGraphsPart(sr);
                        sr.CloseDeserialize();
                    }
                    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 System.ArgumentNullException("Bytes should not be null when passed to DeserializeGraphs");
                }
                active.VerifyIntegrity();
            } catch (System.Exception e) {
                Debug.LogWarning("Caught exception while deserializing data.\n" + e);
                data_backup = bytes;
            }

            UpdateShortcuts();
        }
コード例 #4
0
ファイル: AstarData.cs プロジェクト: stjordanis/gridworld
        /** Deserializes graphs from the specified byte array.
         * If an error ocurred, it will try to deserialize using the old deserializer.
         * A warning will be logged if all deserializers failed.
         */
        public void DeserializeGraphs(byte[] bytes)
        {
            try {
                if (bytes != null)
                {
                    Pathfinding.Serialization.AstarSerializer sr = new Pathfinding.Serialization.AstarSerializer(this);

                    if (sr.OpenDeserialize(bytes))
                    {
                        DeserializeGraphsPart(sr);
                        sr.CloseDeserialize();
                    }
                    else
                    {
                        Debug.Log("Invalid data file (cannot read zip). Trying to load with old deserializer (pre 3.1)...");
                        AstarSerializer serializer = new AstarSerializer(active);
                        DeserializeGraphs_oldInternal(serializer);
                    }
                }
                else
                {
                    throw new System.ArgumentNullException("Bytes should not be null when passed to DeserializeGraphs");
                }
                active.DataUpdate();
            } catch (System.Exception e) {
                Debug.LogWarning("Caught exception while deserializing data.\n" + e);
                data_backup = bytes;
            }
        }
コード例 #5
0
ファイル: AstarData.cs プロジェクト: henryj41043/TheUnseen
		/** 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) {
					Pathfinding.Serialization.AstarSerializer sr = new Pathfinding.Serialization.AstarSerializer(this);
					
					if (sr.OpenDeserialize(bytes)) {
						DeserializeGraphsPartAdditive (sr);
						sr.CloseDeserialize();
					} else {
						Debug.Log ("Invalid data file (cannot read zip).");
					}
				} else {
					throw new System.ArgumentNullException ("Bytes should not be null when passed to DeserializeGraphs");
				}
				active.VerifyIntegrity ();
			} catch (System.Exception e) {
				Debug.LogWarning ("Caught exception while deserializing data.\n"+e);
			}
			
		}
コード例 #6
0
ファイル: AstarData.cs プロジェクト: henryj41043/TheUnseen
		/** Deserializes graphs from the specified byte array.
		 * If an error ocurred, 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) {
					Pathfinding.Serialization.AstarSerializer sr = new Pathfinding.Serialization.AstarSerializer(this);
					
					if (sr.OpenDeserialize(bytes)) {
						DeserializeGraphsPart (sr);
						sr.CloseDeserialize();
					} 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 System.ArgumentNullException ("Bytes should not be null when passed to DeserializeGraphs");
				}
				active.VerifyIntegrity ();
			} catch (System.Exception e) {
				Debug.LogWarning ("Caught exception while deserializing data.\n"+e);
				data_backup = bytes;
			}
			
		}
コード例 #7
0
ファイル: AstarData.cs プロジェクト: TimEckhoff/GGJ13_Chill
        /** Deserializes graphs from the specified byte array.
         * If an error ocurred, it will try to deserialize using the old deserializer.
         * A warning will be logged if all deserializers failed.
          */
        public void DeserializeGraphs(byte[] bytes)
        {
            try {
                if (bytes != null) {
                    Pathfinding.Serialization.AstarSerializer sr = new Pathfinding.Serialization.AstarSerializer(this);

                    if (sr.OpenDeserialize(bytes)) {
                        DeserializeGraphsPart (sr);
                        sr.CloseDeserialize();
                    } else {
                        Debug.Log ("Invalid data file (cannot read zip). Trying to load with old deserializer (pre 3.1)...");
                        AstarSerializer serializer = new AstarSerializer (active);
                        DeserializeGraphs_oldInternal (serializer);
                    }
                } else {
                    throw new System.ArgumentNullException ("Bytes should not be null when passed to DeserializeGraphs");
                }
                active.DataUpdate ();
            } catch (System.Exception e) {
                Debug.LogWarning ("Caught exception while deserializing data.\n"+e);
                data_backup = bytes;
            }
        }