Exemple #1
0
        private FileBatchChangeName ConstructFileBatchChangeName()
        {
            FileBatchChangeName retVal = new FileBatchChangeName();

            retVal.SetFileSelectParm(this.GetFormFileSelParm());

            FileChangeRule fileChangeBy = FileChangeRule.FixedString;

            if (rdoChgNmRulFixedStr.Checked)
            {
                fileChangeBy = FileChangeRule.FixedString;
            }
            else if (rdoChgNmRulWildcard.Checked)
            {
                fileChangeBy = FileChangeRule.Wildcard;
            }
            else if (rdoChgNmRulSpecList.Checked)
            {
                fileChangeBy = FileChangeRule.SpecList;
            }

            switch (fileChangeBy)
            {
            case FileChangeRule.FixedString:
                retVal.SetFunctionRule(fileChangeBy, txtChgNmFixedStr.Text, chkChgNmIsRegex.Checked);
                break;

            case FileChangeRule.Wildcard:
                retVal.SetFunctionRule(fileChangeBy,
                                       perfixStr: txtChgNmPerfixStr.Text,
                                       suffixStr: txtChgNmSuffixStr.Text,
                                       startNum: (int)numChgNmStartNum.Value,
                                       wildcardLen: (int)numChgNmWildcardLen.Value,
                                       onlyFixStr: chkChgNmOnlyFixStr.Checked);
                break;

            case FileChangeRule.SpecList:
                retVal.SetFunctionRule(fileChangeBy, specChgList: _fileChangeNameChangeList);
                break;
            }

            return(retVal);
        }
        private FileBatchChangeName ConstructFileBatchChangeName()
        {
            FileBatchChangeName retVal = new FileBatchChangeName();
            retVal.SetFileSelectParm(this.GetFormFileSelParm());

            FileChangeRule fileChangeBy = FileChangeRule.FixedString;
            if (rdoChgNmRulFixedStr.Checked)
                fileChangeBy = FileChangeRule.FixedString;
            else if (rdoChgNmRulWildcard.Checked)
                fileChangeBy = FileChangeRule.Wildcard;
            else if (rdoChgNmRulSpecList.Checked)
                fileChangeBy = FileChangeRule.SpecList;

            switch (fileChangeBy) {
                case FileChangeRule.FixedString:
                    retVal.SetFunctionRule(fileChangeBy, txtChgNmFixedStr.Text, chkChgNmIsRegex.Checked);
                    break;
                case FileChangeRule.Wildcard:
                    retVal.SetFunctionRule(fileChangeBy,
                                           perfixStr: txtChgNmPerfixStr.Text,
                                           suffixStr: txtChgNmSuffixStr.Text,
                                           startNum: (int)numChgNmStartNum.Value,
                                           wildcardLen: (int)numChgNmWildcardLen.Value,
                                           onlyFixStr: chkChgNmOnlyFixStr.Checked);
                    break;
                case FileChangeRule.SpecList:
                    retVal.SetFunctionRule(fileChangeBy, specChgList: _fileChangeNameChangeList);
                    break;
            }

            return retVal;
        }