Exemplo n.º 1
0
        private void OGNItemsAdd(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
        {
            if (Tag == null)
            {
                return;
            }
            try
            {
                lb_ogn.Tag = true;
                SimPe.Plugin.ObjectGraphNode ogn = (SimPe.Plugin.ObjectGraphNode)Tag;
                ObjectGraphNodeItem          b   = new ObjectGraphNodeItem();

                tb_ogn_1.Text = "0x" + Helper.HexString(b.Enabled);
                tb_ogn_2.Text = "0x" + Helper.HexString(b.Dependant);
                tb_ogn_3.Text = "0x" + Helper.HexString(b.Index);

                ogn.Items = (ObjectGraphNodeItem[])Helper.Add(ogn.Items, b);
                lb_ogn.Items.Add(b);
                ogn.Changed = true;
            }
            catch (Exception ex)
            {
                Helper.ExceptionMessage("", ex);
            }
            finally
            {
                lb_ogn.Tag = null;
            }
        }
Exemplo n.º 2
0
        private void OGNItemsDelete(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
        {
            if (Tag == null)
            {
                return;
            }
            if (lb_ogn.SelectedIndex < 0)
            {
                return;
            }
            try
            {
                lb_ogn.Tag = true;
                SimPe.Plugin.ObjectGraphNode ogn = (SimPe.Plugin.ObjectGraphNode)Tag;
                ObjectGraphNodeItem          b   = (ObjectGraphNodeItem)lb_ogn.Items[lb_ogn.SelectedIndex];

                ogn.Items = (ObjectGraphNodeItem[])Helper.Delete(ogn.Items, b);
                lb_ogn.Items.Remove(b);
                ogn.Changed = true;
            }
            catch (Exception ex)
            {
                Helper.ExceptionMessage("", ex);
            }
            finally
            {
                lb_ogn.Tag = null;
            }
        }
Exemplo n.º 3
0
        private void OGNSelect(object sender, System.EventArgs e)
        {
            if (Tag == null)
            {
                return;
            }
            if (lb_ogn.Tag != null)
            {
                return;
            }
            if (this.lb_ogn.SelectedIndex < 0)
            {
                return;
            }

            try
            {
                lb_ogn.Tag = true;
                SimPe.Plugin.ObjectGraphNode ogn = (SimPe.Plugin.ObjectGraphNode)Tag;
                ObjectGraphNodeItem          b   = (ObjectGraphNodeItem)lb_ogn.Items[lb_ogn.SelectedIndex];

                tb_ogn_1.Text = "0x" + Helper.HexString(b.Enabled);
                tb_ogn_2.Text = "0x" + Helper.HexString(b.Dependant);
                tb_ogn_3.Text = "0x" + Helper.HexString(b.Index);
                ogn.Changed   = true;
            }
            catch (Exception)
            {
                //Helper.ExceptionMessage("", ex);
            }
            finally
            {
                lb_ogn.Tag = null;
            }
        }
Exemplo n.º 4
0
        private void SelectNode(object sender, System.EventArgs e)
        {
            if (lbnode.Tag != null)
            {
                return;
            }
            if (lbnode.SelectedIndex < 0)
            {
                return;
            }

            try
            {
                lbnode.Tag = true;
                ObjectGraphNodeItem item = (ObjectGraphNodeItem)lbnode.Items[lbnode.SelectedIndex];
                tbnode1.Text = "0x" + Helper.HexString(item.Enabled);
                tbnode2.Text = "0x" + Helper.HexString(item.Dependant);
                tbnode2.Text = "0x" + Helper.HexString(item.Index);
            }
            catch (Exception) {}
            finally
            {
                lbnode.Tag = null;
            }
        }
Exemplo n.º 5
0
        //internal Shpe wrapper;



        private void UpdateLists()
        {
            try
            {
                SimPe.Plugin.Shape shape = (SimPe.Plugin.Shape) this.Tag;

                ObjectGraphNodeItem[] ogni = new ObjectGraphNodeItem[lbnode.Items.Count];
                for (int i = 0; i < ogni.Length; i++)
                {
                    ogni[i] = (ObjectGraphNodeItem)lbnode.Items[i];
                }
                shape.GraphNode.Items = ogni;
            }
            catch (Exception) {}
        }
Exemplo n.º 6
0
        private void linkLabel10_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
        {
            try
            {
                //Shpe wrp = (Shpe)wrapper;
                Shape shape = (Shape)this.Tag;

                ObjectGraphNodeItem val = new ObjectGraphNodeItem();
                val.Enabled   = Convert.ToByte(tbnode1.Text, 16);
                val.Dependant = Convert.ToByte(tbnode2.Text, 16);
                val.Index     = Convert.ToUInt32(tbnode3.Text, 16);

                lbnode.Items.Add(val);
                UpdateLists();
            }
            catch (Exception) {}
        }
Exemplo n.º 7
0
        void AddToGMND(SimPe.Events.ResourceContainer rc)
        {
            SimPe.Plugin.GenericRcol rcol = new GenericRcol();
            rcol.ProcessData(rc.Resource);
            RemoveFromGMND(rcol);

            GeometryNode      gn  = (GeometryNode)rcol.Blocks[0];
            DataListExtension dle = new DataListExtension(rcol);

            dle.Extension.VarName = "copyright";
            dle.Extension.Items   = new ExtensionItem[4];

            dle.Extension.Items[0]          = new ExtensionItem();
            dle.Extension.Items[0].Typecode = ExtensionItem.ItemTypes.String;
            dle.Extension.Items[0].Name     = "created by";
            dle.Extension.Items[0].String   = form.tbCreator.Text;

            dle.Extension.Items[1]          = new ExtensionItem();
            dle.Extension.Items[1].Typecode = ExtensionItem.ItemTypes.String;
            dle.Extension.Items[1].Name     = "license";
            dle.Extension.Items[1].String   = form.tbLicense.Text;

            dle.Extension.Items[2]          = new ExtensionItem();
            dle.Extension.Items[2].Typecode = ExtensionItem.ItemTypes.String;
            dle.Extension.Items[2].Name     = "release date";
            dle.Extension.Items[2].String   = form.tbDate.Text;

            dle.Extension.Items[3]          = new ExtensionItem();
            dle.Extension.Items[3].Typecode = ExtensionItem.ItemTypes.String;
            dle.Extension.Items[3].Name     = "version";
            dle.Extension.Items[3].String   = form.tbVersion.Text;
            rcol.Blocks = (SimPe.Interfaces.Scenegraph.IRcolBlock[])Helper.Add(rcol.Blocks, dle, typeof(SimPe.Interfaces.Scenegraph.IRcolBlock));


            ObjectGraphNodeItem ogni = new ObjectGraphNodeItem();

            ogni.Index               = (uint)(rcol.Blocks.Length - 1);
            ogni.Enabled             = 0x01;
            ogni.Dependant           = 0x00;
            gn.ObjectGraphNode.Items = (ObjectGraphNodeItem[])Helper.Add(gn.ObjectGraphNode.Items, ogni);

            rcol.SynchronizeUserData(true, true);
        }
Exemplo n.º 8
0
        private void OGNChangedItems(object sender, System.EventArgs e)
        {
            if (Tag == null)
            {
                return;
            }
            if (lb_ogn.Tag != null)
            {
                return;
            }
            if (this.lb_ogn.SelectedIndex < 0)
            {
                return;
            }

            try
            {
                lb_ogn.Tag = true;
                SimPe.Plugin.ObjectGraphNode ogn = (SimPe.Plugin.ObjectGraphNode)Tag;
                ObjectGraphNodeItem          b   = (ObjectGraphNodeItem)lb_ogn.Items[lb_ogn.SelectedIndex];

                b.Enabled   = Convert.ToByte(tb_ogn_1.Text, 16);
                b.Dependant = Convert.ToByte(tb_ogn_2.Text, 16);
                b.Index     = Convert.ToUInt32(tb_ogn_3.Text, 16);

                lb_ogn.Items[lb_ogn.SelectedIndex] = b;
                ogn.Changed = true;
            }
            catch (Exception)
            {
                //Helper.ExceptionMessage("", ex);
            }
            finally
            {
                lb_ogn.Tag = null;
            }
        }