예제 #1
0
        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);
        }
예제 #2
0
파일: AcsFile.cs 프로젝트: DrinkyBird/DeACC
 public AcsFile(Stream stream) : this(stream, AcsFormatIdentifier.IdentifyFormat(stream))
 {
 }