public static void RemovePlayerFromGame(Net.GS.GameClient gameClient) { if (gameClient == null || gameClient.Game == null) return; var gameId = gameClient.Game.GameId; if (!Games.ContainsKey(gameId)) return; var game = Games[gameId]; if (!game.Players.ContainsKey(gameClient)) return; Player p = null; if (!game.Players.TryRemove(gameClient, out p)) { Logger.Error("Can't remove player ({0}) from game with id: {1}", gameClient.Player.Toon.Name, gameId); } if (p != null) { var toon = p.Toon; toon.TimePlayed += DateTimeExtensions.ToUnixTime(DateTime.UtcNow) - toon.LoginTime; toon.SaveToDB(); // Remove Player From World if (p.InGameClient != null) p.World.Leave(p); } if (game.Players.Count == 0) { Games.Remove(gameId); // we should be also disposing it /raist. } }
public override void OnTargeted(Player player, Net.GS.Message.Definitions.World.TargetMessage message) { var world = player.World; world.BroadcastIfRevealed(new PlayAnimationMessage() { ActorID = this.DynamicID, Field1 = 5, Field2 = 0f, tAnim = new[] { new PlayAnimationMessageSpec() { Duration = 4, AnimationSNO = 0x2f761, PermutationIndex = 0, Speed = 1f, } } }, this); player.InGameClient.SendMessage(new ANNDataMessage(Opcodes.OpenWaypointSelectionWindowMessage) { ActorID = this.DynamicID }); //erekose we set the flag for "operated" this.Attributes[Net.GS.Message.GameAttribute.Gizmo_Has_Been_Operated] = true; }
public override void OnTargeted(Players.Player player, Net.GS.Message.Definitions.World.TargetMessage message) { World.BroadcastIfRevealed(new PlayAnimationMessage { ActorID = this.DynamicID, Field1 = 5, Field2 = 0, tAnim = new Net.GS.Message.Fields.PlayAnimationMessageSpec[] { new Net.GS.Message.Fields.PlayAnimationMessageSpec() { Duration = 50, AnimationSNO = AnimationSet.TagMapAnimDefault[AnimationSetKeys.Opening], PermutationIndex = 0, Speed = 1 } } }, this); World.BroadcastIfRevealed(new SetIdleAnimationMessage { ActorID = this.DynamicID, AnimationSNO = AnimationSetKeys.Open.ID }, this); this.Attributes[GameAttribute.Gizmo_Has_Been_Operated] = true; this.Attributes[GameAttribute.Gizmo_Operator_ACDID] = unchecked((int)player.DynamicID); this.Attributes[GameAttribute.Gizmo_State] = 1; Attributes.BroadcastChangedIfRevealed(); base.OnTargeted(player, message); }
protected override Analyzer GetAnalyzer(Net.Util.Version version) { analyzer = new PerFieldAnalyzerWrapper(base.GetAnalyzer(version)); analyzer.AddAnalyzer<SampleDocument>(t => t.Id, new KeywordAnalyzer()); analyzer.AddAnalyzer<SampleDocument>(t => t.Key, new CaseInsensitiveKeywordAnalyzer()); return analyzer; }
public static void HandlePacketPong(Client client, Net.Paket.PongPaket pp) { if(pp.Message == Settings.Default.ServerName) { client._nextActivityCheck = DateTime.Now + TimeSpan.FromSeconds(30); } }
protected override Analyzer GetAnalyzer(Net.Util.Version version) { var analyzer = new PerFieldAnalyzerWrapper(base.GetAnalyzer(version)); analyzer.AddAnalyzer("Path", new CaseInsensitiveKeywordAnalyzer()); analyzer.AddAnalyzer("Key", new KeywordAnalyzer()); return analyzer; }
protected override Analyzer GetAnalyzer(Net.Util.Version version) { var a = new PerFieldAnalyzerWrapper(base.GetAnalyzer(version)); a.AddAnalyzer("Version", new KeywordAnalyzer()); a.AddAnalyzer("Flag", new KeywordAnalyzer()); return a; }
public override void OnTargeted(Player player, Net.GS.Message.Definitions.World.TargetMessage message) { var world = player.World; world.BroadcastIfRevealed(new PlayAnimationMessage() { ActorID = this.DynamicID, Field1 = 5, Field2 = 0f, tAnim = new[] { new PlayAnimationMessageSpec() { Duration = 4, AnimationSNO = 0x2f761, PermutationIndex = 0, Speed = 1f, } } }, this); player.InGameClient.SendMessage(new ANNDataMessage(Opcodes.OpenWaypointSelectionWindowMessage) { ActorID = this.DynamicID }); }
public override void handleMsg(Net.Message msg) { EventArgs e = new EventArgs(); switch (msg.head) { case "in": join(client); msg.data = client.loginName + " is in"; break; case "talk": string content = msg.data; msg.data = client.loginName + " : " + content; break; case "exit": msg.data = client.loginName + " is out"; break; default: addText(e, "client trigger a undefined event!"); break; } for (int i = 0; i < roomChatter.Count; i++) { roomChatter[i].sw.Write(serializeStream(msg)); roomChatter[i].sw.Flush(); //AddItemToListBox("To " + user.loginName + ":" + message); } }
public static void Main(string[] args) { QApplication.initialize(args); // Parse any command-line arguments we're interested in. // For now, we just assume all arguments are hostnames // or IP addresses of peers we want to connect to. // This might change if/when we need more interesting options. ushort port = 0; // 0 means system-chosen port (default) foreach (string arg in args) { if (arg.StartsWith("-port:")) { port = UInt16.Parse(arg.Substring(6)); } else if (arg.StartsWith("-")) { Console.WriteLine( "Unknown command-line option" + arg); } else // Interpret the argument as a peer name. initPeers.Add(arg); } // Create the Net object implementing our network protocol // and our peer-to-peer system state model. Net net = new Net(port, initPeers); // Create and show the main GUI window // The Gui object can "see" the Net object but not vice versa. // This is intentional: we want to keep Net independent of Gui, // so that (for example) we can run a non-graphical instance // of our peer-to-peer system controlled some other way, // e.g., as a daemon or via command-line or Web-based control. Gui gui = new Gui(net); gui.show(); QApplication.exec(); }
public NNBasicStrategy(Net.Net net, double eps = .9, double lambda = .5) { this.net = net; this.eps = eps; this.lambda = .5; r = new Random(); }
public async Task<string> Route(ControllerActionParts parts, Net.Api.RequestType requestType) { var path = parts.OriginalPath; path = path.Replace("/", "."); //path = path.Replace("-", "_"); var resourceName = string.Format("Scrutiny.{0}", path); var content = await Resources.GetStringAsync(resourceName); return content; }
private Net GetNet() { if (m_Net == null) { m_Net = new Net(); } return m_Net; }
private void Write (String data, Net.IRequestListener requestListener) { try { File.AppendAllText (tracesFile, data); requestListener.Result (""); } catch (Exception e) { requestListener.Error (e.Message); } }
public override void OnTargeted(Players.Player player, Net.GS.Message.Definitions.World.TargetMessage message) { Logger.Warn("Healthwell has no function, Powers not implemented"); this.Attributes[GameAttribute.Gizmo_Has_Been_Operated] = true; this.Attributes[GameAttribute.Gizmo_Operator_ACDID] = unchecked((int)player.DynamicID); this.Attributes[GameAttribute.Gizmo_State] = 1; Attributes.BroadcastChangedIfRevealed(); }
public async Task<string> Route(ControllerActionParts parts, Net.Api.RequestType requestType) { var apiControllers = loadApiControllersFromConfig(); var controllersMap = createCaseInsensitiveDictionaryOf(apiControllers); var controllerType = controllersMap[parts.Action]; var response = callMethod(controllerType, requestType.ToString(), parts.Value); return Json(response); }
public static void HandlePacketUser(Client client, Net.Paket.UserPaket up) { client.ClientInfo.Username = up.Username; client.ClientInfo.RealName = up.RealName; client.ClientInfo.Host = up.Hostname; if(client.ClientInfo.Nickname != null) { client.ClientInfo.IsRegistered = true; RegisterUser(client); } }
public override void handleMsg(Net.Message msg) { EventArgs e = new EventArgs(); switch (msg.head) { case "0": client.loginName = msg.data; break; case "1": if (am.addUser(client.loginName, msg.data)) { msg.data = "registe successfully,welcome!" + client.loginName; addText(e, client.loginName + " is regist!"); msg.head = "11"; sendMessage(msg); } else { msg.data = "this name is already used"; msg.head = "10"; sendMessage(msg); } break; case "2": client.loginName = msg.data; break; case "3": if (am.authentify(client.loginName, msg.data)) { msg.data = "login successfully,welcome!" + client.loginName; addText(e, client.loginName + " is login!"); msg.head = "31"; sendMessage(msg); } else { msg.data = "fail to login,username or password is wrong"; msg.head = "30"; sendMessage(msg); } break; case "4": am.removeUser(msg.data); //sendMessage(msg);//tell user who out break; case "talk": sendMessage(msg); break; // default: //AddItemToListBox("什么意思啊:" + receiveString); } }
public static void HandlePacketNick(Client client, Net.Paket.NickPaket np) { var nickClient = client.Server.GetClientByNickname(np.Nickname.ToUpper()); if(nickClient != null) { client.SendPacket(new NickNameInUseResponse {NickName = np.Nickname}); return; } client.ClientInfo.Nickname = np.Nickname; client.Server.Nicknames.Add(np.Nickname.ToUpper(), client); RegisterUser(client); }
public void Send (String data, Net.IRequestListener flushListener) { string tmpData = data.Replace("{\"actor", "${\"actor").Replace("[", "").Replace("]", ""); string[] tmpArray = tmpData.Split('$'); foreach (string action in tmpArray) { if (action != "") { Log.L().AddLogLine(action); } } net.POST (host + track, System.Text.Encoding.UTF8.GetBytes (data), trackHeaders, flushListener); }
private void Write (String data, Net.IRequestListener requestListener) { #if UNITY_WEBGL requestListener.Error ("Impossible to use LocalStorage in WebGL version"); #elif UNITY_ANDROID || UNITY_IPHONE || UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN || UNITY_STANDALONE_LINUX try { File.AppendAllText (tracesFile, data); requestListener.Result (""); } catch (Exception e) { requestListener.Error (e.Message); } #endif }
static void Main(string[] args) { Net net = new Net(); LoginParam param = new LoginParam(); param.user = "******"; param.psw = "1111111"; param.host = "127.0.0.1"; param.port = 15299; net.ConnectLoginServer(param); while (true) { net.Update(); System.Threading.Thread.Sleep(10); } }
public IrcServices(IrcServicesConfig config) { Config = config; //If a bind address has been given, bind to it, otherwise use default behavior. if (Config.LocalHost == String.Empty) { net = new Net(); } else { net = new Net(Config.LocalHost); } Parser = new IrcParser(); Unreal unreal = new Unreal(this, Parser); unreal.Setup(); }
public async Task<string> Route(ControllerActionParts parts, Net.Api.RequestType requestType) { var controller = new Controllers.RunController(); switch (parts.Action) { case "index": //TODO: Rewrite as async? var value = parts.Value.SingleOrDefault(); var testRun = string.IsNullOrEmpty(value) ? 0 : int.Parse(value); return await controller.Index(testRun); default: throw new NotSupportedException(); } }
protected internal override void Init(Net.Renderers.GL4.Renderer renderer) { base.Init(renderer); throw new NotImplementedException(); //var depthShader = THREE.ShaderLib[ "depthRGBA" ]; //var depthUniforms = THREE.UniformsUtils.clone( depthShader.uniforms ); // //_depthMaterial = new THREE.ShaderMaterial( { fragmentShader: depthShader.fragmentShader, vertexShader: depthShader.vertexShader, uniforms: depthUniforms } ); //_depthMaterialMorph = new THREE.ShaderMaterial( { fragmentShader: depthShader.fragmentShader, vertexShader: depthShader.vertexShader, uniforms: depthUniforms, morphTargets: true } ); //_depthMaterialSkin = new THREE.ShaderMaterial( { fragmentShader: depthShader.fragmentShader, vertexShader: depthShader.vertexShader, uniforms: depthUniforms, skinning: true } ); //_depthMaterialMorphSkin = new THREE.ShaderMaterial( { fragmentShader: depthShader.fragmentShader, vertexShader: depthShader.vertexShader, uniforms: depthUniforms, morphTargets: true, skinning: true } ); // //_depthMaterial._shadowPass = true; //_depthMaterialMorph._shadowPass = true; //_depthMaterialSkin._shadowPass = true; //_depthMaterialMorphSkin._shadowPass = true; }
public override void OnRequestUse(GS.Players.Player player, Item target, int actionId, Net.GS.Message.Fields.WorldPlace worldPlace) { if (player.Attributes[GameAttribute.Hitpoints_Cur] == player.Attributes[GameAttribute.Hitpoints_Max]) return; // TODO Error msg? /fasbat player.Attributes[GameAttribute.Hitpoints_Cur] = Math.Min(player.Attributes[GameAttribute.Hitpoints_Cur] + this.Attributes[GameAttribute.Hitpoints_Granted], player.Attributes[GameAttribute.Hitpoints_Max]); player.Attributes.SendChangedMessage(player.InGameClient, player.DynamicID); // TODO Send to all. /fasbat if (this.Attributes[GameAttribute.ItemStackQuantityLo] <= 1) player.Inventory.DestroyInventoryItem(this); // No more potions! else { this.Attributes[GameAttribute.ItemStackQuantityLo]--; // Just remove one this.Attributes.SendChangedMessage(player.InGameClient, this.DynamicID); } }
/// <summary> /// </summary> /// <param name="net">An object to interact with the network.</param> /// <param name="host">Host of the collector server.</param> /// <param name="trackingCode">Tracking code for the game.</param> /// <param name="authorization">Authorization to start the tracking.</param> public NetStorage (MonoBehaviour behaviour, string host, string trackingCode) { this.net = new Net (behaviour); this.host = host; this.trackingCode = trackingCode; this.authorization = "a:"; string filePath = Application.dataPath + "/Assets/track.txt"; if (Application.platform != RuntimePlatform.WebGLPlayer) { filePath = "file:///" + filePath; } WWW www = new WWW(filePath); behaviour.StartCoroutine(WaitForRequest(www)); }
internal override void Write(Net.BigEndianStream stream) { base.Write(stream); if (Type >= 0) { if (Durability > 0 || IsEnchantable) stream.Write((short)-1); // TODO: Remove the two lines above and implement items and enchantments write /* * if (Item.CanBeDamaged()) * { * if(_enchantments != null) * WriteEnchantmentsToNBT(stream); * else * stream.Write(-1); * } */ } }
public static void RemovePlayerFromGame(Net.GS.GameClient gameClient) { if (gameClient == null || gameClient.Game == null) return; var gameId = gameClient.Game.GameId; if (!Games.ContainsKey(gameId)) return; var game = Games[gameId]; if (!game.Players.ContainsKey(gameClient)) return; Player.Player p = null; if (!game.Players.TryRemove(gameClient, out p)) { Logger.Error("Can't remove player ({0}) from game with id: {1}", gameClient.Player.Properties.Name, gameId); } if (game.Players.Count == 0) { Games.Remove(gameId); // we should be also disposing it /raist. } }
public async Task<string> Route(ControllerActionParts parts, Net.Api.RequestType requestType) { var context = System.Web.HttpContext.Current; var server = (ScrutinyServer)context.Cache.Get(Module.IOSERVER_CACHE_KEY); var form = context.Request.Unvalidated.Form; var id = form.Get("id"); var message = form.Get("message"); if (string.IsNullOrEmpty(id)) { //Connecting if (!string.IsNullOrEmpty(message)) throw new ArgumentException("Establish a connection first before emitting commands!"); //TODO: Verify formArgs are empty? return server.Connect(); } else if (string.IsNullOrEmpty(message)) { //Polling thread //TODO: Verify formArgs are empty? return await server.Poll(id); } else { //Emitting command switch (message) { case "register": server.Register(id, SocketIORouterModels.RegisterModel.From(form)); break; case "start": server.Start(id, SocketIORouterModels.StartModel.From(form)); break; case "info": server.Info(id, SocketIORouterModels.InfoModel.From(form)); break; case "result": server.Result(id, SocketIORouterModels.ResultModel.From(form)); break; case "complete": server.Complete(id, SocketIORouterModels.CompleteModel.From(form)); break; case "error": server.Error(id, form); break; default: throw new ArgumentException(string.Format("'{0}' is not a valid command", message), "message"); } return "{}"; } }
/// <summary> /// The RmsPropSolver constructor. /// </summary> /// <param name="cuda">Specifies the instance of CudaDnn to use.</param> /// <param name="log">Specifies the Log for output.</param> /// <param name="p">Specifies teh SolverParameter.</param> /// <param name="evtCancel">Specifies a CancelEvent used to cancel the current operation (e.g. training, testing) for which the Solver is performing.</param> /// <param name="evtForceSnapshot">Specifies an automatic reset event that causes the Solver to perform a Snapshot when set.</param> /// <param name="evtForceTest">Specifies an automatic reset event that causes teh Solver to run a testing cycle when set.</param> /// <param name="imgDb">Specifies the CaffeImageDatabase.</param> /// <param name="persist">Specifies the peristence used for loading and saving weights.</param> /// <param name="nSolverCount">Specifies the number of Solvers participating in a multi-GPU session.</param> /// <param name="nSolverRank">Specifies the rank of this Solver in a multi-GPU session.</param> /// <param name="shareNet">Optionally, specifies the net to share when creating the training network (default = null, meaning no share net is used).</param> /// <param name="getws">Optionally, specifies the handler for getting the workspace.</param> /// <param name="setws">Optionally, specifies the handler for setting the workspace.</param> public RmsPropSolver(CudaDnn <T> cuda, Log log, SolverParameter p, CancelEvent evtCancel, AutoResetEvent evtForceSnapshot, AutoResetEvent evtForceTest, IXImageDatabase imgDb, IXPersist <T> persist, int nSolverCount = 1, int nSolverRank = 0, Net <T> shareNet = null, onGetWorkspace getws = null, onSetWorkspace setws = null) : base(cuda, log, p, evtCancel, evtForceSnapshot, evtForceTest, imgDb, persist, nSolverCount, nSolverRank, shareNet, getws, setws) { m_log.CHECK_EQ(0, m_param.momentum, "Momentum cannot be used with RmsProp."); m_log.CHECK_GE(m_param.rms_decay, 0, "rms_decay should lie between 0 and 1."); m_log.CHECK_LT(m_param.rms_decay, 1, "rms_decay should lie between 0 and 1."); }
public static void Quit() { Net.Disconnect(); Self.GetTree().Quit(); }
//[HandlerAjaxOnly] public async Task <ActionResult> CheckLogin(string hotelCode, string userName, string password, string code) { try { if (hotelCode.IsEmpty()) { throw new Exception("请输入酒店码!"); } var verifyCode = Session["opupms_session_verifycode"]; if (verifyCode.IsEmpty() || DESEncrypt.MD5(code.ToLower(), 16) != verifyCode.ToString()) { throw new Exception("验证码错误,请重新输入"); } var result = await _userDomainService.CheckLoginAsync( new LoginInputDto { HotelCode = hotelCode, UserName = userName, UserPwd = password, }); if (result.State == LoginState.Successed) { OperatorModel operatorModel = new OperatorModel(); operatorModel.UserId = result.UserCode; operatorModel.UserCode = result.UserCode; operatorModel.UserName = result.UserName; //operatorModel.UserPwd = userEntity.UserPwd; string pwd = DESEncrypt.Rc4PassHex(DESEncrypt.DecryptFromBase64(password)); operatorModel.CompanyId = result.HotelCode; //operatorModel.DepartmentId = userEntity.F_DepartmentId; operatorModel.ConnectToken = result.HotelCode; operatorModel.RoleId = result.RoleId; operatorModel.LoginIPAddress = Net.Ip; operatorModel.LoginIPAddressName = Net.GetLocation(operatorModel.LoginIPAddress); operatorModel.LoginTime = DateTime.Now; operatorModel.LoginToken = DESEncrypt.Encrypt(Common.GuId()); //if (userEntity.Czdmmc00 == "admin") //{ // operatorModel.IsSystem = true; //} //else //{ // operatorModel.IsSystem = false; //} ClearCache(); //FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(2, operatorModel.UserId, DateTime.Now, DateTime.Now.AddDays(2), false, string.Concat(operatorModel.UserId, "|", operatorModel.UserName)); //HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, FormsAuthentication.Encrypt(ticket)); ////if (loginInput.AutoLogin) ////{ //// cookie.Expires = ticket.Expiration; ////} //cookie.Domain = FormsAuthentication.CookieDomain; //cookie.Path = FormsAuthentication.FormsCookiePath; OperatorProvider.Provider.AddCurrent(operatorModel); //return Content(new AjaxResult { Status = ResultType.Success.ToString(), Message = "登录成功。" }.ToJson()); return(NewtonSoftJson(new JsonMessage <int, object> { Status = 1 }, "text/html" /*解决IE直接返回json提示下载文件问题*/, true)); } else { //return Content(new AjaxResult { Status = ResultType.Error.ToString(), Message = "登录失败,用户名密码错误或被禁用!" }.ToJson()); return(NewtonSoftJson(new JsonMessage <int, object> { Status = result.State.ToInt(), Message = "登录失败,用户名密码错误或被禁用!" }, "text/html" /*解决IE直接返回json提示下载文件问题*/, true)); } } catch (Exception ex) { //return Content(new AjaxResult { Status = ResultType.Error.ToString(), Message = ex.Message }.ToJson()); return(NewtonSoftJson(new JsonMessage <int, object> { Status = 0, Message = ex.Message }, "text/html" /*解决IE直接返回json提示下载文件问题*/, true)); } }