Ejemplo n.º 1
0
        //Start new EVT from scratch
        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //Re-initialize some things that may have changed if you already opened a PAK
            evtPath               = "";
            pakPath               = "";
            bmdPath               = "";
            bmd                   = "";
            this.Text             = "EVTEditor";
            txt_MsgEditor.Enabled = false;
            evt                   = new EvtFile();
            //Add field command to EVT to start with
            var command = new Command();

            command.Type     = "Fd__";
            command.Time     = trackBar.Value;
            command.DataSize = 64;
            command.Data     = CommandDataFactory.Create(command.Type);
            evt.Commands.Add(command);
            //Add field object to EVT to start with
            var obj = new EvtObject();

            obj.Type = EvtObjectType.Field;
            evt.Objects.Add(obj);

            //Enable controls
            AddCommandToolStripMenuItem.Visible = true;
            trackBar.Enabled = true;

            //Enable datagridviews
            EVTSetup();
        }
Ejemplo n.º 2
0
        //Add example Field Object to EVT
        private void newObjectToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var obj = new EvtObject();

            obj.Type = EvtObjectType.Character;
            obj.Id   = listBox_Objects.Items.Count;
            evt.Objects.Add(obj);
            RefreshEVT();
        }
Ejemplo n.º 3
0
        //Update Object's property value in EVT to the changed cell's value
        private void UpdateEVTObject(object sender, DataGridViewCellEventArgs e)
        {
            //Narrow down the selected property in the evt so we can update it
            EvtObject    obj  = evt.Objects.Find(o => Convert.ToInt32(GetSubstringByString("[", "]", listBox_Objects.SelectedItem.ToString())) == evt.Objects.IndexOf(o));
            PropertyInfo prop = obj.GetType().GetProperty(dgv_ObjectProperties.CurrentCell.OwningRow.Cells[0].Value.ToString());

            //Try to update value using the proper type
            var cellValue = dgv_ObjectProperties.CurrentCell.Value;

            UpdateProperty(prop, obj, cellValue);
            BeginInvoke(new MethodInvoker(RefreshEVT));
        }
Ejemplo n.º 4
0
 //Remove selected Object from EVT
 private void selectedObjectToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (evt.Objects.Count > 1)
     {
         try
         {
             EvtObject obj = evt.Objects.Find(o => Convert.ToInt32(GetSubstringByString("[", "]", listBox_Objects.SelectedItem.ToString())) == evt.Objects.IndexOf(o));
             evt.Objects.Remove(obj);
             RefreshEVT();
         }
         catch { }
     }
 }
Ejemplo n.º 5
0
        //Update Objects datagridview based on selected Object
        private void listBox_Objects_SelectedIndexChanged(object sender, EventArgs e)
        {
            GridViewRefresh(dgv_ObjectProperties);
            if (listBox_Objects.SelectedIndex >= 0)
            {
                EvtObject obj = evt.Objects[listBox_Objects.SelectedIndex];

                //Update datagridview with object properties
                foreach (PropertyInfo prop in typeof(EvtObject).GetProperties())
                {
                    dgv_ObjectProperties.Rows.Add(new string[] { $"{prop.Name}", $"{prop.GetValue(obj, null)}" });
                }
            }
        }