Ejemplo n.º 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)
        {
            try {
                if (bytes != null)
                {
                    Pathfinding.Serialize.AstarSerializer sr = new Pathfinding.Serialize.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.DataUpdate();
            } catch (System.Exception e) {
                Debug.LogWarning("Caught exception while deserializing data.\n" + e);
            }
        }
Ejemplo n.º 2
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)
        {
            try {
                if (bytes != null)
                {
                    Pathfinding.Serialize.AstarSerializer sr = new Pathfinding.Serialize.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;
            }
        }
Ejemplo n.º 3
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)
        {
            try {
                if (bytes != null) {
                    Pathfinding.Serialize.AstarSerializer sr = new Pathfinding.Serialize.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.DataUpdate ();
            } catch (System.Exception e) {
                Debug.LogWarning ("Caught exception while deserializing data.\n"+e);
            }
        }
Ejemplo n.º 4
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)
        {
            try {
                if (bytes != null) {
                    Pathfinding.Serialize.AstarSerializer sr = new Pathfinding.Serialize.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;
            }
        }