public void SaveToFile(String path, String password) { var json = JsonConvert.SerializeObject(this); var bytes = Fi.StandardEncoding.GetBytes(json); var autokryptex = new TheAutoEncryptorV1(password, 429497291); var encryptedBytes = autokryptex.Encrypt(bytes); File.WriteAllBytes(path, encryptedBytes); }
public static PgSQLPluginConfiguration LoadFromFile(String path, String password) { if (!File.Exists(path)) { return(null); } var bytes = File.ReadAllBytes(path); var autokryptex = new TheAutoEncryptorV1(password, 429497291); var decryptedBytes = autokryptex.Decrypt(bytes); var json = Fi.StandardEncoding.GetString(decryptedBytes); var obj = JsonConvert.DeserializeObject <PgSQLPluginConfiguration>(json); return(obj); }