コード例 #1
0
ファイル: ForkHelper.cs プロジェクト: Cpa3y/fork
        public static void Init()
        {
            var logger = new Serilog.LoggerConfiguration()
                         .MinimumLevel.Debug()
                         .Enrich.FromLogContext()
                         .WriteTo.Async(x => x.File("fork.serilog", fileSizeLimitBytes: 104857600))
                         .CreateLogger();

            AppDomain.CurrentDomain.UnhandledException += (s, e) =>
            {
                logger.Fatal(e.ExceptionObject as Exception, "Unhandled exception");
            };

            var forkConfig = AppConfigParser.Parse();

            bufferSize = forkConfig.DestinationsBufferSize;
            fork       = forkConfig.CreateFork(logger);
            fork.Run();

            instance = new ObservableCollection <ViewEntry>(forkConfig.Destinations.Select(x =>
                                                                                           new ViewEntry
            {
                Address     = x.Id,
                BufferState = string.Empty,
                Kind        = "Destination",
                State       = true
            }).Prepend(new ViewEntry
            {
                Address     = forkConfig.Source.Id,
                BufferState = string.Empty,
                Kind        = "Source",
                State       = true
            }));
        }
コード例 #2
0
        public PingdomManager()
        {
            m_Credentials = AppConfigParser.Create <Credentials>();
            m_WebServices = WebServices.Connect(m_Credentials.AuthToken, m_Credentials.URL);
            HttpChecker   = new Checker <HTTPCheck>(m_WebServices);

            PingChecker = new Checker <PingCheck>(m_WebServices);
            PortChecker = new Checker <PortCheck>(m_WebServices);
        }