private void ShowEmotePreview(TreeNode node, EmoteNodeProperties.EmoteCondition[] conditions)
        {
            EmoteNodeProperties properties = (EmoteNodeProperties)node.Tag;

            EmoteNodeProperties.EmoteCondition[] allConditions = new EmoteNodeProperties.EmoteCondition[conditions.Length + (properties.Condition != EmoteNodeProperties.EmoteCondition.None ? 1 : 0)];
            conditions.CopyTo(allConditions, 0);
            if (properties.Condition != EmoteNodeProperties.EmoteCondition.None)
            {
                allConditions[allConditions.Length - 1] = properties.Condition;
            }

            EmoteNode dummyEmoteNode = new EmoteNode(node.FullPath, properties);

            if (node.Nodes.Count == 0)
            {
                this.AddOutputNode(this.ToolStripComboBox_Configuration.SelectedItem.ToString() +
                                   " " + dummyEmoteNode.CompletedText, allConditions);
            }
            else
            {
                if (properties.MustContinue == false)
                {
                    this.AddOutputNode(this.ToolStripComboBox_Configuration.SelectedItem.ToString() +
                                       " " + dummyEmoteNode.CompletedText, allConditions);
                }

                foreach (TreeNode childNode in node.Nodes)
                {
                    this.ShowEmotePreview(childNode, allConditions);
                }
            }
        }
 private void TreeView_AfterLabelEdit(object sender, NodeLabelEditEventArgs e)
 {
     if (e.Label != null && (this.CheckBox_KeywordsAutoFill.Checked || this.TextBox_Keywords.Text.Length == 0))
     {
         EmoteNodeProperties properties = new EmoteNodeProperties();
         properties.ImportKeywords(e.Label, (int)this.NumericUpDown_KeywordsMinLength.Value);
         this.TextBox_Keywords.Text = String.Join(" ", properties.Keywords);
     }
 }
        private void ToolStripMenuItem_MustContinue_CheckedChanged(object sender, EventArgs e)
        {
            if (this.currentTreeView.SelectedNode == null)
            {
                return;
            }
            EmoteNodeProperties config = (EmoteNodeProperties)this.currentTreeView.SelectedNode.Tag;

            config.MustContinue = this.ToolStripMenuItem_MustContinue.Checked;
        }
        private void TextBox_Keywords_TextChanged(object sender, EventArgs e)
        {
            if (this.currentTreeView.SelectedNode == null)
            {
                return;
            }
            EmoteNodeProperties config = (EmoteNodeProperties)this.currentTreeView.SelectedNode.Tag;

            config.ImportKeywords(this.TextBox_Keywords.Text);
        }
        private void ToolStripComboBox_Chance_TextChanged(object sender, EventArgs e)
        {
            if (this.currentTreeView.SelectedNode == null)
            {
                return;
            }
            EmoteNodeProperties config = (EmoteNodeProperties)this.currentTreeView.SelectedNode.Tag;

            try {
                config.Chance = int.Parse(this.ToolStripComboBox_Chance.Text);
            }
            catch (FormatException) { }
        }
        private void ToolStripMenuItem_Condition_CheckedChanged(object sender, EventArgs e)
        {
            ToolStripMenuItem menuItem = (ToolStripMenuItem)sender;

            if (menuItem.CheckState == CheckState.Checked)
            {
                if (this.currentTreeView.SelectedNode == null)
                {
                    return;
                }
                EmoteNodeProperties config = (EmoteNodeProperties)this.currentTreeView.SelectedNode.Tag;
                config.Condition = (EmoteCondition)Enum.Parse(config.Condition.GetType(), menuItem.Tag.ToString());
                this.UncheckAllMenuItemsExcept(this.ToolStripMenuItem_Conditions.DropDownItems, menuItem);
            }
        }
        private void TreeView_AfterSelect(object sender, TreeViewEventArgs e)
        {
            EmoteNodeProperties properties = (EmoteNodeProperties)e.Node.Tag;

            this.ToolStripMenuItem_MustContinue.Checked = properties.MustContinue;
            this.ToolStripMenuItem_MustContinue.Enabled = e.Node.Nodes.Count > 0;

            this.ToolStripComboBox_Chance.Text = properties.Chance.ToString();
            this.TextBox_Keywords.Text         = String.Join(" ", properties.Keywords);

            this.EnableToolStripItems(true, this.ToolStrip_Main);
            this.SetSelectedMenuItem(this.ToolStripMenuItem_Conditions.DropDownItems, properties.Condition.ToString());

            this.ShowEmoteOutputByTreeNode(e.Node);
        }
        private void TreeView_ItemDrag(object sender, ItemDragEventArgs e)
        {
            TreeView tree = (TreeView)sender;

            TreeNode node = (TreeNode)e.Item;

            tree.SelectedNode = node;

            if (node != null)
            {
                EmoteNodeProperties properties = (EmoteNodeProperties)node.Tag;
                TreeNode            nodeCloned = (TreeNode)node.Clone();
                nodeCloned.Tag = properties.Clone();
                tree.DoDragDrop(nodeCloned, DragDropEffects.Move | DragDropEffects.Copy);
            }
        }