예제 #1
0
 private void btnCancel_Click(object sender, EventArgs e)
 {
     DlgYesNo no = new DlgYesNo(null, Loc.Get("<LOC>Warning"), Loc.Get("<LOC>Are you sure you want to cancel registration?"));
     if (no.ShowDialog() == DialogResult.Yes)
     {
         this.tbEmailAddress.Text = "";
         this.SubmitData();
     }
 }
예제 #2
0
 private static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
 {
     VGen0 method = null;
     string error = e.Exception.ToString();
     if (!IsReported)
     {
         IsReported = true;
         ErrorLog.WriteLine(e.Exception);
         Service service = new Service();
         string defaultUsername = Settings.Login.DefaultUsername;
         if (defaultUsername == null)
         {
             defaultUsername = "******";
         }
         defaultUsername = defaultUsername + " with GPGnet version " + Assembly.GetEntryAssembly().GetName().Version.ToString(4);
         string log = "";
         BindingList<LogData> mLogList = DlgLogWatcher.sLog.mLogList;
         for (int i = mLogList.Count - 1; (i >= 0) && (i > (mLogList.Count - 300)); i--)
         {
             log = mLogList[i].DateTime.ToString() + " " + mLogList[i].LogType + ": " + mLogList[i].Description + "\r\n" + log;
         }
         service.ReportError(defaultUsername, log, e.Exception.ToString());
     }
     if (MainForm != null)
     {
         if (method == null)
         {
             method = delegate {
                 DlgYesNo no = new DlgYesNo(MainForm, Loc.Get("<LOC>Error"), "A serious error has occured in GPGnet and it is recommended you restart.  You can attempt continue, but GPGnet may behave erratically.  Would you like to continue?\r\n\r\n" + error);
                 if (no.ShowDialog() != DialogResult.Yes)
                 {
                     User.Logout();
                     Application.Exit();
                 }
             };
         }
         MainForm.Invoke(method);
     }
 }
예제 #3
0
 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();
             }
         }
     }
 }
예제 #4
0
 private void miConsolidateAccounts_Click(object sender, EventArgs e)
 {
     if (GameInformation.SelectedGame.GameID <= 2)
     {
         DlgMessage.Show(this, Loc.Get("<LOC>You're game mode must be something other than Chat Only and Supreme Commander in order to consolidate keys."));
     }
     else
     {
         ThreadPool.QueueUserWorkItem(delegate (object o) {
             VGen0 method = null;
             bool flag = false;
             DataList queryData = DataAccess.GetQueryData("Check For Other Keys", new object[0]);
             foreach (DataRecord record in queryData)
             {
                 if (record["gpgnet_game_id"] == "2")
                 {
                     bool doupdate = false;
                     string playername = record["name"];
                     base.Invoke((VGen0)delegate {
                         DlgYesNo no = new DlgYesNo(this, Loc.Get("<LOC>Consolidate Account"), Loc.Get("<LOC>Would you like to consolidate the CD key attached to this account to {0}?  Ratings and other information from this account will not transfer with your key, and this account will still exist.").Replace("{0}", playername));
                         if (no.ShowDialog() == DialogResult.Yes)
                         {
                             doupdate = true;
                         }
                     });
                     flag = true;
                     if (doupdate)
                     {
                         DataAccess.ExecuteQuery("Consolidate CDKey", new object[] { playername });
                         base.Invoke((VGen0)delegate {
                             GameInformation.LoadGamesFromDB();
                             GameInformation.SelectedGame = GameInformation.GPGNetChat;
                         });
                         return;
                     }
                 }
             }
             if (!flag)
             {
                 if (method == null)
                 {
                     method = delegate {
                         DlgMessage.Show(this, Loc.Get("<LOC>We found no accounts to consolidate.  You must have matching emails to consolidate accounts.  You can change account emails under Main -> Change Email Address."));
                     };
                 }
                 base.Invoke(method);
             }
         });
     }
 }
