public void Init()
        {
            if (GlobalStuff.FindSetting("isNew") == "1")
            {
                MessageBox.Show("Please initialize the database in Misc > Database with Scan");
                this.BeginInvoke(new MethodInvoker(Close));
                return;
            }
            string path = GlobalStuff.FindSetting("gamepath");

            path += "Data\\cas.cat";
            cat   = new CATFile(path);
            SQLiteConnection con = Database.GetConnection();

            con.Open();
            SQLiteDataReader reader = new SQLiteCommand("SELECT name,sha1 FROM res WHERE rtype='36F3F2C0' ORDER BY name", con).ExecuteReader();

            shaderDatabases = new Dictionary <string, string>();

            while (reader.Read())
            {
                if (!shaderDatabases.ContainsKey(reader.GetString(0)))
                {
                    shaderDatabases.Add(reader.GetString(0), reader.GetString(1));
                }
            }

            con.Close();
            MakeTree();
            init = true;
        }
Пример #2
0
        private void treeView5_AfterSelect(object sender, TreeViewEventArgs e)
        {
            TreeNode t = treeView5.SelectedNode;

            if (t == null || t.Nodes.Count != 0)
            {
                return;
            }
            string path = t.Text;

            while (t.Parent.Text != "Textures")
            {
                t    = t.Parent;
                path = t.Text + "/" + path;
            }
            listBox2.Items.Clear();
            ttprevlist = new List <DBAccess.TextureInformation>();
            int    count   = 0;
            string DAIpath = GlobalStuff.FindSetting("gamepath");

            foreach (DBAccess.TextureInformation tmp in ttlist)
            {
                if (tmp.name == path)
                {
                    ttprevlist.Add(tmp);
                    DBAccess.BundleInformation buni = DBAccess.GetBundleInformationByIndex(tmp.bundleIndex);
                    listBox2.Items.Add((count++) + " : " + buni.filepath.Substring(DAIpath.Length, buni.filepath.Length - DAIpath.Length) + " -> " + buni.bundlepath);
                }
            }
            if (listBox2.Items.Count > 0)
            {
                listBox2.SelectedIndex = 0;
            }
        }
Пример #3
0
        public void Init()
        {
            if (GlobalStuff.FindSetting("isNew") == "1")
            {
                MessageBox.Show("Please initialize the database in Misc > Database with Scan");
                this.BeginInvoke(new MethodInvoker(Close));
                return;
            }

            SQLiteConnection con = Database.GetConnection();

            con.Open();
            SQLiteDataReader reader = new SQLiteCommand("SELECT DISTINCT name FROM res WHERE rtype = 'AFECB022' ORDER BY name ", con).ExecuteReader();

            scriptPaths = new List <string>();
            while (reader.Read())
            {
                scriptPaths.Add(reader.GetString(0));
            }
            con.Close();
            MakeTree();

            const int tabPixels = 24;

            richTextBox1.SelectionTabs = new int[] { (tabPixels * 1), (tabPixels * 2), (tabPixels * 3), (tabPixels * 4), (tabPixels * 5), (tabPixels * 6), (tabPixels * 7), (tabPixels * 8) };
            init = true;
        }
Пример #4
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.");
                }
            }
        }
        public void Init()
        {
            if (GlobalStuff.FindSetting("isNew") == "1")
            {
                MessageBox.Show("Please initialize the database in Misc > Database with Scan");
                this.BeginInvoke(new MethodInvoker(Close));
                return;
            }
            string path = GlobalStuff.FindSetting("gamepath");

            path += "Data\\cas.cat";
            cat   = new CATFile(path);
            SQLiteConnection con = Database.GetConnection();

            con.Open();
            SQLiteDataReader reader = new SQLiteCommand("SELECT path FROM langsbfiles WHERE path LIKE '%\\loctext\\%' ORDER BY path ", con).ExecuteReader();

            toolStripComboBox1.Items.Clear();
            languages = new List <string>();
            while (reader.Read())
            {
                languages.Add(reader.GetString(0));
            }
            con.Close();
            foreach (string l in languages)
            {
                toolStripComboBox1.Items.Add(Path.GetFileNameWithoutExtension(l));
            }
            toolStripComboBox1.SelectedIndex = 0;
            language = new SBFile(languages[0]);
            MakeTree();
            init = true;
        }
