public static bool TryReadFile <T>(string path, out T obj) { obj = default(T); try { var objDecrypted = Decrypt(SystemInteraction.ReadAllText(path)); obj = JsonConvert.DeserializeObject <T>(objDecrypted); return(true); } catch (Exception e) { Logger.Error($"TryReadFile<{obj?.GetType()}>: {e}"); return(false); } }
public static void Persist <T>(string path, T obj) { var objEncrypted = Encrypt(JsonConvert.SerializeObject(obj)); SystemInteraction.Persist(path, objEncrypted); }