Пример #1
0
        private void createForAllDupsModToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Please select replacement data");
            OpenFileDialog d = new OpenFileDialog();

            d.Filter = "*.bin|*.bin";
            if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                Mod mod = new Mod();
                mod.jobs = new List <Mod.ModJob>();
                Mod.ModJob mj = new Mod.ModJob();
                mj.data = File.ReadAllBytes(d.FileName);
                MessageBox.Show("Please select mod save location");
                SaveFileDialog d2 = new SaveFileDialog();
                d2.Filter = "*.DAIMWV|*.DAIMWV";
                if (d2.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    int plen = GlobalStuff.FindSetting("gamepath").Length;
                    mj.type        = 1;
                    mj.bundlePaths = new List <string>();
                    mj.tocPaths    = new List <string>();
                    bool skip = false;
                    for (int i = 0; i < ttprevlist.Count; i++)
                    {
                        DBAccess.RESInformation resi = ttprevlist[i];
                        mj.respath = resi.resname;
                        skip       = false;
                        foreach (string p in mj.bundlePaths)
                        {
                            if (p == resi.bundlepath)
                            {
                                skip = true;
                                break;
                            }
                        }
                        if (!skip)
                        {
                            mj.bundlePaths.Add(resi.bundlepath);
                        }
                        skip = false;
                        foreach (string p in mj.tocPaths)
                        {
                            if (p == resi.tocfilepath.Substring(plen))
                            {
                                skip = true;
                                break;
                            }
                        }
                        if (!skip && !resi.tocfilepath.ToLower().Contains("\\patch\\"))
                        {
                            mj.tocPaths.Add(resi.tocfilepath.Substring(plen));
                        }
                    }
                    mj.restype = types[toolStripComboBox1.SelectedIndex];
                    mod.jobs.Add(mj);
                    mod.Save(d2.FileName);
                    MessageBox.Show("Done.");
                }
            }
        }
Пример #2
0
        private void createSingleModToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int n = listBox1.SelectedIndex;

            if (n == -1)
            {
                return;
            }
            MessageBox.Show("Please select replacement texture (same size)");
            OpenFileDialog d = new OpenFileDialog();

            d.Filter = "*.dds|*.dds";
            if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                byte[] data = File.ReadAllBytes(d.FileName);
                MessageBox.Show("Please select mod save location");
                SaveFileDialog d2 = new SaveFileDialog();
                d2.Filter = "*.DAIMWV|*.DAIMWV";
                if (d2.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    Mod mod = new Mod();
                    mod.jobs = new List <Mod.ModJob>();
                    Mod.ModJob mj = new Mod.ModJob();
                    mj.type        = 0;
                    mj.bundlePaths = new List <string>();
                    mj.tocPaths    = new List <string>();
                    int plen = GlobalStuff.FindSetting("gamepath").Length;
                    DBAccess.BundleInformation  buni = bil[n];
                    DBAccess.TextureInformation ti   = new DBAccess.TextureInformation();
                    foreach (DBAccess.TextureInformation t in til)
                    {
                        if (t.bundleIndex == buni.index)
                        {
                            ti = t;
                        }
                    }
                    DBAccess.TOCInformation toci = DBAccess.GetTocInformationByIndex(buni.tocIndex);
                    mj.respath = ti.name;
                    mj.bundlePaths.Add(buni.bundlepath);
                    mj.tocPaths.Add(toci.path.Substring(plen, toci.path.Length - plen));
                    MemoryStream m = new MemoryStream();
                    m.Write(data, 0x80, data.Length - 0x80);
                    mj.data = m.ToArray();
                    mod.jobs.Add(mj);
                    mod.Save(d2.FileName);
                    MessageBox.Show("Done.");
                }
            }
        }
Пример #3
0
        private void createSingleModToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int n = listBox2.SelectedIndex;

            if (n == -1)
            {
                return;
            }
            MessageBox.Show("Please select replacement data");
            OpenFileDialog d = new OpenFileDialog();

            d.Filter = "*.bin|*.bin";
            if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                byte[] data = File.ReadAllBytes(d.FileName);
                MessageBox.Show("Please select mod save location");
                SaveFileDialog d2 = new SaveFileDialog();
                d2.Filter = "*.DAIMWV|*.DAIMWV";
                if (d2.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    Mod mod = new Mod();
                    mod.jobs = new List <Mod.ModJob>();
                    Mod.ModJob mj = new Mod.ModJob();
                    mj.type        = 1;
                    mj.bundlePaths = new List <string>();
                    mj.tocPaths    = new List <string>();
                    int plen = GlobalStuff.FindSetting("gamepath").Length;
                    DBAccess.RESInformation resi = ttprevlist[n];
                    mj.respath = resi.resname;
                    mj.bundlePaths.Add(resi.bundlepath);
                    mj.tocPaths.Add(resi.tocfilepath.Substring(plen));
                    MemoryStream m = new MemoryStream();
                    m.Write(data, 0x80, data.Length - 0x80);
                    mj.data    = m.ToArray();
                    mj.restype = types[toolStripComboBox1.SelectedIndex];
                    mod.jobs.Add(mj);
                    mod.Save(d2.FileName);
                    MessageBox.Show("Done.");
                }
            }
        }