예제 #5
0
 private void RequestDirectChallenge(string senderName)
 {
     VGen0 method = null;
     if (!(!User.Current.IsDND && this.AllowDirectChallenge))
     {
         Messaging.SendCustomCommand(senderName, CustomCommands.AutomatchAbortDirectChallenge, new object[] { "Standard" });
     }
     else if (SupcomAutomatch.GetSupcomAutomatch().State != SupcomAutoState.Unavailable)
     {
         Messaging.SendCustomCommand(senderName, CustomCommands.AutomatchAbortDirectChallenge, new object[] { "Standard" });
     }
     else
     {
         if (method == null)
         {
             method = delegate {
                 if (this.mCanDirectChallenge)
                 {
                     this.mCanDirectChallenge = false;
                     DlgYesNo no = new DlgYesNo(this, Loc.Get("<LOC>Ranked Challenge"), senderName + " " + Loc.Get("<LOC>has challenged you to a ranked game.  Would you like to accept?"));
                     if (no.ShowDialog() == DialogResult.Yes)
                     {
                         string kind = "CHALLENGE" + Guid.NewGuid().ToString();
                         Messaging.SendCustomCommand(senderName, CustomCommands.AutomatchConfirmChallenge, new object[] { kind });
                         this.PlayRankedGame(false, kind, null, "", false);
                     }
                     else
                     {
                         Messaging.SendCustomCommand(senderName, CustomCommands.AutomatchAbortDirectChallenge, new object[] { "Standard" });
                     }
                     this.mCanDirectChallenge = true;
                 }
                 else
                 {
                     Messaging.SendCustomCommand(senderName, CustomCommands.AutomatchAbortDirectChallenge, new object[] { "Standard" });
                 }
             };
         }
         base.Invoke(method);
     }
 }
예제 #6
0
        internal void ReceiveTeamInvite(string sender)
        {
            VGen0 gen = null;
            if (this.InvitePending)
            {
                Messaging.SendCustomCommand(sender, CustomCommands.TeamGameDeclineInvite, new object[] { "<LOC>{0} already has a team invite pending.", User.Current.Name });
            }
            else if (!((this.DlgTeamGame == null) || this.DlgTeamGame.IsDisposed))
            {
                Messaging.SendCustomCommand(sender, CustomCommands.TeamGameDeclineInvite, new object[] { "<LOC>{0} is already in a team game.", User.Current.Name });
            }
            else if (SupcomAutomatch.GetSupcomAutomatch().State != SupcomAutoState.Unavailable)
            {
                Messaging.SendCustomCommand(sender, CustomCommands.TeamGameDeclineInvite, new object[] { "<LOC>{0} is already in the ranked game queue.", User.Current.Name });
            }
            else if (this.mIsInGame)
            {
                Messaging.SendCustomCommand(sender, CustomCommands.TeamGameDeclineInvite, new object[] { "<LOC>{0} is playing a game and cannot join your game at this time.", User.Current.Name });
            }
            else if (!(this.IsGameCurrent || User.Current.IsAdmin))
            {
                Messaging.SendCustomCommand(sender, CustomCommands.TeamGameDeclineInvite, new object[] { "<LOC>{0} has a different version of the game and cannot join your game.", User.Current.Name });
            }
            else if (User.Current.IsDND)
            {
                Messaging.SendCustomCommand(sender, CustomCommands.TeamGameDeclineInvite, new object[] { "<LOC>{0} is in Do Not Disturb mode and cannot join your game.", User.Current.Name });
            }
            else
            {
                DataList queryData = DataAccess.GetQueryData("GetCurrentGame", new object[] { sender });
                if ((queryData.Count == 0) || (queryData[0][0] != GPGnetSelectedGame.SelectedGame.GameID.ToString()))
                {
                    Messaging.SendCustomCommand(sender, CustomCommands.TeamGameDeclineInvite, new object[] { "<LOC>{0} is using game {1} and cannot join your team.", User.Current.Name, GPGnetSelectedGame.SelectedGame.GameDescription });
                }
                else if ((base.InvokeRequired && !base.Disposing) && !base.IsDisposed)
                {
                    if (gen == null)
                    {
                        gen = delegate {
                            this.ReceiveTeamInvite(sender);
                        };
                    }
                    base.BeginInvoke(gen);
                }
                else if (!base.Disposing && !base.IsDisposed)
                {
                    this.InvitePending = true;
                    try
                    {
                        DlgYesNo dlg = new DlgYesNo(this, Loc.Get("<LOC>Arranged Team Request"), string.Format(Loc.Get("<LOC>{0} has invited you to play in a rated team game. Do you wish to join?"), sender));
                        ThreadPool.QueueUserWorkItem(delegate (object s) {
                            VGen0 method = null;
                            try
                            {
                                Thread.Sleep((int) (Program.Settings.Chat.PopupTimeout * 0x3e8));
                                if (((dlg != null) && !dlg.Disposing) && !dlg.IsDisposed)
                                {
                                    if (method == null)
                                    {
                                        method = delegate {
                                            try
                                            {
                                                dlg.DialogResult = DialogResult.Cancel;
                                            }
                                            catch (Exception exception)
                                            {
                                                ErrorLog.WriteLine(exception);
                                            }
                                        };
                                    }
                                    this.BeginInvoke(method);
                                }
                            }
                            catch (Exception exception)
                            {
                                ErrorLog.WriteLine(exception);
                            }
                        });
                        switch (dlg.ShowDialog())
                        {
                            case DialogResult.Yes:
                                this.InviteAccepted = true;
                                Messaging.SendCustomCommand(sender, CustomCommands.TeamGameAcceptInvite, new object[0]);
                                break;

                            case DialogResult.No:
                                this.InviteAccepted = false;
                                Messaging.SendCustomCommand(sender, CustomCommands.TeamGameDeclineInvite, new object[0]);
                                break;

                            case DialogResult.Cancel:
                                this.InviteAccepted = false;
                                Messaging.SendCustomCommand(sender, CustomCommands.TeamGameDeclineInvite, new object[] { "<LOC>Your team game invite with {0} has timed out and was automatically declined.", User.Current.Name });
                                break;
                        }
                        if (!(dlg.Disposing || dlg.IsDisposed))
                        {
                            dlg.Dispose();
                        }
                        dlg = null;
                    }
                    catch (Exception exception)
                    {
                        ErrorLog.WriteLine(exception);
                    }
                    finally
                    {
                        this.InvitePending = false;
                    }
                }
            }
        }
