Esempio n. 1
0
        private void toolStripButton3_Click(object sender, EventArgs e)
        {
            string text = this.treeView1.SelectedNode.Text;
            string str  = Interaction.InputBox("Give the object id:", "", "", -1, -1);

            if (str == "")
            {
                return;
            }
            ushort ObjectId = ushort.Parse(str[2].ToString() + (object)str[3] + (object)str[0] + (object)str[1], NumberStyles.HexNumber);

            ObjectDb.Object @object = MKDS_Const.ObjectDatabase.GetObject(ObjectId);
            if (@object != null)
            {
                int num = (int)MessageBox.Show("This object id already exist in the database:\r\n" + @object.Name, "This object already exist", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                string Name = Interaction.InputBox("Give the name of the object:", "", "", -1, -1);
                if (Name == "")
                {
                    return;
                }
                this.changed = true;
                MKDS_Const.ObjectDatabase.AddObject(this.treeView1.SelectedNode.FullPath, Name, ObjectId);
                this.treeView1.BeginUpdate();
                this.treeView1.Nodes.Clear();
                MKDS_Const.ObjectDatabase.GetTreeNodes(this.treeView1.Nodes, text);
                this.treeView1.Sort();
                this.treeView1.EndUpdate();
            }
        }
 private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
 {
     if (e.Node.FullPath != "Root" && !(bool)e.Node.Tag || !(bool)e.Node.Tag)
     {
         return;
     }
     ObjectDb.Object @object = MKDS_Const.ObjectDatabase.GetObject(e.Node.FullPath);
     this.label1.Text = @object.ToString();
     this.label2.Text = @object.Description;
     @object.GetPictureAsyc(this.pictureBox1);
     this.ObjectID = @object.ObjectId;
 }
Esempio n. 3
0
        public bool RenderObject(MKDS_Course_Modifier.MKDS.NKM.OBJIEntry Item)
        {
            this.texoffset = 0;
            ushort objectId = Item.ObjectID;

            ObjectDb.Object @object = MKDS_Const.ObjectDatabase.GetObject(objectId);
            if (@object != null)
            {
                List <string> stringList = new List <string>();
                foreach (ObjectDb.Object.File requiredFile in @object.RequiredFiles)
                {
                    if (requiredFile.FileName.EndsWith(".nsbmd"))
                    {
                        stringList.Add(requiredFile.FileName);
                    }
                }
                foreach (string str in stringList)
                {
                    if (!str.StartsWith("sh_") && !str.EndsWith("_shadow.nsbmd"))
                    {
                        NARC.FileEntry fileByPath1 = this.Root1.GetFileByPath("\\MapObj\\" + str);
                        if (fileByPath1 != null)
                        {
                            this.RenderObject(objectId, new MKDS_Course_Modifier.G3D_Binary_File_Format.NSBMD(fileByPath1.Content), (NSBTP)null, 0, stringList.IndexOf(str) == stringList.Count - 1);
                        }
                        else
                        {
                            NARC.FileEntry fileByPath2 = this.Main.GetFileByPath("\\" + str);
                            if (fileByPath2 != null)
                            {
                                this.RenderObject(objectId, new MKDS_Course_Modifier.G3D_Binary_File_Format.NSBMD(fileByPath2.Content), (NSBTP)null, 0, stringList.IndexOf(str) == stringList.Count - 1);
                            }
                            else
                            {
                                NARC.FileEntry fileByPath3 = this.RomRoot.GetFileByPath("\\data\\MissionRun\\" + str);
                                if (fileByPath3 != null)
                                {
                                    this.RenderObject(objectId, new MKDS_Course_Modifier.G3D_Binary_File_Format.NSBMD(fileByPath3.Content), (NSBTP)null, 0, stringList.IndexOf(str) == stringList.Count - 1);
                                }
                                else
                                {
                                    this.CreateCube(Color.Red, Color.SkyBlue, true);
                                    return(false);
                                }
                            }
                        }
                    }
                }
                return(true);
            }
            this.CreateCube(Color.Blue, Color.SkyBlue, true);
            return(false);
        }
Esempio n. 4
0
 private void propertyGrid1_PropertyValueChanged(object s, PropertyValueChangedEventArgs e)
 {
     this.changed = true;
     if (e.ChangedItem.Label == "Name")
     {
         this.treeView1.BeginUpdate();
         this.treeView1.Nodes.Clear();
         MKDS_Const.ObjectDatabase.GetTreeNodes(this.treeView1.Nodes, (string)null);
         this.treeView1.Sort();
         this.treeView1.EndUpdate();
     }
     ObjectDb.Object @object = MKDS_Const.ObjectDatabase.GetObject(((ObjectDb.Object) this.propertyGrid1.SelectedObject).ObjectId);
     this.label1.Text       = @object.ToString();
     this.label2.Text       = @object.Description;
     this.pictureBox1.Image = (Image)@object.GetPicture();
 }
Esempio n. 5
0
        public NKMCheck(MKDS_Course_Modifier.MKDS.NKM Nkm, NKM Owner)
        {
            this.Owner = Owner;
            this.InitializeComponent();
            this.imageList1.Images.Add((Image)Resources.cross_circle);
            this.imageList1.Images.Add((Image)Resources.exclamation);
            this.imageList1.Images.Add((Image)Resources.information_white);
            int Index = 0;

            foreach (MKDS_Course_Modifier.MKDS.NKM.OBJIEntry objiEntry in Nkm.OBJI)
            {
                if ((long)objiEntry.RouteID > (long)(Nkm.PATH.NrEntries - 1U))
                {
                    this.Errors.Add(new NKMCheck.Error(0, Index, LanguageHandler.GetString("nkm.check.objirouteid"), NKMCheck.Error.ErrorType.Error));
                    this.listView1.Items.Add((ListViewItem)this.Errors.Last <NKMCheck.Error>());
                }
                if (objiEntry.ObjectID == (ushort)101 && objiEntry.TimeTrails || objiEntry.ObjectID == (ushort)201 && objiEntry.TimeTrails)
                {
                    this.Errors.Add(new NKMCheck.Error(0, Index, LanguageHandler.GetString("nkm.check.objiiboxtt"), NKMCheck.Error.ErrorType.Warning));
                    this.listView1.Items.Add((ListViewItem)this.Errors.Last <NKMCheck.Error>());
                }
                ObjectDb.Object @object = MKDS_Const.ObjectDatabase.GetObject(objiEntry.ObjectID);
                if (@object != null && @object.RouteRequired && objiEntry.RouteID == (short)-1)
                {
                    this.Errors.Add(new NKMCheck.Error(0, Index, LanguageHandler.GetString("nkm.check.objineedroute"), NKMCheck.Error.ErrorType.Error));
                    this.listView1.Items.Add((ListViewItem)this.Errors.Last <NKMCheck.Error>());
                }
                ++Index;
            }
            int num = 0;

            foreach (MKDS_Course_Modifier.MKDS.NKM.PATHEntry pathEntry in Nkm.PATH)
            {
                num += (int)pathEntry.NrPoit;
            }
            if ((long)Nkm.POIT.NrEntries != (long)num)
            {
                this.Errors.Add(new NKMCheck.Error(2, -1, LanguageHandler.GetString("nkm.check.pathpoit"), NKMCheck.Error.ErrorType.Error));
                this.listView1.Items.Add((ListViewItem)this.Errors.Last <NKMCheck.Error>());
            }
            if (Nkm.KTPS.Entries.Count != 0 && (Nkm.KTPS.Entries.Count <= 1 || Nkm.KTPS.Entries.Count >= 8))
            {
                return;
            }
            this.Errors.Add(new NKMCheck.Error(4, -1, LanguageHandler.GetString("nkm.check.ktps"), NKMCheck.Error.ErrorType.Warning));
            this.listView1.Items.Add((ListViewItem)this.Errors.Last <NKMCheck.Error>());
        }
 private void ObjectSelector_Load(object sender, EventArgs e)
 {
     this.treeView1.BeginUpdate();
     this.treeView1.Nodes.Clear();
     MKDS_Const.ObjectDatabase.GetTreeNodes(this.treeView1.Nodes, (string)null);
     this.treeView1.Sort();
     this.treeView1.EndUpdate();
     ObjectDb.Object @object = MKDS_Const.ObjectDatabase.GetObject(this.ObjectID);
     if (@object != null)
     {
         this.label1.Text = @object.ToString();
         this.label2.Text = @object.Description;
         @object.GetPictureAsyc(this.pictureBox1);
     }
     else
     {
         this.label1.Text = "Unknown (" + BitConverter.ToString(BitConverter.GetBytes(this.ObjectID)).Replace("-", "") + ")";
     }
 }
        public override object ConvertTo(
            ITypeDescriptorContext context,
            CultureInfo culture,
            object value,
            Type destinationType)
        {
            if (!(destinationType == typeof(string)) || !(value.GetType() == typeof(ushort)))
            {
                return(base.ConvertTo(context, culture, value, destinationType));
            }
            string str = string.Format("{0:X4}", value);

            for (int index = 0; index < 4 - str.Length; ++index)
            {
                str += "0";
            }
            ObjectDb.Object @object = MKDS_Const.ObjectDatabase.GetObject(BitConverter.ToUInt16(((IEnumerable <byte>)BitConverter.GetBytes((ushort)value)).Reverse <byte>().ToArray <byte>(), 0));
            return(@object != null ? (object)(@object.Name + " (" + str + ")") : (object)str);
        }
Esempio n. 8
0
 private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
 {
     if (e.Node.FullPath != "Root" && !(bool)e.Node.Tag)
     {
         this.toolStripButton1.Enabled     = true;
         this.toolStripButton2.Enabled     = true;
         this.toolStripButton3.Enabled     = true;
         this.toolStripButton4.Enabled     = false;
         this.toolStripButton5.Enabled     = false;
         this.propertyGrid1.SelectedObject = (object)null;
         this.label1.Text       = "";
         this.label2.Text       = "";
         this.pictureBox1.Image = (Image)null;
     }
     else if ((bool)e.Node.Tag)
     {
         this.toolStripButton1.Enabled = false;
         this.toolStripButton2.Enabled = false;
         this.toolStripButton3.Enabled = false;
         this.toolStripButton4.Enabled = true;
         this.toolStripButton5.Enabled = true;
         ObjectDb.Object @object = MKDS_Const.ObjectDatabase.GetObject(e.Node.FullPath);
         this.propertyGrid1.SelectedObject = (object)@object;
         this.label1.Text = @object.ToString();
         this.label2.Text = @object.Description;
         @object.GetPictureAsyc(this.pictureBox1);
     }
     else
     {
         this.toolStripButton1.Enabled     = true;
         this.toolStripButton2.Enabled     = false;
         this.toolStripButton3.Enabled     = false;
         this.toolStripButton4.Enabled     = false;
         this.toolStripButton5.Enabled     = false;
         this.propertyGrid1.SelectedObject = (object)null;
         this.label1.Text       = "";
         this.label2.Text       = "";
         this.pictureBox1.Image = (Image)null;
     }
 }
 public ObjectDbWikiTextGenerator(ObjectDb.Object o)
 {
     this.Object = o;
     this.InitializeComponent();
 }