Example #1
0
        /// <summary>
        /// Write a dvdbnd header to the given stream.
        /// </summary>
        public void Write(Stream bhdStream)
        {
            var bw = new BinaryWriterEx(false, bhdStream);

            Write(bw);
            bw.Finish();
        }
Example #2
0
 /// <summary>
 /// Compress a DCX file to the specified path using the specified DCX type.
 /// </summary>
 public static void Compress(byte[] data, Type type, string path)
 {
     using (FileStream stream = File.Create(path))
     {
         BinaryWriterEx bw = new BinaryWriterEx(true, stream);
         Compress(data, bw, type);
         bw.Finish();
     }
 }
Example #3
0
 /// <summary>
 /// Writes the file to the specified path, compressing it as specified.
 /// </summary>
 public void Write(string path, DCX.Type compression)
 {
     using (FileStream stream = File.Create(path))
     {
         BinaryWriterEx bw = new BinaryWriterEx(false, stream);
         Write(bw, compression);
         bw.Finish();
     }
 }
Example #4
0
 /// <summary>
 /// Writes the file to the specified path, compressing it as specified.
 /// </summary>
 public void Write(string path, DCX.Type compression)
 {
     Directory.CreateDirectory(Path.GetDirectoryName(path));
     using (FileStream stream = File.Create(path))
     {
         BinaryWriterEx bw = new BinaryWriterEx(false, stream);
         Write(bw, compression);
         bw.Finish();
     }
 }
Example #5
0
 /// <summary>
 /// Writes the BHD as a file and the BDT as an array of bytes.
 /// </summary>
 public void Write(string bhdPath, out byte[] bdtBytes)
 {
     using (FileStream bhdStream = System.IO.File.Create(bhdPath))
     {
         BinaryWriterEx bhdWriter = new BinaryWriterEx(false, bhdStream);
         BinaryWriterEx bdtWriter = new BinaryWriterEx(false);
         Write(bhdWriter, bdtWriter);
         bhdWriter.Finish();
         bdtBytes = bdtWriter.FinishBytes();
     }
 }
Example #6
0
 /// <summary>
 /// Writes the BHD as an array of bytes and the BDT as a file.
 /// </summary>
 public void Write(out byte[] bhdBytes, string bdtPath)
 {
     using (FileStream bdtStream = System.IO.File.Create(bdtPath))
     {
         BinaryWriterEx bhdWriter = new BinaryWriterEx(false);
         BinaryWriterEx bdtWriter = new BinaryWriterEx(false, bdtStream);
         Write(bhdWriter, bdtWriter);
         bdtWriter.Finish();
         bhdBytes = bhdWriter.FinishBytes();
     }
 }
Example #7
0
 /// <summary>
 /// Writes the BHD and BDT as two files.
 /// </summary>
 public void Write(string bhdPath, string bdtPath)
 {
     using (FileStream bhdStream = System.IO.File.Create(bhdPath))
         using (FileStream bdtStream = System.IO.File.Create(bdtPath))
         {
             BinaryWriterEx bhdWriter = new BinaryWriterEx(false, bhdStream);
             BinaryWriterEx bdtWriter = new BinaryWriterEx(false, bdtStream);
             Write(bhdWriter, bdtWriter);
             bhdWriter.Finish();
             bdtWriter.Finish();
         }
 }
Example #8
0
        /// <summary>
        /// Writes the file to the specified path, compressing it as specified.
        /// </summary>
        public void Write(string path, DCX.Type compression)
        {
            using (MemoryStream corruptPreventStream = new MemoryStream())
            {
                BinaryWriterEx bw = new BinaryWriterEx(false, corruptPreventStream);
                Write(bw, compression);

                corruptPreventStream.Position = 0;

                using (FileStream actualFileStream = File.Create(path))
                {
                    corruptPreventStream.CopyTo(actualFileStream);
                }

                bw.Finish();
            }
        }