コード例 #1
0
        private void ReplaceDDS_Click(object sender, EventArgs e)
        {
            using (var opendialog = new OpenFileDialog())
            {
                opendialog.Filter =
                    "DirectDraw Surface|*.dds";

                if (opendialog.ShowDialog() == DialogResult.OK)
                {
                    G1Texture texture = new G1Texture();
                    DDS       newDDS  = new DDS();
                    newDDS.Read(opendialog.FileName);

                    if (newDDS.MipMapCount >= 10)
                    {
                        MessageBox.Show("The amount of mipmaps for this texture is too big. Reducing it to 9.");
                        newDDS.MipMapCount = 9;
                    }

                    if (FormatIndex == NodeIndexBin && treeView1.Nodes.ContainsKey("BIN"))
                    {
                        texture = BinFileList[treeView1.SelectedNode.Parent.Parent.Index][treeView1.SelectedNode.Parent.Index].Textures[treeView1.SelectedNode.Index];
                        texture.Replace(newDDS);
                    }
                    if (FormatIndex == NodeIndexG1T && treeView1.Nodes.ContainsKey("G1T"))
                    {
                        texture = G1TFileList[treeView1.SelectedNode.Parent.Index].Textures[treeView1.SelectedNode.Index];
                        texture.Replace(newDDS);
                    }
                    pictureBox1.Image = texture.Mipmap.GetBitmap();
                }
            }
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: wangdandanqq/G1Tool
        private void Add_Click(object sender, EventArgs e)
        {
            using (var opendialog = new OpenFileDialog())
            {
                opendialog.Filter =
                    "DirectDraw Surface|*.dds";

                opendialog.Multiselect = false; //For now at least, only one file at a time

                if (opendialog.ShowDialog() == DialogResult.OK)
                {
                    DDS temp = new DDS();
                    temp.Read(opendialog.FileName);

                    if (temp.MipMapCount >= 10)
                    {
                        MessageBox.Show("The amount of mipmaps for this texture is too big. Reducing it to 9.");
                        temp.MipMapCount = 9;
                    }

                    G1Texture texture = new G1Texture();
                    texture.Replace(temp);
                    textureListBox.Items.Add(texture);
                    textureListBox.SelectedItem = texture;
                }
            }
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: wangdandanqq/G1Tool
        private void Replace_Click(object sender, EventArgs e)
        {
            using (var opendialog = new OpenFileDialog())
            {
                opendialog.Filter =
                    "DirectDraw Surface|*.dds";

                opendialog.Multiselect = false; //For now at least, only one file at a time

                if (opendialog.ShowDialog() == DialogResult.OK)
                {
                    G1Texture texture = (G1Texture)textureListBox.SelectedItem;

                    switch (Path.GetExtension(opendialog.FileName))
                    {
                    case ".dds":
                    {
                        DDS temp = new DDS();
                        temp.Read(opendialog.FileName);

                        if (temp.MipMapCount >= 10)
                        {
                            MessageBox.Show("The amount of mipmaps for this texture is too big. Reducing it to 9.");
                            temp.MipMapCount = 9;
                        }

                        texture.Replace(temp);
                    }
                    break;
                    }

                    pictureBox1.Image = texture.Mipmap.GetBitmap();
                }
            }
        }