//Find Array Items public static string[] CallFindArrayItems(string[] InputArray, string[] FilterWords, string anchorTextParamText, bool displayLog) { string[] OutputResults = null; //Get Anchor Text Parameter EnumAnchorTextParam anchorTextParam = ReturnAnchorTextParam(anchorTextParamText); switch (anchorTextParam) { //Any of the Anchor Words case EnumAnchorTextParam.Any: //Loop through the Words foreach (string Word in FilterWords) { string[] SingleWord = { Word }; //Run Extraction OutputResults = Utils.QueryArrayString(InputArray, SingleWord, displayLog); //Exit the Loop in case result is found if (OutputResults.Length > 0) { //Exit the Loop goto ExitLoop; } } break; //All of the Anchor Words case EnumAnchorTextParam.All: //Run Extraction OutputResults = Utils.QueryArrayString(InputArray, FilterWords, displayLog); break; } ExitLoop: return(OutputResults); }
//Extract Text Above Anchor Words public static string[] CallExtractTextAboveAnchorWords(string inputText, string[] anchorWords, string anchorTextParamText, int LinesAbove, int NumLines, bool displayLog, bool displayRegex) { string[] OutputResults = null; //Get Anchor Text Parameter EnumAnchorTextParam anchorTextParam = ReturnAnchorTextParam(anchorTextParamText); switch (anchorTextParam) { //Any of the Anchor Words case EnumAnchorTextParam.Any: //Loop through the Words foreach (string Word in anchorWords) { //Loop through last words OutputResults = Utils.ExtractTextLinePreviousAnchorText(inputText, Word, LinesAbove, NumLines, displayLog, displayRegex); //Exit the Loop in case result is found if (OutputResults.Length > 0) { //Exit the Loop goto ExitLoop; } } break; //All of the Anchor Words case EnumAnchorTextParam.All: //Extract text Below Line Array Tag OutputResults = Utils.ExtractTextLinePreviousAnchorArrayText(inputText, anchorWords, LinesAbove, NumLines, displayLog, displayRegex); break; } ExitLoop: return(OutputResults); }
public static EnumAnchorTextParam ReturnAnchorTextParam(string anchorTextParamText) { //Fill in Variable anchorTextParam EnumAnchorTextParam anchorTextParam = EnumAnchorTextParam.Null; //Fill in Variable anchorTextParam switch (anchorTextParamText) { //Any case "Any": anchorTextParam = EnumAnchorTextParam.Any; break; //All case "All": anchorTextParam = EnumAnchorTextParam.All; break; } return(anchorTextParam); }
//Extract all Lines Below Anchor Text public static string[] CallExtractAllLinesBelowAnchorText(string inputText, string[] anchorText, string anchorTextParamText, bool displayLog, bool displayRegex) { string[] OutputResults = null; //Get Anchor Text Parameter EnumAnchorTextParam anchorTextParam = ReturnAnchorTextParam(anchorTextParamText); //Check the Variable switch (anchorTextParam) { //Any of the Anchor Words case EnumAnchorTextParam.Any: //Loop through the Words foreach (string Word in anchorText) { OutputResults = Utils.ExtractTextAllLinesBelowStartTAGUntilEnd(inputText, Word, displayLog, displayRegex); //Exit the Loop in case result is found if (OutputResults.Length > 0) { //Exit the Loop goto ExitLoop; } } break; //All of the Anchor Words case EnumAnchorTextParam.All: //Extract All Lines Below Anchor Text Array of Strings OutputResults = Utils.ExtractTextAllLinesBelowArrayTAGUntilEnd(inputText, anchorText, displayLog, displayRegex); break; } ExitLoop: return(OutputResults); }
//Extract Text Until Blank Lines public static string[] CallExtractTextUntilBlankLine(string inputText, string[] anchorWords, string anchorWordsParameterText, string directionText, bool includeAnchorWordsRow, bool displayLog, bool displayRegex) { string[] OutputResults = null; //Fill in Variable anchorTextParam EnumAnchorTextParam anchorTextParam = ReturnAnchorTextParam(anchorWordsParameterText); EnumDirection DirectionParam = EnumDirection.Null; //Fill in Variable Direction switch (directionText) { //Above case "Above": DirectionParam = EnumDirection.Above; break; //Below case "Below": DirectionParam = EnumDirection.Below; break; } //Check Direction Variable switch (DirectionParam) { //Below #region Direction: Below case EnumDirection.Below: //Chech Anchor Words Parameter switch (anchorTextParam) { //Any of the Anchor Words case EnumAnchorTextParam.Any: //Loop through the Words foreach (string Word in anchorWords) { //Extract text Below Line Text Until Blank Line OutputResults = Utils.ExtractAllLinesBelowAnchorTextUntilBlankline(inputText, Word, displayLog, displayRegex, includeAnchorWordsRow); //Exit the Loop in case result is found if (OutputResults.Length > 0) { //Exit the Loop goto ExitLoop; } } break; //All of the Anchor Words case EnumAnchorTextParam.All: //Extract text Below Line Array Text Until Blank Line OutputResults = Utils.ExtractAllLinesBelowAnchorArrayofTextUntilBlankline(inputText, anchorWords, displayLog, displayRegex, includeAnchorWordsRow); break; } //End Above Code break; #endregion //Above #region Direction: Above case EnumDirection.Above: //Chech Anchor Words Parameter switch (anchorTextParam) { //Any of the Anchor Words case EnumAnchorTextParam.Any: //Loop through the Words foreach (string Word in anchorWords) { //Extract text Above Line Text Until Blank Line OutputResults = Utils.ExtractAllLinesAboveAnchorTextUntilBlankline(inputText, Word, displayLog, displayRegex, includeAnchorWordsRow); //Exit the Loop in case result is found if (OutputResults.Length > 0) { //Exit the Loop goto ExitLoop; } } break; //All of the Anchor Words case EnumAnchorTextParam.All: //Extract text Above Line Array Text Until Blank Line OutputResults = Utils.ExtractAllLinesAboveAnchorArrayofTextUntilBlankline(inputText, anchorWords, displayLog, displayRegex, includeAnchorWordsRow); break; } //End Below Code break; #endregion #region Direction: Both Directions case EnumDirection.Both: //Chech Anchor Words Parameter switch (anchorTextParam) { //Any of the Anchor Words case EnumAnchorTextParam.Any: //Loop through the Words foreach (string Word in anchorWords) { //Extract All Lines Both Direction Anchor Text Between Blank Lines OutputResults = Utils.ExtractAllLinesBothDirectionsAnchorTextBetweenBlanklines(inputText, Word, displayLog, displayRegex); } break; //All of the Anchor Words case EnumAnchorTextParam.All: //Extract All Lines Both Direction Anchor Text Array Between Blank Lines OutputResults = Utils.ExtractAllLinesBothDirectionsAnchorArrayofTextBetweenBlanklines(inputText, anchorWords, displayLog, displayRegex); break; } //End Both Directions Code break; #endregion } ExitLoop: return(OutputResults); }