/// <summary> /// Writes the manifest.json file with the version of the given object /// </summary> /// <param name="file">A version object to be written</param> /// <returns>Returns True if the file was written to and False if it was not</returns> public bool writejsonVersion(Version file) { bool worked = false; string pattern = "[:][' ']\"[^\"]+\""; int count = 0; string[] temp = File.ReadAllLines(file.getName() + "\\manifest.json"); foreach (string thing in temp) { if (thing.Contains("version") && count < 2) { temp[count] = Regex.Replace(thing, pattern, ": \"" + file.getVersion() + '"'); worked = true; break; } count++; } if (worked == true) { File.WriteAllLines(file.getName() + "\\manifest.json", temp); } return(worked); }
/// <summary> /// Bumps all of the children contained in a parent directory. Does not write anything to file. /// </summary> /// <param name="filename">Path to the main directory</param> /// <returns>Returns a dictionary containing the paths to the children and their corresponding bumped versions.</returns> public Dictionary <string, string> bumpChildrenRewrite(string filename) { Dictionary <string, string> kids = new Dictionary <string, string>(); List <string> files = GetDirectories(filename); myFile file = new myFile(); foreach (string child in files) { file = openAssemblyInfo(child); Version little = getchildVersion(file); little.bumpRewrite(); kids.Add(little.getName(), little.getVersion()); } return(kids); }
/// <summary> /// Takes a path and creates a dictionary containing the name of each child and the corresponding version of the child. /// </summary> /// <param name="filename">The path to the parent</param> /// <returns></returns> public Dictionary <string, string> getAllChildrenVersions(string filename) { Dictionary <string, string> kids = new Dictionary <string, string>(); List <string> filesdirec = GetDirectories(filename); myFile file = new myFile(); foreach (string child in filesdirec) { file = openAssemblyInfo(child); { if (file.getCount() != 0) { Version little = getchildVersion(file); kids.Add(little.getName(), little.getVersion()); } } } return(kids); }