public override void OnAwake() { Instance = this; _Server = AddType <BaseServer>(); StartThreadUI(); }
public void Start() { Server = new TCPServer(_serverConfig); Server.StartServer(); Server.OnPacketReceivedAsObservable().Subscribe(packet => OnPacketReceived(packet)); }
/// <summary> /// 窗体加载时 初始化时钟 并且 打开菜单窗体 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FrmParent_Load(object sender, EventArgs e) { if (!Init()) { Application.Exit(); return; } LoadLocalData(); //tmTime_Tick(sender, e); tmUpload.Interval = 3000; //if (! UCNodeScan._IsCameraActive) // UCNodeScan._IsCameraActive = UnitechDSDll.OpenCamera(pbPreview.Handle, 3, 3, 400, 300, 1024, 768); OpenForm(PageState.Main); CheckInputPnl(false); CustomerServer.AddCustomersCountyId(); HuadongTmsOrderServer.AddTMSOrderOptAt(); BaseServer.AddTable_c2lp_optRecord(); BaseServer.AddTable_c2lp_consignor(); BaseServer.AddTable_c2lp_storage_scan(); BaseServer.AddNode_ParentStorageId(); BaseServer.AddLinkType(); BaseServer.AddLinkRegex(); BaseServer.AddConsignorId(); BaseServer.AddColunmForScanRecord(); BaseServer.AddColunmForScanRecord1(); BaseServer.AddColunmForScanRecord2(); }
/// <summary> /// Tells a client that a UDP connnection is ready. /// </summary> /// <param name="server">The server to run this on.</param> /// <param name="toClient">The client to notify that the connection is ready.</param> internal static void UdpReady(this BaseServer server, int toClient) { using (Packet packet = new Packet((int)ServerPackets.udpReady)) { server.SendUdpData(toClient, packet); } }
public void SendDataFrame(DataFrame data) { foreach (ISession item in BaseServer.GetOnlines()) { SendDataFrame(data, item); } }
public virtual ActionResult FeedsCheck() { var badFeeds = new List <FeedContract>(); var baseserver = new BaseServer(_appConfigBiz, _feedBusiness, _feedItemBusiness, _updaterDurationBusiness); var feeds = _feedBusiness.GetList().Where(f => f.Deleted == DeleteStatus.Temporary && f.UpdatingErrorCount < 7).ToList(); ViewBag.OldCount = feeds.Count; foreach (var feed in feeds) { FeedContract feedContract = new FeedContract(); try { feedContract = feed.ToViewModel <FeedContract>(); feedContract = (new ClientUpdater(baseserver, _feedBusiness, _appConfigBiz, true)).FeedUpdateAsService(feedContract, new List <string>()); if (!feedContract.FeedItems.Any()) { badFeeds.Add(feedContract); } feed.Deleted = DeleteStatus.Active; feed.UpdatingErrorCount = 0; } catch (Exception ex) { feed.UpdatingErrorCount = (byte)(feed.UpdatingErrorCount + 1); feedContract.SiteTitle = ex.Message.SubstringETC(0, 200) + (ex.InnerException != null && ex.InnerException.Message != null ? ex.InnerException.Message.SubstringETC(0, 200) : string.Empty); badFeeds.Add(feedContract); } _feedBusiness.Edit(feed); } ViewBag.NewCount = feeds.Count - badFeeds.Count; return(View(badFeeds)); }
public Oats(BaseUser user, BaseServer server, BaseChannel channel, BaseMessage message) { if (message.GetText().ToLower().IndexOf("oats") != -1 || message.GetText().ToLower().IndexOf("öats") != -1) { channel.SendMessage("pass me the öats brother\nhttps://www.youtube.com/watch?v=8I1sQlRiJdY"); } }
private void btnOk_Click(object sender, System.EventArgs e) { BaseServer server = serverItemControl1.Get(); using (IDbSession session = _sessionFactory.NewSession()) using (TransactionScope transactionScope = new TransactionScope(session)) { if (0 < server.Id) { session.Update("UpdateServer", server); } else { session.Insert("InsertServer", server); } transactionScope.VoteCommit(); } if (1 == this.listView.SelectedIndices.Count) { this.listView.Items.RemoveAt(this.listView.SelectedIndices[0]); } InitServerList(); }
/// <summary> /// Creates a new client. /// </summary> /// <param name="srvr">the server that is servicing this client</param> public BaseClient(BaseServer srvr) { _srvr = srvr; if (srvr != null) _pBuf = srvr.AcquirePacketBuffer(); _pBufOffset = 0; }
static void Main() { BaseServer server = new BaseServer();//Create an instance of the server //Prepare to Listen for connections on port 6789 arriving on all addresses belogning to this machine, //If there is a connection accept it and create a new instance of ConnectedClient to pass it to. server.Init(new IPEndPoint(IPAddress.Any, 6789), typeof(ConnectingClient)); server.StartListening();//Begin listening for connections while (true) Thread.Sleep(5);//Keep ticking over }
//登录角色信息 //private BaseActor.Info _baseActorInfo; //public BaseActor.Info baseActorInfo //{ // get { return _baseActorInfo; } // set { _baseActorInfo = value; } //} public bool InitServer() { server = new BaseServer(); if (server == null) return false; deploy.SERVER_INFO serverinfo = GameConfig.Instance.serverInfoData.GetData("login_server"); if (serverinfo == null) { Debug.Log("serverinfo == null"); return false; } return server.InitServer(serverinfo.ip, serverinfo.port); }
/// <summary> /// ��������� /// </summary> private void OpenMainServer() { mainServer = new BaseServer(mainPort); mainServer.Execute = new ExecuteCodeEvent(mainExecuteCode); mainThread = new Thread(new ThreadStart(mainServer.Run)); mainThread.Start(); }
/// <summary> /// Constructor for a game client /// </summary> /// <param name="srvr">The server that's communicating with this client</param> public GameClient(BaseServer srvr) : base(srvr) { m_clientVersion = eClientVersion.VersionNotChecked; m_player = null; m_activeCharIndex = -1; //No character loaded yet! m_GameObjectUpdateArray = new ReaderWriterDictionary<Tuple<ushort, ushort>, long>(); m_HouseUpdateArray = new ReaderWriterDictionary<Tuple<ushort, ushort>, long>(); }
public void setCommandRecievedCallback(BaseServer.commandRecievedCallback sendCommand) { this.sendCommand = sendCommand; }
public MixedServer(MockServer mock, BaseServer real) { this.MockServer = mock; this.RealServer = real; }
public bool InitServer() { GameConfig.Instance.Init(); BattleManager.Instance.Init(); server = new BaseServer(); if (server == null) return false; if(server.InitServer(serverPort)) { return true; } return false; }
public void ExitServer() { if (server != null) server.ExitServer(); server = null; }
private static void Main() { _Running = true; if (!SettingsLoader.LoadSettings("Settings.ini")) return; //Online The Comms system Console.WriteLine("Starting Comms Server for clients"); _CommsServerClient = new BaseServer(); _CommsServerClient.Init(SettingsLoader.CommsClientLocalIp.Equals("any", StringComparison.InvariantCultureIgnoreCase) ? new IPEndPoint(IPAddress.Any, SettingsLoader.CommsClientPort) : new IPEndPoint(IPAddress.Parse(SettingsLoader.CommsClientLocalIp), SettingsLoader.CommsClientPort), typeof(ConnectedClient)); Console.WriteLine("Comms Server for clients Online at " + SettingsLoader.CommsClientLocalIp + ":" + SettingsLoader.CommsClientPort); Console.WriteLine("Starting Comms Server for workers"); _CommsServerWorker = new BaseServer(); _CommsServerWorker.Init(SettingsLoader.CommsWorkerLocalIp.Equals("any", StringComparison.InvariantCultureIgnoreCase) ? new IPEndPoint(IPAddress.Any, SettingsLoader.CommsWorkerPort) : new IPEndPoint(IPAddress.Parse(SettingsLoader.CommsWorkerLocalIp), SettingsLoader.CommsWorkerPort), typeof(ConnectedWorker)); Console.WriteLine("Comms Server for workers Online at " + SettingsLoader.CommsWorkerLocalIp + ":" + SettingsLoader.CommsWorkerPort); Console.WriteLine("Loading Pending Work"); if (Directory.Exists("Pending")) { String[] files = Directory.GetFiles("Pending"); Console.WriteLine("Possible " + files.Length + " jobs found, loading .."); foreach (String file in files) { try { FileStream stream = File.OpenRead(file); BinaryFormatter binaryFormatter = new BinaryFormatter(); Base work = (Base)binaryFormatter.Deserialize(stream); stream.Close(); _PendingWork.Add(work.GetGuid()); } catch (Exception e) { Console.WriteLine(e); } } } Console.WriteLine("Loading Pending Completed"); _CommsServerClient.StartListening(); _CommsServerWorker.StartListening(); while (_Running) { Console.Title = "Pending:" + _PendingWork.Count + " Processing:" + _WorkBeingProcessed.Count + " Complete:" + _CompleteWork.Count; lock (_WorkBeingProcessed) { List<Tuple<Base, DateTime>> lostwork = _WorkBeingProcessed.Where(a => DateTime.Now - a.Item2 > SettingsLoader.WorkLostAfterTime).ToList(); foreach (Tuple<Base, DateTime> tuple in lostwork) { _WorkBeingProcessed.Remove(tuple); AddJob(tuple.Item1); Console.WriteLine("Job lost Reschedualing " + tuple.Item1.GetGuid()); } } Thread.Sleep(500); } }
/// <summary> /// Constructor for a game client /// </summary> /// <param name="srvr">The server that's communicating with this client</param> public GameClient(BaseServer srvr) : base(srvr) { m_clientVersion = eClientVersion.VersionNotChecked; m_player = null; m_activeCharIndex = -1; //No character loaded yet! }