Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            XTrace.UseConsole();

            var set = AntSetting.Current;

            // 实例化调度器
            var sc = new Scheduler();

            // 使用分布式调度引擎替换默认的本地文件调度
            sc.Provider = new NetworkJobProvider
            {
                Server = set.Server,
                AppID  = set.AppID,
                Secret = set.Secret,
            };

            // 添加作业处理器
            sc.Handlers.Add(new HelloJob());
            sc.Handlers.Add(new BuildPatient());
            sc.Handlers.Add(new BuildWill());

            // 启动调度引擎,调度器内部多线程处理
            sc.Start();

            Console.WriteLine("OK!");
            Console.ReadKey();
        }
Ejemplo n.º 2
0
        private static void Main(string[] args)
        {
            Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.BelowNormal;

            //XTrace.Log = new NetworkLog();
            XTrace.UseConsole();
#if DEBUG
            XTrace.Debug = true;
#endif
            while (true)
            {
                Stopwatch sw = new Stopwatch();
                sw.Start();
#if !DEBUG
                try
                {
#endif
                Test4();
#if !DEBUG
            }
            catch (Exception ex)
            {
                XTrace.WriteException(ex);
            }
#endif

                sw.Stop();
                Console.WriteLine("OK! 耗时 {0}", sw.Elapsed);
                ConsoleKeyInfo key = Console.ReadKey(true);
                if (key.Key != ConsoleKey.C)
                {
                    break;
                }
            }
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            SetConsoleCtrlHandler(consoleCtrlDelegate, 1);
            XTrace.UseConsole();
            var currentDir =
                new FileInfo(Uri.UnescapeDataString(new Uri(Assembly.GetExecutingAssembly().CodeBase).AbsolutePath));
            var appPath = currentDir.DirectoryName;

            if (string.IsNullOrWhiteSpace(appPath))
            {
                throw new ApplicationException("app path not found.");
            }
            if (!Directory.Exists(Config.Current.MusicPath))
            {
                throw new ApplicationException("MusicPath path not found.");
            }

            NewBiliRtmpPush();
            //TestPipeIn();
            //TestPipeOut();
            //RunBiliRtmpPush();
            while (true)
            {
                Console.ReadKey(false);
            }
        }
Ejemplo n.º 4
0
        static void Main(String[] args)
        {
            XTrace.UseConsole();

            var set = Setting.Current;

            var sc = new ApiServer(set.Port)
            {
                Log = XTrace.Log
            };

            if (set.Debug)
            {
                var ns = sc.EnsureCreate() as NetServer;
                ns.Log = XTrace.Log;
#if DEBUG
                ns.LogSend    = true;
                ns.LogReceive = true;
                sc.EncoderLog = XTrace.Log;
#endif
            }

            // 注册服务
            sc.Register <StarService>();

            StarService.Log   = XTrace.Log;
            StarService.Local = new IPEndPoint(NetHelper.MyIP(), set.Port);

            sc.Start();

            _Server = sc;

            Thread.Sleep(-1);
        }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            XTrace.UseConsole();
            SMTS.ServiceMain();

            Console.ReadKey();
        }
Ejemplo n.º 6
0
        static void Main(string[] args)
        {
            XTrace.UseConsole();
            Console.WriteLine("进入Redis消息订阅者模式订单消息推送订阅者客户端!");

            EventBus eventBus = new EventBus();

            eventBus.EventRegister(typeof(OrderCreateEventNotifyHandle), typeof(OrderCreateEventData));
            eventBus.EventRegister(typeof(OrderCreateEventStockLockHandle), typeof(OrderCreateEventData));

            FullRedis fullRedis = new FullRedis("127.0.0.1:6379", "", 1);

            fullRedis.Log     = XTrace.Log;
            fullRedis.Timeout = 30000;
            OrderModel order = null;

            while (order == null)
            {
                order = fullRedis.BLPOP <OrderModel>("orders", 20);
                if (order != null)
                {
                    Console.WriteLine($"得到订单信息:{JsonConvert.SerializeObject(order)}");
                    //执行相关事件
                    eventBus.Trigger(new OrderCreateEventData()
                    {
                        Order = order,
                    });
                    //再次设置为null方便循环读取
                    order = null;
                }
            }
            Console.ReadLine();
        }
