public static ServerConnector getInstance() { if(instance == null) instance = new ServerConnector(); return instance; }
public void AddConnector(ServerConnector connector) { if (m_connected.Contains(connector.RemoteEndPoint)) return; m_connected.Add(connector.RemoteEndPoint, connector); m_connecting.Add(connector.Socket, connector); }
public ConfigurationServiceResponse CheckCanOperate(SocialNetworkServiceRequest request) { try { ServerConnector.CheckCanOperate(request); return(new ConfigurationServiceResponse()); } catch (Exception e) { return(ServerConnector.HandleException <ConfigurationServiceResponse>(e)); } }
public override void Start () { if (!MainHub) { base.Start(); } var connect = new ServerConnector(); connect.Connect(); arrOfHashTags = connect.ParseHashtag(connect.Send("Test")); connect.Close(); Hashtag = arrOfHashTags[Random.Range(0, arrOfHashTags.Length - 1)]; GameObject go = GameObject.Find ("PlayGameButton"); PlayGame Choicereference = go.GetComponent <PlayGame> (); CenterMap.Hashtag = Choicereference.Hashtag.Replace("#", ""); grid = HashtagChoice.Grid; EastHubHashtag = grid.EastNeighbour(); WestHubHashtag = grid.WestNeighbour(); NorthHubHashtag = grid.NorthNeighbour(); SouthHubHashtag = grid.SouthNeighbour(); SouthMap.Hashtag = CenterMap.Hashtag + " - " + SouthHubHashtag; WestMap.Hashtag = CenterMap.Hashtag + " - " + WestHubHashtag; NorthMap.Hashtag = CenterMap.Hashtag + " - " + NorthHubHashtag; EastMap.Hashtag = CenterMap.Hashtag + " - " + EastHubHashtag; SouthMap.map = newMap(SouthMap, CenterMap.Hashtag, SouthHubHashtag); NorthMap.map = newMap(NorthMap, CenterMap.Hashtag, NorthHubHashtag); EastMap.map = newMap(EastMap, CenterMap.Hashtag, EastHubHashtag); WestMap.map = newMap(WestMap, CenterMap.Hashtag, WestHubHashtag); CenterMap.map = newHub(CenterMap); CurrentHashtagGUI.GetComponent<GUIText>().text = "#" + CenterMap.Hashtag; PlaceAllRoadSigns(); MergeAllMaps(); started = true; if (MainHub) { PreInstantiateAll(); } ObjectPlacer.StartPlacements(); previouslyVisitedHubs.Add(CenterMap.Hashtag); BGMusic.audio.Play(); }
public void SuccessConnector(ServerConnector connector) { if (m_connecting.Contains(connector.Socket)) { m_connecting.Remove(connector.Socket); m_servers.Add(connector); } }
public EpicApiController(ServerConnector conn, string fullModulePath) : base(conn) { FullModulePath = fullModulePath; AddRoute = $"{fullModulePath}.add"; GetRoute = $"{fullModulePath}.get"; ModifyRoute = $"{fullModulePath}.modify"; RemoveRoute = $"{fullModulePath}.remove"; }
/// <summary> /// Returns consumer information about google shared application. /// </summary> /// <returns>Consumer information.</returns> public GoogleConsumerInfoResponse GetConsumerInfo() { try { return(new GoogleConsumerInfoResponse { ConsumerInfo = ServerConnector.GetConsumerInfo() }); } catch (Exception e) { return(ServerConnector.HandleException <GoogleConsumerInfoResponse>(e)); } }
public async Task Send_VolatileDeviceInfo_IsSuccessfull() { var mockClient = MockRestClient(MockRestResponse); var mockSettings = MockSettings(); var mockSerializer = new Mock <IJsonSerializer>().Object; var connector = new ServerConnector(_mockCancellation, mockSettings, mockSerializer, mockClient); await connector.Send(new VolatileDeviceInfo()); }
public void Send_VolatileDeviceInfo_WithEmptyResponse_ThrowsHttpException() { var mockClient = MockRestClient((r, c) => new Mock <IRestResponse>().Object); var mockSettings = MockSettings(); var mockSerializer = new Mock <IJsonSerializer>().Object; var connector = new ServerConnector(_mockCancellation, mockSettings, mockSerializer, mockClient); Assert.ThrowsAsync <HttpException>(() => connector.Send(new VolatileDeviceInfo())); }
public void GetActionTestExists() { //Arrange ServerConnector connector = ServerConnector.Instance; //Act var task1 = Task.Run(() => connector.GetAction("Player/146")); task1.Wait(); Assert.AreNotEqual(task1.Result, ""); }
protected override User ExcuteLogin(string userName, string password, string role) { TUser tuser = ServerConnector.GetInstance().Login(userName, password, ClientRepository.GetInstance()._clientIp, ClientRepository.GetInstance()._clientPort); if (string.IsNullOrEmpty(tuser.Id) == false) { return(ThriftUtil.ConvertToUser(tuser)); } return(null); }
void SendGameInfo() { GameInfoDTO gameInfo = new GameInfoDTO() { Name = PlayerInfo.PlayerName, GameTime = PlayerInfo.GameTime, Level = PlayerInfo.Level, }; var call = ServerConnector.UpdateAfterGame(gameInfo); }
public void Echo2PGame(int countStringLength, int sleepTime, string gameId, ServerConnector connection, string strToSend) { var msg = ServusProtobufBasicFactory.createEchoGameMessage(Modulename.Directgame, TestGameFunctions.TgEcho, gameId); msg.ValueString = strToSend; connection.SendMessage(msg); sleepModifier(sleepTime); }
public WorkitemCreationResult CreateWorkitem(Workitem item, ServerConnector.Entities.Workitem closedDuplicate) { item.Description += string.Format("\n\n This is a copy of '{0}' {1}", closedDuplicate.Number, closedDuplicate.TypeName); var workitem = CreateNewWorkitem(item); var url = v1Processor.GetSummaryLink(closedDuplicate); var link = new Link(url, "Previous item"); v1Processor.AddLinkToEntity(workitem, link); return GetWorkitemCreationResult(item, workitem); }
public void SendToAllServer(GamePacket pkg, ServerConnector except) { foreach (ServerConnector connector in m_servers) { if (connector != except) { connector.SendTCP(pkg); } } }
public SearchResult ExecuteSearch(SocialNetworkServiceRequest request) { try { List <FacebookEntity> entities = ServerConnector.ExecuteSearch(request); return(new SearchResult { Entities = entities }); } catch (Exception e) { return(ServerConnector.HandleException <SearchResult>(e)); } }
public FacebookEntitiesResponse GetNodesData(SocialNetworkServiceRequest request) { try { List <FacebookEntity> entities = ServerConnector.GetNodesData(request); return(new FacebookEntitiesResponse { Entities = entities }); } catch (Exception e) { return(ServerConnector.HandleException <FacebookEntitiesResponse>(e)); } }
public int HandlePacket(ServerConnector connector, GamePacket packet) { LogicServerConnector conn = connector as LogicServerConnector; if (conn != null) { conn.Fulled = false; } return(0); }
public void AddConnector(ServerConnector connector) { if (m_connected.Contains(connector.RemoteEndPoint)) { return; } m_connected.Add(connector.RemoteEndPoint, connector); m_connecting.Add(connector.Socket, connector); }
public int HandlePacket(ServerConnector connector, GamePacket packet) { GatewayPlayer player = GatewayGlobal.Players[packet.PlayerID]; if (player != null) { player.SendTcp(packet); } return(0); }
public override string Update(IrregularOrder order, Collection <OrderItem> orderItems) { string errorMessage = AutoSync.GetInstance().CheckServerIsFree(); if (string.IsNullOrEmpty(errorMessage)) { errorMessage = ServerConnector.GetInstance().UpdateOrderInfoRequest(order, orderItems.ToList()); } errorMessage = HandleRequestResult(errorMessage); return(string.IsNullOrEmpty(errorMessage) == false ? errorMessage : base.Update(order, orderItems)); }
public override string Update(IrregularOrder entity) { string errorMessage = AutoSync.GetInstance().CheckServerIsFree(); if (string.IsNullOrEmpty(errorMessage)) { errorMessage = ServerConnector.GetInstance().UpdateSingleOrderInfoRequest(entity); } errorMessage = HandleRequestResult(errorMessage); return(base.Update(entity)); }
private void ConnectionFailed(object sender, EventArgs ev) { Debug.Print("NetworkWrapper.ConnectionFailed"); if (null != _serverConnector) { _serverConnector.Dispose( ); _serverConnector = null; } OnConnectAttemptFailed( ); }
public void RemoveConnector(ServerConnector connector) { if (m_connected.Contains(connector.RemoteEndPoint)) { m_connected.Remove(connector.RemoteEndPoint); } if (m_servers.Contains(connector)) { m_servers.Remove(connector); } }
public DebugAccessTokenResponse DebugAccessToken(SocialNetworkServiceRequest request) { try { AccessTokenInfo accessTokenInfo = ServerConnector.DebugAccessToken(request); return(new DebugAccessTokenResponse() { AccessTokenInfo = accessTokenInfo }); } catch (Exception e) { return(ServerConnector.HandleException <DebugAccessTokenResponse>(e)); } }
public void FaildConnector(ServerConnector connector) { if (m_connecting.Contains(connector.Socket)) { m_connecting.Remove(connector.Socket); } if (m_connected.Contains(connector.RemoteEndPoint)) { m_connected.Remove(connector.RemoteEndPoint); } }
public override string Cancel(DBManagement.Ticket ticket, decimal returnFee) { string errorMessage = AutoSync.GetInstance().CheckServerIsFree(); if (string.IsNullOrEmpty(errorMessage)) { errorMessage = ServerConnector.GetInstance().CancelTicketRequest(ticket); } errorMessage = HandleRequestResult(errorMessage); return(string.IsNullOrEmpty(errorMessage) == false ? errorMessage : base.Cancel(ticket, returnFee)); }
public override string Delete(Ticket entity) { string errorMessage = AutoSync.GetInstance().CheckServerIsFree(); if (string.IsNullOrEmpty(errorMessage)) { errorMessage = ServerConnector.GetInstance().CancelTicketRequest(entity); } errorMessage = HandleRequestResult(errorMessage); return(string.IsNullOrEmpty(errorMessage) == false ? errorMessage : base.Delete(entity)); }
public void RemoveConnector(ServerConnector connector) { if (m_connected.Contains(connector.RemoteEndPoint)) { m_connected.Remove(connector.RemoteEndPoint); } if (m_servers.Contains(connector)) { m_servers.Remove(connector); } }
public void FaildConnector(ServerConnector connector) { if (m_connecting.Contains(connector.Socket)) { m_connecting.Remove(connector.Socket); } if (m_connected.Contains(connector.RemoteEndPoint)) { m_connected.Remove(connector.RemoteEndPoint); } }
public PinFactory( MapLineManager mapLineManager, IUserStorage userStorage, ServerManager serverManager, ServerConnector serverConnector, CountryConnector countryConnector) { _serverManager = serverManager; _serverConnector = serverConnector; _countryConnector = countryConnector; _mapLineManager = mapLineManager; _userStorage = userStorage; }
public void BuySpaceShip(int buySpaceShip, Action <Result[]> applyUi) { if ((SpaceShipList & buySpaceShip) != 0) { return; } SpaceShipList |= buySpaceShip; ServerConnector.POST(applyUi, ServerApi.Bitflag, new MultipartFormDataSection("nick", UserManager.Player.Name), new MultipartFormDataSection("bitflag", buySpaceShip.ToString())); }
public int HandlePacket(ServerConnector connector, GamePacket packet) { uint clientID = packet.ReadUnsignedInt(); ClientBase client = GatewayGlobal.PlayerClientMgr[clientID]; if (client != null) { client.SendTcp(packet); } return(0); }
public void GetActionTest() { //Arrange ServerConnector connector = ServerConnector.Instance; //Act var task1 = Task.Run(() => connector.GetAction("Player")); var task2 = Task.Run(() => connector.GetAction("Player")); task1.Wait(); task2.Wait(); //Assert Assert.AreEqual(task1.Result, task2.Result); }
public Form1(LoginResultDTO opptInfo) { this._opptInfo = opptInfo; InitializeComponent(); _connector = ServerConnector.GetInstance(); _connector.OnConnectedEvent += ConnectedCallBack; _connector.OnRecivedMessageEvent += RecivedMessage; _connector.OnDisconnectedEvent += DisconnectedCallBack; Control.CheckForIllegalCrossThreadCalls = false; EnableGameUi(false); _playerIndex = 0; _opptNick = ""; }
public int HandlePacket(ServerConnector connector, GamePacket packet) { string ip = packet.ReadUTF(); int port = packet.ReadInt(); if (GatewayGlobal.CacheServer == null || GatewayGlobal.CacheServer.Socket.Connected == false) { GatewayGlobal.CacheServer = new CacheServerConnector(ip, port); } return(0); }
public int HandlePacket(ServerConnector connector, GamePacket packet) { int clientID = packet.ReadInt(); GatewayClient client = GatewayGlobal.Clients[clientID]; if (client != null) { client.SendTcp(packet); } return(0); }
private WorkitemCreationResult GetWorkitemCreationResult(Workitem item, ServerConnector.Entities.Workitem newWorkitem) { if(newWorkitem != null) { var result = ConvertToWorkitemCreationResult(item, newWorkitem); result.Messages.Add(string.Format("Created item \"{0}\" ({1}) in Project \"{2}\" URL: {3}", item.Title, result.Source.Number, item.Project, result.Permalink)); return result; } return null; }
private WorkitemCreationResult ConvertToWorkitemCreationResult(Workitem item, ServerConnector.Entities.Workitem newWorkitem) { var result = new WorkitemCreationResult(item) { Source = { Number = newWorkitem.Number, ExternalId = item.ExternalId, Description = newWorkitem.Description, ExternalSystemName = item.ExternalSystemName, ProjectId = newWorkitem.Project.Key, Project = newWorkitem.Project.Value, Title = newWorkitem.Name, Priority = newWorkitem.PriorityToken, }, WorkitemId = newWorkitem.Id, Permalink = v1Processor.GetWorkitemLink(newWorkitem), }; return result; }
void Start() { var connect = new ServerConnector(); connect.Connect(); PopularHashtags = connect.ParseTopList(connect.Send("GetTopList")); Grid = new HashtagGrid(PopularHashtags, 10); connect.Close(); }
private void AddLinkToWorkitemToOriginalIssue(Workitem item, ServerConnector.Entities.Workitem newWorkitem) { if(item.ExternalLink == null) { return; } var url = item.ExternalLink.Url; var urlTitle = item.ExternalLink.Title; var title = !string.IsNullOrEmpty(urlTitle) ? urlTitle : url; var link = new Link(url, title, true); v1Processor.AddLinkToEntity(newWorkitem, link); }
private void LaunchClient() { //change the server address IniFiles myFiles = new IniFiles(SWGANHPAth + _ServerInfo.SafeFolderName + "\\swg2uu_login.cfg"); myFiles.WriteValue("ClientGame", "loginServerPort0", _ServerInfo.Port); myFiles.WriteValue("ClientGame", "loginServerAddress0", _ServerInfo.Address); if (chkAutoLogin.IsChecked.Value) { if ((string.IsNullOrEmpty(cboUsername.Text)) || (string.IsNullOrEmpty(txtPassword.Password))) { string strErrorMessage = ""; if (string.IsNullOrEmpty(cboUsername.Text)) { strErrorMessage += myVariables.BlankUsername; } if (string.IsNullOrEmpty(txtPassword.Password)) { if (!string.IsNullOrEmpty(strErrorMessage)) { strErrorMessage += Environment.NewLine; } strErrorMessage += myVariables.BlankPassword; } if (OnError != null) { OnError(this, new ErrorMessageEventArgs(strErrorMessage, null)); } } else { btnLaunchClient.IsEnabled = false; ServerConnector myConnector = new ServerConnector(this.DataContext as TextVariables); myConnector.PacketReceived += new EventHandler<ServerConnector.PacketsReceivedEventArgs>(myConnector_PacketReceived); if (!myConnector.CreateSessionKey(_ServerInfo, cboUsername.Text, txtPassword.Password)) { if (OnError != null) { OnError(this, new ErrorMessageEventArgs(myConnector.Message, null)); } btnLaunchClient.IsEnabled = true; } } } else { //just start the client Process myProcess = new Process(); myProcess.StartInfo.FileName = SWGANHPAth + _ServerInfo.SafeFolderName + "\\swganh.exe"; myProcess.StartInfo.WorkingDirectory = SWGANHPAth + _ServerInfo.SafeFolderName; //myProcess.StartInfo.Arguments = "-- -s Station sessionId=" + e.SessionKey; myProcess.Start(); } }
void myConnector_PacketReceived(object sender, ServerConnector.PacketsReceivedEventArgs e) { if (e.Success) { this.Dispatcher.BeginInvoke(new System.Windows.Forms.MethodInvoker(delegate() { //make the server details ServerDetails myServerDetails = new ServerDetails(); myServerDetails.ServerId = _ServerInfo.ServerId; myServerDetails.ServerName = _ServerInfo.ServerName; myServerDetails.Username = cboUsername.Text; myServerDetails.Password = txtPassword.Password; if (chkRememberDetails.IsChecked.Value) { theUserPreferences.UpdateSettings(UserPreferences.SettingsType.AddServerCredentials, myServerDetails); } else { //maybe we need to removed them instead? theUserPreferences.UpdateSettings(UserPreferences.SettingsType.RemoveServerCredentials, myServerDetails); } }), System.Windows.Threading.DispatcherPriority.Normal); Process myProcess = new Process(); myProcess.StartInfo.FileName = SWGANHPAth + _ServerInfo.SafeFolderName + "\\swganh.exe"; myProcess.StartInfo.WorkingDirectory = SWGANHPAth + _ServerInfo.SafeFolderName; myProcess.StartInfo.Arguments = "-- -s Station sessionId=" + e.SessionKey; myProcess.Start(); } else { if (OnError != null) { OnError(this, new ErrorMessageEventArgs(e.Message, null)); } this.Dispatcher.BeginInvoke(new System.Windows.Forms.MethodInvoker(delegate() { btnLaunchClient.IsEnabled = true; }), System.Windows.Threading.DispatcherPriority.Normal); } }
/// <summary> /// Creates the connection. /// </summary> /// <returns> /// Is connected. /// </returns> /// <param name='name'> /// server name. /// </param> public bool CreateConnection(string name) { if (serverInfo.ContainsKey(name)) { servers[name] = new ServerConnector(serverInfo[name].host, serverInfo[name].port); return true; } return false; }
public void SuccessConnector(ServerConnector connector) { if (m_connecting.Contains(connector.Socket)) { m_connecting.Remove(connector.Socket); m_servers.Add(connector); } }
public ServerPacketHandlers(ServerConnector connector) { m_connector = connector; }
public string[] getHashtags() { var connect = new ServerConnector(); connect.Connect(); arrOfHashTags = connect.ParseHashtag(connect.Send("Test")); connect.Close(); return arrOfHashTags; }
public void SendToAllServer(GamePacket pkg, ServerConnector except) { foreach (ServerConnector connector in m_servers) { if (connector != except) { connector.SendTCP(pkg); } } }