public CreateRoomTexasHandler(
     ILogger log,
     IServerApplication serverApplication
     ) : base(log)
 {
     ServerApplication = serverApplication;
 }
示例#2
0
        private static void SendPlayerUpdate(
            PortScanApplication portScan,
            PlayerComponent player,
            IServerApplication serverApplication)
        {
            if (player == null)
            {
                return;
            }

            ProcessInfo          processInfo   = new ProcessInfo(portScan);
            ProcessUpdateMessage processUpdate =
                new ProcessUpdateMessage(
                    player.Id,
                    processInfo,
                    player.GetPublicIP());

            processUpdate.Message = $"Found open port: {(int)serverApplication.Port} "
                                    + $"[{serverApplication.Port.ToString().ToUpper()}]";

            Game.SendMessageToClient(player.Id, processUpdate.ToJson());

            // TODO: Have debug config use this.
            Game.SendMessageToClient(
                player.Id,
                new TerminalUpdateMessage(
                    $"Found open port: {(int)serverApplication.Port} "
                    + $"[{serverApplication.Port.ToString().ToUpper()}]")
                .ToJson());
        }
        public static Task Main(string[] args)
        {
            var parsedArgs = Args.Parse(args);

            if (parsedArgs.Benchmark)
            {
                BenchmarkInHarness(parsedArgs);
                return(Task.CompletedTask);
            }

            IServerApplication app = null;

            if (parsedArgs.Mode == Mode.Raw)
            {
                app = new PlainTextRawApplication();
            }
            else if (parsedArgs.Mode == Mode.Features)
            {
                app = new PlainTextApplication();
            }
            else if (parsedArgs.Mode == Mode.RawWithHeaders)
            {
                app = new PlainTextRawWithHeadersApplication();
            }
            else
            {
                app = new HttpServer <BenchmarkHandler>();
            }

            var lifetime         = new ApplicationLifetime(NullLoggerFactory.Instance.CreateLogger <ApplicationLifetime>());
            var binding          = new IPEndPointInformation(new IPEndPoint(IPAddress.Any, parsedArgs.Port));
            var transportFactory = CreateTransport(parsedArgs, lifetime);

            return(app.RunAsync(transportFactory, binding, lifetime));
        }
示例#4
0
        public void Init(IServerApplication app, bool isWinSvc)
        {
            // 发出开始启动服务提示音
            application = app;
            IsWinSvc    = isWinSvc;
            application.WriteMessage("服务开始启动!", EventLogEntryType.Information);
            SessionClass.CurrentSinoUser                    = new SinoUser();
            SessionClass.CurrentSinoUser.CurrentPost        = new SinoPost();
            SessionClass.CurrentSinoUser.CurrentPost.PostID = "0";
            WatchNodeCache.Init();


            // 启动任务服务
            application.WriteMessage("初始化任务服务!", EventLogEntryType.Information);
            InitTask();
            application.WriteMessage("任务服务初始化完成!", EventLogEntryType.Information);
        }
示例#5
0
文件: MainForm.cs 项目: whuacn/CJia
        void StartServer()
        {
            //Create a Scs Service application that runs on 10048 TCP port.
            serverApp  = CJiaServerBuilder.CreateServerApplication(new CJiaEndPoint(10920));
            oraAdapter = new Net.Business.DataAdapter();

            Doctor doctor = new Doctor();

            serverApp.AddService <IDoctor, Doctor>(doctor);
            serverApp.AddService <CJia.Net.Service.IDataAdapter, Net.Business.DataAdapter>(oraAdapter);
            //Start server
            serverApp.ClientConnected    += serverApp_ClientConnected;
            serverApp.ClientDisconnected += serverApp_ClientDisconnected;
            serverApp.Start();

            this.Text = "服务器已启动";
        }
        public static bool CreateRoom(IServerApplication serverApplication, RoomItem roomItem)
        {
            //var roomID = roomItem.ID.ToString();
            for (int i = 1; i < 1000; i++)
            {
                var roomID = "Texas" + GameApplicationBase.ID++;
                if (!HasCore(roomID))
                {
                    var newRoom = new TexasApplication(roomID, serverApplication.Log) as TexasApplication;
                    roomItem.Name    = roomItem.Name != ""?roomItem.Name: roomID;
                    roomItem.RoomID  = roomID;
                    roomItem.Created = DateTime.Now;

                    if (roomItem.Level >= 4)
                    {
                        roomItem.Level       = 4;
                        roomItem.WithdrawMin = 1000;
                        roomItem.WithdrawMax = 0;
                    }
                    else if (roomItem.Level >= 3)
                    {
                        roomItem.Level       = 3;
                        roomItem.WithdrawMin = 1000;
                        roomItem.WithdrawMax = 0;
                    }
                    else if (roomItem.Level >= 2)
                    {
                        roomItem.Level       = 2;
                        roomItem.WithdrawMin = 1000;
                        roomItem.WithdrawMax = 100000;
                    }
                    else
                    {
                        roomItem.Level       = 1;
                        roomItem.WithdrawMin = 1000;
                        roomItem.WithdrawMax = 10000;
                    }
                    m_instanceMap[roomID] = newRoom;
                    newRoom.Startup(new { server = serverApplication, roomItem = roomItem });
                    return(true);
                }
            }

            return(false);
        }
