private static void AddNewEntryToolStripMenuItemClick(object sender, EventArgs e)
        {
            var dlg = new AddToLibrary();

            if (dlg.ShowDialog() != DialogResult.OK)
            {
                dlg.Dispose();
                return;
            }
            var tmp = new RBFLibEntry
            {
                Name      = dlg.ValueName,
                Tags      = dlg.Tags,
                TagGroups = dlg.TagGroups,
                Values    = new List <AttributeValue>()
            };

            if (RBFLibrary.GetEntry(tmp.Name) == null)
            {
                RBFLibrary.AddEntry(tmp);
            }
            else if (dlg.AddTags)
            {
                RBFLibEntry entry = RBFLibrary.GetEntry(tmp.Name);
                foreach (string t in tmp.Tags)
                {
                    RBFLibrary.AddEntryToTag(entry, t);
                }
            }
            dlg.Dispose();
        }
예제 #2
0
        public AddToLibrary()
        {
            InitializeComponent();
            m_chkbxAddTags.Checked = s_addTags;

            m_chklbxTagGroups.Items.AddRange(RBFLibrary.GetTagGroupNames().ToArray());
        }
예제 #3
0
        private void Start()
        {
            m_btnStartStop.Text              = @"Stop";
            m_bIsRunning                     = true;
            m_tbxActionTagGroup.Enabled      = false;
            m_tbxBuffTagGroup.Enabled        = false;
            m_tbxExpActionTagGroup.Enabled   = false;
            m_tbxModifierTagGroup.Enabled    = false;
            m_tbxRequirementTagGroup.Enabled = false;
            m_tbxTargetTagGroup.Enabled      = false;
            m_chklbxFilter.Enabled           = false;

            m_prgProgress.Value   = 1;
            m_prgProgress.Step    = 1;
            m_prgProgress.Minimum = 1;
            m_prgProgress.Maximum = FileManager.AttribTree.RootNode.GetTotalFileCount();

            foreach (object item in m_chklbxFilter.CheckedItems)
            {
                string tagGroupName = item as string;
                var    tags         = RBFLibrary.GetTagGroup(tagGroupName);
                if (tags != null)
                {
                    m_keyFilter.AddRange(tags);
                }
            }

            m_crawlTargets = new List <CrawlerInfo>
            {
                new CrawlerInfo("GameData", v => HasRefWithStart(v, "entity_extensions"),
                                s => "entity_extensions", false),

                new CrawlerInfo("GameData", v => HasRefWithStart(v, "squad_extensions"),
                                s => "squad_extensions", false),

                new CrawlerInfo(m_tbxActionTagGroup.Text, v => HasRefWithStart(v, "actions"),
                                s => s.SubstringBetweenOccurrencs(1, 2, '\\') + "_actions"),

                new CrawlerInfo(m_tbxBuffTagGroup.Text, v => HasRefWithStart(v, "buffs"),
                                s => s.SubstringBetweenOccurrencs(1, 2, '\\') + "_buffs"),

                new CrawlerInfo(m_tbxExpActionTagGroup.Text,
                                v => HasRefWithStart(v, "wargear\\expendable_actions"),
                                s => "expendable_actions"),

                new CrawlerInfo(m_tbxModifierTagGroup.Text, v => HasRefWithStart(v, "modifiers"),
                                s => s.SubstringBetweenOccurrencs(1, 2, '\\')),

                new CrawlerInfo(m_tbxRequirementTagGroup.Text,
                                v => HasRefWithStart(v, "requirements"), s => "requirements"),

                new CrawlerInfo(m_tbxTargetTagGroup.Text, v => HasRefWithStart(v, "types\\targets"),
                                s => "targets"),
            };

            m_crawler             = new RBFCrawler(ScanFile, string.Empty, AdvanceProgress);
            m_crawler.OnFinished += OnCrawlerDone;
            m_crawler.Start();
        }
 private void RemoveSelectedToolStripMenuItemClick(object sender, EventArgs e)
 {
     if (_lbxEntries.SelectedItem == null)
     {
         return;
     }
     RBFLibrary.RemoveEntry(_lbxEntries.SelectedItem as RBFLibEntry);
 }
예제 #5
0
        private static void AddToLibrary(string[] tags, string[] tagGroups, AttribInfo info)
        {
            RBFLibEntry entry = new RBFLibEntry();

            entry.Values    = new List <AttributeValue>();
            entry.Submenu   = info.Category;
            entry.TagGroups = tagGroups ?? new string[0];
            entry.Tags      = tags ?? new string[0];
            entry.Values.Add(info.Value);
            entry.Name = info.Value.Key;
            RBFLibrary.RemoveEntry(entry.Name);
            RBFLibrary.AddEntry(entry);
        }
