コード例 #1
0
        public ReplaceArgsDialog(ReplaceArgs args)
        {
            InitializeComponent();

            Needle_TextBox.Text = args.Needle;
            Hammer_TextBox.Text = args.Hammer;
        }
コード例 #2
0
        public ReplaceConfigDialog(StringArgs args)
        {
            InitializeComponent();

            myArgs = args as ReplaceArgs;
            replacedWithTextBox.Text = myArgs.From;
            replacedWithTextBox.Text = myArgs.To;
            this.DataContext         = myArgs;
        }
コード例 #3
0
 public ReplaceDialog(ReplaceArgs args)
 {
     InitializeComponent();
     needleTextBox.Text = args.Needle;
     hammerTextBox.Text = args.Hammer;
 }
コード例 #4
0
        private void ExportButton_Click(object sender, RoutedEventArgs e)
        {
            var screen = new OpenFileDialog();

            if (screen.ShowDialog() == true)
            {
                var url = screen.FileName;

                using (StreamReader sr = new StreamReader(url))
                {
                    while (sr.Peek() >= 0)
                    {
                        string[] tokens_sub   = sr.ReadLine().Split(new string[] { " - " }, StringSplitOptions.None);
                        string[] tokens_space = tokens_sub[0].Split(new string[] { " " }, StringSplitOptions.None);
                        string[] tokens_Args  = tokens_sub[1].Split(new string[] { " " }, StringSplitOptions.None);

                        string first_word = tokens_space[0];

                        if (first_word == "Replace")
                        {
                            var _replaceArgs = new ReplaceArgs();
                            _replaceArgs.Needle = tokens_Args[1];
                            _replaceArgs.Hammer = tokens_Args[3];

                            var _action = new ReplaceAction();

                            var _replacAction = _action as StringAction;

                            var _cloneReplaceAction = _replacAction.Clone();
                            _cloneReplaceAction.Args = _replaceArgs;

                            ActionListBox.Items.Add(_cloneReplaceAction);
                        }
                        else if (first_word == "New")
                        {
                            var _newcaseArgs = new NewCaseArgs();
                            _newcaseArgs.Needle = tokens_Args[3];

                            var _action = new NewCaseAction();

                            var _newcaseAction = _action as StringAction;

                            var _cloneNewCaseAction = _newcaseAction.Clone();
                            _cloneNewCaseAction.Args = _newcaseArgs;

                            ActionListBox.Items.Add(_cloneNewCaseAction);
                        }
                        else if (first_word == "Fullname")
                        {
                            var _fullnameArgs = new FullnameNormalizeArgs();
                            _fullnameArgs.Needle = tokens_Args[3];

                            var _action = new FullnameNormalizeAction();

                            var _fullnameAction = _action as StringAction;

                            var _cloneFullNameAction = _fullnameAction.Clone();
                            _cloneFullNameAction.Args = _fullnameArgs;

                            ActionListBox.Items.Add(_cloneFullNameAction);
                        }
                        else if (first_word == "Move")
                        {
                            var _moveArgs = new MoveArgs();
                            _moveArgs.Needle = tokens_Args[2];

                            var _action = new MoveAction();

                            var _moveAction = _action as StringAction;

                            var _cloneMoveAction = _moveAction.Clone();
                            _cloneMoveAction.Args = _moveArgs;

                            ActionListBox.Items.Add(_cloneMoveAction);
                        }
                        else if (first_word == "Unique")
                        {
                            var _uniqueArgs = new UniqueNameArgs();
                            _uniqueArgs.Needle = tokens_Args[1];
                            _uniqueArgs.Hammer = tokens_Args[3];

                            var _action = new UniqueName();

                            var _uniqueAction = _action as StringAction;

                            var _cloneUniqueAction = _uniqueAction.Clone();
                            _cloneUniqueAction.Args = _uniqueArgs;

                            ActionListBox.Items.Add(_cloneUniqueAction);
                        }
                        else
                        {
                            var _removeArgs = new RemoveActionArgs();
                            _removeArgs.Needle = tokens_Args[2];

                            var _action = new RemoveAction();

                            var _removeAction = _action as StringAction;

                            var _cloneRemoveAction = _removeAction.Clone();
                            _cloneRemoveAction.Args = _removeArgs;

                            ActionListBox.Items.Add(_cloneRemoveAction);
                        }
                    }
                }
                System.Windows.MessageBox.Show("Exported!");
            }
        }