public static async void WriteNew(string configKey, string username, string password, string baseUrl, string certificateThumb, int checkIntervalSeconds) { var path = new R2ConfigFile1().GetFilePath(configKey); await new FileSystemAccesor1().Delete(path); ParseOrDefault(configKey, username, password, baseUrl, certificateThumb, checkIntervalSeconds); }
public new static R2ConfigFile1 Parse(string configKey) { var fs = new FileSystemAccesor1(); var cfg = new R2ConfigFile1(); var path = cfg.GetFilePath(configKey); var cfgPwd = Saltify(configKey); return(fs.DecryptJsonFile <R2ConfigFile1>(path, cfgPwd)); }
public static R2ConfigFile1 ParseOrDefault(string configKey, string username, string password, string baseUrl, string certificateThumb, int checkIntervalSeconds) { var path = new R2ConfigFile1().GetFilePath(configKey); if (File.Exists(path)) { return(Parse(configKey)); } var cfg = new R2ConfigFile1 { Username = username, Password = password, BaseURL = baseUrl, CertificateThumb = certificateThumb, CheckIntervalSeconds = checkIntervalSeconds, }; new FileSystemAccesor1() .EncryptJsonToFile(path, cfg, Saltify(configKey)); return(cfg); }