bool LoadPack(string sFile, string sKey)
        {
            if (!File.Exists(sFile))
            {
                return(false);
            }
            br = new BinaryReader(new FileStream(sFile, FileMode.Open));
            if (!br.BaseStream.CanRead)
            {
                return(false);
            }

            int nIndexSize = br.ReadInt32();

            char[] buffer  = br.ReadChars(nIndexSize);
            char[] decoded = scramble(buffer, sKey);

            int pos = 0;
            Action <char[], int> read = (char[] dst, int size) =>
            {
                Array.Copy(decoded, pos, dst, 0, size);
                pos += size;
            };
            Func <byte> get = () =>
            {
                char[] c = new char[1];
                read(c, 1);
                return((byte)c[0]);
            };


            // 2) Read Map
            int nMapEntries = br.ReadInt32();

            for (int i = 0; i < nMapEntries; i++)
            {
                int nFilePathSize = get();

                char[] c = new char[nFilePathSize];
                for (int j = 0; j < nFilePathSize; j++)
                {
                    c[j] = (char)get();
                }
                string sFileName = new string(c);

                char[] cnSize = new char[sizeof(int)];
                read(cnSize, sizeof(int));

                char[] cnOffset = new char[sizeof(Int32)];
                read(cnOffset, sizeof(int));

                sResourceFile e = new sResourceFile();
                e.nSize   = BitConverter.ToInt32(Encoding.GetEncoding("UTF-8").GetBytes(cnSize));
                e.nOffset = BitConverter.ToInt32(Encoding.GetEncoding("UTF-8").GetBytes(cnOffset));
                mapFiles.Add(sFileName, e);
            }
            // Don't close base file! we will provide a stream
            // pointer when the file is requested
            return(true);
        }
        //ResourcePack();
        bool AddFile(string sFile)
        {
            string file = sFile; // makeposix

            if (File.Exists(file))
            {
                sResourceFile e = new sResourceFile
                {
                    nSize   = (int)new FileInfo(file).Length,
                    nOffset = 0 // Unknown at this stage
                };
                mapFiles[file] = e;
                return(true);
            }
            return(false);
        }