private IEnumerable <string> GetFileContent(IGeneralFile file)
        {
            DataReader dataReader = new DataReader(this._fileSystem);

            string[] fileContent = dataReader.ReadSingleFileIntoStringArray(file);
            return(fileContent);
        }
 public string[] ReadSingleFileIntoStringArray(IGeneralFile file)
 {
     string[] fileContentStringArray = this._fileSystem.File.ReadAllLines(
         path: file.Path,
         encoding: Encoding.GetEncoding(1252));
     return(fileContentStringArray);
 }
Exemple #3
0
 public void WriteFromStringListsToLatexFile(
     IGeneralFile templateFile,
     IGeneralFile writeFile,
     StringTupleLists stringTupleLists)
 {
     this.FileSystem.File.WriteAllLines(
         path: writeFile.Path,
         contents: this.GetReplacedFileContent(templateFile, stringTupleLists),
         encoding: Encoding.GetEncoding(1252));
 }
        public StringTupleLists GetBasicStringListsForSingleTextFile(IGeneralFile file)
        {
            IEnumerable <string> fileContent                = this.GetFileContent(file);
            FileContentParser    fileContentParser          = new FileContentParser();
            StringTupleLists     stringTupleCollectionsList = new StringTupleLists
            {
                List = fileContentParser.GetStringTupleListFromFileContent(
                    fileContent,
                    file.Name)
            };

            return(stringTupleCollectionsList);
        }
Exemple #5
0
        private string[] GetReplacedFileContent(IGeneralFile file, StringTupleLists stringTupleLists)
        {
            string[] fileContent = this._dataReader.ReadSingleFileIntoStringArray(file);
            for (int i = 0; i < fileContent.Length; i++)
            {
                foreach (Tuple <string, string> stringTuple in stringTupleLists.List)
                {
                    fileContent[i] = fileContent[i].Replace(stringTuple.Item1, stringTuple.Item2);
                }
            }

            return(fileContent);
        }