예제 #1
0
        /// <summary>
        /// Конструктор
        /// </summary>
        /// <param name="usedEncryption">Тип шифрования куков</param>
        public YAuthStorage(YAuthStorageEncryption usedEncryption = YAuthStorageEncryption.None)
        {
            User = new YUser();

            Context = new HttpContext();

            // Шифрование
            encryptor  = new Encryptor($"");
            encryption = usedEncryption;
        }
예제 #2
0
        public async Task SaveAsync(YUser user)
        {
            File.Delete(_filePath);

            var jsonUser = JsonConvert.SerializeObject(user);

            using (var stream = new FileStream(_filePath, FileMode.OpenOrCreate))
            {
                using (var writer = new StreamWriter(stream))
                {
                    await writer.WriteAsync(jsonUser);
                }
            }
        }