예제 #6
0
        private void CopyIntoLibraryToolStripMenuItemClick(object sender, EventArgs e)
        {
            TreeNode selected = m_trvTables.SelectedNode;

            if (selected == null || selected.Tag == null)
            {
                return;
            }

            var dlg = new AddToLibrary();

            if (selected.Parent != null)
            {
                dlg.Tags = new[] { selected.Parent.Text + '\n' }
            }
            ;
            dlg.ValueName = selected.Text;
            if (dlg.ShowDialog() != DialogResult.OK)
            {
                dlg.Dispose();
                return;
            }
            var tmp = new RBFLibEntry
            {
                Name      = dlg.ValueName,
                Tags      = dlg.Tags,
                TagGroups = dlg.TagGroups
            };

            if (dlg.SubMenu != string.Empty)
            {
                tmp.Submenu = dlg.SubMenu;
            }
            tmp.Values = new List <AttributeValue> {
                selected.Tag as AttributeValue
            };

            if (RBFLibrary.GetEntry(tmp.Name) == null)
            {
                RBFLibrary.AddEntry(tmp);
            }
            else if (dlg.AddTags)
            {
                RBFLibEntry entry = RBFLibrary.GetEntry(tmp.Name);
                foreach (string t in tmp.Tags)
                {
                    RBFLibrary.AddEntryToTag(entry, t);
                }
            }
            dlg.Dispose();
        }
        public RBFLibraryEditor()
        {
            InitializeComponent();

            SortedDictionary <string, RBFLibEntry> entries = RBFLibrary.GetAllEntries();

            foreach (RBFLibEntry entry in entries.Values)
            {
                _lbxEntries.Items.Add(entry);
            }

            RBFLibrary.EntryAdded   += RBFLibraryEntryAdded;
            RBFLibrary.EntryRemoved += RBFLibraryEntryRemoved;
        }
예제 #8
0
 public CrawlerInfo(string tagGroupName, Func <AttributeValue, bool> selector, Func <string, string> categoryMaker, bool usesTagGroup = true)
 {
     TagGroupName  = tagGroupName;
     Selector      = selector;
     CategoryMaker = categoryMaker;
     UsesTagGroup  = usesTagGroup;
     if (usesTagGroup)
     {
         Tags = new HashSet <string>();
         var currentTags = RBFLibrary.GetTagGroup(tagGroupName);
         if (currentTags != null)
         {
             Tags.AddRange(currentTags);
         }
     }
     Entries = new Dictionary <string, AttribInfo>();
 }
예제 #9
0
        public override void Init(PluginEnvironment env)
        {
            LoggingManager.SendMessage("RBFPlugin - Setup started");
            RBFSettings.Instance = this;

            // adding stuff to the menu
            ToolStripItem openRBFLib = new ToolStripMenuItem("Open RBF-Library")
            {
                Name = "openRBFLib"
            };

            openRBFLib.Click += OpenRBFLibClick;
            ToolStripItem options = new ToolStripMenuItem("Options")
            {
                Name = "options"
            };

            options.Click += OptionsClick;
            ToolStripItem search = new ToolStripMenuItem("RBF-Search")
            {
                Name = "RBFSearch"
            };

            search.Click += SearchClick;
            ToolStripItem openDictionaryCrawler = new ToolStripMenuItem("Open Dictionary Builder")
            {
                Name = "dictCrawler"
            };

            openDictionaryCrawler.Click += OpenDictionaryCrawlerClick;
            ToolStripItem openLibraryCrawler = new ToolStripMenuItem("Open Library Builder")
            {
                Name = "libraryCrawler"
            };

            openLibraryCrawler.Click += OpenLibraryCrawlerClick;
            env.PluginSubMenu.Add(openRBFLib);
            env.PluginSubMenu.Add(openDictionaryCrawler);
            env.PluginSubMenu.Add(openLibraryCrawler);
            env.PluginSubMenu.Add(options);
            env.PluginSubMenu.Add(search);

            RBFLibrary.Init();
            RBFDictionary.Init();
            LoggingManager.SendMessage("RBFPlugin - Setup finished");
        }
예제 #10
0
 private void AddToLibrary()
 {
     foreach (var crawlInfo in m_crawlTargets)
     {
         foreach (var entry in crawlInfo.Entries.Values)
         {
             if (crawlInfo.UsesTagGroup)
             {
                 RBFLibrary.AddTagsToGroup(crawlInfo.TagGroupName, crawlInfo.Tags);
                 AddToLibrary(null, new[] { crawlInfo.TagGroupName }, entry);
             }
             else
             {
                 AddToLibrary(new[] { crawlInfo.TagGroupName }, null, entry);
             }
         }
     }
 }
