public static string GetDecryptedString(string value, string password) { if (string.IsNullOrEmpty(value)) { return(string.Empty); } try { return(AESUtility.Decrypt(value, password)); } catch (Exception) { return(string.Empty); } }
public static bool LoadFromFile <T>(this T item, string filePath, bool isEncrypted = false, string password = "") where T : IFileSerializable, IJSONSerializable { if (File.Exists(filePath) == false) { return(false); } string jsonText = File.ReadAllText(filePath); if (isEncrypted) { jsonText = AESUtility.Decrypt(jsonText, password); } var jToken = JToken.Parse(jsonText); return(item.FromJSON(jToken)); }