示例#7
0
 public PhotonServerPeer(S2SPeerBase peer, bool isPeer,
                         ILogger log,
                         IServerApplication server,
                         IEnumerable <IServerData> serverData,
                         IServerConnectionCollection <IServerType, IServerPeer> serverCollection,
                         IHandlerList <IServerPeer> handlerList)
 {
     _peer  = peer;
     Log    = log;
     Server = server;
     Log.DebugFormat("Created Server Peer");
     _serverCollection = serverCollection;
     _handlerList      = handlerList;
     _serverCollection.Connect(this);
     foreach (var data in serverData)
     {
         Log.DebugFormat("Data {0}-{1}", data.ToString(), data.GetType().ToString());
         _serverData.Add(data.GetType(), data);
     }
 }
 public PhotonClientPeer(InitRequest initRequest,
                         ILogger log,
                         IServerApplication server,
                         IEnumerable <IClientData> clientData,
                         IConnectionCollection <IClientPeer> connectionCollection,
                         IHandlerList <IClientPeer> handlerList)
     : base(initRequest)
 {
     Log          = log;
     _server      = server;
     _handlerList = handlerList;
     Log.DebugFormat("Created Client Peer");
     ConnectionCollection = connectionCollection;
     ConnectionCollection.Connect(this);
     PeerId      = Guid.NewGuid();
     _clientData = new Dictionary <Type, IClientData>();
     foreach (var data in clientData)
     {
         _clientData.Add(data.GetType(), data);
     }
 }
示例#9
0
        private static void ScanCurrentPort(
            PortScanApplication portScan,
            ComputerComponent targetComputer,
            PlayerComponent player)
        {
            foreach (
                IApplication application
                in targetComputer.RunningApplications.Values)
            {
                IServerApplication serverApplication = application as IServerApplication;

                if (serverApplication != null &&
                    serverApplication.Port == portScan.CurrentPort)
                {
                    portScan.OpenPorts.Add(serverApplication.Port);
                    SendPlayerUpdate(
                        portScan: portScan,
                        player: player,
                        serverApplication: serverApplication);
                    break;
                }
            }
        }
示例#10
0
        public void Init(IServerApplication app)
        {
            // 发出开始启动服务提示音
            application = app;

            InitConnectTest();
            TryDataBaseConnect();

            ServiceHost WcfHost = new ServiceHost(typeof(SinoMonitorCommand));

            try
            {
                WcfHost.Open();
                application.WriteMessage("WCF服务接口已启动!", EventLogEntryType.Information);
            }
            catch (Exception ex)
            {
                application.WriteMessage(string.Format("WCF服务接口启动失败!{0}", ex.Message), EventLogEntryType.Error);
            }


            InitTask();
        }
示例#11
0
 public void Setup(IServerApplication server)
 {
     // do nothing in this setup, normally used for setting up one time things in th background thread it starts.
 }
 public void Setup(IServerApplication server)
 {
     Log.InfoFormat("TexasBackgroundThread::Setup");
 }
示例#13
0
 public ServerPluginService(IServerApplication _app)
 {
     application = _app;
 }