Пример #4
0
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            TreeNode t = treeView4.SelectedNode;

            if (t == null || t.Nodes == null || t.Nodes.Count != 0)
            {
                return;
            }
            string path = Helpers.GetPathFromNode(t, "/");

            path = path.Substring(1, path.Length - 1);
            MessageBox.Show("Please select replacement data");
            OpenFileDialog d = new OpenFileDialog();

            d.Filter = "*.bin|*.bin";
            if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                byte[] data = File.ReadAllBytes(d.FileName);
                MessageBox.Show("Please select mod save location");
                SaveFileDialog d2 = new SaveFileDialog();
                d2.Filter = "*.DAIMWV|*.DAIMWV";
                if (d2.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    Mod mod = new Mod();
                    mod.jobs = new List <Mod.ModJob>();
                    Mod.ModJob mj = new Mod.ModJob();
                    mj.type        = 2;
                    mj.respath     = path;
                    mj.data        = data;
                    mj.bundlePaths = new List <string>();
                    mj.tocPaths    = new List <string>();
                    int plen = GlobalStuff.FindSetting("gamepath").Length;
                    ebxstatus.Text = "Finding All References...";
                    DBAccess.EBXInformation[] ebxl = DBAccess.GetEBXInformationByPath(path);
                    ebxstatus.Text = "Creating Mod...";
                    foreach (DBAccess.EBXInformation ebx in ebxl)
                    {
                        bool found = false;
                        foreach (string p in mj.bundlePaths)
                        {
                            if (p == ebx.bundlepath)
                            {
                                found = true;
                                break;
                            }
                        }
                        if (!found)
                        {
                            mj.bundlePaths.Add(ebx.bundlepath);
                        }
                        found = false;
                        foreach (string p in mj.tocPaths)
                        {
                            if (p == ebx.tocfilepath.Substring(plen))
                            {
                                found = true;
                                break;
                            }
                        }
                        if (!found && !ebx.tocfilepath.ToLower().Contains("\\patch\\"))
                        {
                            mj.tocPaths.Add(ebx.tocfilepath.Substring(plen));
                        }
                    }
                    mod.jobs.Add(mj);
                    mod.Save(d2.FileName);
                    ebxstatus.Text = "Ready.";
                    MessageBox.Show("Done.");
                }
            }
        }
Пример #5
0
        private void createForAllDupsModToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Please select replacement texture (same size)");
            OpenFileDialog d = new OpenFileDialog();

            d.Filter = "*.dds|*.dds";
            if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                byte[] data = File.ReadAllBytes(d.FileName);
                MessageBox.Show("Please select mod save location");
                SaveFileDialog d2 = new SaveFileDialog();
                d2.Filter = "*.DAIMWV|*.DAIMWV";
                if (d2.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    Mod mod = new Mod();
                    mod.jobs = new List <Mod.ModJob>();
                    Mod.ModJob mj = new Mod.ModJob();
                    mj.type        = 0;
                    mj.bundlePaths = new List <string>();
                    mj.tocPaths    = new List <string>();
                    int  plen = GlobalStuff.FindSetting("gamepath").Length;
                    bool skip = false;
                    for (int i = 0; i < bil.Length; i++)
                    {
                        DBAccess.BundleInformation  buni = bil[i];
                        DBAccess.TextureInformation ti   = new DBAccess.TextureInformation();
                        foreach (DBAccess.TextureInformation t in til)
                        {
                            if (t.bundleIndex == buni.index)
                            {
                                ti = t;
                            }
                        }
                        DBAccess.TOCInformation toci = DBAccess.GetTocInformationByIndex(buni.tocIndex);
                        mj.respath = ti.name;
                        skip       = false;
                        foreach (string p in mj.bundlePaths)
                        {
                            if (p == buni.bundlepath)
                            {
                                skip = true;
                                break;
                            }
                        }
                        if (!skip)
                        {
                            mj.bundlePaths.Add(buni.bundlepath);
                        }
                        string tpath = toci.path.Substring(plen, toci.path.Length - plen);
                        skip = false;
                        foreach (string p in mj.tocPaths)
                        {
                            if (p == tpath)
                            {
                                skip = true;
                                break;
                            }
                        }
                        if (tpath.ToLower().Contains("\\patch\\"))
                        {
                            skip = true;
                        }
                        if (!skip)
                        {
                            mj.tocPaths.Add(tpath);
                        }
                    }
                    MemoryStream m = new MemoryStream();
                    m.Write(data, 0x80, data.Length - 0x80);
                    mj.data = m.ToArray();
                    mod.jobs.Add(mj);
                    mod.Save(d2.FileName);
                    MessageBox.Show("Done.");
                }
            }
        }