/// <summary> /// Loads an ascii video from a file path, returns a Video structure. /// </summary> /// <param name="filePath"></param> /// <returns></returns> public static Video Load(string filePath) { VidObj vidObj = new VidObj(new Video()); FileStream fileStream = new FileStream(filePath, FileMode.Open); BinaryFormatter bf = new BinaryFormatter(); vidObj = (VidObj)bf.Deserialize(fileStream); fileStream.Close(); return(vidObj.video); }
/// <summary> /// Given a file path, and a video object, it will save to the specified file path. /// </summary> /// <param name="filePath"></param> /// <param name="video"></param> /// <returns></returns> public static void Save(string filePath, Video video) { FileStream fileStream = new FileStream(filePath, FileMode.Create); BinaryFormatter bf = new BinaryFormatter(); VidObj vidObj = new VidObj(video); bf.Serialize(fileStream, vidObj); fileStream.Close(); }