Пример #1
0
 /// <summary>
 /// Constructor specifying type and containers (header/footer) - no value assigned (can be used for all types except UserString)
 /// </summary>
 /// <param name="type">The word type contained in the portion</param>
 /// <param name="header">string to be placed before portion</param>
 /// <param name="footer">string to be placed after portion</param>
 /// <param name="caseOption">Option to be applied to case of portion</param>
 public FileNamePortion(FileWordType type, string header, string footer, CaseOptionType caseOption)
 {
     this.Type       = type;
     this.Header     = header;
     this.Footer     = footer;
     this.CaseOption = CaseOptionType.None;
     this.Whitespace = " ";
 }
Пример #2
0
 /// <summary>
 /// Constructor specifying all properties
 /// </summary>
 /// <param name="type">The word type contained in the portion</param>
 /// <param name="value">The value for the custom string</param>
 /// <param name="header">string to be placed before portion</header>
 /// <param name="footer">string to be placed after portion</header>
 /// <param name="option">Option to be applied to case of portion</param>
 public FileNamePortion(FileWordType type, string header, string footer, CaseOptionType caseOption, string whitespace)
 {
     this.Type = type;
     this.Header = header;
     this.Footer = footer;
     this.CaseOption = caseOption;
     this.Whitespace = whitespace;
 }
Пример #3
0
 /// <summary>
 /// Constructor specifying all properties
 /// </summary>
 /// <param name="type">The word type contained in the portion</param>
 /// <param name="value">The value for the custom string</param>
 /// <param name="header">string to be placed before portion</header>
 /// <param name="footer">string to be placed after portion</header>
 /// <param name="option">Option to be applied to case of portion</param>
 public FileNamePortion(FileWordType type, string header, string footer, CaseOptionType caseOption, string whitespace)
 {
     this.Type       = type;
     this.Header     = header;
     this.Footer     = footer;
     this.CaseOption = caseOption;
     this.Whitespace = whitespace;
 }
Пример #4
0
 /// <summary>
 /// Constructor with default RemoveAfterWords properties.
 /// </summary>
 /// <param name="SeperatorBefore">Separator type required before word</param>
 /// <param name="SeperatorAfter">Separator type required after word</param>
 /// <param name="Word">The word to remove from string</param>
 /// <param name="type">type of the word to remove</param>
 public RemoveFileWord(Separator seperatorBefore, Separator seperatorAfter, string word, FileWordType type)
 {
     this.SeparatorBefore = seperatorBefore;
     this.SeparatorAfter = seperatorAfter;
     this.Word = word;
     this.Type = type;
     this.RemoveFollowingEndWord = true;
     this.RemoveEverythingAfter = false;
 }
Пример #5
0
 /// <summary>
 /// Constructor specifying type and containers (header/footer) - no value assigned (can be used for all types except UserString)
 /// </summary>
 /// <param name="type">The word type contained in the portion</param>
 /// <param name="header">string to be placed before portion</param>
 /// <param name="footer">string to be placed after portion</param>
 /// <param name="caseOption">Option to be applied to case of portion</param>
 public FileNamePortion(FileWordType type, string header, string footer, CaseOptionType caseOption)
 {
     this.Type = type;
     this.Header = header;
     this.Footer = footer;
     this.CaseOption = CaseOptionType.None;
     this.Whitespace = " ";
 }
Пример #6
0
 /// <summary>
 /// Constructor with parameters for all properties
 /// </summary>
 /// <param name="seperatorBefore"></param>
 /// <param name="seperatorAfter"></param>
 /// <param name="word">The word to remove from string</param>
 /// <param name="type">type of the word to remove</param>
 /// <param name="removeAfterWords">Whether to also remove the word following if it is the last in the string</param>
 /// <param name="removeEverythingAfter">Whether to remove all characters after match</param>
 public RemoveFileWord(Separator seperatorBefore, Separator seperatorAfter, string word, FileWordType type, bool removeAfterWords, bool removeEverythingAfter)
     : this(seperatorBefore, seperatorAfter, word, type)
 {
     this.RemoveFollowingEndWord = removeAfterWords;
     this.RemoveEverythingAfter = removeEverythingAfter;
 }
