Example #1
0
        /// <summary>
        /// Cosntructs string collection from UOP file.
        /// </summary>
        /// <param name="filePath">File to construct from.</param>
        /// <returns>String collection.</returns>
        public static UltimaStringCollection FromPackage(string filePath)
        {
            using (UltimaPackage package = new UltimaPackage(filePath))
            {
                byte[] data = package.GetFile("data/localizedstrings/001.cliloc");

                if (data != null)
                {
                    using (MemoryStream stream = new MemoryStream(data))
                        return(FromStream(stream));
                }
            }

            return(null);
        }
Example #2
0
        /// <summary>
        /// Constructs a new instance of UltimaPackageFile.
        /// </summary>
        /// <param name="package">Pacakge that contains this file.</param>
        /// <param name="reader">Reader to read from.</param>
        public UltimaPackageFile( UltimaPackage package, BinaryReader reader )
        {
            _Package = package;
            _FileAddress = reader.ReadInt64();
            _FileAddress += reader.ReadInt32();
            _CompressedSize = reader.ReadInt32();
            _DecompressedSize = reader.ReadInt32();
            _FileNameHash = reader.ReadUInt64();

            reader.ReadInt32(); // Header hash

            switch ( reader.ReadInt16() )
            {
                case 0: _Compression = FileCompression.None; break;
                case 1: _Compression = FileCompression.Zlib; break;
            }
        }
Example #3
0
        /// <summary>
        /// Constructs a new instance of UltimaPackageFile.
        /// </summary>
        /// <param name="package">Pacakge that contains this file.</param>
        /// <param name="reader">Reader to read from.</param>
        public UltimaPackageFile(UltimaPackage package, BinaryReader reader)
        {
            _Package          = package;
            _FileAddress      = reader.ReadInt64();
            _FileAddress     += reader.ReadInt32();
            _CompressedSize   = reader.ReadInt32();
            _DecompressedSize = reader.ReadInt32();
            _FileNameHash     = reader.ReadUInt64();

            reader.ReadInt32();             // Header hash

            switch (reader.ReadInt16())
            {
            case 0: _Compression = FileCompression.None; break;

            case 1: _Compression = FileCompression.Zlib; break;
            }
        }
Example #4
0
        /// <summary>
        /// Cosntructs string collection from UOP file.
        /// </summary>
        /// <param name="filePath">File to construct from.</param>
        /// <returns>String collection.</returns>
        public static UltimaStringCollection FromPackage( string filePath )
        {
            using ( UltimaPackage package = new UltimaPackage( filePath ) )
            {
                byte[] data = package.GetFile( "data/localizedstrings/001.cliloc" );

                if ( data != null )
                {
                    using ( MemoryStream stream = new MemoryStream( data ) )
                        return FromStream( stream );
                }
            }

            return null;
        }
Example #5
0
        private void LoadFile( string fileName )
        {
            string filePath = Path.Combine( _SourceFolder, fileName );

            if ( !File.Exists( filePath ) )
                return;

            UltimaPackage package = new UltimaPackage( filePath );

            foreach ( KeyValuePair<ulong, UltimaPackageFile> kvp in package.Files )
            {
                if ( !_Files.ContainsKey( kvp.Key ) )
                    _Files.Add( kvp.Key, kvp.Value );
            }
        }