示例#1
0
        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);
        }
示例#2
0
        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));
        }