private int Disassemble(DisassembleOptions options) { string path = Path.GetFullPath(options.FileName); if (!File.Exists(path)) { PrintError("File does not exist: " + path); return(2); } FileStream stream = new FileStream(path, FileMode.Open, FileAccess.Read); AcsFormat format = AcsFormatIdentifier.IdentifyFormat(stream); if (format == AcsFormat.NotAcs) { stream.Dispose(); PrintError(path + " is not an ACS file!"); return(3); } Console.WriteLine("Detected format: " + format); string outputPath = Path.GetFullPath(options.OutputFile); if (File.Exists(outputPath)) { File.Delete(outputPath); } FileStream outputStream = new FileStream(outputPath, FileMode.OpenOrCreate, FileAccess.Write); AcsFile file = new AcsFile(stream, format); file.Disassemble(outputStream); outputStream.Dispose(); stream.Dispose(); return(0); }
public AcsFile(Stream stream) : this(stream, AcsFormatIdentifier.IdentifyFormat(stream)) { }