private void SetDefaults() { SearchAndReplaceMethod = SearchAndReplaceMethod.LineByLine; OutputFile = "SearchAndReplaceOutput.txt"; NoUI = false; // Remove Diacritics existing set SearchAndReplaceDataSource = SearchAndReplaceDataSource.ExistingSet; string existingSetCommandLineName = "RemoveDiacritics"; SearchAndReplaceExistingSetInfo = SearchAndReplaceUtil.ExistingSets[SearchAndReplaceUtil.GetExistingSetInfoIndexByCommandLineName(existingSetCommandLineName)]; SearchAndReplaceContent = SearchAndReplaceUtil.GetExistingSetByCommandLineName(existingSetCommandLineName); }
public static void SearchAndReplaceInFile(string[][] searchAndReplace, string fileIn, string fileOut = null, SearchAndReplaceMethod method = SearchAndReplaceMethod.WholeFileInMemory, Encoding encoding = null) { switch(method) { case SearchAndReplaceMethod.LineByLine: SearchAndReplaceInFile_LineByLine(searchAndReplace, fileIn, fileOut, encoding); break; case SearchAndReplaceMethod.WholeFileInMemory: SearchAndReplaceInFile_WholeFileInMemory(searchAndReplace, fileIn, fileOut, encoding); break; default: throw new Exception("Search and replace method needs to be implemented"); } }
public static void SearchAndReplaceInFile(string fileSearchAndReplace, string fileIn, string fileOut = null, SearchAndReplaceMethod method = SearchAndReplaceMethod.WholeFileInMemory, Encoding encoding = null) { string[][] searchAndReplace = GetSearchAndReplaceArray(fileSearchAndReplace); SearchAndReplaceInFile(searchAndReplace, fileIn, fileOut, method, encoding); }
public static void SearchAndReplaceInFile(string[][] searchAndReplace, string fileIn, string fileOut = null, SearchAndReplaceMethod method = SearchAndReplaceMethod.WholeFileInMemory, Encoding encoding = null) { switch (method) { case SearchAndReplaceMethod.LineByLine: SearchAndReplaceInFile_LineByLine(searchAndReplace, fileIn, fileOut, encoding); break; case SearchAndReplaceMethod.WholeFileInMemory: SearchAndReplaceInFile_WholeFileInMemory(searchAndReplace, fileIn, fileOut, encoding); break; default: throw new Exception("Search and replace method needs to be implemented"); } }