Пример #6
0
        public void LoadById(string id)
        {
            hb1.ByteProvider       = new DynamicByteProvider(new byte[0]);
            hb2.ByteProvider       = new DynamicByteProvider(new byte[0]);
            toolStripTextBox1.Text = id;
            while (!hasLoaded)
            {
                Application.DoEvents();
            }
            listBox1.Items.Clear();
            ttprevlist = new List <DBAccess.RESInformation>();
            string DAIpath = GlobalStuff.FindSetting("gamepath");

            foreach (DBAccess.RESInformation tmp in ttlist)
            {
                if (tmp.resname == id)
                {
                    ttprevlist.Add(tmp);
                }
            }
            List <DBAccess.RESInformation> tmplist = new List <DBAccess.RESInformation>();

            for (int i = 0; i < ttprevlist.Count; i++)
            {
                if (ttprevlist[i].isPatch)
                {
                    continue;
                }
                bool found = false;
                for (int j = 0; j < tmplist.Count; j++)
                {
                    if (tmplist[j].bundlepath == ttprevlist[i].bundlepath &&
                        tmplist[j].tocfilepath == ttprevlist[i].tocfilepath)
                    {
                        found = true;
                        break;
                    }
                }
                if (!found)
                {
                    tmplist.Add(ttprevlist[i]);
                }
            }
            int count = 0;

            ttprevlist = tmplist;
            List <string> paths = new List <string>();

            foreach (DBAccess.RESInformation tmp in ttprevlist)
            {
                paths.Add((count++) + " : " + tmp.tocfilepath.Substring(DAIpath.Length, tmp.tocfilepath.Length - DAIpath.Length) + " -> " + tmp.bundlepath);
            }
            listBox1.Items.AddRange(paths.ToArray());
            if (listBox1.Items.Count > 0)
            {
                listBox1.SelectedIndex = 0;
            }
        }
Пример #7
0
        private void ScanFiles()
        {
            Log("Saving file paths into db...");
            SQLiteConnection con = Database.GetConnection();

            con.Open();
            var transaction = con.BeginTransaction();

            string[] files = Directory.GetFiles(GlobalStuff.FindSetting("gamepath"), "*.sb", SearchOption.AllDirectories);
            Log("SB files...");
            foreach (string file in files)
            {
                if (!file.ToLower().Contains("\\update\\"))//exlude patches
                {
                    if (!file.Contains("\\loc\\") &&
                        !file.Contains("\\locfacefx\\") &&
                        !file.Contains("\\loctext\\"))
                    {
                        Database.AddSBFile(file, con);
                    }
                    else
                    {
                        Database.AddLanguageSBFile(file, con);
                    }
                }
            }
            transaction.Commit();
            transaction = con.BeginTransaction();
            Log("TOC files...");
            files = Directory.GetFiles(GlobalStuff.FindSetting("gamepath"), "*.toc", SearchOption.AllDirectories);
            foreach (string file in files)
            {
                if (!file.ToLower().Contains("\\update\\"))//exlude patches
                {
                    if (!file.Contains("\\loc\\") &&
                        !file.Contains("\\locfacefx\\") &&
                        !file.Contains("\\loctext\\"))
                    {
                        Database.AddTOCFile(file, con);
                    }
                    else
                    {
                        Database.AddLanguageTOCFile(file, con);
                    }
                }
            }
            transaction.Commit();
            transaction = con.BeginTransaction();
            Log("CAS files...");
            files = Directory.GetFiles(GlobalStuff.FindSetting("gamepath"), "*.cas", SearchOption.AllDirectories);
            foreach (string file in files)
            {
                Database.AddCASFile(file, con);
            }
            transaction.Commit();
            con.Close();
        }
