/// <summary> /// Конструктор /// </summary> /// <param name="usedEncryption">Тип шифрования куков</param> public YAuthStorage(YAuthStorageEncryption usedEncryption = YAuthStorageEncryption.None) { User = new YUser(); Context = new HttpContext(); // Шифрование encryptor = new Encryptor($""); encryption = usedEncryption; }
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); } } }