private void btnBrowse_Click(object sender, EventArgs e)
        {
            TagBrowserDialog tbd = null;

            //TODO: fix this so that the edited tag has the version info and we launch the right type of browser
            if (ProjectManager.ProjectLoaded)
            {
                tbd = new TagBrowserDialog(ProjectManager.Version);
            }
            else
            {
                tbd = new TagBrowserDialog(MapfileVersion.HALOPC);
            }

            //tbd.SelectedTag = this.value;
            tbd.AddFilter("All Files (*.*)|*.*");
            if (tbd.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }
            this.value.Value = tbd.SelectedTag.PathNoExtension;
        }
示例#2
0
                protected virtual IndexEntry SelectEntry(MapFile map, IndexEntry entry)
                {
                    //Prepare
                    IndexEntry result = entry;

                    //Create Dialog
                    using (TagBrowserDialog tagDlg = new TagBrowserDialog(map.IndexEntries, map.Name))
                    {
                        //Setup
                        tagDlg.AllowNull  = false;
                        tagDlg.SelectedID = entry.Id;

                        //Show
                        if (tagDlg.ShowDialog() == DialogResult.OK)
                        {
                            result = map.IndexEntries[tagDlg.SelectedID];
                        }
                    }

                    //Return
                    return(entry);
                }
        private void simpleButtonAddPrefabTag_Click(object sender, System.EventArgs e)
        {
            TagBrowserDialog dlg = new TagBrowserDialog(MapfileVersion.HALOPC);

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                DependencyBuilder ib = new DependencyBuilder();
                ib.ProcessDependants(dlg.SelectedTag);

                string[] temp = DependencyBuilder.mapfileTagsIndex.RelativePathList;
                for (int i = 0; i < temp.Length; i++)
                {
                    Trace.WriteLine("Tag Dependency: " + temp[i]);
                }


                Trace.WriteLine("Broken Dependency List");
                string[] broken         = DependencyBuilder.brokenDependencies.RelativePathList;
                string[] broken_parents = DependencyBuilder.brokenDependenciesParents.RelativePathList;
                for (int i = 0; i < broken.Length; i++)
                {
                    Trace.WriteLine("Broken Dependency: " + broken[i]);
                }

                for (int i = 0; i < broken_parents.Length; i++)
                {
                    if (broken_parents[i] != null)
                    {
                        Trace.WriteLine("Broken Parent: " + broken_parents[i]);
                    }
                    else
                    {
                        Trace.WriteLine("Broken Parent: none");
                    }
                }
            }
        }
示例#4
0
        object IHost.Request(IAddOn sender, string request, params object[] args)
        {
            //Prepare
            int        value      = 0;
            RawSection section    = 0;
            StringId   stringId   = StringId.Zero;
            TagId      tagId      = TagId.Null;
            Stream     dataStream = null;
            IndexEntry entry      = null;

            //Handle Request
            switch (request)
            {
            case "Map": return(map);

            case "SelectedEntry": return(selectedEntry);

            case "Xbox": return(DebugXbox);

            case "StringBrowserDialog":
                //Prepare
                if (args.Length > 0 && args[0] is StringId)
                {
                    stringId = (StringId)args[0];
                }

                //Initialize Tag Browser Dialog
                using (StringSelectDialog stringDlg = new StringSelectDialog(map.Strings.ToList()))
                {
                    //Set
                    stringDlg.SelectedString = stringId;

                    //Show
                    if (stringDlg.ShowDialog() == DialogResult.OK)
                    {
                        stringId = stringDlg.SelectedString;
                    }
                }

                //Return
                return(stringId);

            case "TagBrowserDialog":
                //Prepare
                if (args.Length > 0 && args[0] is TagId)
                {
                    tagId = (TagId)args[0];
                }

                //Initialize Tag Browser Dialog
                using (TagBrowserDialog tagDlg = new TagBrowserDialog(map.IndexEntries, map.Name))
                {
                    //Set
                    tagDlg.SelectedID = tagId;

                    //Show
                    if (tagDlg.ShowDialog() == DialogResult.OK)
                    {
                        tagId = tagDlg.SelectedID;
                    }
                }

                //Return
                return(tagId);

            case "SelectEntry":
                //Prepare
                if (args.Length > 0 && args[0] is TagId)
                {
                    tagId = (TagId)args[0];
                }

                //Check ID...
                if (!tagId.IsNull && entries.ContainsKey(tagId))
                {
                    //Select
                    var                wrapper = entries[tagId];
                    string[]           parts = $"{wrapper.Filename}.{wrapper.Root}".Split(new char[] { '\\' }, StringSplitOptions.RemoveEmptyEntries);
                    TreeNodeCollection collection = tagTreeView.Nodes; TreeNode node = null;
                    for (int i = 0; i < parts.Length; i++)
                    {
                        //Get Node
                        node = collection[parts[i]];

                        //Check
                        if (node != null)
                        {
                            collection = node.Nodes;
                        }
                    }

                    //Check
                    if (node != null)
                    {
                        //Select and goto
                        tagTreeView.SelectedNode = node;
                        node.EnsureVisible();
                    }
                }
                return(selectedEntry);

            case "RawDataStream":
                //Check Parameters
                if (args.Length > 2 && (args[0] is IndexEntry || args[0] is TagId) && args[1] is RawSection && args[2] is int)
                {
                    //Get Parameters
                    if (args[0] is IndexEntry)
                    {
                        entry = (IndexEntry)args[0];
                    }
                    else
                    {
                        entry = map.IndexEntries[(TagId)args[0]];
                    }
                    section = (RawSection)args[1];
                    value   = (int)args[2];

                    //Check
                    if (entry != null)
                    {
                        switch (value & 0xC0000000 >> 29)
                        {
                        case 0: if (entry.Raws[section].ContainsRawOffset(value))
                            {
                                dataStream = (Stream)entry.Raws[section][value].Clone();
                            }
                            break;

                        case 1: break;

                        case 2: break;

                        case 3: break;
                        }
                    }
                }
                return(dataStream);

            default: return(null);
            }
        }