예제 #7
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]);
 }
 private void menuItem3_Click(object sender, EventArgs e)
 {
     if (this.mSelectedRecord != null)
     {
         WaitCallback callBack = null;
         int tournamentid = Convert.ToInt32(this.mSelectedRecord["tournament_id"]);
         DlgYesNo no = new DlgYesNo(base.MainForm, Loc.Get("<LOC>Warning"), Loc.Get("<LOC>Are you sure you want to delete this tournament?"));
         if (no.ShowDialog() == DialogResult.Yes)
         {
             if (callBack == null)
             {
                 callBack = delegate (object o) {
                     VGen0 method = null;
                     try
                     {
                         DataAccess.ExecuteQuery("Tournament Delete", new object[] { tournamentid });
                         if (method == null)
                         {
                             method = delegate {
                                 this.RefreshDates();
                             };
                         }
                         this.Invoke(method);
                     }
                     catch (Exception exception)
                     {
                         ErrorLog.WriteLine(exception);
                     }
                 };
             }
             ThreadQueue.QueueUserWorkItem(callBack, new object[0]);
         }
     }
 }
예제 #9
0
 private void forcefullyEndGameToolStripMenuItem_Click(object sender, EventArgs e)
 {
     DlgYesNo no = new DlgYesNo(base.MainForm, Loc.Get("<LOC>Warning"), Loc.Get("<LOC>Are you sure you want to end this game?"));
     if ((no.ShowDialog() == DialogResult.Yes) && (this.dragPlayers.SelectedMatchup != null))
     {
         if (this.dragPlayers.SelectedMatchup.Player1 != null)
         {
             Messaging.SendCustomCommand(this.dragPlayers.SelectedMatchup.Player1.PlayerName, CustomCommands.TournamentEndMatch, new object[0]);
         }
         if (this.dragPlayers.SelectedMatchup.Player2 != null)
         {
             Messaging.SendCustomCommand(this.dragPlayers.SelectedMatchup.Player2.PlayerName, CustomCommands.TournamentEndMatch, new object[0]);
         }
     }
 }
