Пример #1
0
        public Sod ReadSod()
        {
            Sod sod = new Sod();

            sod.Header = ReadHeader();
            if (sod.Header.recordType != RecordType.StartDump)
            {
                Console.WriteLine("ERROR: This does not appear to be an AOS/VS DUMP_II or DUMP_III file (No SOD record found).");
                System.Environment.Exit(1);
            }
            sod.DumpFormatRevision = ReadWord();
            sod.DumpTimeSecs       = ReadWord();
            sod.DumpTimeMins       = ReadWord();
            sod.DumpTimeHours      = ReadWord();
            sod.DumpTimeDay        = ReadWord();
            sod.DumpTimeMonth      = ReadWord();
            sod.DumpTimeYear       = ReadWord();
            return(sod);
        }
Пример #2
0
        public void Parse(bool extract, bool ignoreErrors, bool list, bool summary, bool verbose, string baseDir)
        {
            byte[] fsbBlob  = new byte[0];
            string fileName = "";

            this.baseDir = baseDir; // we won't ever traverse above this
            workingDir   = baseDir;

            // There should always be a SOD record...
            Sod sod = ReadSod();

            if (summary || verbose)
            {
                Console.WriteLine("AOS/VS DUMP version  : {0}", sod.DumpFormatRevision);
                Console.WriteLine("DUMP date (y-m-d)    : {0}-{1}-{2}", sod.DumpTimeYear, sod.DumpTimeMonth, sod.DumpTimeDay);
                Console.WriteLine("DUMP time (h:m:s)    : {0}-{1}-{2}", sod.DumpTimeHours, sod.DumpTimeMins, sod.DumpTimeSecs);
            }
            // Now work through the dump examining each block type and handle accoordingly...
            bool done = false;

            while (!done)
            {
                var recHdr = ReadHeader();
                if (verbose)
                {
                    Console.WriteLine("Found block of type: {0} length: {1}", recHdr.recordType, recHdr.recordLength);
                }
                switch (recHdr.recordType)
                {
                case RecordType.StartDump:
                    Console.WriteLine("ERROR: Another START record found in DUMP - this should not happen.");
                    System.Environment.Exit(1);
                    break;

                case RecordType.Fsb:
                    fsbBlob = ReadBlob(recHdr.recordLength);
                    loadIt  = false;
                    break;

                case RecordType.NB:
                    fileName = ProcessNameBlock(recHdr, fsbBlob, summary, verbose, extract, ignoreErrors);
                    break;

                case RecordType.Uda:
                    // throw away for now
                    _ = ReadBlob(recHdr.recordLength);
                    break;

                case RecordType.Acl:
                    var aclBlob = ReadBlob(recHdr.recordLength);
                    if (verbose)
                    {
                        Console.WriteLine(" ACL: {0}", System.Text.Encoding.ASCII.GetString(aclBlob).TrimEnd('\0'));
                    }
                    break;

                case RecordType.Link:
                    ProcessLink(recHdr, fileName, verbose, extract, summary);
                    break;

                case RecordType.StartBlock:
                    // nothing to do - it's a standalone recHdr
                    break;

                case RecordType.DataBlock:
                    ProcessDataBlock(recHdr, verbose, extract);
                    break;

                case RecordType.EndBlock:
                    ProcessEndBlock(verbose, extract, summary);
                    break;

                case RecordType.EndDump:
                    Console.WriteLine("=== End of DUMP ===");
                    done = true;
                    break;
                }
            }
        }