Example #1
0
        static void Main(string[] args)
        {
            if (args == null || args.Length == 0)
            {
                Console.WriteLine("1 args required");
                return;
            }
            var path = args[0];

            var zip = args.Length > 1 ? Boolean.TrueString.ToLower() == args[1].ToLower() : false;

            if (zip)
            {
                Console.WriteLine("zip will be enabled");
            }
            var cancelToken = new CancellationTokenSource();

            Console.CancelKeyPress += delegate(object sender, ConsoleCancelEventArgs e)
            {
                e.Cancel = true;
                cancelToken.Cancel(true);
            };
            var config   = AppSettingsService.BuildConfiguration("appsettings.json");
            var services = new ServiceCollection();

            services.AddAppServices(config);
            services.AddSingleton <UploadManager>();
            var serviceProvider = services.BuildGlobalServices(bulder =>
            {
                bulder.RegisterGeneric(typeof(Logger <>)).As(typeof(ILogger <>)).SingleInstance();
            });

            serviceProvider.GetService <UploadManager>().UploadAll(path, zip, cancelToken.Token).Wait();
        }
Example #2
0
        public FilPanDbContext CreateDbContext(string[] args)
        {
            var config   = AppSettingsService.BuildConfiguration("appsettings.json");
            var services = new ServiceCollection();

            services.AddAppServices(config);
            var serviceProvider = services.BuildGlobalServices();

            return(serviceProvider.GetService <FilPanDbContext>());
        }
Example #3
0
        static void Main(string[] args)
        {
            var cancelToken = new CancellationTokenSource();

            Console.CancelKeyPress += delegate(object sender, ConsoleCancelEventArgs e)
            {
                e.Cancel = true;
                cancelToken.Cancel(true);
            };
            var config   = AppSettingsService.BuildConfiguration("appsettings.json");
            var services = new ServiceCollection();

            services.AddAppServices(config);
            services.AddSingleton <MaintainManager>();
            var serviceProvider = services.BuildGlobalServices(bulder =>
            {
                bulder.RegisterGeneric(typeof(Logger <>)).As(typeof(ILogger <>)).SingleInstance();
            });

            serviceProvider.GetService <MaintainManager>().Maintain2(cancelToken.Token).Wait();
        }
Example #4
0
 static void Main(string[] args)
 {
     try
     {
         var config   = AppSettingsService.BuildConfiguration("appsettings.json");
         var services = new ServiceCollection();
         services.AddAppServices(config);
         var serviceProvider = services.BuildGlobalServices();
         var powergateClient = serviceProvider.GetService <PowergateClient>();
         var addrs           = powergateClient.Net.ListenAddr(new Net.Rpc.ListenAddrRequest());
         Console.WriteLine("powergate net info:");
         Console.WriteLine("net id: {0}", addrs.AddrInfo.Id);
         Console.WriteLine("net addrs: {0}", string.Join(',', addrs.AddrInfo.Addrs));
         var botaddrs = powergateClient.Ffs.Addrs(new Ffs.Rpc.AddrsRequest(), powergateClient.BotXFfsToken);
         Console.WriteLine("powergate ffs addrs:");
         Console.WriteLine("ffs addrs: {0}", Newtonsoft.Json.JsonConvert.SerializeObject(botaddrs));
     }
     catch (Exception ex)
     {
         Console.WriteLine("powergate test failed:");
         Console.WriteLine(ex.ToString());
     }
 }
Example #5
0
        public static void Main(string[] args)
        {
            var config = AppSettingsService.BuildConfiguration("appsettings.json");

            CreateHostBuilder(config, args).Build().Run();
        }