예제 #10
0
 private void btnRound_Click(object sender, EventArgs e)
 {
     if (this.btnRound.ButtonState == 0)
     {
         this.mDetails.SetValue("status", "Playing Round " + this.Round.ToString());
         DataAccess.QueueExecuteQuery("Tournament Status", new object[] { "Playing Round", this.Round, this.mTournamentID });
         this.LaunchGames();
         this.UpdateBrackets();
     }
     else if (this.btnRound.ButtonState == 2)
     {
         this.mDetails.SetValue("status", "Setup Round " + this.Round.ToString());
         DataAccess.QueueExecuteQuery("Tournament Status", new object[] { "Setup Round", this.Round, this.mTournamentID });
         foreach (GPGDragItem item in this.dragPlayers.Items)
         {
             item.PlayerReport = "No Report";
             item.Won = -1;
         }
         foreach (GPGMatchup matchup in this.dragPlayers.Matchups)
         {
             if (matchup.Player1 != null)
             {
                 matchup.Player1.IsMatched = false;
                 matchup.Player1 = null;
             }
             if (matchup.Player2 != null)
             {
                 matchup.Player2.IsMatched = false;
                 matchup.Player2 = null;
             }
         }
         this.dragPlayers.Invalidate();
         this.UpdateBrackets();
     }
     else
     {
         int num = 0;
         foreach (GPGMatchup matchup in this.dragPlayers.Matchups)
         {
             if ((matchup.Player1 != null) && (matchup.Player2 != null))
             {
                 num++;
                 if (((matchup.Player1.PlayerReport == "NoReport") || (matchup.Player1.PlayerReport == "Playing")) && ((matchup.Player2.PlayerReport == "NoReport") || (matchup.Player2.PlayerReport == "Playing")))
                 {
                     DlgMessage.ShowDialog(base.MainForm, matchup.Player1.PlayerName + " vs " + matchup.Player2.PlayerName + " needs to be resolved before you can end the round.");
                     return;
                 }
             }
         }
         if (num == 0)
         {
             DlgYesNo no = new DlgYesNo(base.MainForm, Loc.Get("<LOC>DANGER"), Loc.Get("<LOC>You have no matchups.  Ending the tournament round may corrupt your tournament.  Are you sure you wish to continue?"));
             if (no.ShowDialog() == DialogResult.No)
             {
                 return;
             }
         }
         foreach (GPGMatchup matchup in this.dragPlayers.Matchups)
         {
             if ((matchup.Player1 != null) && (matchup.Player2 != null))
             {
                 if ((matchup.Player1.Won == 0) && (matchup.Player2.Won == -1))
                 {
                     matchup.Player2.Won = 1;
                     GPGDragItem item1 = matchup.Player2;
                     item1.Wins++;
                     base.MainForm.SystemMessage(matchup.Player2.Label + " did not report and was assigned a win.", new object[0]);
                     Messaging.SendGathering(matchup.Player2.Label + " did not report and was assigned a win.");
                 }
                 if ((matchup.Player1.Won == 1) && (matchup.Player2.Won == -1))
                 {
                     matchup.Player2.Won = 0;
                     GPGDragItem item2 = matchup.Player2;
                     item2.Losses++;
                     base.MainForm.SystemMessage(matchup.Player2.Label + " did not report and was assigned a loss.", new object[0]);
                     Messaging.SendGathering(matchup.Player2.Label + " did not report and was assigned a loss.");
                 }
                 if ((matchup.Player1.Won == 2) && (matchup.Player2.Won == -1))
                 {
                     matchup.Player2.Won = 2;
                     GPGDragItem item3 = matchup.Player2;
                     item3.Draws++;
                     base.MainForm.SystemMessage(matchup.Player2.Label + " did not report and was assigned a draw.", new object[0]);
                     Messaging.SendGathering(matchup.Player2.Label + " did not report and was assigned a draw.");
                 }
                 if ((matchup.Player2.Won == 0) && (matchup.Player1.Won == -1))
                 {
                     matchup.Player1.Won = 1;
                     GPGDragItem item4 = matchup.Player1;
                     item4.Wins++;
                     base.MainForm.SystemMessage(matchup.Player1.Label + " did not report and was assigned a win.", new object[0]);
                     Messaging.SendGathering(matchup.Player1.Label + " did not report and was assigned a win.");
                 }
                 if ((matchup.Player2.Won == 1) && (matchup.Player1.Won == -1))
                 {
                     matchup.Player1.Won = 0;
                     GPGDragItem item5 = matchup.Player1;
                     item5.Losses++;
                     base.MainForm.SystemMessage(matchup.Player1.Label + " did not report and was assigned a loss.", new object[0]);
                     Messaging.SendGathering(matchup.Player1.Label + " did not report and was assigned a loss.");
                 }
                 if ((matchup.Player2.Won == 2) && (matchup.Player1.Won == -1))
                 {
                     matchup.Player1.Won = 2;
                     GPGDragItem item6 = matchup.Player1;
                     item6.Draws++;
                     base.MainForm.SystemMessage(matchup.Player1.Label + " did not report and was assigned a draw.", new object[0]);
                     Messaging.SendGathering(matchup.Player1.Label + " did not report and was assigned a draw.");
                 }
             }
         }
         foreach (GPGMatchup matchup in this.dragPlayers.Matchups)
         {
             if ((matchup.Player1 != null) && (((matchup.Player1.Wins + matchup.Player1.Losses) + matchup.Player1.Draws) != this.Round))
             {
                 DlgMessage.ShowDialog(base.MainForm, Loc.Get("<LOC>Player " + matchup.Player1.PlayerName + " needs to be resolved before you can end the round."));
                 return;
             }
             if ((matchup.Player2 != null) && (((matchup.Player2.Wins + matchup.Player2.Losses) + matchup.Player2.Draws) != this.Round))
             {
                 DlgMessage.ShowDialog(base.MainForm, Loc.Get("<LOC>Player " + matchup.Player2.PlayerName + " needs to be resolved before you can end the round."));
                 return;
             }
         }
         DataAccess.QueueExecuteQuery("Tournament Status", new object[] { "Completed Round", this.Round, this.mTournamentID });
         this.mDetails.SetValue("status", "Completed Round " + this.Round.ToString());
         this.UpdateBrackets();
         this.Round++;
     }
     this.SetButtonState();
 }