Пример #8
0
        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            treeView2.Nodes.Clear();
            if (treeView1.SelectedNode == null)
            {
                return;
            }
            string path = Path.GetDirectoryName(GlobalStuff.FindSetting("gamepath")) + Helpers.GetPathFromNode(treeView1.SelectedNode);

            PreviewFile(path);
        }
Пример #9
0
 public void Init()
 {
     if (GlobalStuff.FindSetting("isNew") == "1")
     {
         MessageBox.Show("Please initialize the database in Misc > Database with Scan");
         this.BeginInvoke(new MethodInvoker(Close));
         return;
     }
     Scripting.SetScriptOutput(rtb2);
     init = true;
 }
Пример #10
0
        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            int n = listBox1.SelectedIndex;

            if (n == -1)
            {
                return;
            }
            string path = GlobalStuff.FindSetting("gamepath") + listBox1.Items[n];

            PreviewFile(path);
        }
Пример #11
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.");
                }
            }
        }
Пример #12
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (GlobalStuff.FindSetting("isNew") != "1")
            {
                MessageBox.Show("Database was already filled with data, please clear it before scan.");
                return;
            }
            OpenFileDialog d = new OpenFileDialog();

            d.Filter = "DragonAgeInquisition.exe|DragonAgeInquisition.exe";
            if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                StartScan(Path.GetDirectoryName(d.FileName) + "\\");
            }
        }
Пример #13
0
 private void toolStripButton3_Click(object sender, EventArgs e)
 {
     try
     {
         string input  = Microsoft.VisualBasic.Interaction.InputBox("Please enter offset in decimal", "Find by offset and cas number", "");
         uint   offset = Convert.ToUInt32(input);
         input = Microsoft.VisualBasic.Interaction.InputBox("Please enter cas number decimal", "Find by offset and cas number", "");
         uint casnr = Convert.ToUInt32(input);
         input = Microsoft.VisualBasic.Interaction.InputBox("Search base(b) or patch(p)?", "Find by offset and cas number", "b");
         CATFile cat = null;
         if (input != "p")
         {
             cat = new CATFile(GlobalStuff.FindSetting("gamepath") + "Data\\cas.cat");
         }
         else
         {
             cat = new CATFile(GlobalStuff.FindSetting("gamepath") + "Update\\Patch\\Data\\cas.cat");
         }
         byte[] sha1 = new byte[0];
         for (int i = 0; i < cat.lines.Count; i++)
         {
             if (cat.lines[i][7] == casnr && cat.lines[i][5] <= offset && cat.lines[i][5] + cat.lines[i][6] > offset)
             {
                 MemoryStream m = new MemoryStream();
                 for (int j = 0; j < 5; j++)
                 {
                     Helpers.WriteLEUInt(m, cat.lines[i][j]);
                 }
                 sha1 = m.ToArray();
                 break;
             }
         }
         cat = null;
         if (sha1.Length == 0)
         {
             MessageBox.Show("SHA1 not found!");
             return;
         }
         toolStripTextBox1.Text = Helpers.ByteArrayToHexString(sha1);
         Thread t = new Thread(ThreadedSearch);
         t.Start();
         MessageBox.Show("Done.");
         return;
     }
     catch (Exception)
     {
     }
 }
Пример #14
0
 public void Init()
 {
     if (GlobalStuff.FindSetting("isNew") == "1")
     {
         MessageBox.Show("Please initialize the database in Misc > Database with Scan");
         this.BeginInvoke(new MethodInvoker(Close));
         return;
     }
     this.WindowState = FormWindowState.Maximized;
     Application.DoEvents();
     statusConsumer("Querying...");
     EBXList = Database.LoadAllEbxEntries();
     statusConsumer("Making Tree...");
     MakeTree();
     statusConsumer("Done.");
     init = true;
 }
