private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            TreeNode t = treeView1.SelectedNode;

            if (t == null || t.Parent == null)
            {
                return;
            }
            string path = t.Text;

            while (t.Parent.Text != "Talktable Bundles")
            {
                t    = t.Parent;
                path = t.Text + "/" + path;
            }
            foreach (Bundle b in language.bundles)
            {
                foreach (Bundle.restype res in b.res)
                {
                    if (BitConverter.ToUInt32(res.rtype, 0) == 0x5e862e05)
                    {
                        if (res.name == path)
                        {
                            byte[] data = Tools.GetDataBySHA1(res.SHA1, cat);
                            talk = new Talktable();
                            talk.Read(new MemoryStream(data));
                            RefreshMe();
                        }
                    }
                }
            }
        }
Example #2
0
 public void LoadData(MemoryStream m)
 {
     talk = new Talktable();
     talk.Read(m);
     raw = m.ToArray();
     RefreshMe();
 }
        private void Search()
        {
            TreeNode t = treeView1.SelectedNode;

            if (t == null)
            {
                t = treeView1.Nodes[0];
            }
            string search = toolStripTextBox1.Text;

            while ((t = FindNext(t)) != null)
            {
                Application.DoEvents();
                string path = GetPath(t);
                status.Text = "Searching : " + GetPath(t) + "...";
                foreach (Bundle b in language.bundles)
                {
                    foreach (Bundle.restype res in b.res)
                    {
                        if (BitConverter.ToUInt32(res.rtype, 0) == 0x5e862e05)
                        {
                            if (res.name == path)
                            {
                                byte[] data = Tools.GetDataBySHA1(res.SHA1, cat);
                                if (talk == null)
                                {
                                    talk = new Talktable();
                                }
                                talk.Read((new MemoryStream(data)));
                                for (int j = 0; j < talk.Strings.Count; j++)
                                {
                                    if (talk.Strings[j].Value.Contains(search))
                                    {
                                        status.Text            = "";
                                        treeView1.SelectedNode = t;
                                        listBox2.SelectedIndex = j;
                                        return;
                                    }
                                }
                            }
                        }
                    }
                }
            }
            status.Text = "";
        }
        private void toolStripButton4_Click(object sender, EventArgs e)
        {
            OpenFileDialog d = new OpenFileDialog();

            d.Filter = "*.bin|*.bin";
            if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                try
                {
                    talk = new Talktable();
                    talk.Read(new MemoryStream(File.ReadAllBytes(d.FileName)));
                    RefreshMe();
                    MessageBox.Show("Done", "Loading");
                }
                catch (Exception)
                {
                    MessageBox.Show("Error on loading!");
                }
            }
        }