示例#1
0
 public RTCClient(ISignalingEvents <SignalingParameters> signalingEvents, ILogger logger = null)
 {
     _signalingEvents = signalingEvents;
     _executor        = ExecutorServiceFactory.CreateExecutorService(nameof(RTCClient));
     _logger          = logger ?? new ConsoleLogger();
     State            = ConnectionState.New;
 }
 public H113RTCClient(ISignalingEvents <RegisteredMessage> signalingEvents, ILogger logger = null)
 {
     _signalingEvents = signalingEvents;
     _executor        = ExecutorServiceFactory.CreateExecutorService(nameof(H113RTCClient));
     _logger          = logger ?? new ConsoleLogger();
     State            = ConnectionState.New;
 }
        private FloorStatus()
        {
            try
            {
                _updateFloorStatusOld = Extensions.GetAppSettingValueBool("UpdateFloorStatusOld", false);
                if (_updateFloorStatusOld)
                {
                    _oServer = IPCServer.GetInstance(ConfigManager.Read("RemotingServer"),
                                                     Convert.ToInt32(ConfigManager.Read("RemotingServerPort")));

                    int itmpInterval = Convert.ToInt32(ConfigManager.Read("RemotingServerInterval")) * 1000;

                    if (itmpInterval > 5000)
                    {
                        iInterval = itmpInterval;
                    }

                    mre_isStoped = new ManualResetEvent(false);
                    Thread th = new Thread(UpdateFloorStatus);
                    th.Start();
                }
                else
                {
                    _exec = ExecutorServiceFactory.CreateExecutorService();
                    CDOCentralServerHostApplication.Start(_exec);
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteLog("FloorStatus : Unable to initialize the reference type." + ex.Message, LogManager.enumLogLevel.Error);
            }
        }
 internal ExchangeConfigStore()
 {
     _executor    = ExecutorServiceFactory.CreateExecutorService();
     _cfgExchange = ConfigApplicationFactory.Get <IConfig_ExchangeServer>();
     ConfigStoreManager.PullValues(this);
     //ConfigStoreManager.Register(new System.Runtime.Remoting.ObjectHandle(this));
 }
示例#5
0
        protected override bool BindInternal()
        {
            if (_handler == null)
            {
                _executorService = ExecutorServiceFactory.CreateExecutorService();
                if (_hasThreads)
                {
                    _pool = ThreadPoolExecutorFactory.CreateThreadPool <ClientsInfo>(
                        new ThreadPoolExecutorArg()
                    {
                        ExecutorService = _executorService,
                        PoolType        = (_totalThreads == -1 ? ThreadPoolType.NonBlockDynamic : ThreadPoolType.AsyncTaskQueue),
                        ThreadCount     = _totalThreads,
                    });
                    _pool.ProcessItem += new ExecutorProcessItemHandler <ClientsInfo>(OnPool_ProcessItem);
                }

                _handler = new TcpListener(_localEndPoint as IPEndPoint);
                _socket  = _handler.Server;
                _handler.Start();

                if (Extensions.UseTaskInsteadOfThread)
                {
                    Extensions.CreateLongRunningTask(this.OnListen);
                }
                else
                {
                    Extensions.CreateThreadAndStart(new System.Threading.ThreadStart(this.OnListen));
                }
            }
            return(_handler != null);
        }
        public SRTCClient(ISignalingEvents <SignalingParameters> _signalingEvents, ILogger _logger = null)
        {
            signalingEvents = _signalingEvents;
            executor        = ExecutorServiceFactory.CreateExecutorService(nameof(SRTCClient));
            logger          = _logger ?? new ConsoleLogger();

            State = ConnectionState.New;

            App.Instance = this;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="FileLoggingSystem"/> class.
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="allowMultipleWriters">if set to <c>true</c> [allow multiple writers].</param>
        /// <param name="maxFileSize">Size of the max file.</param>
        /// <param name="mode">The mode.</param>
        public FileLoggingSystem(string source, bool allowMultipleWriters, int maxFileSize, QueueProcessMode mode)
            : base(source, mode,
                   (mode == QueueProcessMode.Thread ? ExecutorServiceFactory.CreateExecutorService() : null))
        {
            if (Path.GetFileName(source).IsEmpty())
            {
                throw new ArgumentNullException("File Name");
            }

            if (mode == QueueProcessMode.Thread)
            {
                AppDomain.CurrentDomain.ProcessExit  += CurrentDomain_ProcessExit;
                AppDomain.CurrentDomain.DomainUnload += CurrentDomain_ProcessExit;
                ShutdownHelper.ShutdownInitiated     += CurrentDomain_ProcessExit;
            }

            this.MaxFileSize          = maxFileSize;
            this.AllowMultipleWriters = allowMultipleWriters;
        }
示例#8
0
        private static void Initialize()
        {
#if !SILVERLIGHT
            _dispatcher = Dispatcher.FromThread(Thread.CurrentThread);
#else
            _rootVisual = rootVisual;
            _dispatcher = System.Windows.Deployment.Current.Dispatcher;
#endif

            _executorService = ExecutorServiceFactory.CreateExecutorService();
            CurrentApplication.Properties.Add("ExecutorService", _executorService);

#if !SILVERLIGHT
            CurrentApplication.DispatcherUnhandledException += CurrentApplication_DispatcherUnhandledException;
#else
            CurrentApplication.UnhandledException += CurrentApplication_UnhandledException;
#endif
            CurrentApplication.Exit += CurrentApplication_Exit;
        }
 public CPlayerData()
 {
     InitializeComponent();
     cmbMessageTypes.ItemsSource = GetMessageTypes();
     LogManager.WriteLog("CPlayerData[GateWay Initializing]", LogManager.enumLogLevel.Debug);
     try
     {
         BMC.PlayerGateway.SharedData.ActiveLogger.WriteToExternalLog += new BMC.PlayerGateway.WriteToExternalLogHandler(ActiveLogger_WriteToExternalLog);
         BMC.PlayerGateway.GatewaySettings.GlobalExecutorService       = ExecutorServiceFactory.CreateExecutorService();
         oGateWay = GatewayFactory.GetGateway(GatewayType.SDT);
         BMC.PlayerGateway.GatewaySettings.ConnectionString = oCommonUtilities.CreateInstance().GetConnectionString();
         oGateWay.Initialize(true);
         oGateWay.SocketSenderPT.Initialize(Settings.PT_GATEWAY_IP, Settings.SDT_SendPTPortNo);
         oGateWay.SocketSenderCA.Initialize(Settings.PT_GATEWAY_IP, Settings.SDT_SendCAPortNo);
         LogManager.WriteLog("CPlayerData[GateWay Initialized]", LogManager.enumLogLevel.Debug);
     }
     catch (Exception Ex)
     {
         ExceptionManager.Publish(Ex);
     }
 }
示例#10
0
        static void Main(string[] args)
        {
            Log.GlobalWriteToExternalLog += Log_GlobalWriteToExternalLog;
            IExecutorService exec = ExecutorServiceFactory.CreateExecutorService();
            var activators        =
                MEFHelper.GetExportedValues <IExCommsServerHostFactoryActivator>();

            ExCommsServerHostFactory host = null;
            var activator = (from a in activators
                             where a.ServerType == ExCommsHostingServerType.MonitorServer
                             select a).FirstOrDefault();

            if (activator == null)
            {
                return;
            }

            ExCommsHostingModuleTypeHelper.Current.ModuleType = ExCommsHostingModuleType.MonitorServer4CommsServer;
            host = activator.Create(exec);
            host.Start();

            while (true)
            {
                Console.WriteLine(@"Press any key to continue...");
                string s = Console.ReadLine();
                if (s == "q")
                {
                    break;
                }
            }

            exec.Shutdown();
            host.Stop();
            exec.AwaitTermination(TimeSpan.FromMinutes(2));

            Thread.Sleep(10000);
        }
 /// <summary>
 /// Initializes the <see cref="CoreLibManager"/> class.
 /// </summary>
 static CoreLibManager()
 {
     ExecutorService = ExecutorServiceFactory.CreateExecutorService();
     AppDomain.CurrentDomain.DomainUnload += new EventHandler(CurrentDomain_DomainUnload);
 }
示例#12
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 /// <param name="mutexGuid">The mutex unique identifier.</param>
 /// <param name="args">The args.</param>
 protected ServiceEntryPoint(Guid mutexGuid, string[] args)
 {
     _mutexGuid       = mutexGuid;
     _args            = args;
     _executorService = ExecutorServiceFactory.CreateExecutorService();
 }
示例#13
0
 internal EBSConfigStore()
 {
     _executor    = ExecutorServiceFactory.CreateExecutorService();
     _cfgExchange = ConfigApplicationFactory.Get <IConfig_ExchangeServer>();
     ConfigStoreManager.PullValues(this);
 }
示例#14
0
 public MessageDispatcherInterceptor(MessageDispatcherConfigurator configurator, string id, int throughput, long?throughputDeadlineTime, ExecutorServiceFactory executorServiceFactory, TimeSpan shutdownTimeout) : base(configurator, id, throughput, throughputDeadlineTime, executorServiceFactory, shutdownTimeout)
 {
 }
示例#15
0
        static void Main(string[] args)
        {
            Console.Title = "ExCommsServer Testing";
            Console.SetWindowSize(80, 58);

            BMCRegistryHelper.ActiveInstallationType = BMCCategorizedInstallationTypes.Exchange;
            Log.AddAppFileLoggingSystem();
            Log.GlobalWriteToExternalLog += Log_GlobalWriteToExternalLog;

            TestPIDData();
            //MonMsg_H2G monH2G = new MonMsg_H2G();
            //MonTgt_H2G_AckNack nack = new MonTgt_H2G_AckNack();
            //nack.Nack = true;
            //monH2G.AddTarget(nack);
            //var msg2 = MonitorEntityFactory.CreateEntity(monH2G);
            //var ffBuffer = FreeformEntityFactory.CreateBuffer(msg2);

            var configStore = ExMonitorServerConfigStoreFactory.Store;
            var cat         = ErrorEventCategoryFactory.Categories;

            string       barcode = "889900027000052237";
            TicketIDInfo idInfo  = new TicketIDInfo(barcode);
            int          seqno   = idInfo.SequenceNumber;
            //byte[] packed = FreeformHelper.GetBCDToBytes(sUnpacked, sUnpacked.Length / 2);
            //string sUnpacked2 = packed.GetBCDValueString(0, 0, 9);



            //EncryptSecurity();

            //var dr = ExCommsDataContext.Current.GetMeterDeltaForPlayerSession(27, "1000012345", "IR");
            //ExecutionStepsTest();
            //return;

            //ExCommsHostingModuleTypeHelper.Current.SetAll();
            //_server = new ExCommsServerImpl(ExecutorServiceFactory.CreateExecutorService());
            //_server.Start();
            IExecutorService exec = ExecutorServiceFactory.CreateExecutorService();
            //ExecutionStepFactory.Initialize(exec, false, ExecutionStepDeviceTypes.GMU);
            //FFMsgHandlerFactory.Initialize(exec, FFTgtHandlerDeviceTypes.GMU, () =>
            //{
            //    return new FFMsgTransmitter();
            //});
            MonTgt_G2H_GIM_GameIDInfo  target = new MonTgt_G2H_GIM_GameIDInfo();
            MonTgt_G2H_GVA_TED_Request r      = new MonTgt_G2H_GVA_TED_Request();

            //TestGIM();

            //Console.ForegroundColor = ConsoleColor.Cyan;
            //GenerateKeys(SECURITY_KEY_INDEX.TICKET_KEY, IPADDR);
            //GenerateKeys(SECURITY_KEY_INDEX.EFT_KEY, IPADDR);
            //Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine("Start ExComms Server?");
            Console.ResetColor();
            string anser = "y";// Console.ReadLine();

            if (anser == "y")
            {
                var activators =
                    MEFHelper.GetExportedValues <IExCommsServerHostFactoryActivator>();

                ExCommsServerHostFactoryActivatorFactory factory = new ExCommsServerHostFactoryActivatorFactory(exec,
                                                                                                                ExCommsHostingModuleType.CommunicationServer |
                                                                                                                ExCommsHostingModuleType.MonitorServer4CommsServer |
                                                                                                                ExCommsHostingModuleType.MonitorServer4MonProcessor
                                                                                                                ,
                                                                                                                activators);
                factory.Start();
            }

            long ticks = DateTime.Now.Ticks;

            byte[] lohi = FFDataTypeHelper.GetInt64Bytes(ticks, FFEndianType.LittleEndian);
            //TestGIM();

            while (true)
            {
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine("Press any key to continue...");
                Console.ResetColor();
                string s = Console.ReadLine();
                if (s == "q")
                {
                    return;
                }

                //TestEncryptedTicketMessage();
                //InitKeyExchangeStart();
                //if (s == "k1") InitKeyExchangeStartG2H();
                //if (s == "k2") InitKeyExchangeEnd();
                //if (s == "t") GenerateKeys(SECURITY_KEY_INDEX.TICKET_KEY);
                //if (s == "e") GenerateKeys(SECURITY_KEY_INDEX.EFT_KEY);
                if (s == "g")
                {
                    ExecutionStepsTest();
                }
                if (s == "ss")
                {
                    EncryptSecurity();
                }
                if (s == "pci")
                {
                    TestPlayerCardIn();
                }
                if (s == "pco")
                {
                    TestPlayerCardOut();
                }
                if (s == "bal")
                {
                    TestECashBalanceRequest();
                }
            }
            //TestKeyExchangePartialKey();
            return;

            //short sval = 9999;
            //short ss1 = sval;
            //List<byte> ll = new List<byte>();
            //while (true)
            //{
            //    byte b1 = (byte)(ss1 % 10);
            //    ll.Add(b1);
            //    ss1 /= 10;
            //}

            byte[] b1234 = new byte[] { 0x12, 0x34, 0x56, 0x78 };
            ulong  u     = b1234.GetBytesToBCDUInt64(0, 4);
            int    v     = 99999;
            byte   b1    = (byte)(v & 0x0F);
            byte   b2    = (byte)((v >> 4) & 0x0F);

            byte[] buf = "1000500026".GetBCDToBytes(5);
            byte[] iv  = FFDataTypeHelper.GetInt32Bytes(99999, FFEndianType.LittleEndian);
            byte[] sb1 = FFDataTypeHelper.GetInt16Bytes(9999, FFEndianType.LittleEndian);
            byte[] sb2 = FFDataTypeHelper.GetInt16Bytes(9999, FFEndianType.BigEndian);
            short  s1  = FFDataTypeHelper.GetInt16(sb1, FFEndianType.LittleEndian);
            short  s2  = FFDataTypeHelper.GetInt16(sb2, FFEndianType.BigEndian);

            string cc = "1A345";

            byte[] b = cc.GetHexBytesValue(2);
            //FF_AppId_SessionIds sval = FFEnumParserFactory.GetAppId<FF_GmuId_SessionIds, FF_AppId_SessionIds>(FF_GmuId_SessionIds.ECash);
            //FF_GmuId_SessionIds ss2 = FFEnumParserFactory.GetGmuId<FF_AppId_SessionIds, FF_GmuId_SessionIds>(FF_AppId_SessionIds.GIM);

            //byte b = 23;
            //FF_AppId_SessionIds ss3 = b.GetAppId<FF_GmuId_SessionIds, FF_AppId_SessionIds>();
        }
示例#16
0
 public Program()
 {
     Log.WriteToExternalLog += Log_WriteToExternalLog;
     _factory = new EBSCommClientHostFactory(ExecutorServiceFactory.CreateExecutorService());
 }