Пример #15
0
        public static string GetOrSetAuthor()
        {
            string name = GlobalStuff.FindSetting("author");

            if (name == "")
            {
                string input = Microsoft.VisualBasic.Interaction.InputBox("Please enter author name", "Author name", "noname");
                if (input != "")
                {
                    name = input;
                    GlobalStuff.AssignSetting("author", name);
                }
                else
                {
                    name = "noname";
                }
            }
            return(name);
        }
Пример #16
0
        private void Search()
        {
            rtb1.Text = rtb2.Text = rtb3.Text = "";
            string sha1 = toolStripTextBox1.Text.Trim().ToLower();

            if (sha1.Length != 40)
            {
                MessageBox.Show("Not valid SHA1!");
                return;
            }
            byte[] data = SHA1Access.GetDataBySha1(Helpers.HexStringToByteArray(sha1));
            if (data.Length == 0)
            {
                MessageBox.Show("SHA1 not found!");
                return;
            }
            hb1.ByteProvider = new DynamicByteProvider(data);
            el = DBAccess.GetEBXInformationBySHA1(sha1);
            rl = DBAccess.GetRESInformationBySHA1(sha1);
            cl = DBAccess.GetChunkInformationBySHA1(sha1);
            listBox1.Items.Clear();
            int count = 0;
            int l     = GlobalStuff.FindSetting("gamepath").Length;

            foreach (DBAccess.EBXInformation ei in el)
            {
                listBox1.Items.Add((count++) + " : " + ei.ebxname);
            }
            listBox2.Items.Clear();
            count = 0;
            foreach (DBAccess.RESInformation ri in rl)
            {
                listBox2.Items.Add((count++) + " : " + ri.resname);
            }
            listBox3.Items.Clear();
            count = 0;
            foreach (DBAccess.ChunkInformation ci in cl)
            {
                listBox3.Items.Add((count++) + " : id = " + Helpers.ByteArrayToHexString(ci.id));
            }
        }
Пример #17
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.");
                }
            }
        }
Пример #18
0
        private void openInTOCToolToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string path  = Path.GetDirectoryName(GlobalStuff.FindSetting("gamepath"));
            string path2 = "";

            if (toolStripButton4.Checked)
            {
                int n = listBox1.SelectedIndex;
                if (n == -1)
                {
                    return;
                }
                path2 = listBox1.Items[n].ToString();
            }
            else
            {
                TreeNode t = treeView1.SelectedNode;
                if (t == null)
                {
                    return;
                }
                path2 = t.Text;
                while (t.Parent != null)
                {
                    t     = t.Parent;
                    path2 = t.Text + "\\" + path2;
                }
            }
            if (!path2.StartsWith("\\"))
            {
                path += "\\";
            }
            path += path2;
            FileTools.TOCTool toc = new FileTools.TOCTool();
            toc.toc = new TOCFile(path);
            toc.RefreshTree();
            toc.MdiParent   = this.MdiParent;
            toc.WindowState = FormWindowState.Maximized;
            toc.Show();
        }
