public static ARWObject Extract(byte[] bytes) { string data = System.Text.Encoding.UTF8.GetString(bytes).Replace("\0", null).Replace("\"", null); ARWObject newObj = new ARWObject(); string[] dataParts = data.Split('~'); if (dataParts.Length == 3) { newObj.requestName = dataParts [0]; string[] prms = dataParts [1].Split('_'); foreach (string p in prms) { string[] paramParts = p.Split('#'); if (paramParts.Length == 2) { newObj.dataList.Add(paramParts [0], paramParts [1]); } } newObj.eventParams = SpecialEventParam.Extract(dataParts [2]); return(newObj); } return(newObj); }
public Room(SpecialEventParam e) { try{ this.name = e.GetString("RoomName"); this.tag = e.GetString("RoomTag"); this.id = e.GetInt("RoomId"); userList = new List <User>(); string[] userArray = e.GetString("Users").Split(new string[] { "''" }, StringSplitOptions.None); for (int ii = 0; ii < userArray.Length; ii++) { string[] userDataParts = userArray[ii].Split(new string[] { "^^" }, StringSplitOptions.None); SpecialEventParam userParams = new SpecialEventParam(); userParams.PutVariable("userName", userDataParts[0]); userParams.PutVariable("userId", userDataParts[1]); userParams.PutVariable("isMe", false); userParams.PutVariable("userVariables", userDataParts[2]); User u = new User(userParams); userList.Add(u); } }catch (System.NullReferenceException) { }catch (System.IndexOutOfRangeException) {} }
public static SpecialEventParam Extract(string data) { SpecialEventParam newSpecialEventParam = new SpecialEventParam(); if (data == null) { return(newSpecialEventParam); } string[] variables = data.Split('_'); foreach (string variable in variables) { string[] varParts = variable.Split('#'); if (varParts.Length == 2) { newSpecialEventParam.dataList.Add(varParts [0], varParts [1]); } } return(newSpecialEventParam); }
public User(SpecialEventParam e) { this.name = e.GetString("userName"); this.id = e.GetInt("userId"); this.isMe = bool.Parse(e.GetString("isMe")); this.lastJoinedRoom = null; this.userVariables = new List <UserVariable>(); string userVariables = e.GetString("userVariables"); string[] userVars = userVariables.Split('§'); foreach (string userVar in userVars) { string[] variableParts = userVar.Split('½'); if (variableParts.Length == 2) { this.userVariables.Add(new UserVariable(variableParts[0], variableParts[1])); } } UserManager.allUserInGame.Add(this); }
public ARWObject() { dataList = new Dictionary <string, object> (); requestName = String.Empty; eventParams = new SpecialEventParam(); }