Exemple #1
0
 public CheckReminders(UserAccounts accounts, Global global, LoginFromConsole log)
 {
     _accounts = accounts;
     _global   = global;
     _log      = log;
     CheckTimer();
 }
Exemple #2
0
        public static async Task InitializeServicesAsync(this IServiceProvider services)
        {
            var singletonServicesCount = 0;
            var transientServicesCount = 0;

            var watchSingleton = Stopwatch.StartNew();

            foreach (var type in Assembly.GetEntryAssembly().GetTypes()
                     .Where(x => typeof(IServiceSingleton).IsAssignableFrom(x) && !x.IsInterface))
            {
                singletonServicesCount++;
                await((IServiceSingleton)services.GetRequiredService(type)).InitializeAsync();
            }
            watchSingleton.Stop();


            var watchTransient = Stopwatch.StartNew();

            foreach (var type in Assembly.GetEntryAssembly().GetTypes()
                     .Where(x => typeof(IServiceTransient).IsAssignableFrom(x) && !x.IsInterface))
            {
                transientServicesCount++;
                await((IServiceTransient)services.GetRequiredService(type)).InitializeAsync();
            }
            watchTransient.Stop();

            var log = new LoginFromConsole();

            log.Info($"\nSingleton Initialized count: {singletonServicesCount} ({watchSingleton.Elapsed:m\\:ss\\.ffff}s.)");
            log.Info($"Transient Initialized count: {transientServicesCount} ({watchTransient.Elapsed:m\\:ss\\.ffff}s.)\n");
        }
Exemple #3
0
 public Reminder(UserAccounts accounts, SecureRandom secureRandom, OctoNamePull octoNamePull, HelperFunctions helperFunctions, LoginFromConsole log, Global global)
 {
     _accounts        = accounts;
     _secureRandom    = secureRandom;
     _octoNamePull    = octoNamePull;
     _helperFunctions = helperFunctions;
     _log             = log;
     _global          = global;
 }
Exemple #4
0
 public Config(LoginFromConsole log)
 {
     try
     {
         JsonConvert.PopulateObject(File.ReadAllText(@"DataBase/OctoDataBase/config.json"), this);
     }
     catch (Exception ex)
     {
         log.Critical(ex);
         Console.ReadKey();
         Environment.Exit(-1);
     }
 }
Exemple #5
0
        public static IServiceCollection AutoAddTransient(this IServiceCollection services)
        {
            var transientServicesCount = 0;

            var watchTransient = Stopwatch.StartNew();

            foreach (var type in Assembly.GetEntryAssembly().GetTypes()
                     .Where(x => typeof(IServiceTransient).IsAssignableFrom(x) && !x.IsInterface))
            {
                transientServicesCount++;
                services.AddTransient(type);
            }
            watchTransient.Stop();

            var log = new LoginFromConsole();

            log.Info($"Transient added count: {transientServicesCount} ({watchTransient.Elapsed:m\\:ss\\.ffff}s.)");
            return(services);
        }
Exemple #6
0
        public static IServiceCollection AutoAddSingleton(this IServiceCollection services)
        {
            var singletonServicesCount = 0;


            var watchSingleton = Stopwatch.StartNew();

            foreach (var type in Assembly.GetEntryAssembly().GetTypes()
                     .Where(x => typeof(IServiceSingleton).IsAssignableFrom(x) && !x.IsInterface))
            {
                singletonServicesCount++;
                services.AddSingleton(type);


                // type.GetInterfaces().FirstOrDefault(x => !(x is typeof(IServiceSingleton)))
                //x != typeof(IService)
            }
            watchSingleton.Stop();

            var log = new LoginFromConsole();

            log.Info($"Singleton added count: {singletonServicesCount} ({watchSingleton.Elapsed:m\\:ss\\.ffff}s.)");
            return(services);
        }
 public LoggingSystemDataStorage(LoginFromConsole log)
 {
     _log = log;
 }
 public ServerDataStorage(LoginFromConsole log)
 {
     _log = log;
 }
Exemple #9
0
 public SpellDataStorage(LoginFromConsole log)
 {
     _log = log;
 }
 public UserAccountsDataStorage(LoginFromConsole log)
 {
     _log = log;
 }