Пример #1
0
        public static void Pack(string fileIn, string fileOut, ref sFolder unpacked)
        {
            BinaryReader br = new BinaryReader(File.OpenRead(fileIn));
            br.BaseStream.Position = 0x08;
            uint block_size = br.ReadUInt32();
            br.Close();

            BinaryWriter bw = new BinaryWriter(File.OpenWrite(fileOut));

            bw.Write(new char[] { 'L', 'I', 'N', 'K' });
            bw.Write(unpacked.files.Count);
            bw.Write(block_size);
            bw.Write(0x00);

            unpacked.files.Sort(SortFiles);

            uint offset = block_size;
            List<byte> buffer = new List<byte>();
            for (int i = 0; i < unpacked.files.Count; i++)
            {
                br = new BinaryReader(File.OpenRead(unpacked.files[i].path));
                br.BaseStream.Position = unpacked.files[i].offset;
                buffer.AddRange(br.ReadBytes((int)unpacked.files[i].size));
                while (buffer.Count % block_size != 0)
                    buffer.Add(0x00);
                br.Close();

                bw.Write(offset / block_size);
                bw.Write(unpacked.files[i].size);

                sFile upFile = unpacked.files[i];
                upFile.offset = offset;
                upFile.path = fileOut;
                unpacked.files[i] = upFile;

                offset += unpacked.files[i].size;
                if (offset % block_size != 0)  // Padding
                    offset += (block_size - (offset % block_size));
            }
            byte[] rem = new byte[0];
            if (bw.BaseStream.Position % block_size != 0)
                rem = new byte[block_size - (bw.BaseStream.Position % block_size)];
            bw.Write(rem);
            bw.Flush();

            bw.Write(buffer.ToArray());
            bw.Flush();

            bw.Close();
        }
Пример #2
0
        public void Initialize(IPluginHost pluginHost, string gameCode)
        {
            this.pluginHost = pluginHost;
            this.gameCode = gameCode;

            bigImages = new List<int>();
            bigImages.Add(0x1E8);
            bigImages.Add(0x1EB);
            bigImages.Add(0x1ED);
            bigImages.Add(0x1EE);
            bigImages.Add(0x1F0);
            bigImages.Add(0x1F3);
            bigImages.Add(0x1F5);
            bigImages.Add(0x1F8);
            bigImages.Add(0x1FA);
            bigImages.Add(0x1FD);
            bigImages.Add(0x1FF);
            bigImages.Add(0x202);
            bigImages.Add(0x204);
            bigImages.Add(0x207);
            bigImages.Add(0x20A);
            bigImages.Add(0x20D);
            bigImages.Add(0x212);
            bigImages.Add(0x214);
            bigImages.Add(0x217);
            bigImages.Add(0x21A);
            bigImages.Add(0x21C);
            bigImages.Add(0x21F);
            bigImages.Add(0x221);
            bigImages.Add(0x224);
            bigImages.Add(0x226);
            bigImages.Add(0x229);
            bigImages.Add(0x22B);
            bigImages.Add(0x22E);
            bigImages.Add(0x235);
        }