예제 #1
0
        public async Task Import(
            ILogger logger,
            CancellationToken cancel)
        {
            if (!File.Exists(SettingsPath))
            {
                return;
            }
            var txt = await File.ReadAllTextAsync(SettingsPath, cancel);

            var json = JsonDocument.Parse(txt);

            ObjectSettingsVM.ImportStatic(_nodes, json.RootElement, logger);
        }
예제 #2
0
        public void Persist(ILogger logger)
        {
            var doc = new JObject();

            ObjectSettingsVM.PersistStatic(_nodes, null, doc, logger);
            Directory.CreateDirectory(Path.GetDirectoryName(SettingsPath) !);
            File.WriteAllText(SettingsPath, doc.ToString());
            if (!Repository.IsValid(SettingsFolder))
            {
                Repository.Init(SettingsFolder);
            }
            using var repo = new Repository(SettingsFolder);
            Commands.Stage(repo, SettingsSubPath);
            var sig = new Signature("Synthesis", "*****@*****.**", DateTimeOffset.Now);

            try
            {
                repo.Commit("Settings changed", sig, sig);
            }
            catch (EmptyCommitException)
            {
            }
        }
 public EnumerableObjectSettingsVM(SettingsParameters param, string memberName, Type t)
     : base(memberName)
 {
     _prototype = new ObjectSettingsVM(param, string.Empty, t);
     Init();
 }
 private EnumerableObjectSettingsVM(string memberName, ObjectSettingsVM prototype)
     : base(memberName)
 {
     _prototype = prototype;
     Init();
 }