Esempio n. 1
0
 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;
         }
     }
 }
Esempio n. 2
0
 private void PreLoadChat()
 {
     ThreadQueue.QueueUserWorkItem(delegate (object p) {
         VGen0 method = null;
         EventHandler handler = null;
         PaintEventHandler handler2 = null;
         MouseEventHandler handler3 = null;
         EventHandler handler4 = null;
         ChatLinkEventHandler handler5 = null;
         ChatLinkEventHandler handler6 = null;
         ChatLinkEventHandler handler7 = null;
         ChatLinkEventHandler handler8 = null;
         ChatLinkEventHandler handler9 = null;
         ChatLinkEventHandler handler10 = null;
         ChatLinkEventHandler handler11 = null;
         ChatLinkEventHandler handler12 = null;
         ChatLinkEventHandler handler13 = null;
         ChatLinkEventHandler handler14 = null;
         ChatLinkEventHandler handler15 = null;
         EventHandler handler16 = null;
         EventHandler handler17 = null;
         EventHandler handler18 = null;
         EventHandler handler19 = null;
         try
         {
             this.InitChatContainers();
             if (!this.CancelLoad && base.InvokeRequired)
             {
                 if (!base.Disposing && !base.IsDisposed)
                 {
                     if (method == null)
                     {
                         method = delegate {
                             this.mChatHistory = new LinkedList<string>();
                             this.mChatLines = new BindingList<ChatLine>();
                             this.gpgChatGrid.DataSource = this.mChatLines;
                         };
                     }
                     base.BeginInvoke(method);
                 }
             }
             else
             {
                 this.mChatHistory = new LinkedList<string>();
                 this.mChatLines = new BindingList<ChatLine>();
                 this.gpgChatGrid.DataSource = this.mChatLines;
             }
             ThreadQueue.Quazal.Enqueue((VGen0)delegate {
                 DataList queryData = DataAccess.GetQueryData("GetIgnoredPlayers", new object[0]);
                 foreach (DataRecord record in queryData)
                 {
                     User.IgnoredPlayers.Add(Convert.ToInt32(record["id"]));
                 }
             }, new object[0]);
             foreach (TextContainer<StatusTextLine> container in this.ChatContainers)
             {
                 container.Clear();
             }
             this.textBoxMsg.KeyDown += new KeyEventHandler(this.textBoxMsg_KeyDown);
             this.textBoxMsg.TextChanged += new EventHandler(this.UpdateCommandPopup);
             this.textBoxMsg.LostFocus += new EventHandler(this.textBoxMsg_LostFocus);
             this.gpgTextListCommands.ValueSelected += new EventHandler<TextValEventArgs>(this.CommandSelected);
             this.gvChat.MouseDown += new MouseEventHandler(this.gvChat_MouseDown);
             this.gvChat.MouseMove += new MouseEventHandler(this.gvChat_MouseMove);
             this.gvChat.MouseUp += new MouseEventHandler(this.gvChat_MouseUp);
             if (handler == null)
             {
                 handler = delegate (object s, EventArgs e) {
                     this.EmoteCount = 0;
                     this.CountEmotes = true;
                 };
             }
             this.gvChat.RowCountChanged += handler;
             if (handler2 == null)
             {
                 handler2 = delegate (object s, PaintEventArgs e) {
                     this.CountEmotes = false;
                     if (this.PaintPending)
                     {
                         ImageAnimator.UpdateFrames();
                         this.PaintPending = false;
                     }
                 };
             }
             this.gpgChatGrid.Paint += handler2;
             this.ChatFiltersChanged();
             if (handler3 == null)
             {
                 handler3 = delegate (object s, MouseEventArgs e) {
                     this.textBoxMsg.Select();
                     GPGGridView.ScrollBarFocus(this.gvChat);
                 };
             }
             GPGGridView.ScrollBarClick(this.gvChat, handler3);
             this.ResetAwayTimer();
             if (handler4 == null)
             {
                 handler4 = delegate (object s, EventArgs e) {
                     if (this.gpgTextListCommands.Visible)
                     {
                         this.gpgTextListCommands.BringToFront();
                     }
                 };
             }
             this.gpgTextListCommands.VisibleChanged += handler4;
             if (handler5 == null)
             {
                 handler5 = delegate (ChatLink sender, string url) {
                     this.ShowWebPage(url);
                 };
             }
             ChatLink.Web.Click += handler5;
             if (handler6 == null)
             {
                 handler6 = delegate (ChatLink sender, string url) {
                     this.ShowWebPage(string.Format("mailto:{0}", url.Replace("mailto:", "")));
                 };
             }
             ChatLink.Email.Click += handler6;
             if (handler7 == null)
             {
                 handler7 = delegate (ChatLink sender, string url) {
                     this.OnViewPlayerProfile(url);
                 };
             }
             ChatLink.Player.Click += handler7;
             if (handler8 == null)
             {
                 handler8 = delegate (ChatLink sender, string url) {
                     this.OnViewClanProfileByName(url);
                 };
             }
             ChatLink.Clan.Click += handler8;
             if (handler9 == null)
             {
                 handler9 = delegate (ChatLink sender, string url) {
                     if (!this.mRanInitializeChat)
                     {
                         this.CloseHomePage(url);
                     }
                     else
                     {
                         this.CreateChannelIfNonExist(url);
                     }
                 };
             }
             ChatLink.Chat.Click += handler9;
             if (handler10 == null)
             {
                 handler10 = delegate (ChatLink sender, string url) {
                     try
                     {
                         bool flag = true;
                         if (Program.Settings.Chat.Emotes.ShowViewWarning)
                         {
                             string msg = "<LOC>Clicking this link will trigger this user's custom emote for the first time. Although abuse of the system is prohibited, the emote displayed has been created by this user and has not been pre-screened. You can manage the appearance of custom emotes via Tools > Chat > Emotes and learn more about them via the Knowledge Base. Do you want to accept this custom emote?";
                             DlgYesNo no = new DlgYesNo(this, "<LOC>Warning", msg, new Size(350, 350)) {
                                 DoNotShowAgainCheck = true
                             };
                             if (no.ShowDialog() != DialogResult.Yes)
                             {
                                 flag = false;
                             }
                             Program.Settings.Chat.Emotes.ShowViewWarning = !no.DoNotShowAgainValue;
                         }
                         if (flag)
                         {
                             char ch = '\x0003';
                             if (url.Contains(ch.ToString()))
                             {
                                 string[] strArray = url.Split(new char[] { '\x0003' });
                                 string recipient = strArray[0];
                                 string str3 = strArray[1];
                                 Messaging.SendCustomCommand(recipient, CustomCommands.RequestEmotes, new object[] { str3 });
                             }
                         }
                     }
                     catch (Exception exception)
                     {
                         ErrorLog.WriteLine(exception);
                     }
                 };
             }
             ChatLink.Emote.Click += handler10;
             if (handler11 == null)
             {
                 handler11 = delegate (ChatLink sender, string url) {
                     TimeSpan span = (TimeSpan) (DateTime.Now - this.mGameLinkClickTime);
                     if (span.TotalSeconds >= 2.0)
                     {
                         this.mGameLinkClickTime = DateTime.Now;
                         if (this.mSearchingForAutomatch)
                         {
                             this.ErrorMessage("<LOC>You cannot join a custom game while searching for a ranked game.", new object[0]);
                         }
                         else
                         {
                             GameItem item;
                             bool flag = false;
                             if (ConfigSettings.GetBool("DoOldGameList", false))
                             {
                                 flag = DataAccess.TryGetObject<GameItem>("GetGameByName", out item, new object[] { url.Replace("'", @"\'") });
                             }
                             else
                             {
                                 flag = DataAccess.TryGetObject<GameItem>("GetGameByName2", out item, new object[] { url.Replace("'", @"\'"), GameInformation.SelectedGame.GameID });
                             }
                             if (!flag)
                             {
                                 this.ErrorMessage(Loc.Get("<LOC>The game '{0}' does not exist. Click the Join Game button for a list of currently available games.", new object[] { url }), new object[0]);
                                 this.gvChat.MoveLastVisible();
                             }
                             else if (((item.Password != null) && (item.Password.Length > 0)) && (item.Password != DlgAskQuestion.AskQuestion(this, Loc.Get("<LOC>What is the password?"), true)))
                             {
                                 DlgMessage.ShowDialog(Loc.Get("<LOC>That password is not correct."));
                             }
                             else
                             {
                                 this.BeforeGameChatroom = Chatroom.CurrentName;
                                 this.mGameName = item.Description;
                                 this.mGameURL = item.URL;
                                 this.mHostName = item.PlayerName;
                                 ThreadQueue.Quazal.Enqueue(typeof(Chatroom), "Leave", this, "OnJoinGame", new object[0]);
                                 int num = 0;
                                 while (Chatroom.InChatroom)
                                 {
                                     Thread.Sleep(10);
                                     Application.DoEvents();
                                     num++;
                                     if (num > 300)
                                     {
                                         break;
                                     }
                                 }
                                 this.SetStatusButtons(1);
                             }
                         }
                     }
                 };
             }
             ChatLink.Game.Click += handler11;
             if (handler12 == null)
             {
                 handler12 = delegate (ChatLink sender, string url) {
                     this.ShowDlgKeywordSearch(url, false);
                 };
             }
             ChatLink.Help.Click += handler12;
             if (handler13 == null)
             {
                 handler13 = delegate (ChatLink sender, string url) {
                     int num;
                     if (int.TryParse(url, out num))
                     {
                         this.ShowDlgSolution(num);
                     }
                 };
             }
             ChatLink.Solution.Click += handler13;
             ChatLink.Replay.Click += delegate (ChatLink sender, string url) {
                 try
                 {
                     if ((url != null) && (url.Length > 0))
                     {
                         ReplayInfo.Download(url);
                     }
                 }
                 catch (Exception exception)
                 {
                     ErrorLog.WriteLine(exception);
                 }
             };
             if (handler14 == null)
             {
                 handler14 = delegate (ChatLink sender, string url) {
                     ThreadQueue.QueueUserWorkItem(delegate (object objurl) {
                         try
                         {
                             string str = ((object[]) objurl)[0].ToString();
                             DataList queryDataSafe = new DataList();
                             if (str.IndexOf(" ") > 0)
                             {
                                 string str2 = str.Split(new char[] { ' ' })[0];
                                 int num = Convert.ToInt32(str.Split(new char[] { ' ' })[1]);
                                 queryDataSafe = DataAccess.GetQueryDataSafe("GetReplay", new object[] { str2, num });
                             }
                             else
                             {
                                 queryDataSafe = DataAccess.GetQueryDataSafe("GetLastReplay", new object[] { str });
                             }
                             if (queryDataSafe.Count > 0)
                             {
                                 if (((GameInformation.SelectedGame.GameLocation != null) && (GameInformation.SelectedGame.GameLocation.Length >= 1)) || this.LocateExe("SupremeCommander", true))
                                 {
                                     int @int = ConfigSettings.GetInt("Live Replay GameID", 0x12);
                                     foreach (GameInformation information in GameInformation.Games)
                                     {
                                         if (information.GameID == @int)
                                         {
                                             SupComGameManager.LastLocation = information.GameLocation;
                                             this.mSupcomGameManager = new SupComGameManager();
                                             this.mSupcomGameManager.WatchReplay("", queryDataSafe[0][0]);
                                         }
                                     }
                                 }
                             }
                             else
                             {
                                 DlgMessage.Show(this, Loc.Get("<LOC>Unable to view replay."));
                             }
                         }
                         catch (Exception exception)
                         {
                             ErrorLog.WriteLine(exception);
                         }
                     }, new object[] { url });
                 };
             }
             ChatLink.LiveReplay.Click += handler14;
             ChatLink.Content.Click += delegate (ChatLink sender, string url) {
                 DlgContentDetailsView view = DlgContentDetailsView.CreateOrGetExisting(ContentLinkMask.GetContentID(sender));
                 view.Show();
                 view.BringToFront();
             };
             if (handler15 == null)
             {
                 handler15 = delegate (ChatLink sender, string url) {
                     int contentID = TournamentLinkMask.GetContentID(sender);
                     DlgTournamentRegistration registration = this.LocateDialog(typeof(DlgTournamentRegistration)) as DlgTournamentRegistration;
                     if (registration == null)
                     {
                         registration = new DlgTournamentRegistration(contentID);
                         registration.Show();
                     }
                     else
                     {
                         registration.RefreshDates(contentID);
                         registration.Visible = true;
                         registration.BringToFront();
                     }
                 };
             }
             ChatLink.Tournament.Click += handler15;
             if (handler16 == null)
             {
                 handler16 = delegate (object sender, EventArgs e) {
                     this.ChatRowHeights.Clear();
                     this.ChatRowPoints.Clear();
                     foreach (ChatLine line in this.mChatLines)
                     {
                         line.ContainsEmotes = null;
                     }
                     this.RefreshEmoteAnimations();
                     this.gvChat.RefreshData();
                 };
             }
             Emote.EmotesChanged += handler16;
             if (handler17 == null)
             {
                 handler17 = delegate (object s, EventArgs e) {
                     this.ChatRowPoints.Clear();
                     this.ChatRowHeights.Clear();
                 };
             }
             this.gpgChatGrid.SizeChanged += handler17;
             this.ChatSyncTimer = new System.Timers.Timer((double) ConfigSettings.GetInt("ChatSyncTimer", 0x493e0));
             this.ChatSyncTimer.AutoReset = true;
             this.ChatSyncTimer.Elapsed += new ElapsedEventHandler(this.SyncChatroom);
             if (handler18 == null)
             {
                 handler18 = delegate (object s, EventArgs e) {
                     if (!this.IsSortingChatroom && !this.BetweenChannels)
                     {
                         this.IsSortingChatroom = true;
                         try
                         {
                             while (this.IsSynchronizingChatroom)
                             {
                                 Thread.Sleep(20);
                             }
                             GPG.Logging.EventLog.WriteLine("Chatroom queue emptied, sorting chatroom.", new object[0]);
                             this.pnlUserListChat.RefreshData();
                             GPG.Logging.EventLog.WriteLine("Chatroom queue sorted and refreshed.", new object[0]);
                         }
                         catch (Exception exception)
                         {
                             ErrorLog.WriteLine(exception);
                         }
                         finally
                         {
                             this.IsSortingChatroom = false;
                         }
                     }
                 };
             }
             this.ChatroomQueue.Emptied += handler18;
             if (handler19 == null)
             {
                 handler19 = delegate (object s, EventArgs e) {
                     this.ChatroomQueue.Enqueue((VGen0)delegate {
                     }, new object[0]);
                 };
             }
             this.pnlUserListChat.RequestRefresh += handler19;
             this._AddUser = new VGen(this.AddUser);
             this._UpdateUser = new VGen(this.UpdateUser);
             this._RemoveUser = new VGen(this.RemoveUser);
         }
         catch (Exception exception)
         {
             ErrorLog.WriteLine(exception);
         }
     }, new object[0]);
 }