public static void UpdateBranch(string filepath, Branch branch) { BranchJSON branchJSON = new BranchJSON(branch); var options = JSONFileFormat.GetJsonSerializerOptions(); string json = JsonSerializer.Serialize(branchJSON, options); File.WriteAllText(filepath, json); }
public static Branch LoadBranch(string filepath, DirectoryStructure directory) { string json; try { json = File.ReadAllText(filepath); } catch { throw new FileNotFoundException(filepath); } BranchJSON branchJSON = JsonSerializer.Deserialize <BranchJSON>(json); return(branchJSON.GetBranch(directory)); }