private void openInPCCEditorToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (listView1.SelectedItems.Count == 0)
            {
                return;
            }
            ListViewItem item = listView1.SelectedItems[0];
            TreeNode     t    = TV1.SelectedNode;

            if (t == null)
            {
                return;
            }
            int        l = Convert.ToInt32(item.Name);
            PCCEditor2 p = new PCCEditor2();

            p.MdiParent   = this.MdiParent;
            p.WindowState = FormWindowState.Maximized;
            p.Show();
            try
            {
                p.pcc = new PCCObject(currentPCC);
                p.SetView(2);
                p.RefreshView();
                p.InitStuff();
                p.listBox1.SelectedIndex = l;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error:\n" + ex.Message);
            }
        }
Beispiel #2
0
        private void openInPCCEditorToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int l = CurrentObjects[listBox1.SelectedIndex];

            if (l == -1)
            {
                return;
            }
            PCCEditor2 p = new PCCEditor2();

            p.MdiParent   = this.MdiParent;
            p.WindowState = FormWindowState.Maximized;
            p.Show();
            try
            {
                p.pcc = new PCCObject(CurrentFile);
                p.SetView(2);
                p.RefreshView();
                p.InitStuff();
                p.listBox1.SelectedIndex = l;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error:\n" + ex.Message);
            }
        }
Beispiel #3
0
        void openInPCCEd_Click(object sender, EventArgs e)
        {
            PCCEditor2 p = new PCCEditor2();

            //p.MdiParent = Form.MdiParent;
            p.WindowState = FormWindowState.Maximized;
            p.Show();
            p.pcc = new PCCObject(pcc.pccFileName);
            p.SetView(2);
            p.RefreshView();
            p.InitStuff();
            p.listBox1.SelectedIndex = index;
        }
Beispiel #4
0
        void openInPCCEd_Click(object sender, EventArgs e)
        {
            PCCEditor2 p = new PCCEditor2();

            //p.MdiParent = Form.MdiParent;
            p.WindowState = FormWindowState.Maximized;
            p.Show();
            try
            {
                p.pcc = new PCCObject(pcc.pccFileName);
                p.SetView(2);
                p.RefreshView();
                p.InitStuff();
                p.listBox1.SelectedIndex = index;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error:\n" + ex.Message);
            }
        }
Beispiel #5
0
        void openInPCCEd_Click(object sender, EventArgs e)
        {

            PCCEditor2 p = new PCCEditor2();
            //p.MdiParent = Form.MdiParent;
            p.WindowState = FormWindowState.Maximized;
            p.Show();
            p.pcc = new PCCObject(pcc.pccFileName);
            p.SetView(2);
            p.RefreshView();
            p.InitStuff();
            p.listBox1.SelectedIndex = index - 1;
        }
Beispiel #6
0
        private void button7_Click(object sender, EventArgs e)
        {
            PCCObject.ExportEntry entry  = new PCCObject.ExportEntry();
            PCCObject.ExportEntry source = pcc.Exports[ObjectIndex];
            byte[] Header = new byte[source.info.Length];                       //Header
            for (int i = 0; i < source.info.Length; i++)
            {
                Header[i] = source.info[i];
            }
            entry.pccRef = pcc;
            entry.info   = Header;
            if (radioButton2.Checked)                                           //Name from list
            {
                if (comboBox1.SelectedIndex != -1)
                {
                    entry.idxObjectName = comboBox1.SelectedIndex;
                }
            }
            if (radioButton3.Checked)                                           //Custom Name
            {
                if (textBox1.Text != "")
                {
                    pcc.Names.Add(textBox1.Text);
                    entry.idxObjectName = pcc.Names.Count - 1;
                }
            }
            if (radioButton4.Checked)                                           //Class
            {
                if (comboBox2.SelectedIndex != -1)
                {
                    entry.idxClassName = Classes[comboBox2.SelectedIndex];
                }
            }
            if (radioButton8.Checked)                                           //Link
            {
                if (treeView1.SelectedNode != null)
                {
                    string link = treeView1.SelectedNode.Name;
                    entry.idxLink = Convert.ToInt32(link);
                }
            }
            byte[] Data = new byte[0];
            if (radioButton6.Checked)                                           //Load data from file...
            {
                if (File.Exists(textBox2.Text))
                {
                    FileStream fs = new FileStream(textBox2.Text, FileMode.Open, FileAccess.Read);
                    Data = new byte[fs.Length];
                    for (int i = 0; i < fs.Length; i++)
                    {
                        Data[i] = (byte)fs.ReadByte();
                    }
                    fs.Close();
                }
            }
            if (radioButton7.Checked)                                           //...or keep old data
            {
                Data = new byte[source.Data.Length];
                for (int i = 0; i < source.Data.Length; i++)
                {
                    Data[i] = source.Data[i];
                }
            }
            entry.Data = Data;
            int lastoffset = 0;

            foreach (PCCObject.ExportEntry ent in pcc.Exports)
            {
                if (ent.DataOffset > lastoffset)
                {
                    lastoffset = ent.DataOffset + ent.Data.Length;
                }
            }
            entry.DataOffset = lastoffset;
            //entry.DataSize = -1;//force update
            pcc.addExport(entry);
            foreach (PCCObject.ExportEntry ex in pcc.Exports) //silly update trick, but it works... wv
            {
                ex.Data = ex.Data;
            }
            refForm.RefreshView();
            this.Close();
        }