public Form_CityManage() { InitializeComponent(); City_Client = (CityClient)ClientFactory.GetClient(ClientType.Type.City); Province_Client = (ProvinceClient)ClientFactory.GetClient(ClientType.Type.Province); List_City = City_Client.SelectAllCitys().ToList(); CB_ProviceBind(); }
public WeatherPredictionController( WeatherForecastClient weatherForecastClient, CityClient cityClient, IconClient iconClient, IOptions <ApiEndpoints> options) { _weatherForecastClient = weatherForecastClient; _cityClient = cityClient; _apiEndpoints = options.Value; }
private void m_Listener_OnReceiveEvent(PacketStream P, CityClient Client) { byte ID = (byte)P.ReadByte(); switch (ID) { case 0x00: PacketHandlers.HandleCharacterCreate(P, Client); break; case 0x01: PacketHandlers.HandleClientKeyReceive(P, ref Client); break; } }
public LoginRegulator(AuthClient authClient, CityClient cityClient, IShardsDomain domain) { this.Shards = domain; this.AuthClient = authClient; this.CityClient = cityClient; AddState("NotLoggedIn") .Default() .Transition() .OnData(typeof(AuthRequest)).TransitionTo("AuthLogin"); AddState("AuthLogin").OnlyTransitionFrom("NotLoggedIn"); AddState("InitialConnect").OnlyTransitionFrom("AuthLogin"); AddState("AvatarData").OnlyTransitionFrom("InitialConnect", "UpdateRequired", "LoggedIn"); AddState("ShardStatus").OnlyTransitionFrom("AvatarData"); AddState("LoggedIn").OnlyTransitionFrom("ShardStatus"); AddState("UpdateRequired").OnlyTransitionFrom("InitialConnect"); }
public Form_VersionManage() { InitializeComponent(); Mark = false; CarSummery_Client = (CarSummeryClient)ClientFactory.GetClient(ClientType.Type.CarSummery); Province_Client = (ProvinceClient)ClientFactory.GetClient(ClientType.Type.Province); City_Client = (CityClient)ClientFactory.GetClient(ClientType.Type.City); Shop_Client = (ShopClient)ClientFactory.GetClient(ClientType.Type.Shop); Brand_Client = (BrandClient)ClientFactory.GetClient(ClientType.Type.Brand); Type_Client = (TypeClient)ClientFactory.GetClient(ClientType.Type.Type); Version_Client = (VersionClient)ClientFactory.GetClient(ClientType.Type.Version); List_VersionInfo = CarSummery_Client.SelectAllCar().ToList(); List_Car_Province = Province_Client.SelectAllProvinces().ToList(); List_City = City_Client.SelectAllCitys().ToList(); List_Shop = Shop_Client.SelectAllShops().ToList(); List_Brand = Brand_Client.SelectAllBrands().ToList(); List_Type = Type_Client.SelectAllTypes().ToList(); CB_ProviceBind(); CB_BrandBind(); CB_TypeBind(); BT_UpdateVersion.Visible = false; }
public Form1() { InitializeComponent(); bool FoundConfig = LoadCityConfig(); Logger.Initialize("Log.txt"); Logger.WarnEnabled = true; Logger.DebugEnabled = true; if (!FoundConfig) { Logger.LogWarning("Couldn't find a ServerConfig.ini file!"); //TODO: This doesn't work... Application.Exit(); } m_Listener = new CityListener(); m_Listener.OnReceiveEvent += new OnReceiveDelegate(m_Listener_OnReceiveEvent); //CharacterCreate, variable length... CityClient.RegisterCityPacketID(0x00, 0); //KeyFetch, variable length... CityClient.RegisterCityPacketID(0x01, 0); m_LoginClient = new LoginClient("127.0.0.1", 2348); m_LoginClient.OnNetworkError += new NetworkErrorDelegate(m_LoginClient_OnNetworkError); m_LoginClient.Connect(); //Send a pulse to the LoginServer every second. m_PulseTimer = new System.Timers.Timer(1000); m_PulseTimer.AutoReset = true; m_PulseTimer.Elapsed += new ElapsedEventHandler(m_PulseTimer_Elapsed); m_PulseTimer.Start(); m_Listener.Initialize(2107); }
public CityConnectionRegulator(CityClient cityApi, [Named("City")] AriesClient cityClient, IDatabaseService db, IClientDataService ds, IKernel kernel, IShardsDomain shards) { this.CityApi = cityApi; this.Client = cityClient; this.Client.AddSubscriber(this); this.DB = db; this.DataService = ds; this.Shards = shards; AddState("Disconnected") .Default() .Transition() .OnData(typeof(ShardSelectorServletRequest)) .TransitionTo("SelectCity"); AddState("SelectCity") .OnlyTransitionFrom("Disconnected", "Reconnecting"); AddState("ConnectToCitySelector") .OnData(typeof(ShardSelectorServletResponse)) .TransitionTo("CitySelected") .OnlyTransitionFrom("SelectCity"); AddState("CitySelected") .OnData(typeof(ShardSelectorServletResponse)) .TransitionTo("OpenSocket") .OnlyTransitionFrom("ConnectToCitySelector"); AddState("OpenSocket") .OnData(typeof(AriesConnected)).TransitionTo("SocketOpen") .OnData(typeof(AriesDisconnected)).TransitionTo("UnexpectedDisconnect") .OnlyTransitionFrom("CitySelected"); AddState("SocketOpen") .OnData(typeof(RequestClientSession)).TransitionTo("RequestClientSession") .OnData(typeof(AriesDisconnected)).TransitionTo("UnexpectedDisconnect") .OnlyTransitionFrom("OpenSocket"); AddState("RequestClientSession") .OnData(typeof(HostOnlinePDU)).TransitionTo("HostOnline") .OnData(typeof(AriesDisconnected)).TransitionTo("UnexpectedDisconnect") .OnlyTransitionFrom("SocketOpen"); AddState("HostOnline").OnlyTransitionFrom("RequestClientSession"); AddState("PartiallyConnected") .OnData(typeof(AriesDisconnected)).TransitionTo("UnexpectedDisconnect") .OnData(typeof(ShardSelectorServletRequest)).TransitionTo("CompletePartialConnection") .OnlyTransitionFrom("HostOnline"); AddState("CompletePartialConnection").OnlyTransitionFrom("PartiallyConnected"); AddState("AskForAvatarData") .OnData(typeof(LoadAvatarByIDResponse)).TransitionTo("ReceivedAvatarData") .OnlyTransitionFrom("PartiallyConnected", "CompletePartialConnection"); AddState("ReceivedAvatarData").OnlyTransitionFrom("AskForAvatarData"); AddState("AskForCharacterData").OnlyTransitionFrom("ReceivedAvatarData"); AddState("ReceivedCharacterData").OnlyTransitionFrom("AskForCharacterData"); AddState("Connected") .OnData(typeof(AriesDisconnected)).TransitionTo("UnexpectedDisconnect") .OnlyTransitionFrom("ReceivedCharacterData"); AddState("UnexpectedDisconnect"); AddState("Disconnect") .OnData(typeof(AriesDisconnected)) .TransitionTo("Disconnected"); AddState("Reconnect") .OnData(typeof(AriesDisconnected)) .TransitionTo("Reconnecting"); AddState("Reconnecting") .OnData(typeof(ShardSelectorServletRequest)) .TransitionTo("SelectCity") .OnlyTransitionFrom("Reconnect"); GameThread.SetInterval(() => { if (Client.IsConnected) { Client.Write(new Server.Protocol.Electron.Packets.KeepAlive()); } }, 10000); //keep alive every 10 seconds. prevents disconnection by aggressive NAT. }
public LotSimulation(CityClient Owner) { m_Owner = Owner; m_VM.NewSimulationStateEvent += new OnNewSimulationState(m_VM_NewSimulationStateEvent); }
/// <summary> /// 客户端服务实例产生器 /// </summary> /// <param name="type">产生的服务类型</param> /// <returns></returns> private static object build(ClientType.Type type) { switch (type) { case ClientType.Type.Account: { AccountClient temp = new AccountClient(); UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName; UNPCC.UserName = GlobalParams.UserName; UNPCC.Password = GlobalParams.Password; AddClient <AccountClient>(type, temp); return(temp); } case ClientType.Type.Action: { ActionClient temp = new ActionClient(); UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName; UNPCC.UserName = GlobalParams.UserName; UNPCC.Password = GlobalParams.Password; AddClient <ActionClient>(type, temp); return(temp); } case ClientType.Type.Brand: { BrandClient temp = new BrandClient(); UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName; UNPCC.UserName = GlobalParams.UserName; UNPCC.Password = GlobalParams.Password; AddClient <BrandClient>(type, temp); return(temp); } case ClientType.Type.CarSummery: { CarSummeryClient temp = new CarSummeryClient(); UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName; UNPCC.UserName = GlobalParams.UserName; UNPCC.Password = GlobalParams.Password; AddClient <CarSummeryClient>(type, temp); return(temp); } case ClientType.Type.Checkout: { CheckoutClient temp = new CheckoutClient(); UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName; UNPCC.UserName = GlobalParams.UserName; UNPCC.Password = GlobalParams.Password; AddClient <CheckoutClient>(type, temp); return(temp); } case ClientType.Type.City: { CityClient temp = new CityClient(); UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName; UNPCC.UserName = GlobalParams.UserName; UNPCC.Password = GlobalParams.Password; AddClient <CityClient>(type, temp); return(temp); } case ClientType.Type.Order: { OrderClient temp = new OrderClient(); UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName; UNPCC.UserName = GlobalParams.UserName; UNPCC.Password = GlobalParams.Password; AddClient <OrderClient>(type, temp); return(temp); } case ClientType.Type.OrderSummery: { OrderSummeryClient temp = new OrderSummeryClient(); UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName; UNPCC.UserName = GlobalParams.UserName; UNPCC.Password = GlobalParams.Password; AddClient <OrderSummeryClient>(type, temp); return(temp); } case ClientType.Type.Province: { ProvinceClient temp = new ProvinceClient(); UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName; UNPCC.UserName = GlobalParams.UserName; UNPCC.Password = GlobalParams.Password; AddClient <ProvinceClient>(type, temp); return(temp); } case ClientType.Type.RAP: { RAPClient temp = new RAPClient(); UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName; UNPCC.UserName = GlobalParams.UserName; UNPCC.Password = GlobalParams.Password; AddClient <RAPClient>(type, temp); return(temp); } case ClientType.Type.Salary: { SalaryClient temp = new SalaryClient(); UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName; UNPCC.UserName = GlobalParams.UserName; UNPCC.Password = GlobalParams.Password; AddClient <SalaryClient>(type, temp); return(temp); } case ClientType.Type.SalaryAppend: { SalaryAppendClient temp = new SalaryAppendClient(); UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName; UNPCC.UserName = GlobalParams.UserName; UNPCC.Password = GlobalParams.Password; AddClient <SalaryAppendClient>(type, temp); return(temp); } case ClientType.Type.SalaryInfoSummery: { SalaryInfoSummeryClient temp = new SalaryInfoSummeryClient(); UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName; UNPCC.UserName = GlobalParams.UserName; UNPCC.Password = GlobalParams.Password; AddClient <SalaryInfoSummeryClient>(type, temp); return(temp); } case ClientType.Type.SalaryLog: { SalaryLogClient temp = new SalaryLogClient(); UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName; UNPCC.UserName = GlobalParams.UserName; UNPCC.Password = GlobalParams.Password; AddClient <SalaryLogClient>(type, temp); return(temp); } case ClientType.Type.Shop: { ShopClient temp = new ShopClient(); UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName; UNPCC.UserName = GlobalParams.UserName; UNPCC.Password = GlobalParams.Password; AddClient <ShopClient>(type, temp); return(temp); } case ClientType.Type.Type: { TypeClient temp = new TypeClient(); UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName; UNPCC.UserName = GlobalParams.UserName; UNPCC.Password = GlobalParams.Password; AddClient <TypeClient>(type, temp); return(temp); } case ClientType.Type.Version: { VersionClient temp = new VersionClient(); UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName; UNPCC.UserName = GlobalParams.UserName; UNPCC.Password = GlobalParams.Password; AddClient <VersionClient>(type, temp); return(temp); } case ClientType.Type.WorkRAP: { WorkRAPClient temp = new WorkRAPClient(); UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName; UNPCC.UserName = GlobalParams.UserName; UNPCC.Password = GlobalParams.Password; AddClient <WorkRAPClient>(type, temp); return(temp); } case ClientType.Type.UserManager: { UserManagerClient temp = new UserManagerClient(); UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName; UNPCC.UserName = GlobalParams.UserName; UNPCC.Password = GlobalParams.Password; AddClient <UserManagerClient>(type, temp); return(temp); } case ClientType.Type.UserSummery: { UserSummeryClient temp = new UserSummeryClient(); UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName; UNPCC.UserName = GlobalParams.UserName; UNPCC.Password = GlobalParams.Password; AddClient <UserSummeryClient>(type, temp); return(temp); } case ClientType.Type.GetCar: { GetCarClient temp = new GetCarClient(); UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName; UNPCC.UserName = GlobalParams.UserName; UNPCC.Password = GlobalParams.Password; AddClient <GetCarClient>(type, temp); return(temp); } } ; return(null); }
public CityController(CityClient cityClient, ICitiesClient citiesClient) { _cityClient = cityClient; _citiesClient = citiesClient; }