Beispiel #1
0
 private void miTournamentSchedule_Click(object sender, EventArgs e)
 {
     DlgTournamentRegistration registration = new DlgTournamentRegistration();
     registration.MainForm = this;
     registration.Show();
 }
Beispiel #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]);
 }