Beispiel #1
0
        public MovieWriter(string filepath, MovieId id, bool UseExistingFile)
        {
            file = new FileInfo(filepath);

            if (file.Exists && UseExistingFile)
            {
                using (FileStream input = new FileStream(filepath, FileMode.Open, FileAccess.Read))
                    fs = new FrameScanner(input);

                if (fs.HeaderOkay)
                    output = new FileStream(filepath, FileMode.Open, FileAccess.ReadWrite);
            }
            else
            {
                output = new FileStream(filepath, FileMode.Create, FileAccess.Write);
                output.Write(Encoding.ASCII.GetBytes("MMDb"), 0, 4);
                output.WriteByte((byte)FileVersions.First.Major);
                output.WriteByte((byte)FileVersions.First.Minor);
                output.Write(BitConverter.GetBytes(id.Id), 0, 4);
                output.Close();

                using (FileStream input = new FileStream(filepath, FileMode.Open, FileAccess.Read))
                    fs = new FrameScanner(input);

                output = new FileStream(filepath, FileMode.Open, FileAccess.Write);
            }
        }
Beispiel #2
0
        public MovieReader(string filepath)
        {
            file = new FileInfo(filepath);

            if (file.Exists)
            {
                input = new FileStream(filepath, FileMode.Open, FileAccess.Read);
                fs = new FrameScanner(input);
                this.id = new MovieId(fs.Id);
            }
            else
                this.id = new MovieId();
        }