/// <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(); }
/// <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(); } }
/// <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(); } }
/// <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(); } }
/// <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(); } }
/// <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(); } }
/// <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(); } }
/// <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(); } }