Esempio n. 1
0
        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);
            }
        }
Esempio n. 2
0
        public static void Persist <T>(string path, T obj)
        {
            var objEncrypted = Encrypt(JsonConvert.SerializeObject(obj));

            SystemInteraction.Persist(path, objEncrypted);
        }