예제 #1
0
        private void AddRuleButtonClick(object sender, System.Windows.RoutedEventArgs e)
        {
            if (OldPathStr.Length == 0)
            {
                MessageBoxX.Show("您尚未添加任何文件!", "错误", MessageBoxButton.OK, MessageBoxIcon.Error);
                return;
            }
            EditRule editRule = new EditRule(NewPathStr[0]);

            editRule.deal        = new ReplaceDeal();
            editRule.deal.AimLen = 0;
            editRule.deal.AimStr = "";
            editRule.deal.NewStr = "";
            editRule.deal.Len    = 0;
            editRule.tab         = 0;
            editRule.max         = max;

            editRule.OnShow();
            editRule.ShowDialog();
            if (editRule.DialogResult == true)
            {
                RuleList.Add(editRule.deal);
            }
            DealOldData();
            Show_List();
            Show_Rule_List();
        }
예제 #2
0
        private void EditRuleButtonClick(object sender, System.Windows.RoutedEventArgs e)
        {
            if (Rule_ListBox.SelectedIndex == -1)
            {
                MessageBoxX.Show("您尚未选择任何规则!", "错误", MessageBoxButton.OK, MessageBoxIcon.Error);
                return;
            }
            else
            {
                int    i        = Rule_ListBox.SelectedIndex;
                string tempPath = OldPathStr[0];
                for (int k = 0; k < i; k++)
                {
                    tempPath = RuleList[k].Deal(tempPath, 1, out _);
                }
                DealBase d        = RuleList[Rule_ListBox.SelectedIndex];
                EditRule editRule = new EditRule(tempPath);
                editRule.deal = d;
                string temp = d.GetType().ToString();
                if (temp == "ReName.src.ReplaceDeal")
                {
                    editRule.tab = 0;
                }
                else if (temp == "ReName.src.CleanDeal")
                {
                    editRule.tab = 1;
                }
                else if (temp == "ReName.src.AddIndexDeal")
                {
                    editRule.tab = 2;
                }
                else if (temp == "ReName.src.AddDeal")
                {
                    editRule.tab = 3;
                }
                else if (temp == "ReName.src.RemoveDeal")
                {
                    editRule.tab = 4;
                }
                else if (temp == "ReName.src.RegexDeal")
                {
                    editRule.tab = 5;
                }
                editRule.max = max;

                editRule.OnShow();
                editRule.ShowDialog();
                if (editRule.DialogResult == true)
                {
                    RuleList.Remove(d);
                    RuleList.Insert(i, editRule.deal);
                }
                DealOldData();
                Show_List();
                Show_Rule_List();
            }
        }