Ejemplo n.º 7
0
        static void Main(String[] args)
        {
            MachineInfo.RegisterAsync();
            XTrace.UseConsole();

            Console.Write("输出要执行的测试方法序号:");
            var idx = Console.ReadLine().ToInt();

            try
            {
                //Test1();
                var mi = typeof(Program).GetMethod("Test" + idx, BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
                if (mi != null)
                {
                    mi.Invoke(null, null);
                }
            }
            catch (Exception ex)
            {
                XTrace.WriteException(ex);
            }

            Console.WriteLine("OK");
            Console.Read();
        }
Ejemplo n.º 8
0
        protected IActionResult ExecutePack(string project, string service)
        {
            XTrace.UseConsole();
            Response.ContentType = string.Format(CultureInfo.InvariantCulture, "application/x-{0}-result", service);
            SetNoCache();

            try
            {
                XTrace.WriteLine(project);
                using (var git = new GitService(project))
                {
                    var svc = service.Substring(4);
                    git.ExecutePack(svc, GetInputStream(), Response.Body);
                }
                return(new EmptyResult());
            }
            catch (RepositoryNotFoundException e)
            {
                e.Log(GetLog().Exception(e));
                Response.StatusCode = (int)HttpStatusCode.NotFound;
                throw new HttpRequestException(string.Empty, e);
            }
            catch (Exception e)
            {
                e.Log(GetLog().Exception(e));
                Response.StatusCode = (int)HttpStatusCode.InternalServerError;
                throw new HttpRequestException(string.Empty, e);
            }
        }
Ejemplo n.º 9
0
        static void Main(String[] args)
        {
            XTrace.UseConsole();

            try
            {
                var cfg = new Config();

                // 分解参数
                if (args != null && args.Length > 0)
                {
                    cfg.Parse(args);
                }

                // 显示帮助菜单或执行
                if (cfg.Address.IsNullOrEmpty())
                {
                    ShowHelp();
                }
                else
                {
                    Work(cfg);
                }
            }
            catch (Exception ex)
            {
                XTrace.WriteException(ex.GetTrue());
            }

            //Console.WriteLine("OK!");
            //Console.ReadKey();
        }
Ejemplo n.º 10
0
        static void Main(String[] args)
        {
            XTrace.UseConsole();

            try
            {
                Console.Write("请选择运行模式:1,服务端;2,客户端  ");
                var ch = Console.ReadKey().KeyChar;
                Console.WriteLine();
                if (ch == '1')
                {
                    TestServer();
                }
                else
                {
                    TestClient();
                }
            }
            catch (Exception ex)
            {
                XTrace.WriteException(ex);
            }

            Console.WriteLine("OK!");
            Console.ReadKey();
        }
Ejemplo n.º 11
0
        public static void Main(String[] args)
        {
            // 启用控制台日志,拦截所有异常
            XTrace.UseConsole();

            CreateHostBuilder(args).Build().Run();
        }
Ejemplo n.º 12
0
        static void Main(String[] args)
        {
            // 启用控制台日志,拦截所有异常
            XTrace.UseConsole();

            var set = AntSetting.Current;

            // 实例化调度器
            var scheduler = new Scheduler();

            // 使用分布式调度引擎替换默认的本地文件调度
            scheduler.Provider = new NetworkJobProvider
            {
                Debug  = set.Debug,
                Server = set.Server,
                AppID  = set.AppID,
                Secret = set.Secret,
            };

            // 添加作业处理器
            //sc.Handlers.Add(new CSharpHandler());
            scheduler.AddHandler <SqlHandler>();
            scheduler.AddHandler <SqlMessage>();

            // 启动调度引擎,调度器内部多线程处理
            scheduler.Start();

            // 友好退出
            //ObjectContainer.Current.BuildHost().Run();
            Thread.Sleep(-1);
        }
Ejemplo n.º 13
0
        private static void Main(String[] args)
        {
            //XTrace.Log = new NetworkLog();
            XTrace.UseConsole();
#if DEBUG
            XTrace.Debug = true;
#endif
            while (true)
            {
                var sw = Stopwatch.StartNew();
#if !DEBUG
                try
                {
#endif
                Test7();
#if !DEBUG
            }
            catch (Exception ex)
            {
                XTrace.WriteException(ex?.GetTrue());
            }
#endif

                sw.Stop();
                Console.WriteLine("OK! 耗时 {0}", sw.Elapsed);
                //Thread.Sleep(5000);
                GC.Collect();
                GC.WaitForPendingFinalizers();
                var key = Console.ReadKey(true);
                if (key.Key != ConsoleKey.C)
                {
                    break;
                }
            }
        }
Ejemplo n.º 14
0
        static void Main(string[] args)
        {
            XTrace.UseConsole();
            while (true)
            {
#if !DEBUG
                try
                {
#endif
                Test5();
#if !DEBUG
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
#endif

                Console.WriteLine("OK!");
                ConsoleKeyInfo key = Console.ReadKey(true);
                if (key.Key != ConsoleKey.C)
                {
                    break;
                }
            }
        }
Ejemplo n.º 15
0
        static void Main(string[] args)
        {
            Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.BelowNormal;

            XTrace.UseConsole();
            while (true)
            {
#if !DEBUG
                try
                {
#endif
                Test1();
#if !DEBUG
            }
            catch (Exception ex)
            {
                XTrace.WriteException(ex);
                //Console.WriteLine(ex.ToString());
            }
#endif

                GC.Collect();
                Console.WriteLine("OK!");
                ConsoleKeyInfo key = Console.ReadKey(true);
                if (key.Key != ConsoleKey.C)
                {
                    break;
                }
                //Console.Clear();
            }
        }
Ejemplo n.º 16
0
        private static void Main(String[] args)
        {
            //Environment.SetEnvironmentVariable("DOTNET_SYSTEM_GLOBALIZATION_INVARIANT", "1");

            XTrace.UseConsole();
#if DEBUG
            XTrace.Debug     = true;
            XTrace.Log.Level = LogLevel.All;

            var set = NewLife.Setting.Current;
            set.Debug    = true;
            set.LogLevel = LogLevel.All;

            new LogEventListener(new[] {
                "System.Runtime",
                "System.Diagnostics.Eventing.FrameworkEventSource",
                "System.Transactions.TransactionsEventSource",
                "Microsoft-Windows-DotNETRuntime",
                //"Private.InternalDiagnostics.System.Net.Sockets",
                "System.Net.NameResolution",
                //"Private.InternalDiagnostics.System.Net.NameResolution",
                "System.Net.Sockets",
                //"Private.InternalDiagnostics.System.Net.Http",
                "System.Net.Http",
                //"System.Data.DataCommonEventSource",
                //"Microsoft-Diagnostics-DiagnosticSource",
            });

            var set2 = XCode.Setting.Current;
            set2.Debug = true;
#endif
            while (true)
            {
                var sw = Stopwatch.StartNew();
#if !DEBUG
                try
                {
#endif
                Test5();
#if !DEBUG
            }
            catch (Exception ex)
            {
                XTrace.WriteException(ex?.GetTrue());
            }
#endif

                sw.Stop();
                Console.WriteLine("OK! 耗时 {0}", sw.Elapsed);
                //Thread.Sleep(5000);
                GC.Collect();
                GC.WaitForPendingFinalizers();
                var key = Console.ReadKey(true);
                if (key.Key != ConsoleKey.C)
                {
                    break;
                }
            }
        }
Ejemplo n.º 17
0
        static void Main(string[] args)
        {
            XTrace.UseConsole();

            TestEventBus(MQSetting.Current.MQType);

            Console.ReadKey();
        }
Ejemplo n.º 18
0
        public App()
        {
            InitializeComponent();

            DependencyService.Register <MockDataStore>();
            XTrace.UseConsole(false, false);
            MainPage = new MainPage();
        }
Ejemplo n.º 19
0
        public static void Main(string[] args)
        {
            Environment.SetEnvironmentVariable("DOTNET_SYSTEM_GLOBALIZATION_INVARIANT", "1");

            XTrace.UseConsole();

            CreateHostBuilder(args).Build().Run();
        }
Ejemplo n.º 20
0
        static void Main(string[] args)
        {
            XTrace.UseConsole();

            Await.Start();

            Console.WriteLine("OK!");
            Console.ReadKey(true);
        }
Ejemplo n.º 21
0
        private void RibbonFormMain_Load(object sender, EventArgs e)
        {
            if (DesignMode)
            {
                return;
            }

            XTrace.UseConsole();
        }
Ejemplo n.º 22
0
        static void Main(String[] args)
        {
            XTrace.UseConsole();

            Test2();

            Console.WriteLine("OK!");
            Console.ReadKey();
        }
Ejemplo n.º 23
0
        static AgentServiceBase()
        {
            XTrace.UseConsole();

            if (_Instance == null)
            {
                _Instance = new TService();
            }
        }
Ejemplo n.º 24
0
        static void Main(String[] args)
        {
            XTrace.UseConsole();

            TestByNumber();

            Console.WriteLine("OK!");
            Console.ReadLine();
        }
Ejemplo n.º 25
0
        public static void Main(String[] args)
        {
            XTrace.UseConsole();

            // 异步初始化
            Task.Run(InitAsync);

            CreateWebHostBuilder(args).Build().Run();
        }
Ejemplo n.º 26
0
 static void Main(string[] args)
 {
     XTrace.UseConsole();
     StockHelper.AnalysisFirst();
     //StockHelper.SpliteDB();
     //GroupKind.ParseGroupInfo();
     //StockHisText.PraseHistoryData();
     Console.WriteLine("完成");
     Console.Read();
 }
Ejemplo n.º 27
0
        static void Main(String[] args)
        {
            XTrace.UseConsole();

            FullRedis.Register();

            Test3();

            Console.ReadKey();
        }
Ejemplo n.º 28
0
        public static void Main(string[] args)
        {
            XTrace.UseConsole();

            var app = ApplicationManager.Load();

            do
            {
                app.Start(CreateHostBuilder(args).Build());
            } while (app.Restarting);
        }
Ejemplo n.º 29
0
        static void Main(String[] args)
        {
            XTrace.UseConsole();

            // 激活FullRedis,否则Redis.Create会得到默认的Redis对象
            FullRedis.Register();

            Test5();

            Console.ReadKey();
        }
Ejemplo n.º 30
0
        static void Main(string[] args)
        {
            XTrace.UseConsole();

            // 激活FullRedis,否则new FullRedis会得到默认的Redis对象
            FullRedis.Register();

            Test1();

            Console.ReadKey();
        }