private void gvChat_MouseUp(object sender, MouseEventArgs e) { try { int num2; if (this.ChatRowPoints.ContainsKey((sender as GridView).FocusedRowHandle)) { Rectangle rectangle = this.ChatRowPoints[(sender as GridView).FocusedRowHandle]; if (rectangle.Contains(e.X, e.Y)) { ChatLine row = (sender as GridView).GetRow((sender as GridView).FocusedRowHandle) as ChatLine; if (row != null) { IText text = row.TextSegments[0]; if (text != null) { int index; Font textFont = text.TextFont; string str = text.Text; string str2 = null; Dictionary<int, ChatLink> dictionary = null; List<string> list = null; List<MultiVal<int, int>> list2 = null; SortedList<int, Emote> list3 = null; if (!(!Program.Settings.Chat.Links.ShowChatLinks || (!row.ContainsLinks.HasValue ? false : !row.ContainsLinks.Value))) { dictionary = ChatLink.CreateCharacterIndex(ChatLink.FindLinks(str)); } if (!(!Program.Settings.Chat.Emotes.ShowEmotes || (!row.ContainsEmotes.HasValue ? false : !row.ContainsEmotes.Value))) { list = new List<string>(); list2 = new List<MultiVal<int, int>>(); list3 = new SortedList<int, Emote>(); SortedList<int, Emote> list4 = new SortedList<int, Emote>(new EmoteLengthComparer()); foreach (Emote emote in Emote.AllEmotes.Values) { list4.Add(emote.CharSequence.Length, emote); } foreach (Emote emote in list4.Values) { index = str.IndexOf(emote.CharSequence); while (index >= 0) { bool flag = false; if (dictionary != null) { foreach (ChatLink link in dictionary.Values) { if ((index >= link.StartIndex) && (index <= link.EndIndex)) { flag = true; } } } bool flag2 = false; foreach (KeyValuePair<int, Emote> pair in list3) { if ((index >= pair.Key) && (index < (pair.Key + pair.Value.CharSequence.Length))) { flag2 = true; break; } } if (!(flag || flag2)) { list2.Add(new MultiVal<int, int>(index, emote.CharSequence.Length)); list3.Add(index, emote); } index = str.IndexOf(emote.CharSequence, (int) (index + emote.CharSequence.Length)); if (!(!Program.Settings.Chat.Links.ShowChatLinks || (!row.ContainsLinks.HasValue ? false : !row.ContainsLinks.Value))) { if (str2 == null) { str2 = str; } str2 = str2.Replace(emote.CharSequence, ""); } } } } using (Graphics graphics = this.gpgChatGrid.CreateGraphics()) { float num6; float x; float y; int num9; int num10; ChatLink link2; SolidBrush brush; string[] strArray; int num11; SizeF ef; Brush brush2; Font linkFont; RectangleF ef2; if ((list3 != null) && (list3.Count > 0)) { list2.Add(new MultiVal<int, int>(str.Length, 0)); list3.Add(str.Length, null); SortedList<int, MultiVal<int, int>> list5 = new SortedList<int, MultiVal<int, int>>(list2.Count); list5[-1] = new MultiVal<int, int>(0, 0); foreach (MultiVal<int, int> val in list2) { list5[val.Value1] = val; } for (num2 = 1; num2 < list5.Count; num2++) { int num3 = list5.Values[num2 - 1].Value1; index = list5.Values[num2].Value1; int num4 = list5.Values[num2 - 1].Value2; int num5 = list5.Values[num2].Value2; list.Add(str.Substring(num3 + num4, index - (num3 + num4))); } dictionary = ChatLink.CreateCharacterIndex(ChatLink.FindLinks(str2)); num6 = textFont.Height + 3; x = rectangle.X; y = rectangle.Y; num9 = (this.colText.VisibleWidth - 10) + rectangle.X; num10 = 0; link2 = null; using (brush = new SolidBrush(text.TextColor)) { num2 = 0; while (num2 < list.Count) { if (list[num2].Length > 0) { strArray = DrawUtil.SplitString(list[num2], " "); for (num11 = 0; num11 < strArray.Length; num11++) { if (link2 == null) { if ((dictionary.Count > 0) && dictionary.ContainsKey(num10)) { link2 = dictionary[num10]; } if (link2 != null) { using (brush2 = new SolidBrush(link2.LinkColor)) { linkFont = link2.LinkFont; ef = DrawUtil.MeasureString(graphics, link2.DisplayText + " ", linkFont); if (((ef.Width <= (num9 - rectangle.Left)) || (x != rectangle.Left)) && ((x + ef.Width) > num9)) { x = rectangle.X; y += num6; } ef2 = new RectangleF(x, y, ef.Width, ef.Height); if (ef2.Contains((float) e.X, (float) e.Y)) { link2.OnClick(); return; } } } else { ef = DrawUtil.MeasureString(graphics, strArray[num11], textFont); if (((ef.Width <= (num9 - rectangle.Left)) || (x != rectangle.Left)) && ((x + ef.Width) > num9)) { x = rectangle.X; y += num6; } } num10 += strArray[num11].Length; x += ef.Width; } else { num10 += strArray[num11].Length; } if ((link2 != null) && (num10 >= link2.EndIndex)) { link2 = null; } } } if (list3.Values[num2] != null) { float num12 = 1f; float num13 = list3.Values[num2].Image.Width * num12; if ((x + num13) > num9) { x = rectangle.X; y += num6; } if ((e.Button == MouseButtons.Right) && ConfigSettings.GetBool("Emotes", true)) { Rectangle rectangle2 = new Rectangle((int) x, (int) y, list3.Values[num2].Image.Width, list3.Values[num2].Image.Height); if (rectangle2.Contains(e.Location)) { this.ciEmote_Animate.Checked = Program.Settings.Chat.Emotes.AnimateEmotes; this.ciEmote_Share.Checked = Program.Settings.Chat.Emotes.AutoShareEmotes; this.SelectedEmote = list3.Values[num2]; this.gpgContextMenuEmote.Show(this.gpgChatGrid, e.Location); return; } } x += num13; } num2++; } } } else if ((dictionary != null) && (dictionary.Count > 0)) { num6 = textFont.Height + 3; x = rectangle.X; y = rectangle.Y; num9 = (this.colText.VisibleWidth - 10) + rectangle.X; num10 = 0; link2 = null; using (brush = new SolidBrush(text.TextColor)) { strArray = DrawUtil.SplitString(str, " "); for (num11 = 0; num11 < strArray.Length; num11++) { if (link2 == null) { if ((dictionary.Count > 0) && dictionary.ContainsKey(num10)) { link2 = dictionary[num10]; } if (link2 != null) { using (brush2 = new SolidBrush(link2.LinkColor)) { linkFont = link2.LinkFont; ef = DrawUtil.MeasureString(graphics, link2.DisplayText + " ", linkFont); if (((ef.Width <= (num9 - rectangle.Left)) || (x != rectangle.Left)) && ((x + ef.Width) > num9)) { x = rectangle.X; y += num6; } ef2 = new RectangleF(x, y, ef.Width, ef.Height); if (ef2.Contains((float) e.X, (float) e.Y)) { if (e.Button == MouseButtons.Left) { link2.OnClick(); goto Label_0C82; } if (e.Button == MouseButtons.Right) { goto Label_0C82; } } } } else { ef = DrawUtil.MeasureString(graphics, strArray[num11], textFont); if (((ef.Width <= (num9 - rectangle.Left)) || (x != rectangle.Left)) && ((x + ef.Width) > num9)) { x = rectangle.X; y += num6; } } num10 += strArray[num11].Length; x += ef.Width; } else { num10 += strArray[num11].Length; } if ((link2 != null) && (num10 >= link2.EndIndex)) { link2 = null; } } } } } } } } } Label_0C82: if (e.Button == MouseButtons.Right) { if ((this.SelectedChatTextSender == null) || this.SelectedChatTextSender.IsSystem) { this.ciChatText_ShowEmotes.Visible = !Program.Settings.Chat.Emotes.ShowEmotes; this.ciChatText_ViewPlayer.Visible = false; this.ciChatText_ViewRank.Visible = false; this.ciChatText_PrivateMsg.Visible = false; this.ciChatText_ClanInvite.Visible = false; this.ciChatText_ClanRequest.Visible = false; this.ciChatText_ViewClan.Visible = false; this.ciChatText_Ignore.Visible = false; this.ciChatText_Unignore.Visible = false; this.ciChatText_WebStats.Visible = false; this.ciChatText_Replays.Visible = false; this.ciChatText_FriendInvite.Visible = false; this.ciChatText_FriendRemove.Visible = false; this.ciChatText_Promote.Visible = false; this.ciChatText_Demote.Visible = false; this.ciChatText_ClanRemove.Visible = false; this.ciChatText_LeaveClan.Visible = false; this.ciChatText_Ban.Visible = false; this.ciChatText_Kick.Visible = false; this.ciChatText_Solution.Visible = false; } else { User selectedChatTextSender = this.SelectedChatTextSender; this.ciChatText_ShowEmotes.Visible = !Program.Settings.Chat.Emotes.ShowEmotes; this.ciChatText_ViewPlayer.Visible = true; this.ciChatText_ViewRank.Visible = false; this.ciChatText_PrivateMsg.Visible = !selectedChatTextSender.IsCurrent && selectedChatTextSender.Online; this.ciChatText_ClanInvite.Visible = (User.Current.IsInClan && !selectedChatTextSender.IsInClan) && !selectedChatTextSender.IsCurrent; this.ciChatText_ClanRequest.Visible = (!User.Current.IsInClan && selectedChatTextSender.IsInClan) && !selectedChatTextSender.IsCurrent; this.ciChatText_ViewClan.Visible = selectedChatTextSender.IsInClan; this.ciChatText_Ignore.Visible = !selectedChatTextSender.IsCurrent && !selectedChatTextSender.IsIgnored; this.ciChatText_Unignore.Visible = !selectedChatTextSender.IsCurrent && selectedChatTextSender.IsIgnored; this.ciChatText_WebStats.Visible = ConfigSettings.GetBool("WebStatsEnabled", false); this.ciChatText_Replays.Visible = true; this.ciChatText_FriendInvite.Visible = !selectedChatTextSender.IsFriend && !selectedChatTextSender.IsCurrent; this.ciChatText_FriendRemove.Visible = selectedChatTextSender.IsFriend && !selectedChatTextSender.IsCurrent; this.ciChatText_Promote.Visible = selectedChatTextSender.IsClanMate && ClanMember.Current.CanTargetAbility(ClanAbility.Promote, selectedChatTextSender.Name); this.ciChatText_Demote.Visible = selectedChatTextSender.IsClanMate && ClanMember.Current.CanTargetAbility(ClanAbility.Demote, selectedChatTextSender.Name); this.ciChatText_ClanRemove.Visible = selectedChatTextSender.IsClanMate && ClanMember.Current.CanTargetAbility(ClanAbility.Remove, selectedChatTextSender.Name); this.ciChatText_LeaveClan.Visible = User.Current.Equals(selectedChatTextSender) && User.Current.IsInClan; if ((Chatroom.Current != null) && Chatroom.Current.IsClanRoom) { this.ciChatText_Ban.Visible = ((User.Current.IsAdmin || ClanMember.Current.CanTargetAbility(ClanAbility.Ban, selectedChatTextSender.Name)) && !selectedChatTextSender.IsCurrent) && !selectedChatTextSender.IsAdmin; this.ciChatText_Kick.Visible = ((User.Current.IsAdmin || ClanMember.Current.CanTargetAbility(ClanAbility.Kick, selectedChatTextSender.Name)) && !selectedChatTextSender.IsCurrent) && !selectedChatTextSender.IsAdmin; } else { this.ciChatText_Ban.Visible = (((Chatroom.InChatroom && Chatroom.GatheringParticipants.ContainsIndex("name", selectedChatTextSender.Name)) && (User.Current.IsAdmin || (!Chatroom.Current.IsPersistent && User.Current.IsChannelOperator))) && !selectedChatTextSender.IsCurrent) && !selectedChatTextSender.IsAdmin; this.ciChatText_Kick.Visible = this.ciChatText_Ban.Visible; } this.ciChatText_Solution.Visible = true; } int num14 = -1; for (num2 = 0; num2 < this.gpgContextMenuChatText.MenuItems.Count; num2++) { if (this.gpgContextMenuChatText.MenuItems[num2].Text == "-") { if ((num14 < 0) || (this.gpgContextMenuChatText.MenuItems[num14].Text == "-")) { this.gpgContextMenuChatText.MenuItems[num2].Visible = false; } else if (num2 == (this.gpgContextMenuChatText.MenuItems.Count - 1)) { this.gpgContextMenuChatText.MenuItems[num2].Visible = false; } else { this.gpgContextMenuChatText.MenuItems[num2].Visible = true; } } if (this.gpgContextMenuChatText.MenuItems[num2].Visible) { num14 = num2; } } if ((num14 >= 0) && (this.gpgContextMenuChatText.MenuItems[num14].Text == "-")) { this.gpgContextMenuChatText.MenuItems[num14].Visible = false; } this.gpgContextMenuChatText.Show(this.gvChat.GridControl, e.Location); } } catch (Exception exception) { ErrorLog.WriteLine(exception); } }
private void skinButtonCreate_Click(object sender, EventArgs e) { base.ClearErrors(); if (!((this.pictureBoxNewIcon.Image != null) && this.ImageSet)) { base.Error(this.gpgButtonChooseNewIcon, "<LOC>You must choose an icon for this emote.", new object[0]); } else if ((this.gpgTextBoxNewKeySeq.Text == null) || (this.gpgTextBoxNewKeySeq.Text.Length < 2)) { base.Error(this.gpgTextBoxNewKeySeq, "<LOC>You must choose a key sequence for this emote of at least 2 characters.", new object[0]); } else if (Emote.AllEmotes.ContainsKey(this.gpgTextBoxNewKeySeq.Text)) { base.Error(this.gpgTextBoxNewKeySeq, "<LOC>You already have an emote with this key sequence. If you wish to replace it you must delete it first.", new object[0]); } else if (Profanity.ContainsProfanity(this.gpgTextBoxNewKeySeq.Text)) { base.Error(this.gpgTextBoxNewKeySeq, "<LOC>Key sequence may not contain profanity.", new object[0]); } else if ((this.gpgTextBoxNewOutFile.Text == null) || (this.gpgTextBoxNewOutFile.Text.Length < 1)) { base.Error(this.skinButtonCreate, "<LOC>You must specify the ouput file for this emote.", new object[0]); } else { for (int i = 0; i < this.RestrictedEmotes.Length; i++) { if (this.gpgTextBoxNewKeySeq.Text.Contains(this.RestrictedEmotes[i])) { base.Error(this.gpgTextBoxNewKeySeq, "<LOC>'{0}' is a restricted key sequence. Please choose another.", new object[] { this.gpgTextBoxNewKeySeq.Text }); return; } } if (Program.Settings.Chat.Emotes.ShowCreateWarning) { string msg = "<LOC>This tool allows you to create and share emote icons with your own images. Sharing offensive or inappropriate images is grounds for deactivation of your user account and product key. You can learn more about custom emotes via the Knowledge Base. Are you sure you want to create this emote?"; DlgYesNo no = new DlgYesNo(base.MainForm, "<LOC>Warning", msg, new Size(350, 0x145)); no.DoNotShowAgainCheck = true; if (no.ShowDialog() == DialogResult.Yes) { Program.Settings.Chat.Emotes.ShowCreateWarning = !no.DoNotShowAgainValue; } else { Program.Settings.Chat.Emotes.ShowCreateWarning = !no.DoNotShowAgainValue; return; } } FileStream serializationStream = null; try { string text = this.gpgTextBoxNewOutFile.Text; List<Emote> graph = null; if (File.Exists(text)) { serializationStream = File.Open(text, FileMode.Open, FileAccess.ReadWrite); graph = new BinaryFormatter().Deserialize(serializationStream) as List<Emote>; serializationStream.Close(); if (graph == null) { base.Error(this.skinButtonCreate, "<LOC>File is invalid or corrupt.", new object[0]); return; } } else { serializationStream = File.Create(text); serializationStream.Close(); graph = new List<Emote>(); } Bitmap bitmap = new Bitmap(40, 20); this.pictureBoxNewIcon.DrawToBitmap(bitmap, new Rectangle(0, 0, 40, 20)); Emote item = new Emote(bitmap, this.gpgTextBoxNewKeySeq.Text, text); graph.Add(item); serializationStream = File.OpenWrite(text); new BinaryFormatter().Serialize(serializationStream, graph); serializationStream.Close(); serializationStream = null; Emote.AllEmotes[item.CharSequence] = item; this.ResetForm(); this.RefreshEmotes(); Emote.OnEmotesChanged(); } catch (Exception exception) { ErrorLog.WriteLine(exception); } finally { if (serializationStream != null) { serializationStream.Close(); } } } }
internal static void ValidateEmotes() { string str = ConfigSettings.GetString("RestrictedEmotes", null); if (str != null) { string[] array = str.Split(new char[] { ',' }); if (array.Length > 0) { Emote[] emoteArray = new Emote[AllEmotes.Values.Count]; AllEmotes.Values.CopyTo(emoteArray, 0); foreach (Emote emote in emoteArray) { if (Array.IndexOf<string>(array, emote.CharSequence) >= 0) { emote.Delete(); EventLog.WriteLine("Deleted bad emote '{0}'.", new object[] { emote.CharSequence }); } } emoteArray = null; } } }
public FrmMain() { WaitCallback callBack = null; MessageEventHandler handler = null; EventHandler handler2 = null; EventHandler handler3 = null; this.components = null; this.WebURL = null; this.IsGPGNetPatching = true; this.mNotFound = ""; this.IsLatestVer = false; this.mPatchFileName = ""; this.mServerGameVersion = null; this.mLastSelectedGame = null; this.mIsSupComVersionEnforced = null; this.mIsSupComPatching = false; this.DlgUpdate = null; this.SupComPatchThread = null; this.FriendsLoaded = false; this.FriendContainers = new BoundContainerList(); this.FriendContainerLookup = new Dictionary<string, TextContainer>(); this.ActiveDialogRequests = new List<string>(); this.FriendRequests = new MappedObjectList<FriendRequest>(); this.AwaitingLogin = true; this.ContinueLoading = null; this.LadderViews = new Dictionary<int, FrmLadderView>(); this.mGameMenuItems = new List<ToolStripMenuItem>(); this.mLastMoveItem = null; this.mConfigSleepRate = 0x493e0; this.mFirstConfig = true; this.mLastMOTD = ""; this.mLastProcessList = ""; this.mConfigThread = null; this.mConnected = true; this.mShuttingDown = false; this.CancelFade = false; this.HasFadeStarted = false; this.IsFading = false; this.TargetFade = 0.0; this.FadeIncrement = 0.0; this.StayActive = false; this.mIsActiveWindow = false; this.mWelcomePage = null; this.mRanInitializeChat = false; this.mHeightDiff = 0; this.mWidthDiff = 0; this.mLastX = 0; this.mLastY = 0; this.mLastMouseX = 0; this.mLastMouseY = 0; this.mLastWidth = 0; this.mLastHeight = 0; this.mIsMoving = false; this.mIsResizing = false; this.mStartResizing = false; this.RESIZE_RECT = 40; this.mResizeRect = new Rectangle(); this.FirstPaint = true; this.mIsMaximized = false; this.mRestore = new Rectangle(0, 0, 100, 100); this.MinimizeLoc = new Point(-32000, -32000); this.MinimizeSize = new Size(640, 500); this.StatusTimer = null; this.mActiveDialogs = new List<DlgBase>(); this.mActiveWindow = null; this.DlgAbout = null; this.DlgOptions = null; this.DlgUserFeedback = null; this.FrmStatsLadders = new List<FrmStatsLadder>(); this.DlgGameKeys = null; this.DlgEmotes = null; this.DlgSelectChannel = null; this.DlgKeywordSearch = null; this.DlgSearchResults = null; this.DlgSolution = null; this.DlgSearchReplays = null; this.DlgTeamGame = null; this.DlgSelectGame = null; this.DlgActiveEfforts = null; this.DlgContentManager = null; this.mSearchingForAutomatch = false; this.mLastStatus = ""; this.mCalcGridHeight = false; this.ToolstripSizeChanged = false; this.mCustomPaint = new List<ToolStripItem>(); this.mLastCheckTime = DateTime.Now; this.mDlgWorldMap = null; this.mSelectedTab = null; this.mGameLinkClickTime = DateTime.Now; this.ChatRowPoints = new Dictionary<int, Rectangle>(); this.ChatRowHeights = new Dictionary<int, int>(); this.mFirstChatDraw = true; this.SelectedEmote = null; this.LastTick = 0; this.Divider = 1; this.CurrentFrame = 1; this.EmoteCount = 0; this.CountEmotes = true; this.PaintPending = false; this.mSelectedParticipantView = null; this.UIQueue = new ThreadQueue(true); this.IsSortingChatroom = false; this.IsSynchronizingChatroom = false; this.ChatSyncTimer = null; this._AddUser = null; this._UpdateUser = null; this._RemoveUser = null; this.mSelectedChatParticipant = null; this.ChatContainerLookup = new Dictionary<string, TextContainer<StatusTextLine>>(); this.ChatContainers = new BoundContainerList<StatusTextLine>(); this.RefreshData = false; this.BetweenChannels = false; this.mMainChatrom = ""; this.ChatroomQueue = new ThreadQueue(true); this.mLastChatTimes = Hashtable.Synchronized(new Hashtable()); this.mLastChatContent = Hashtable.Synchronized(new Hashtable()); this.mChatLines = new BindingList<ChatLine>(); this.PlayerChatEffects = new Dictionary<string, ChatEffectBase>(); this.mSpeakingTimers = new Dictionary<string, StateTimer>(); this.AwayTimer = new StateTimer(); this.SelfLeaveTimer = new StateTimer(); this.LastAction = DateTime.Now; this.mChatHistory = new LinkedList<string>(); this.HistoryIndex = -1; this.SelectingTextList = false; this.PMTargets = new List<string>(); this.mPrivateChats = new Dictionary<string, FrmPrivateChat>(); this.PlayerProfileForm = null; this.ClanLoaded = false; this.ClanContainers = new BoundContainerList(); this.ClanContainerLookup = new Dictionary<string, TextContainer>(); this.ClanRequests = null; this.ClanInvites = null; this.ClanProfileForm = null; this.mBeforeGameChatroom = ""; this.mIsInGame = false; this.StatusButtonRankedGameCancel = new SkinStatusButton(); this.mGameName = ""; this.mGameURL = ""; this.mHostName = ""; this.mSupcomGameManager = null; this.mPassword = ""; this.mFirstRankedSupcomGame = true; this.PlayNowMatch = false; this.mAutoStatus = Loc.Get("<LOC>Searching for game "); this.LastGameChallenges = new Dictionary<int, bool>(); this.LadderInvitePending = false; this.mCanDirectChallenge = true; this.mDirectChallengePlayer = ""; this.AllowDirectChallenge = true; this.BeforeTeamGameChatroom = null; this.mTeamAutomatchExit = false; this.InviteAccepted = false; this.InvitePending = false; this.PendingJoinFrom = null; ThreadID = Thread.CurrentThread.ManagedThreadId; if (new DlgLogin().ShowDialog() == DialogResult.OK) { if (callBack == null) { callBack = delegate (object p) { GameInformation.LoadGamesFromDB(); new QuazalQuery("RemoveSpaceSiegeGame", new object[0]).ExecuteNonQuery(); ConfigSettings.LoadSettings(DataAccess.GetQueryData("GetAllConfigs", new object[0])); try { DataList queryData = null; queryData = DataAccess.GetQueryData("GetTOSPrompt", new object[0]); if ((queryData != null) && (queryData.Count < 1)) { DataAccess.ExecuteQuery("CreatePlayerInfo", new object[0]); queryData = DataAccess.GetQueryData("GetTOSPrompt", new object[0]); } if ((queryData != null) && (queryData.Count > 0)) { if (Convert.ToInt32(queryData[0]["term_of_service_prompt"]) > 0) { if (new DlgTermsOfService(this, queryData[0]["url"]).ShowDialog() == DialogResult.OK) { ThreadQueue.Quazal.Enqueue((VGen0)delegate { DataAccess.ExecuteQuery("SetTOSPrompt", new object[] { 0 }); }, new object[0]); this.ContinueLoading = true; } else { this.ContinueLoading = false; } } else { this.ContinueLoading = true; } } else { AuditLog.WriteLine("Unable to find Terms of Service agreement.", new object[0]); this.ContinueLoading = true; } } catch (Exception exception) { ErrorLog.WriteLine(exception); this.ContinueLoading = false; } }; } ThreadQueue.QueueUserWorkItem(callBack, new object[0]); while (!this.ContinueLoading.HasValue) { Thread.Sleep(100); } if (this.ContinueLoading.Value) { if (ConfigSettings.GetBool("DoOldGameList", false)) { if (((User.Current.IsAdmin || (GameInformation.SelectedGame.GameID == -1)) || (GameKey.BetaKeys.Count > 0)) || ((GameKey.BetaKeys.Count < 1) && (new DlgNoBetaKey(this).ShowDialog() == DialogResult.OK))) { this.AwaitingLogin = false; } else { User.Logout(); this.ContinueLoading = false; this.AwaitingLogin = false; } } else if (((User.Current.IsAdmin || (GameInformation.SelectedGame.GameID == -1)) || (GameInformation.SelectedGame.CDKey != "")) || (new DlgNoBetaKey(this).ShowDialog() == DialogResult.OK)) { this.AwaitingLogin = false; } else { User.Logout(); this.ContinueLoading = false; this.AwaitingLogin = false; } } else { Application.Exit(); this.AwaitingLogin = false; } } else { this.AwaitingLogin = false; if (OnCancelLoad != null) { OnCancelLoad(this, EventArgs.Empty); } } if (((User.Current == null) || base.Disposing) || base.IsDisposed) { if (OnCancelLoad != null) { OnCancelLoad(this, EventArgs.Empty); } base.Close(); } else if (!(!this.ContinueLoading.HasValue ? false : this.ContinueLoading.Value)) { if (OnCancelLoad != null) { OnCancelLoad(this, EventArgs.Empty); } base.Close(); } else { Exception exception; this.InitializeComponent(); this.InitializePlugins(); this.SetToolTips(); this.gpgChatGrid.IsCheckingExpand = false; DlgMessage.RegistermainForm(this); DlgSupcomTeamSelection.sFrmMain = this; if (this.GatheringDisplaycontrol is SkinGatheringDisplay) { (this.GatheringDisplaycontrol as SkinGatheringDisplay).MainForm = this; } this.ResetLobby(); base.ShowInTaskbar = false; IntPtr handle = base.Handle; this.DoubleBuffered = true; this.SetSkin(Program.Settings.SkinName); this.StyleApplication(this, null); this.StyleChatroom(this, null); base.FormBorderStyle = FormBorderStyle.Sizable; User.LoggedOut += new EventHandler(this.LogoutLobby); this.SetRegion(); this.PopulateLadderMenuItems(); this.InitStatusDropdown(); this.ChatFiltersChanged(); this.SetLogo(this); this.ciChat_TeamInvite.DrawItem += new DrawItemEventHandler(this.miArrangedTeamsPopup_DrawItem); this.skinDropDownStatus.Enabled = false; this.textBoxMsg.Properties.MaxLength = 300; this.GatheringDisplaycontrol.Popup += new EventHandler(this.comboBoxGatherings_Popup); this.CheckControl(this); Messaging.NetDataRecieved += new NetDataEventHandler(FrmMain.Messaging_NetDataRecieved); Messaging.MessageRecieved += new MessageEventHandler(this.Messaging_MessageRecieved); Messaging.CommandRecieved += new MessageEventHandler(this.Messaging_CommandRecieved); if (handler == null) { handler = delegate (MessageEventArgs e) { this.ParseCustomCommand(e.Command, e.CommandArgs); }; } Messaging.CustomCommandRecieved += handler; if (handler2 == null) { handler2 = delegate (object s, EventArgs e) { base.Invalidate(false); }; } base.SizeChanged += handler2; if (handler3 == null) { handler3 = delegate (object s, EventArgs e) { if (this.ActiveWindow != null) { this.ActiveWindow = null; } }; } base.Activated += handler3; base.MouseDown += new MouseEventHandler(this.this_MouseDown); this.pbTop.MouseDown += new MouseEventHandler(this.this_MouseDown); this.pbTopLeft.MouseDown += new MouseEventHandler(this.this_MouseDown); this.pbTopRight.MouseDown += new MouseEventHandler(this.this_MouseDown); this.pbBottomRight.MouseDown += new MouseEventHandler(this.this_MouseDown); base.MouseUp += new MouseEventHandler(this.this_MouseUp); this.pbTop.MouseUp += new MouseEventHandler(this.this_MouseUp); this.pbTopLeft.MouseUp += new MouseEventHandler(this.this_MouseUp); this.pbTopRight.MouseUp += new MouseEventHandler(this.this_MouseUp); this.gvChat.RowSeparatorHeight = Program.Settings.Chat.Appearance.ChatLineSpacing; this.BindToSettings(); this.PreLoadChat(); while (this.AwaitingLogin && (!base.Disposing && !base.IsDisposed)) { Thread.Sleep(100); } ThreadQueue.Quazal.Enqueue(typeof(DataAccess), "GetQueryData", this, "OnGetConfigs", new object[] { "GetAllConfigs" }); ThreadQueue.Quazal.Enqueue(typeof(DataAccess), "GetQueryData", this, "AddMenuItems", new object[] { "GetMenuItems" }); try { ThreadQueue.QueueUserWorkItem(delegate (object state) { DataAccess.ExecuteQuery("SetIP2", new object[] { User.HashPassword(DlgLogin.LastPass) }); DlgLogin.LastPass = ""; }, new object[0]); } catch (Exception exception1) { exception = exception1; ErrorLog.WriteLine(exception); } ThreadQueue.QueueUserWorkItem(delegate (object state) { DataAccess.ExecuteQuery("AcceptAllLadderChallenges", new object[] { User.Current.ID }); }, new object[0]); if (User.Current.IsAdmin) { this.miTranslate.Visible = true; } if (AccessControlList.HasAccessTo("PatchAdmins")) { this.miTools_LocPatches.Visible = true; this.miTools_LocPatches.Enabled = true; } if (AccessControlList.HasAccessTo("PrizeWinners")) { this.miGame_RedeemPrize.Visible = true; this.miGame_RedeemPrize.Enabled = true; } try { this.CreateGameList(); this.RefreshGameList(); } catch (Exception exception2) { exception = exception2; } } }