예제 #1
0
        private void listView3_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listView3.SelectedItems.Count <= 0)
            {
                textBox5.Clear();
                textBox6.Clear();
                textBox5.ReadOnly = true;
                textBox6.ReadOnly = true;

                selectedUi = 0;

                return;
            }

            UInt32 selectedItem = (UInt32)listView3.SelectedItems[0].Tag;

            selectedUi = selectedItem;

            PackageText text = resman.ui[selectedItem];

            textBox5.Text = text.sourceString;
            textBox6.Text = text.translation;

            textBox5.ReadOnly = true;
            textBox6.ReadOnly = false;
        }
예제 #2
0
        private void listView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listView1.SelectedItems.Count <= 0)
            {
                textBox1.Clear();
                textBox2.Clear();
                textBox1.ReadOnly = true;
                textBox2.ReadOnly = true;

                selectedDialogue = 0;

                return;
            }

            UInt32 selectedItem = (UInt32)listView1.SelectedItems[0].Tag;

            selectedDialogue = selectedItem;

            PackageText text = resman.dialogue[selectedItem];

            textBox1.Text = text.sourceString;
            textBox2.Text = text.translation;

            textBox1.ReadOnly = true;
            textBox2.ReadOnly = false;
        }
예제 #3
0
        public CResourceManager(string filename)
        {
            FileStream fs = new FileStream(filename, FileMode.Open);

            BinaryReader reader = new BinaryReader(fs);

            UInt32 magic            = reader.ReadUInt32();
            UInt32 textOffset       = reader.ReadUInt32();
            UInt32 textCount        = reader.ReadUInt32();
            UInt32 charactersOffset = reader.ReadUInt32();
            UInt32 charactersCount  = reader.ReadUInt32();
            UInt32 uiOffset         = reader.ReadUInt32();
            UInt32 uiCount          = reader.ReadUInt32();
            UInt32 imageOffset      = reader.ReadUInt32();
            UInt32 imageCount       = reader.ReadUInt32();

            if (magic != 0x8D120AB6)
            {
                return;
            }

            fs.Seek(textOffset, SeekOrigin.Begin);

            for (uint i = 0; i < textCount; i++)
            {
                UInt32 id;
                UInt32 sourceLen;
                UInt32 translatedLen;

                id            = reader.ReadUInt32();
                sourceLen     = reader.ReadUInt32();
                translatedLen = reader.ReadUInt32();

                if (sourceLen <= 1)
                {
                    continue;
                }

                PackageText pkg = new PackageText();

                pkg.source       = reader.ReadBytes((int)sourceLen);
                pkg.sourceLen    = sourceLen;
                pkg.sourceString = Encoding.GetEncoding("SHIFT-JIS").GetString(pkg.source);
                pkg.sourceString = Humanize(pkg.sourceString);

                if (translatedLen > 1)
                {
                    pkg.translation = Encoding.GetEncoding("SHIFT-JIS").GetString(reader.ReadBytes((int)translatedLen - 1));
                    pkg.translation = Humanize(pkg.translation);
                    reader.ReadByte();
                }
                else
                {
                    pkg.translation = "";
                }

                dialogue.Add(id, pkg);
            }

            fs.Seek(uiOffset, SeekOrigin.Begin);

            for (uint i = 0; i < uiCount; i++)
            {
                UInt32 id;
                UInt32 sourceLen;
                UInt32 translatedLen;

                id            = reader.ReadUInt32();
                sourceLen     = reader.ReadUInt32();
                translatedLen = reader.ReadUInt32();

                if (sourceLen <= 1)
                {
                    continue;
                }

                PackageText pkg = new PackageText();

                pkg.source       = reader.ReadBytes((int)sourceLen);
                pkg.sourceLen    = sourceLen;
                pkg.sourceString = Encoding.GetEncoding("SHIFT-JIS").GetString(pkg.source);

                if (translatedLen > 1)
                {
                    pkg.translation = Encoding.GetEncoding("SHIFT-JIS").GetString(reader.ReadBytes((int)translatedLen - 1));
                    reader.ReadByte();
                }
                else
                {
                    pkg.translation = "";
                }

                ui.Add(id, pkg);
            }

            fs.Seek(imageOffset, SeekOrigin.Begin);

            for (uint i = 0; i < imageCount; i++)
            {
                PackageImage img = new PackageImage();
                UInt32       titleLen;

                img.hash = Encoding.GetEncoding("ASCII").GetString(reader.ReadBytes(40));

                titleLen = reader.ReadUInt32();

                img.title = Encoding.GetEncoding("ASCII").GetString(reader.ReadBytes((int)titleLen - 1));
                reader.ReadByte();
                img.width  = reader.ReadInt16();
                img.height = reader.ReadInt16();
                img.flags  = reader.ReadInt32();
                img.depth  = reader.ReadInt32();

                img.replacementLen = reader.ReadUInt32();

                if (img.replacementLen > 0)
                {
                    img.replacement = reader.ReadBytes((int)img.replacementLen);
                }

                images.Add(img.hash, img);
            }

            fs.Close();
        }