예제 #11
0
 private void btnLaunchChat_Click(object sender, EventArgs e)
 {
     DlgYesNo no = new DlgYesNo(base.MainForm, Loc.Get("<LOC>Warning"), Loc.Get("<LOC>This will launch everybody who is still in your chatroom.  You should only do so if you have already hit the main Launch Games in a round.  Continue?"));
     if (no.ShowDialog() == DialogResult.Yes)
     {
         foreach (GPGMatchup matchup in this.dragPlayers.Matchups)
         {
             int num = 0;
             foreach (User user in Chatroom.GatheringParticipants)
             {
                 if (user.Name.ToUpper() == matchup.Player1.PlayerName.ToUpper())
                 {
                     num++;
                 }
             }
             if (num == 2)
             {
                 this.LaunchSelectedGame(matchup);
             }
         }
     }
 }
예제 #12
0
 private void btnEjectOffline_Click(object sender, EventArgs e)
 {
     DataList queryData = DataAccess.GetQueryData("Tournament Online Status", new object[] { this.mTournamentID });
     foreach (DataRecord record in queryData)
     {
         if (record["connected"] == "0")
         {
             DlgYesNo no = new DlgYesNo(base.MainForm, Loc.Get("<LOC>Eject"), Loc.Get("<LOC>Would you like to eject this offline player from the tournament?") + "\r\n" + record["name"]);
             this.EjectPlayer(record["name"]);
         }
     }
 }