Пример #19
0
        public void Init()
        {
            if (GlobalStuff.FindSetting("isNew") == "1")
            {
                MessageBox.Show("Please initialize the database in Misc > Database with Scan");
                this.BeginInvoke(new MethodInvoker(Close));
            }
            ids = new List <int>();
            listBox1.Items.Clear();
            SQLiteConnection con = Database.GetConnection();

            con.Open();
            SQLiteDataReader reader = Database.getAllSorted("bundles", "frostpath", con);

            while (reader.Read())
            {
                listBox1.Items.Add(reader.GetString(2) + " (" + reader.GetInt32(3) + "/" + reader.GetInt32(4) + "/" + reader.GetInt32(5) + ")");
                ids.Add(reader.GetInt32(0));
            }
            con.Close();
            init = true;
        }
        public void Init()
        {
            if (GlobalStuff.FindSetting("isNew") == "1")
            {
                MessageBox.Show("Please initialize the database in Misc > Database with Scan");
                this.BeginInvoke(new MethodInvoker(Close));
                return;
            }
            SQLiteConnection con = Database.GetConnection();

            con.Open();
            SQLiteDataReader reader = new SQLiteCommand("SELECT DISTINCT name FROM res WHERE rtype = '5C4954A6' ORDER BY name ", con).ExecuteReader();

            TexPaths = new List <string>();
            while (reader.Read())
            {
                TexPaths.Add(reader.GetString(0));
            }
            con.Close();
            MakeTree();
            init = true;
        }
        public void Init()
        {
            if (GlobalStuff.FindSetting("isNew") == "1")
            {
                MessageBox.Show("Please initialize the database in Misc > Database with Scan");
                this.BeginInvoke(new MethodInvoker(Close));
                return;
            }
            Sounds = new List <SoundEntry>();
            SQLiteConnection con = Database.GetConnection();

            con.Open();
            SQLiteDataReader reader = new SQLiteCommand("SELECT * FROM langtocfiles WHERE path LIKE '%\\loc\\%' ORDER BY path ", con).ExecuteReader();

            toolStripComboBox1.Items.Clear();
            Languages = new List <string>();
            while (reader.Read())
            {
                Languages.Add(reader.GetString(0));
            }
            foreach (string l in Languages)
            {
                toolStripComboBox1.Items.Add(Path.GetFileName(l));
            }
            langTOC = new TOCFile(Languages[0]);
            LoadTOC();
            toolStripComboBox1.SelectedIndex = 0;
            reader = new SQLiteCommand("SELECT DISTINCT name FROM ebx WHERE type = 'SoundWaveAsset' ORDER BY name ", con).ExecuteReader();
            while (reader.Read())
            {
                SoundEntry e = new SoundEntry();
                e.path = reader.GetString(0);
                Sounds.Add(e);
            }
            con.Close();
            MakeTree();
            init = true;
        }
Пример #22
0
        private CATFile ScanCAT()
        {
            Log("Loading CAT...");
            string           path = GlobalStuff.FindSetting("gamepath") + "Data\\cas.cat";
            CATFile          cat  = new CATFile(path);
            SQLiteConnection con  = Database.GetConnection();

            con.Open();
            var transaction = con.BeginTransaction();

            Database.ClearSHA1db(con);
            int counter = 0;

            Log("Saving sha1s into db...");
            foreach (uint[] line in cat.lines)
            {
                Database.AddSHA1(line, con);
                if ((counter % 100000) == 0)
                {
                    rtb1.AppendText(counter + "/" + cat.lines.Count + "\n");
                    rtb1.SelectionStart = rtb1.Text.Length;
                    rtb1.ScrollToCaret();

                    transaction.Commit();
                    transaction = con.BeginTransaction();
                }
                counter++;
            }
            Log("Saving chunk ids into db...");
            foreach (CATFile.ChunkType c in cat.chunks)
            {
                Database.AddChunk(c.id, c.sha1, con);
            }
            transaction.Commit();
            con.Close();
            return(cat);
        }
