Пример #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)
            {
                Log.Error($"TryReadFile<{obj?.GetType()}>: {e}");
                return(false);
            }
        }
Пример #2
0
        public static void Persist <T>(string path, T obj)
        {
            var objEncrypted = Encrypt(JsonConvert.SerializeObject(obj));

            SystemInteraction.Persist(path, objEncrypted);
        }