예제 #11
0
        private void EditTagsToolStripMenuItemClick(object sender, EventArgs e)
        {
            if (_lbxEntries.SelectedItem == null)
            {
                return;
            }
            var entry = _lbxEntries.SelectedItem as RBFLibEntry;
            var dlg   = new TagEditor {
                Tags = { Lines = entry.Tags }, TagGroups = entry.TagGroups
            };

            if (dlg.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            entry.Tags = dlg.Tags.Lines;
            RBFLibrary.RemoveEntry(entry);
            RBFLibrary.AddEntry(entry);
        }
예제 #12
0
        // RBF Library link

        private void InsertFromLibraryToolStripMenuItemDropDownOpening(object sender, EventArgs e)
        {
            insertFromLibraryToolStripMenuItem.DropDownItems.Clear();
            TreeNode selected = m_trvTables.SelectedNode;

            if (selected == null)
            {
                return;
            }
            SortedDictionary <string, RBFLibEntry> entries = RBFLibrary.GetEntriesForTag(selected.Text);

            if (entries == null)
            {
                return;
            }

            foreach (var entry in entries)
            {
                ToolStripMenuItem menu = insertFromLibraryToolStripMenuItem;
                if (entry.Value.Submenu != null)
                {
                    string subname = entry.Value.Submenu;
                    if (!insertFromLibraryToolStripMenuItem.DropDownItems.ContainsKey(subname))
                    {
                        var s = new ToolStripMenuItem(subname)
                        {
                            Name = subname
                        };
                        insertFromLibraryToolStripMenuItem.DropDownItems.Add(s);
                        menu = s;
                    }
                    else
                    {
                        menu = insertFromLibraryToolStripMenuItem.DropDownItems[subname] as ToolStripMenuItem;
                    }
                }
                ToolStripItem rbfLibItem = menu.DropDownItems.Add(entry.Key);
                rbfLibItem.Click += RBFLibItemClick;
            }
        }
예제 #13
0
        private void RBFLibItemClick(object sender, EventArgs e)
        {
            var      item     = sender as ToolStripItem;
            TreeNode selected = m_trvTables.SelectedNode;

            if (selected == null)
            {
                return;
            }
            SortedDictionary <string, RBFLibEntry> entries = RBFLibrary.GetEntriesForTag(selected.Text);

            if (entries == null || !entries.ContainsKey(item.Text))
            {
                return;
            }
            List <AttributeValue> values = entries[item.Text].Values;

            foreach (AttributeValue value in values)
            {
                InsertValueIntoSelected(value);
            }
        }
예제 #14
0
        private void BtnOkClick(object sender, EventArgs e)
        {
            if (m_tbxName.Text == string.Empty)
            {
                UIHelper.ShowError("The selected name is invalid!");
                return;
            }
            if (m_rtbTags.Text == string.Empty)
            {
                UIHelper.ShowError("Please enter at least ONE tag.");
                return;
            }

            if (!s_addTags && RBFLibrary.GetAllEntries().ContainsKey(m_tbxName.Text))
            {
                UIHelper.ShowError("The selected name is already in use by another value.");
                return;
            }
            DialogResult = DialogResult.OK;
            Close();
            return;
        }
예제 #15
0
        public LibraryCrawlerForm()
        {
            InitializeComponent();
            m_advanceProgress = new MethodInvoker(m_prgProgress.PerformStep);

            var taggroups = RBFLibrary.GetTagGroupNames();

            foreach (string tag in taggroups)
            {
                m_chklbxFilter.Items.Add(tag);
            }
            if (RBFLibrary.GetTagGroup("modifiers") != null)
            {
                m_tbxModifierTagGroup.Text = @"modifiers";
            }
            if (RBFLibrary.GetTagGroup("actions") != null)
            {
                m_tbxActionTagGroup.Text = @"actions";
            }
            if (RBFLibrary.GetTagGroup("targets") != null)
            {
                m_tbxTargetTagGroup.Text = @"targets";
            }
            if (RBFLibrary.GetTagGroup("buffs") != null)
            {
                m_tbxBuffTagGroup.Text = @"buffs";
            }
            if (RBFLibrary.GetTagGroup("expendable_actions") != null)
            {
                m_tbxExpActionTagGroup.Text = @"expendable_actions";
            }
            if (RBFLibrary.GetTagGroup("requirements") != null)
            {
                m_tbxRequirementTagGroup.Text = @"requirements";
            }
        }
예제 #16
0
 public TagEditor()
 {
     InitializeComponent();
     m_chklbxTagGroups.Items.AddRange(RBFLibrary.GetTagGroupNames().ToArray());
 }
예제 #17
0
 static void OpenRBFLibClick(object sender, EventArgs e)
 {
     RBFLibrary.ShowLibraryForm();
 }
예제 #18
0
 private void BtnOpenLibraryClick(object sender, EventArgs e)
 {
     RBFLibrary.ShowLibraryForm();
 }
예제 #19
0
        private void TbxTagFilterTextChanged(object sender, EventArgs e)
        {
            _lbxEntries.Items.Clear();
            SortedDictionary <string, RBFLibEntry> entries = _tbx_tagFilter.Text == string.Empty ? RBFLibrary.GetAllEntries() : RBFLibrary.GetEntriesForTag(_tbx_tagFilter.Text);

            if (entries == null)
            {
                return;
            }

            foreach (RBFLibEntry entry in entries.Values)
            {
                _lbxEntries.Items.Add(entry);
            }
        }