예제 #1
0
        private string GenerateNewSecret()
        {
            string secret = Cryptor.GenerateSecret();

            JsonStorage.Save("session_secret", new Dictionary <string, object>
            {
                { "exp", DateTime.UtcNow.AddDays(1).ToBinary() },
                { "val", secret }
            });
            return(secret);
        }
예제 #2
0
        static void Main(string[] args)
        {
            BankAccount        acc1         = new BankAccount("Jane Doe", 2000.50m, 20, AccountType.Gold, true);
            BankAccount        acc2         = new BankAccount("John Doe", 15000.50m, 50, AccountType.Platinum, true);
            BankAccount        acc3         = new BankAccount("Steve McQueen", 500.50m, 10, AccountType.Base, true);
            BankAccount        acc4         = new BankAccount("Alice Cooper", 500.50m, 10, AccountType.Base, false);
            List <BankAccount> bankAccounts = new List <BankAccount>();

            bankAccounts.AddRange(new[] { acc1, acc2, acc3, acc4 });

            IStorage <BankAccount> storage = new JsonStorage(bankAccounts);

            storage.Save();
            IRepository <BankAccount> repository = new BankAccountRepository(storage);
            BankAccountService        service    = new BankAccountService(repository);

            //service.Create(acc1);
            //service.Create(acc2);
            //service.Create(acc3);
            service.Print();

            Console.WriteLine();
        }
예제 #3
0
 public void Save()
 {
     _storage.Save(_saveGameStorageModel);
 }