Ejemplo n.º 1
0
        //Replace =========================================================================

        ///<summary>Updates the newFilemane Atrubute of the given FileElement.</summary>
        ///<param name="file">the FileElement to update newFilename.</param>
        ///<param name="pos">the position index in the files List.</param>
        private void Replace_updateFileName(FileElement file)
        {
            string newFileName;


            if (replace_extensionCheckBox.IsChecked != true)
            {
                newFileName = file.GetFileNameWithoutExtension();
            }
            else
            {
                newFileName = file.GetFilename();
            }

            if (replace_searchTextBox.Text != "")
            {
                newFileName = newFileName.Replace(replace_searchTextBox.Text, replace_replaceTextBox.Text);
            }

            if (replace_extensionCheckBox.IsChecked != true)
            {
                newFileName += file.GetExtension();
            }


            file.SetNewFilename(newFileName);
        }
Ejemplo n.º 2
0
        //Normal Tab =========================================================================

        ///<summary>Updates the newFilemane Atrubute of the given FileElement.</summary>
        ///<param name="file">the FileElement to update newFilename.</param>
        ///<param name="pos">the position index in the files List.</param>
        private void Normal_updateFileName(FileElement file, int pos)
        {
            string newFileName;
            string counterString;             //includes leading zeroes

            //calculate counter
            counterString = ((int)normal_counterStartvalueNumericUpDown.Value + pos * (int)normal_counterStepsizeNumericUpDown.Value).ToString();
            while (counterString.Length < normal_counterLeadingzerosLengthNumericUpDown.Value && !ReferenceEquals((ComboBoxItem)normal_counterLeadingzerosTypeComboBox.SelectedItem, normal_counterLeadingzerosTypeNoneComboBoxItem))
            {
                if (ReferenceEquals((ComboBoxItem)normal_counterLeadingzerosTypeComboBox.SelectedItem, normal_counterLeadingzerosTypeZeroComboBoxItem))
                {
                    counterString = "0" + counterString;
                }
                else if (ReferenceEquals((ComboBoxItem)normal_counterLeadingzerosTypeComboBox.SelectedItem, normal_counterLeadingzerosTypeSpaceComboBoxItem))
                {
                    counterString = " " + counterString;
                }
                else if (ReferenceEquals((ComboBoxItem)normal_counterLeadingzerosTypeComboBox.SelectedItem, normal_counterLeadingzerosTypeUnderscoreComboBoxItem))
                {
                    counterString = "_" + counterString;
                }
            }

            //calculate newFilemame
            newFileName = normal_newFileNameTextBox.Text;

            //replace [NAME]
            while (newFileName.IndexOf("[NAME]") != -1)
            {
                newFileName = newFileName.Replace("[NAME]", file.GetFileNameWithoutExtension());
            }

            //replace [C]
            while (newFileName.IndexOf("[C]") != -1)
            {
                newFileName = newFileName.Replace("[C]", counterString);
            }

            //add extension
            newFileName += file.GetExtension();

            file.SetNewFilename(newFileName);
        }