Пример #7
0
        /// <summary>
        /// Combines string value for strings for a file word type from simplify results
        /// </summary>
        /// <param name="simplifyResult">File name simplifying results</param>
        /// <param name="type">Type of file word we want string of</param>
        /// <param name="combinedWord">Resulting combination of all strings of specified type</param>
        /// <returns>whether any words of the specified type were found in results</returns>
        private static bool GetFileWord(FileHelper.SimplifyStringResults simplifyResult, FileWordType type, out string combinedWord)
        {
            // Initialize combined string
            combinedWord = string.Empty;

            // Check if any word of the desired type were remove during simplify
            if (simplifyResult.RemovedWords.ContainsKey(type))
            {
                // Get words of desired type
                List <string> words = simplifyResult.RemovedWords[type];

                // Go through each removed word and build single string with all of them together
                for (int i = 0; i < words.Count; i++)
                {
                    if (i != 0)
                    {
                        combinedWord += "_";
                    }
                    combinedWord += words[i];
                }

                // Words were found
                return(true);
            }

            // No words of type found
            return(false);
        }
Пример #8
0
        /// <summary>
        /// Combines string value for strings for a file word type from simplify results
        /// </summary>
        /// <param name="simplifyResult">File name simplifying results</param>
        /// <param name="type">Type of file word we want string of</param>
        /// <param name="combinedWord">Resulting combination of all strings of specified type</param>
        /// <returns>whether any words of the specified type were found in results</returns>
        private static bool GetFileWord(FileHelper.SimplifyStringResults simplifyResult, FileWordType type, out string combinedWord)
        {
            // Initialize combined string
            combinedWord = string.Empty;

            // Check if any word of the desired type were remove during simplify
            if (simplifyResult.RemovedWords.ContainsKey(type))
            {
                // Get words of desired type
                List<string> words = simplifyResult.RemovedWords[type];

                // Go through each removed word and build single string with all of them together
                for (int i = 0; i < words.Count; i++)
                {
                    if (i != 0)
                        combinedWord += "_";
                    combinedWord += words[i];
                }

                // Words were found
                return true;
            }

            // No words of type found
            return false;
        }
Пример #9
0
 /// <summary>
 /// Constructor with default RemoveAfterWords properties.
 /// </summary>
 /// <param name="SeperatorBefore">Separator type required before word</param>
 /// <param name="SeperatorAfter">Separator type required after word</param>
 /// <param name="Word">The word to remove from string</param>
 /// <param name="type">type of the word to remove</param>
 public RemoveFileWord(Separator seperatorBefore, Separator seperatorAfter, string word, FileWordType type)
 {
     this.SeparatorBefore        = seperatorBefore;
     this.SeparatorAfter         = seperatorAfter;
     this.Word                   = word;
     this.Type                   = type;
     this.RemoveFollowingEndWord = true;
     this.RemoveEverythingAfter  = false;
 }
Пример #10
0
 /// <summary>
 /// Constructor with parameters for all properties
 /// </summary>
 /// <param name="seperatorBefore"></param>
 /// <param name="seperatorAfter"></param>
 /// <param name="word">The word to remove from string</param>
 /// <param name="type">type of the word to remove</param>
 /// <param name="removeAfterWords">Whether to also remove the word following if it is the last in the string</param>
 /// <param name="removeEverythingAfter">Whether to remove all characters after match</param>
 public RemoveFileWord(Separator seperatorBefore, Separator seperatorAfter, string word, FileWordType type, bool removeAfterWords, bool removeEverythingAfter)
     : this(seperatorBefore, seperatorAfter, word, type)
 {
     this.RemoveFollowingEndWord = removeAfterWords;
     this.RemoveEverythingAfter  = removeEverythingAfter;
 }