public static Node[] deserializeNodeArray(string serializedNodeArray) { byte[] bytes = Convert.FromBase64String (serializedNodeArray); MemoryStream stream = new MemoryStream (bytes, false); ModeldataSerializer serializer = new ModeldataSerializer (); swellanimations.Animation animation = null; animation = (swellanimations.Animation)serializer.Deserialize (stream, null, typeof(swellanimations.Animation)); stream.Close (); return animation.frames.ToArray (); }
public static string serializeNodeArray(Node[] nodeArray) { swellanimations.Animation animation = new swellanimations.Animation (); animation.frames.AddRange (nodeArray); ModeldataSerializer serializer = new ModeldataSerializer (); MemoryStream memStream = new MemoryStream (); serializer.Serialize (memStream, animation); byte[] arr = memStream.ToArray (); memStream.Close (); return Convert.ToBase64String (arr); }
public static Node[] deserializeNodeArray(string serializedNodeArray) { byte[] bytes = Convert.FromBase64String(serializedNodeArray); MemoryStream stream = new MemoryStream(bytes, false); ModeldataSerializer serializer = new ModeldataSerializer(); swellanimations.Animation animation = null; animation = (swellanimations.Animation)serializer.Deserialize(stream, null, typeof(swellanimations.Animation)); stream.Close(); return(animation.frames.ToArray()); }
public static string serializeNodeArray(Node[] nodeArray) { swellanimations.Animation animation = new swellanimations.Animation(); animation.frames.AddRange(nodeArray); ModeldataSerializer serializer = new ModeldataSerializer(); MemoryStream memStream = new MemoryStream(); serializer.Serialize(memStream, animation); byte[] arr = memStream.ToArray(); memStream.Close(); return(Convert.ToBase64String(arr)); }
public static swellanimations.Animation GenerateFromBackend(ModelData modelData) { ModeldataSerializer serializer = new ModeldataSerializer (); MemoryStream memStream = new MemoryStream (); serializer.Serialize (memStream, modelData); byte[] arr = memStream.ToArray (); //Debug.Log (Convert.ToBase64String (arr)); int size = arr.Length; uint outputSize = 0; IntPtr retData = generateAnimation (arr, size, ref outputSize); var bytes = new byte[(int)outputSize]; Marshal.Copy (retData, bytes, 0, (int)outputSize); //Debug.Log (Convert.ToBase64String (bytes)); MemoryStream stream = new MemoryStream (bytes, false); swellanimations.Animation animation = null; animation = (swellanimations.Animation)serializer.Deserialize (stream, null, typeof(swellanimations.Animation)); memStream.Close (); stream.Close (); return animation; }
public static swellanimations.Animation GenerateFromBackend(ModelData modelData) { ModeldataSerializer serializer = new ModeldataSerializer(); MemoryStream memStream = new MemoryStream(); serializer.Serialize(memStream, modelData); byte[] arr = memStream.ToArray(); //Debug.Log (Convert.ToBase64String (arr)); int size = arr.Length; uint outputSize = 0; IntPtr retData = generateAnimation(arr, size, ref outputSize); var bytes = new byte[(int)outputSize]; Marshal.Copy(retData, bytes, 0, (int)outputSize); //Debug.Log (Convert.ToBase64String (bytes)); MemoryStream stream = new MemoryStream(bytes, false); swellanimations.Animation animation = null; animation = (swellanimations.Animation)serializer.Deserialize(stream, null, typeof(swellanimations.Animation)); memStream.Close(); stream.Close(); return(animation); }