/// <summary> /// Opens an assembly info file and puts it into a myFile /// </summary> /// <param name="filename">Path to a folder containing an assembly info file</param> /// <returns>Returns a myFile with the contents of the assembly info file</returns> public myFile openAssemblyInfo(string filename) { myFile info = new myFile(); info.setFilename(filename); string path = filename + "\\properties\\AssemblyInfo.cs"; if (File.Exists(path)) { foreach (string line in File.ReadLines(filename + "\\properties\\AssemblyInfo.cs", Encoding.UTF8)) { info.add(line); } } return(info); }
/// <summary> /// Opens a json file and puts the contents into a myFile /// </summary> /// <param name="filename">A path that contains a manifest.json file</param> /// <returns>Returns a myFile that contains the contents and the corresponding path</returns> public myFile openJSON(string filename) { myFile json = new myFile(); json.setFilename(filename); try { foreach (string line in File.ReadLines(filename + "\\manifest.json", Encoding.UTF8)) { json.add(line); } } catch (System.IO.FileNotFoundException) { Console.WriteLine(); } return(json); }
/// <summary> /// Opens multiple json files /// </summary> /// <param name="dir">Main parent directory</param> /// <returns>Returns a list contaning myFiles of each manifest.json file.</returns> public List <myFile> openAllJson(string dir) { List <myFile> dic = new List <myFile>(); List <string> direcs = GetDirectories(dir); foreach (string location in direcs) { string[] temp = File.ReadAllLines(location + "\\manifest.json"); myFile json = new myFile(temp); json.setFilename(location); dic.Add(json); } return(dic); }