Пример #23
0
        private void treeView3_AfterSelect(object sender, TreeViewEventArgs e)
        {
            TreeNode t = treeView3.SelectedNode;

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

            for (int i = 0; i < tblist.Count; i++)
            {
                if (path.Contains(tblist[i].bundlepath))
                {
                    DBAccess.BundleInformation bi = tblist[i];
                    if (bi.isbase)
                    {
                        return;
                    }
                    TOCFile toc  = new TOCFile(bi.filepath);
                    byte[]  data = toc.ExportBundleDataByPath(bi.bundlepath);
                    Bundle  b    = null;
                    if (bi.incas)
                    {
                        List <BJSON.Entry> tmp = new List <BJSON.Entry>();
                        BJSON.ReadEntries(new MemoryStream(data), tmp);
                        b = Bundle.Create(tmp[0]);
                    }
                    else
                    {
                        b = Bundle.Create(data, true);
                    }
                    if (b == null)
                    {
                        return;
                    }
                    if (b.ebx == null)
                    {
                        b.ebx = new List <Bundle.ebxtype>();
                    }
                    if (b.res == null)
                    {
                        b.res = new List <Bundle.restype>();
                    }
                    if (b.chunk == null)
                    {
                        b.chunk = new List <Bundle.chunktype>();
                    }
                    int           total = b.ebx.Count + b.res.Count + b.chunk.Count;
                    StringBuilder sb    = new StringBuilder();
                    sb.AppendFormat("Total count : {0}\n", total);
                    sb.AppendFormat("EBX count   : {0}\n", b.ebx.Count);
                    sb.AppendFormat("RES count   : {0}\n", b.res.Count);
                    sb.AppendFormat("CHUNK count : {0}\n", b.chunk.Count);
                    rtb1.Text = sb.ToString();
                    DBAccess.BundleInformation[] dupBun = DBAccess.GetBundleInformationById(bi.bundlepath);
                    listBox3.Items.Clear();
                    int count = 0;
                    int l     = GlobalStuff.FindSetting("gamepath").Length;
                    foreach (DBAccess.BundleInformation dup in dupBun)
                    {
                        DBAccess.TOCInformation ti = DBAccess.GetTocInformationByIndex(dup.tocIndex);
                        listBox3.Items.Add((count++) + " : " + ti.path.Substring(l, ti.path.Length - l) + " -> Delta:" + dup.isdelta + " Base:" + dup.isbase);
                    }
                }
            }
        }
Пример #24
0
        private void treeView5_AfterSelect(object sender, TreeViewEventArgs e)
        {
            TreeNode t = treeView5.SelectedNode;

            if (t == null || t.Nodes.Count != 0)
            {
                return;
            }
            string path = t.Text;

            while (t.Parent.Text != "")
            {
                t    = t.Parent;
                path = t.Text + "/" + path;
            }
            listBox2.Items.Clear();
            ttprevlist = new List <DBAccess.RESInformation>();
            string DAIpath = GlobalStuff.FindSetting("gamepath");

            foreach (DBAccess.RESInformation tmp in ttlist)
            {
                if (tmp.resname == path)
                {
                    ttprevlist.Add(tmp);
                }
            }
            List <DBAccess.RESInformation> tmplist = new List <DBAccess.RESInformation>();

            for (int i = 0; i < ttprevlist.Count; i++)
            {
                if (ttprevlist[i].isPatch)
                {
                    continue;
                }
                bool found = false;
                for (int j = 0; j < tmplist.Count; j++)
                {
                    if (tmplist[j].bundlepath == ttprevlist[i].bundlepath &&
                        tmplist[j].tocfilepath == ttprevlist[i].tocfilepath)
                    {
                        found = true;
                        break;
                    }
                }
                if (!found)
                {
                    tmplist.Add(ttprevlist[i]);
                }
            }
            int count = 0;

            ttprevlist = tmplist;
            List <string> paths = new List <string>();

            foreach (DBAccess.RESInformation tmp in ttprevlist)
            {
                paths.Add((count++) + " : " + tmp.tocfilepath.Substring(DAIpath.Length, tmp.tocfilepath.Length - DAIpath.Length) + " -> " + tmp.bundlepath);
            }
            listBox2.Items.AddRange(paths.ToArray());
            if (listBox2.Items.Count > 0)
            {
                listBox2.SelectedIndex = 0;
            }
        }
Пример #25
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.");
                }
            }
        }
Пример #26
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.");
                }
            }
        }