/// <summary> /// Register new user /// </summary> /// <param name="user"></param> /// <returns>user id</returns> public int RegisterUser(VirtualServerEntity.User user) { // create object var newUser = new Dictionary <UserInfo, string>(); foreach (var ui in user.Info) { newUser.Add((UserInfo)ui.Key, ui.Value); } // register user var id = _server.registerUser(newUser); // update id user.Id = id; // set user texture if (user.Texture.Length > 0) { _server.setTexture(id, user.Texture); } // add in cache _entity.Users.Add(id, user); return(id); }