Example #1
0
        public ArchiveFile(IDataSource Source, string Name, ArchiveFileCompression Compression)
        {
            if (Name.EndsWith(".wav"))
            {
                //this.Source = new CompressedDataSource(Source, ArchiveFileType.Audio);
                this.Source = new Xgg.XggWrappedSource(Source);
                this.Name   = Name.Replace(".wav", ".xgg");
            }
            else
            {
                this.Source = Source;
                this.Name   = Name;
            }


            if (this.Name.EndsWith(".xgg"))
            {
                Type = ArchiveFileType.Audio;
            }
            else if (this.Name.EndsWith(".png"))
            {
                Type = ArchiveFileType.Image;
            }
            else
            {
                this.Compression = Compression;
            }
        }
Example #2
0
 public ExtendedArchiveWriter(string Filename, string Name)
 {
     this.Filename      = Filename;
     this.Name          = Name;
     Type               = ArchiveType.Archive;
     DefaultCompression = ArchiveFileCompression.LZ4;
 }
Example #3
0
        internal ArchiveFileSource(BinaryReader reader)
        {
            Type        = (ArchiveFileType)reader.ReadByte();
            Flags       = (ArchiveFileFlags)reader.ReadByte();
            Compression = (ArchiveFileCompression)reader.ReadByte();

            reader.BaseStream.Seek(1, SeekOrigin.Current);
            _crc = reader.ReadUInt32();
            _md5 = reader.ReadBytes(16);
            reader.BaseStream.Seek(48, SeekOrigin.Current);

            ushort len = reader.ReadUInt16();

            string[] names = Encoding.Unicode.GetString(reader.ReadBytes(len)).Split('/');

            ArchiveName = names[0];
            Name        = names[1];

            offset = reader.ReadUInt64();
            _size  = reader.ReadUInt32();
            length = reader.ReadUInt32();

            ArchiveFilename = (reader.BaseStream as FileStream).Name;
        }