示例#14
0
 public RegisterSubServerResponseHandler(ILogger log, IServerApplication serverApplication)
 {
     Log = log;
     _serverApplication = serverApplication;
 }
示例#15
0
文件: Tester.cs 项目: koav/Rhetos
 public Tester(TextWriter textWriter, IServerApplication serverApplication = null)
 {
     TextWriter = textWriter;
     ServerName = ConfigurationManager.AppSettings["Server"];
     ServerApplication = serverApplication;
 }
示例#16
0
 public static ServerProcessingResult Execute(this IServerApplication app, params ServerCommandInfo[] commands)
 {
     return(app.Execute(commands));
 }
示例#17
0
 public ServerPluginService(IServerApplication _app)
 {
     application    = _app;
     CurrentService = this;
 }
示例#18
0
文件: Testing.cs 项目: koav/Rhetos
        internal string RunTest(IServerApplication serverApplication, TextWriter textWriter)
        {
            ExtractCommandsAndResults();

            textWriter.Write("Executing command sets ({0}): ", Commands.Count);
            var newXDocument = new XDocument(new XElement("Log"));
            var root = newXDocument.Root;
            if (root != null)
                foreach (var cmd in Commands)
                {
                    root.Add(XElement.Parse(XmlUtility.SerializeArrayToXml(cmd)));
                    textWriter.Write(".");
                    root.Add(XElement.Parse(XmlUtility.SerializeToXml(serverApplication.Execute(cmd))));
                }

            var newFileName = SuffixFileNameWith(FileName, "_New");
            newXDocument.Save(newFileName);

            return newFileName;
        }
示例#19
0
        public static void Init(IServerApplication app, bool isWinSvc)
        {
            // 发出开始启动服务提示音
            ServerCommon.SvcBeep(SvcAction.Starting);
            application   = app;
            IsWinSvc      = isWinSvc;
            WriteTaskInfo = ConfigFile.WriteTaskStartInfo;
            //加载ZHTJ_CSB中的参数

            #region 查看ORACLE服务是否已经成功运行

            int TestTimes = 10;
            int SleepTime = 60000;
#if DEBUG
            SleepTime = 100;
#endif
            while (!OracleHelper.IsReady() && TestTimes-- > 0)
            {
                Thread.Sleep(SleepTime);
            }
            if (TestTimes < 1)
            {
                EventLogSystemLog _event = new EventLogSystemLog("SinoSZJSLog");
                string            _log   = "因数据库无法连接,启动服务失败!";
                _event.WriteLog(_log, EventLogEntryType.Error);
                throw new Exception();
            }
            #endregion

            ConfigFile.Client_ShowPendingAlert = LoadDB_CSB_Bool("Client_ShowPendingAlert");



            //建立系统日志和用户日志的写入器
            SystemLogWriter.ICS_SystemLog = new OraSysLogWriter();
            UserLogWriter.ICS_UserLog     = new OraUserLogWriter();

            application.WriteMessage("服务开始启动!");

            //清除验证票据缓存
            TicketLib.Clear();
            // 加载代码表Cache
            application.WriteMessage("开始加载代码表缓存!");
            InitRefCodeCache();
            application.WriteMessage("代码表缓存加载完毕!");


            // 加载授权信息Cache
            application.WriteMessage("开始加载授权信息缓存!");
            InitPermissionCache();
            application.WriteMessage("授权信息缓存加载完毕!");

            // 初始化Remoting服务
            application.WriteMessage("初始化Remoting服务!");
            //RemotingServerSvc.Init();
            application.WriteMessage("Remoting服务初始化完毕!");

            application.WriteMessage("注册Remoting服务工厂!");
            //RemotingServerSvc.RegisterService(typeof(IServiceFactory), typeof(BizServiceFactory));
            application.WriteMessage("Remoting服务工厂注册完毕!");



            // 启动任务服务
            application.WriteMessage("初始化任务服务!");
            InitTask();
            application.WriteMessage("任务服务初始化完成!");

            // 发出启动成功提示音
            ServerCommon.SvcBeep(SvcAction.Started);
        }
示例#20
0
 public void Setup(IServerApplication server)
 {
 }
 public void Setup(IServerApplication server)
 {
     // Do nothing in this setup. Normally used for setting up one time things in the background thread before it starts.
 }