//==== READ Methods ==== // Read: InputDoc // "Initialize Object Properties" public void Read_InputDoc(string _inputFilePath) { this.Txt_FilePath = _inputFilePath; // Populate 'textLines' Array from .txt document this.TextArray = System.IO.File.ReadAllLines(this.Txt_FilePath); this.LinesList = TextArray.ToList(); this.LineCount = LinesList.Count(); Console.WriteLine("LineCount: " + LineCount); }
// Mod Line to TitleCasing public void ToTitleCase() { TextInfo textInfo = new CultureInfo("en-US", false).TextInfo; for (int i = 0; i < LinesList.Count(); i++) { if (LinesList[i].Contains("MODULE") || LinesList[i].ToUpper().Contains("KNOWLEDGE CHECK")) { LinesList[i] = textInfo.ToTitleCase(LinesList[i]); } } }
// Flag Module Breaks public void FlagModuleBreaks() { TextInfo textInfo = new CultureInfo("en-US", false).TextInfo; for (int i = 0; i < LinesList.Count(); i++) { string line = LinesList[i]; if (LinesList[i].ToUpper().Contains("SUBMODULE")) { LinesList[i] = LinesList[i].Replace("SUBMODULE", "Submodule"); LinesList[i] = textInfo.ToTitleCase(LinesList[i]); LinesList[i] = LinesList[i].Insert(0, "###"); } else if (LinesList[i].ToUpper().Contains("MODULE")) { LinesList[i] = LinesList[i].Replace("MODULE", "Module"); LinesList[i] = textInfo.ToTitleCase(LinesList[i]); LinesList[i] = LinesList[i].Insert(0, "***"); } } }