private void SetMaterial(List <Type> result, Player player) { if (result.Count() == 0) { return; } //Put the first in the carry slot. player.User.Carrying.Modify(Item.Get(result[0]), 1); //Put the rest in the toolbar. int index = 1; foreach (var stack in player.User.Inventory.Toolbar.Stacks.Where(x => !(x.Item is ToolItem))) { if (index >= result.Count()) { break; } var entry = result[index++]; stack.Modify(Activator.CreateInstance(entry) as Item, 1); } AdminCommands.CarryAll(player.User, true); //Select the dev tool player.User.Inventory.Toolbar.SelectType(player, this.GetType()); }
public void HandleConsoleMessage(ClientStructure client, ChatConsoleMsgData message) { if (client.Authenticated && AdminCommands.Retrieve().Contains(client.PlayerName)) { CommandHandler.HandleServerInput(message.Message); } }
public void Can_update_admin() { var admin = SecurityTestHelper.CreateAdmin(); var firstName = TestDataGenerator.GetRandomString(); var lastName = TestDataGenerator.GetRandomString(); var status = true; var language = TestDataGenerator.GetRandomString(); var description = TestDataGenerator.GetRandomString(); admin.FirstName = firstName; admin.LastName = lastName; admin.IsActive = status; admin.Language = language; admin.Description = description; var adminData = Mapper.DynamicMap <EditAdminData>(admin); adminData.AllowedBrands = admin.AllowedBrands.Select(b => b.Id).ToList(); adminData.AssignedLicensees = admin.Licensees.Select(l => l.Id).ToList(); adminData.Password = TestDataGenerator.GetRandomString(); AdminCommands.UpdateAdmin(adminData); admin = AdminQueries.GetAdminById(admin.Id); Assert.True(admin.FirstName == firstName); Assert.True(admin.LastName == lastName); Assert.True(admin.IsActive == status); Assert.True(admin.Language == language); Assert.True(admin.Description == description); }
/// <summary> /// Generates default command name->method pairs. /// </summary> void DefaultCommands(DiscordBot bot) { AdminCommands adminCmds = new AdminCommands(); MetaCommands metaCmds = new MetaCommands(); UtilityCommands utilCmds = new UtilityCommands(); CoreCommands coreCmds = new CoreCommands(IsBotCommander); // Informational bot.RegisterCommand(InfoCmds.CMD_Help, "help", "halp", "helps", "halps", "hel", "hal", "h"); bot.RegisterCommand(InfoCmds.CMD_Hello, "hello", "hi", "hey", "source", "src"); bot.RegisterCommand(InfoCmds.CMD_Info, "info", "notice", "alert"); bot.RegisterCommand(InfoCmds.CMD_Update, "update", "latest", "current", "build", "builds", "download", "version"); bot.RegisterCommand(InfoCmds.CMD_GitHub, "github", "git", "gh", "readme", "read", "link"); bot.RegisterCommand(InfoCmds.CMD_Issues, "issues", "issue", "error", "ghissues", "githubissues"); bot.RegisterCommand(InfoCmds.CMD_Rule, "rule", "rules"); bot.RegisterCommand(InfoCmds.CMD_Quote, "quote", "quotes", "q"); // Meta Docs bot.RegisterCommand(metaCmds.CMD_Command, "command", "commands", "cmd", "cmds", "c"); bot.RegisterCommand(metaCmds.CMD_Mechanism, "mechanism", "mechanisms", "mech", "mechs", "mec", "mecs", "m"); bot.RegisterCommand(metaCmds.CMD_Tag, "tag", "tags", "t"); bot.RegisterCommand(metaCmds.CMD_Event, "event", "events", "evt", "evts", "e"); bot.RegisterCommand(metaCmds.CMD_Action, "action", "actions", "act", "acts", "a"); bot.RegisterCommand(metaCmds.CMD_Language, "language", "languages", "lang", "langs", "l"); bot.RegisterCommand(metaCmds.CMD_Guide, "guide", "guides", "g", "beginner", "beginners", "beginnersguide", "guidepage", "guidespage"); bot.RegisterCommand(metaCmds.CMD_Search, "search", "s", "find", "f", "get", "locate", "what", "where", "how", "w", "meta", "metainfo", "docs", "doc", "documentation", "documentations", "document", "documents"); // Utility bot.RegisterCommand(utilCmds.CMD_LogCheck, "logcheck", "checklog", "logscheck", "checklogs"); bot.RegisterCommand(utilCmds.CMD_VersionCheck, "versioncheck", "checkversion", "iscurrent", "isuptodate", "isupdated", "checkcurrent", "currentcheck"); bot.RegisterCommand(utilCmds.CMD_ScriptCheck, "script", "scriptcheck", "dscript", "ds", "checkscript", "dscriptcheck", "checkdscript"); // Admin bot.RegisterCommand(coreCmds.CMD_Restart, "restart"); bot.RegisterCommand(adminCmds.CMD_Reload, "reload"); }
/// <summary> /// /// </summary> /// <param name="Reader"></param> public override void ReadXml(XmlReader Reader) { // read baseclass part base.ReadXml(Reader); // bot Reader.ReadToFollowing(XMLTAG_BOT); IRCServer = Reader[XMLATTRIB_IRCSERVER]; IRCPort = Convert.ToUInt16(Reader[XMLATTRIB_IRCPORT]); Channel = Reader[XMLATTRIB_CHANNEL]; NickName = Reader[XMLATTRIB_NICKNAME]; IRCPassword = Reader[XMLATTRIB_IRCPASSWORD]; ChatPrefix = Reader[XMLATTRIB_CHATPREFIX]; MaxBurst = Convert.ToUInt32(Reader[XMLATTRIB_MAXBURST]); Refill = Convert.ToUInt32(Reader[XMLATTRIB_REFILL]); Banner = Reader[XMLATTRIB_BANNER]; // admincommands list AdminCommands.Clear(); Reader.ReadToFollowing(XMLTAG_ADMINCOMMANDS); if (Reader.ReadToDescendant(XMLTAG_ITEM)) { do { AdminCommands.Add(Reader[XMLATTRIB_NAME]); }while (Reader.ReadToNextSibling(XMLTAG_ITEM)); } }
public ParseCommands(DragonChat chat) { _chat = chat; adminCommands = new AdminCommands(chat); userCommands = new UserCommands(chat); defaultCommands = new DefaultCommands(chat); }
public static void LoadDataBuffers() { //DisabledQuikEdit(); Stopwatch allData = new Stopwatch(); allData.Start(); int count = 0; count += DataProvider.LoadEtc(@".\NX\Etc.nx"); ManualResetEvent[] handles = new ManualResetEvent[6]; for (int i = 0; i < handles.Count(); i++) { handles[i] = new ManualResetEvent(false); } ThreadPool.QueueUserWorkItem(new WaitCallback(LoadMobs), handles[2]); ThreadPool.QueueUserWorkItem(new WaitCallback(LoadEquips), handles[0]); ThreadPool.QueueUserWorkItem(new WaitCallback(LoadItems), handles[1]); ThreadPool.QueueUserWorkItem(new WaitCallback(LoadSkills), handles[3]); ThreadPool.QueueUserWorkItem(new WaitCallback(LoadQuests), handles[4]); handles[2].WaitOne(); //Wait for mob thread to finish ThreadPool.QueueUserWorkItem(new WaitCallback(LoadMaps), handles[5]); //Map needs mob wz info, so wait until mobs finished WaitHandle.WaitAll(handles); //Always do strings after the other WZs! count += DataProvider.LoadStrings(@".\NX\String.nx"); ServerConsole.Info("{0} Strings loaded", count); ServerConsole.Info("Finished loading .NX in {0} ms", (int)allData.ElapsedMilliseconds); Stopwatch sw = new Stopwatch(); sw.Start(); count = DataProvider.LoadScripts(); ServerConsole.Info("{0} Scripts loaded in {1} ms", count, (int)sw.ElapsedMilliseconds); sw.Reset(); /* * sw.Start(); * Count = LoadCashShopItems(); * ServerConsole.Info(String.Format("{0} CashShop items loaded in {1} ms", Count, (int)sw.ElapsedMilliseconds)); * sw.Reset(); */ sw.Start(); count = AdminCommands.ReloadCommands(); count += GMCommands.ReloadCommands(); count += PlayerCommands.ReloadCommands(); count += DonorCommands.ReloadCommands(); ServerConsole.Info("{0} Commands loaded in {1} ms", count, (int)sw.ElapsedMilliseconds); sw.Reset(); LoadMonsterDrops(); allData.Stop(); ServerConsole.Info("All data loaded in {0} ms", (int)allData.ElapsedMilliseconds); ServerConsole.Info("=============================================="); }
public static void SendAdminList(ClientStructure client) { var newMessage = new AdminListReplyMsgData { Admins = AdminCommands.Retrieve().ToArray() }; MessageQueuer.SendToClient <AdminSrvMsg>(client, newMessage); }
/// <summary> /// Software entry point - starts the bot. /// </summary> static void Main(string[] args) { DiscordBotBaseHelper.StartBotHandler(args, new DiscordBotConfig() { CommandPrefix = "!", Initialize = (bot) => { InfoCommands infoCommands = new InfoCommands() { Bot = bot }; VotingCommands voteCommands = new VotingCommands() { Bot = bot }; CoreCommands coreCommands = new CoreCommands(IsAdmin) { Bot = bot }; AdminCommands adminCommands = new AdminCommands() { Bot = bot }; OwningGuildID = bot.ConfigFile.GetUlong("guild_id").Value; VoteTopicsSection = bot.ConfigFile.GetSection("vote_topics"); if (VoteTopicsSection == null) { VoteTopicsSection = new FDSSection(); bot.ConfigFile.Set("vote_topics", VoteTopicsSection); } Admins = new HashSet <ulong>(bot.ConfigFile.GetStringList("admins").Select(s => ulong.Parse(s))); // Info bot.RegisterCommand(infoCommands.CMD_Help, "help", "halp", "hlp", "hal", "hel", "h", "?", "use", "usage"); bot.RegisterCommand(infoCommands.CMD_Hello, "hello", "hi", "whoareyou", "what", "link", "info"); // Voting bot.RegisterCommand(voteCommands.CMD_Ballot, "ballot", "b"); bot.RegisterCommand(voteCommands.CMD_Vote, "vote", "v"); bot.RegisterCommand(voteCommands.CMD_ClearVote, "clearvote", "voteclear", "cv"); // Admin bot.RegisterCommand(coreCommands.CMD_Restart, "restart"); bot.RegisterCommand(adminCommands.CMD_CallVote, "callvote"); bot.RegisterCommand(adminCommands.CMD_EndVote, "endvote"); bot.RegisterCommand(adminCommands.CMD_VoteStatus, "votestatus"); bot.Client.Ready += () => { bot.Client.SetGameAsync("With the balance of power in this world.").Wait(); return(Task.CompletedTask); }; }, ShouldPayAttentionToMessage = (message) => { //return message.Channel is IPrivateChannel || IsAdmin(message.Author); return(true); } }); }
private void RequestUser(long id) { string response = AdminCommands.UserInfo(id); targetUser = Library.GetUserInfoFromString(response); targetUserGames = RequestUserLibrary(id); UpdateUserDisplay(); }
public void Cannot_create_admin_without_licensees() { /*** Arrange ***/ var userData = CreateAddAdminData(); /*** Act ***/ Action action = () => AdminCommands.CreateAdmin(userData); action.ShouldThrow <RegoException>() .Where(x => x.Message.Contains("licenseesRequired")); }
public UnauthenticatedModule() { Get("/api/playerCount", async(_) => { PlayerCountResponseModel resp = null; Gate.RunGatedAction(() => resp = new PlayerCountResponseModel() { Online = PlayerManager.GetAllOnline().Count, Offline = PlayerManager.GetAllOffline().Count }); return(resp.AsJsonWebResponse()); }); Get("/api/networkStats", async(_) => { return(new NetworkStatsResponseModel() { C2S_CRCErrors_Aggregate = NetworkStatistics.C2S_CRCErrors_Aggregate, C2S_Packets_Aggregate = NetworkStatistics.C2S_Packets_Aggregate, C2S_RequestsForRetransmit_Aggregate = NetworkStatistics.C2S_RequestsForRetransmit_Aggregate, S2C_Packets_Aggregate = NetworkStatistics.S2C_Packets_Aggregate, S2C_RequestsForRetransmit_Aggregate = NetworkStatistics.S2C_RequestsForRetransmit_Aggregate, Summary = NetworkStatistics.Summary() }.AsJsonWebResponse()); }); Get("/api/serverStatus", async(_) => { string resp = null; Gate.RunGatedAction(() => resp = AdminCommands.GetServerStatus()); return(resp.AsJsonWebResponse()); }); Get("/api/serverInfo", async(_) => { ServerInfoResponseModel resp = null; Gate.RunGatedAction(() => resp = new ServerInfoResponseModel() { PlayerCount = new PlayerCountResponseModel() { Online = PlayerManager.GetAllOnline().Count, Offline = PlayerManager.GetAllOffline().Count }, Uptime = Timers.RunningTime, WorldName = ConfigManager.Config.Server.WorldName, AccountDefaults = ConfigManager.Config.Server.Accounts, MaximumAllowedSessions = ConfigManager.Config.Server.Network.MaximumAllowedSessions, ServerMotd = PropertyManager.GetString("server_motd").Item, PopupMotd = PropertyManager.GetString("popup_motd").Item, }); return(resp.AsJsonWebResponse()); }); }
private void AddVoucherButton_Click(object sender, RoutedEventArgs e) { //Debug.LogError("Not implemented yet!"); string code = ConvertVoucherCodeToSend(VoucherCodeBox.Text); int uses = -1; long coins = -1; long gameID = -1; if (code.Length == 0) { Debug.LogError("No code entered"); return; } if (!int.TryParse(UsesTextBox.Text, out uses)) { Debug.ConversionError(UsesTextBox.Text, "uses", uses); return; } if (uses < -1) { Debug.LogError("Cannot add voucher without any uses"); return; } string response; if (!long.TryParse(GameTextBox.Text, out gameID)) { gameID = -1; if (!long.TryParse(CoinsTextBox.Text, out coins)) { Debug.ConversionError(CoinsTextBox.Text, "gameID and coins", coins); return; } response = AdminCommands.AddVoucher(coins, uses, code, true); } else { response = AdminCommands.AddVoucher(gameID, uses, code, false); } if (response != "OK") { Debug.LogError("Server response: \"" + response + "\""); } RefreshVouchersList(); }
public static void HandleNudge(Session session, params string[] parameters) { var pos = session.Player.GetPosition(PositionType.Location); if (session.Player.AdjustDungeonCells(pos)) { pos.PositionZ += 0.005000f; var posReadable = PostionAsLandblocksGoogleSpreadsheetFormat(pos); AdminCommands.HandleTeleportLOC(session, posReadable.Split(' ')); var positionMessage = new GameMessageSystemChat($"Nudge player to {posReadable}", ChatMessageType.Broadcast); session.Network.EnqueueSend(positionMessage); } }
public void Cannot_create_admin_without_brands() { /*** Arrange ***/ var licensees = BrandQueries.GetLicensees().Select(l => l.Id); var userData = CreateAddAdminData(licensees); /*** Act ***/ Action action = () => AdminCommands.CreateAdmin(userData); /*** Assert ***/ action.ShouldThrow <RegoException>() .Where(x => x.Message.Contains("brandsRequired")); }
public void Can_change_password() { var admin = SecurityTestHelper.CreateAdmin(); var authRepository = Container.Resolve <IAuthRepository>(); var initialPasswordValue = authRepository.Actors.Single(a => a.Id == admin.Id).EncryptedPassword; AdminCommands.ChangePassword(admin.Id, TestDataGenerator.GetRandomString()); var updatedPasswordValue = authRepository.Actors.Single(a => a.Id == admin.Id).EncryptedPassword; Assert.AreNotEqual(initialPasswordValue, updatedPasswordValue); }
public void Can_activate() { // *** Arrange *** var admin = SecurityTestHelper.CreateAdmin(); // *** Act *** AdminCommands.Activate(new ActivateUserData(admin.Id, string.Empty)); // *** Assert *** var activatedAdmin = AdminQueries.GetAdminById(admin.Id); Assert.IsNotNull(activatedAdmin); Assert.True(activatedAdmin.IsActive == true); }
private void RequestVoucher(string code) { code = ConvertVoucherCodeToSend(code); string response = AdminCommands.VoucherInfo(code); /*if(response != "OK") * { * Debug.LogError("Server response: " + response); * return; * }*/ targetVoucher = ParseStringToVoucher(response); UpdateVoucherDisplay(); }
public static void SendConsoleMessageToAdmins(string text) { var admins = AdminCommands.Retrieve(); foreach (var client in ClientRetriever.GetAuthenticatedClients().Where(c => admins.Contains(c.PlayerName))) { var messageData = new ChatConsoleMsgData { From = GeneralSettings.SettingsStore.ConsoleIdentifier, Message = text }; MessageQueuer.SendToClient <ChatSrvMsg>(client, messageData); } }
private void AddGameButton_Click(object sender, RoutedEventArgs e) { if (GameSearchBar.Text.Length == 0) { Debug.LogError("No game entered"); return; } if (targetUser == null) { Debug.LogError("No user selected"); return; } string response = ""; if (IsNumber(GameSearchBar.Text[0])) { long gameID = 0; try { gameID = long.Parse(GameSearchBar.Text); } catch (Exception) { Debug.ConversionError(GameSearchBar.Text, "gameID", gameID); return; } response = AdminCommands.AddGameToUser(targetUser.id, gameID); if (response != "OK") { Debug.LogError("Add game to user error: \"" + response + "\""); return; } return; } response = AdminCommands.AddGameToUser(targetUser.id, GameSearchBar.Text); if (response != "OK") { Debug.LogError("Add game to user error: \"" + response + "\""); return; } }
public void Can_add_allowed_brand_to_admin() { // *** Arrange *** var admin = SecurityTestHelper.CreateAdmin(); var brand = BrandHelper.CreateBrand(); // *** Act *** AdminCommands.AddBrandToAdmin(admin.Id, brand.Id); // *** Assert *** var createdAdmin = SecurityRepository.Admins.Include(u => u.AllowedBrands).FirstOrDefault(u => u.Id == admin.Id); Assert.IsNotNull(createdAdmin); Assert.IsNotNull(createdAdmin.AllowedBrands); Assert.True(createdAdmin.AllowedBrands.Any(b => b.Id == brand.Id)); }
public void Cannot_update_admin_without_licensees() { /*** Arrange ***/ var admin = SecurityTestHelper.CreateAdmin(); var adminData = Mapper.DynamicMap <EditAdminData>(admin); adminData.AllowedBrands = new[] { Brand.Id }; adminData.AssignedLicensees = null; /*** Act ***/ Action action = () => AdminCommands.UpdateAdmin(adminData); /*** Assert ***/ action.ShouldThrow <RegoException>() .Where(x => x.Message.Contains("licenseesRequired")); }
public void Can_filter_brands() { // *** Arrange *** var admin = SecurityTestHelper.CreateAdmin(licenseeId: Licensee.Id); admin.AllowedBrands.Clear(); var brands = new List <Core.Brand.Interface.Data.Brand>(); const int brandCount = 20; const int userBrandCount = 10; // Create user brands for (var i = 0; i < userBrandCount; i++) { var brand = CreateBrand(); brands.Add(brand); AdminCommands.AddBrandToAdmin(admin.Id, brand.Id); } // Create other brands for (var i = 0; i < brandCount - userBrandCount; i++) { var brand = CreateBrand(); brands.Add(brand); } SecurityTestHelper.SignInAdmin(admin); // *** Act *** var filtered = BrandQueries.GetFilteredBrands(brands, admin.Id); // *** Assert *** Assert.IsNotNull(filtered); Assert.True(filtered.Count() == userBrandCount); var userBrandIds = admin.AllowedBrands.Select(b => b.Id); var filteredBrandIds = filtered.Select(b => b.Id); var isEqual = userBrandIds.OrderBy(a => a).SequenceEqual(filteredBrandIds.OrderBy(a => a)); Assert.True(isEqual); }
private void GameChangeButton_Click(object sender, RoutedEventArgs e) { if (targetVoucher == null) { Debug.LogError("No voucher selected"); return; } long gameID = -1; if (!long.TryParse(GameTextBox.Text, out gameID)) { Debug.ConversionError(GameTextBox.Text, "uses", gameID); return; } AdminCommands.ChangeVoucherGameID(targetVoucher.code, gameID); }
private void CoinsChangeButton_Click(object sender, RoutedEventArgs e) { if (targetVoucher == null) { Debug.LogError("No voucher selected"); return; } long coins = -1; if (!long.TryParse(CoinsTextBox.Text, out coins)) { Debug.ConversionError(CoinsTextBox.Text, "uses", coins); return; } AdminCommands.ChangeVoucherCoins(targetVoucher.code, coins); }
private void UsesChangeButton_Click(object sender, RoutedEventArgs e) { if (targetVoucher == null) { Debug.LogError("No voucher selected"); return; } //Debug.LogError("Not implemented yet!"); int uses = -1; if (!int.TryParse(UsesTextBox.Text, out uses)) { Debug.ConversionError(UsesTextBox.Text, "uses", uses); return; } AdminCommands.ChangeVoucherUses(targetVoucher.code, uses); }
private void DeleteVoucherButton_Click(object sender, RoutedEventArgs e) { string code = ConvertVoucherCodeToSend(VoucherCodeBox.Text); if (code.Length == 0) { Debug.LogError("No code entered"); return; } string response = AdminCommands.DeleteVoucher(code); if (response != "OK") { Debug.LogError("Server response: \"" + response + "\""); } RefreshVouchersList(); }
/// <summary> /// Generates default command name->method pairs. /// </summary> void DefaultCommands() { InfoCmds.Bot = this; AdminCommands adminCmds = new AdminCommands() { Bot = this }; MetaCommands metaCmds = new MetaCommands() { Bot = this }; UtilityCommands utilCmds = new UtilityCommands() { Bot = this }; // Informational RegisterCommand(InfoCmds.CMD_Help, "help", "halp", "helps", "halps", "hel", "hal", "h"); RegisterCommand(InfoCmds.CMD_Hello, "hello", "hi", "hey", "source", "src"); RegisterCommand(InfoCmds.CMD_Info, "info", "notice", "alert"); RegisterCommand(InfoCmds.CMD_Update, "update", "latest", "current", "build", "builds", "download", "version"); RegisterCommand(InfoCmds.CMD_GitHub, "github", "git", "gh", "readme", "read", "link"); RegisterCommand(InfoCmds.CMD_Issues, "issues", "issue", "error", "ghissues", "githubissues"); RegisterCommand(InfoCmds.CMD_Rule, "rule", "rules"); // Meta Docs RegisterCommand(metaCmds.CMD_Command, "command", "commands", "cmd", "cmds", "c"); RegisterCommand(metaCmds.CMD_Mechanism, "mechanism", "mechanisms", "mech", "mechs", "mec", "mecs", "m"); RegisterCommand(metaCmds.CMD_Tag, "tag", "tags", "t"); RegisterCommand(metaCmds.CMD_Event, "event", "events", "evt", "evts", "e"); RegisterCommand(metaCmds.CMD_Action, "action", "actions", "act", "acts", "a"); RegisterCommand(metaCmds.CMD_Language, "language", "languages", "lang", "langs", "l"); RegisterCommand(metaCmds.CMD_Search, "search", "s", "find", "f", "get", "g", "locate", "what", "where", "how", "w", "meta", "metainfo", "docs", "doc", "documentation", "documentations", "document", "documents"); // Utility // TODO: CMD_DScriptCheck RegisterCommand(utilCmds.CMD_LogCheck, "logcheck", "checklog", "logscheck", "checklogs"); RegisterCommand(utilCmds.CMD_VersionCheck, "versioncheck", "checkversion", "iscurrent", "isuptodate", "isupdated", "checkcurrent", "currentcheck"); // Admin RegisterCommand(adminCmds.CMD_Restart, "restart"); RegisterCommand(adminCmds.CMD_Reload, "reload"); }
public override void Entry(IModHelper helper) { Utilities.Helper = helper; this.Config = new ModConfig(Monitor, helper); hostCommands = new HostCommands(Config); userCommands = new UserCommands(Config); adminCommands = new AdminCommands(Config); helper.Events.GameLoop.OneSecondUpdateTicked += this.OnOneSecondUpdateTicked; helper.Events.GameLoop.Saved += this.OnSaved; var harmony = HarmonyInstance.Create(this.ModManifest.UniqueID); harmony.Patch( original: AccessTools.Method(typeof(StardewValley.Menus.ChatBox), nameof(StardewValley.Menus.ChatBox.receiveChatMessage)), postfix: new HarmonyMethod(typeof(ModEntry), nameof(ModEntry.receiveChatMessage_Postfix)) ); helper = this.Helper; }
private void RequestButton_Click(object sender, RoutedEventArgs e) { if (UserIDTextBox.Text.Length == 0) { return; } long id = 0; if (!IsNumber(UserIDTextBox.Text[0])) { string strId = AdminCommands.GetUserID(UserIDTextBox.Text); if (!long.TryParse(strId, out id)) { Debug.LogError("Cannot parse \"" + strId + "\" to userID ( long )"); targetUser = null; UpdateUserDisplay(); return; } } else { if (!long.TryParse(UserIDTextBox.Text, out id)) { Debug.LogError("Cannot parse \"" + UserIDTextBox.Text + "\" to userID ( long )"); targetUser = null; UpdateUserDisplay(); return; } } ClearUserInfo(); //Debug.Log("Requested user with id: " + id); RequestUser(id); //UpdateUserDisplay(); }