Esempio n. 1
0
        private void OpenFARArchive(string Path)
        {
            BinaryReader Reader = new BinaryReader(File.Open(Path, FileMode.Open));

            string Header  = Encoding.ASCII.GetString(Reader.ReadBytes(8));
            uint   Version = Reader.ReadUInt32();

            if ((Header != "FAR!byAZ") || (Version != 1))
            {
                MessageBox.Show("Archive wasn't a valid FAR V.1 archive!");
                return;
            }

            uint ManifestOffset = Reader.ReadUInt32();

            m_ManifestOffset = ManifestOffset;

            Reader.BaseStream.Seek(ManifestOffset, SeekOrigin.Begin);

            LstFiles.Items.Clear();

            uint NumFiles = Reader.ReadUInt32();

            LstFiles.Items.Add("Number of files: " + NumFiles.ToString());
            LstFiles.Items.Add("");

            for (int i = 0; i < NumFiles; i++)
            {
                FarEntry Entry = new FarEntry();
                Entry.DataLength     = Reader.ReadInt32();
                Entry.DataLength2    = Reader.ReadInt32();
                Entry.DataOffset     = Reader.ReadInt32();
                Entry.FilenameLength = Reader.ReadInt16();
                Entry.Filename       = Encoding.ASCII.GetString(Reader.ReadBytes(Entry.FilenameLength));

                m_FarEntries.Add(Entry);
                LstFiles.Items.Add(Entry.Filename);
            }

            Reader.Close();
        }
Esempio n. 2
0
        private void OpenFARArchive(string Path)
        {
            BinaryReader Reader = new BinaryReader(File.Open(Path, FileMode.Open));

            string Header = Encoding.ASCII.GetString(Reader.ReadBytes(8));
            uint Version = Reader.ReadUInt32();

            if ((Header != "FAR!byAZ") || (Version != 1))
            {
                MessageBox.Show("Archive wasn't a valid FAR V.1 archive!");
                return;
            }

            uint ManifestOffset = Reader.ReadUInt32();
            m_ManifestOffset = ManifestOffset;

            Reader.BaseStream.Seek(ManifestOffset, SeekOrigin.Begin);

            LstFiles.Items.Clear();

            uint NumFiles = Reader.ReadUInt32();
            LstFiles.Items.Add("Number of files: " + NumFiles.ToString());
            LstFiles.Items.Add("");

            for (int i = 0; i < NumFiles; i++)
            {
                FarEntry Entry = new FarEntry();
                Entry.DataLength = Reader.ReadInt32();
                Entry.DataLength2 = Reader.ReadInt32();
                Entry.DataOffset = Reader.ReadInt32();
                Entry.FilenameLength = Reader.ReadInt16();
                Entry.Filename = Encoding.ASCII.GetString(Reader.ReadBytes(Entry.FilenameLength));

                m_FarEntries.Add(Entry);
                LstFiles.Items.Add(Entry.Filename);
            }

            Reader.Close();
        }