Beispiel #1
0
 private void btnStats_Click(object sender, EventArgs e)
 {
     if ((base.MainForm != null) && (base.MainForm.GetSupcomGameManager() != null))
     {
         if (this.mLastManager != base.MainForm.GetSupcomGameManager())
         {
             this.mLastManager = base.MainForm.GetSupcomGameManager();
             this.mLastManager.OnStatsXML += new StatsXML(this.DlgStatsTest_OnStatsXML);
         }
         this.mLastManager.GetStats();
     }
 }
Beispiel #2
0
 public StatsWatcher(SupComGameManager manager)
 {
     this.mManager = manager;
     this.mManager.OnStatsXML += new StatsXML(this.manager_OnStatsXML);
 }
Beispiel #3
0
 private void OnHostGame(bool result)
 {
     EventHandler handler = null;
     SupComGameManager.GameArgs = Program.Settings.SupcomPrefs.CommandLineArgs;
     if ((((GameInformation.SelectedGame.GameLocation != null) && (GameInformation.SelectedGame.GameLocation.Length > 0)) && System.IO.File.Exists(GameInformation.SelectedGame.GameLocation)) || this.LocateExe(GameInformation.SelectedGame.ExeName, true))
     {
         if (!(User.Current.IsAdmin || this.IsGameCurrent))
         {
             this.UpdateSupCom();
         }
         else
         {
             Chatroom.Leave();
             SupComGameManager.LastLocation = GameInformation.SelectedGame.GameLocation;
             this.ShowWelcome(this.UrlById("GAME"));
             this.DisableControls();
             this.mSupcomGameManager = new SupComGameManager();
             this.mSupcomGameManager.SetPassword(this.mPassword);
             this.mSupcomGameManager.OnAbortGame += new StringEventHandler(this.mSupcomGameManager_OnAbortGame);
             if (handler == null)
             {
                 handler = delegate (object s, EventArgs e) {
                     if (this.GameHosted != null)
                     {
                         this.GameHosted(this, EventArgs.Empty);
                     }
                     if (!GameInformation.SelectedGame.IsSpaceSiege)
                     {
                         Messaging.SendCustomCommand(this.FriendsMessageList, CustomCommands.GameEvent, new object[] { "<LOC>Your friend {0} has just hosted the game {1}\"{2}\"", User.Current.Name, " game:", this.mGameName });
                         Messaging.SendCustomCommand(this.UniqueClanMessageList, CustomCommands.GameEvent, new object[] { "<LOC>Your clan member {0} has just hosted the game {1}\"{2}\"", User.Current.Name, " game:", this.mGameName });
                     }
                 };
             }
             this.mSupcomGameManager.GameHosted += handler;
             if (this.mSupcomGameManager.HostGame(false, this.mGameName))
             {
                 this.mIsInGame = true;
                 this.ChangeStatus("<LOC>In Game", StatusIcons.in_game);
                 this.mSupcomGameManager.OnExit += new EventHandler(this.manager_OnExit);
                 base.KeyDown += new KeyEventHandler(this.GameKeyDown);
             }
         }
     }
 }
Beispiel #4
0
 private void OnJoinGame(bool result)
 {
     base.KeyDown += new KeyEventHandler(this.GameKeyDown);
     SupComGameManager.GameArgs = Program.Settings.SupcomPrefs.CommandLineArgs;
     if ((((GameInformation.SelectedGame.GameLocation != null) && (GameInformation.SelectedGame.GameLocation.Length > 0)) && System.IO.File.Exists(GameInformation.SelectedGame.GameLocation)) || this.LocateExe(GameInformation.SelectedGame.ExeName, true))
     {
         if (!(User.Current.IsAdmin || this.IsGameCurrent))
         {
             this.UpdateSupCom();
         }
         else
         {
             GPG.Logging.EventLog.WriteLine("Entered OnJoinChat method", new object[0]);
             Chatroom.Leave();
             SupComGameManager.LastLocation = GameInformation.SelectedGame.GameLocation;
             this.ShowWelcome(this.UrlById("GAME"));
             this.DisableControls();
             this.mSupcomGameManager = new SupComGameManager();
             this.mSupcomGameManager.OnAbortGame += new StringEventHandler(this.mSupcomGameManager_OnAbortGame);
             string[] strArray = this.mGameURL.Replace("udp:/", "").Split("=;".ToCharArray());
             string address = strArray[1];
             int port = Convert.ToInt32(strArray[3]);
             if (this.mSupcomGameManager.JoinGame(false, this.mGameName, address, port, this.mHostName))
             {
                 this.mIsInGame = true;
                 this.ChangeStatus("<LOC>In Game", StatusIcons.in_game);
                 this.mSupcomGameManager.OnExit += new EventHandler(this.manager_OnExit);
                 if (!GameInformation.SelectedGame.IsSpaceSiege)
                 {
                     Messaging.SendCustomCommand(this.FriendsMessageList, CustomCommands.GameEvent, new object[] { "<LOC>Your friend {0} has just joined the game {1}\"{2}\"", User.Current.Name, "game:", this.mGameName });
                     Messaging.SendCustomCommand(this.UniqueClanMessageList, CustomCommands.GameEvent, new object[] { "<LOC>Your clan member {0} has just joined the game {1}\"{2}\"", User.Current.Name, "game:", this.mGameName });
                 }
             }
             else
             {
                 ErrorLog.WriteLine("Failed to join game {0}!", new object[] { this.mGameName });
             }
         }
     }
 }
Beispiel #5
0
 private void InitStatusDropdown()
 {
     EventHandler handler = null;
     SkinMenuItem item = new SkinMenuItem(Loc.Get("<LOC>Online"), StatusIcons.online);
     item.Click += delegate (object s, EventArgs e) {
         this.SetAwayStatus(false);
         this.SetDNDStatus(false);
         this.UpdateOnlineStatus(true);
     };
     item.Tag = 0;
     this.skinDropDownStatus.Menu.MenuItems.Add(item);
     SkinMenuItem item2 = new SkinMenuItem(Loc.Get("<LOC>Away"), StatusIcons.idle);
     item2.Click += delegate (object s, EventArgs e) {
         this.skinDropDownStatus.Text = "";
         this.SetAwayStatus(true);
     };
     item2.Tag = 0;
     this.skinDropDownStatus.Menu.MenuItems.Add(item2);
     SkinMenuItem item3 = new SkinMenuItem(Loc.Get("<LOC>Do Not Disturb"), StatusIcons.dnd);
     item3.Click += delegate (object s, EventArgs e) {
         this.skinDropDownStatus.Text = "";
         this.SetDNDStatus(true);
     };
     item3.Tag = 0;
     this.skinDropDownStatus.Menu.MenuItems.Add(item3);
     if (User.Current.IsAdmin)
     {
         SkinMenuItem item4 = new SkinMenuItem(Loc.Get("<LOC>Offline"), StatusIcons.offline);
         if (handler == null)
         {
             handler = delegate (object s, EventArgs e) {
                 this.ChangeStatus("<LOC>Offline", StatusIcons.offline);
                 this.UpdateOnlineStatus(false);
             };
         }
         item4.Click += handler;
         item4.Tag = 0;
         this.skinDropDownStatus.Menu.MenuItems.Add(item4);
     }
     SkinMenuItem item5 = new SkinMenuItem(Loc.Get("<LOC>Cancel"), StatusIcons.cancel);
     item5.Click += delegate (object s, EventArgs e) {
         if (this.mSupcomGameManager != null)
         {
             this.mSupcomGameManager.AbortGame();
             this.mSupcomGameManager = null;
         }
         else
         {
             this.CancelRankedGame();
         }
     };
     item5.Tag = 1;
     item5.Visible = false;
     this.skinDropDownStatus.Menu.MenuItems.Add(item5);
     this.ChangeStatus("<LOC>Online", StatusIcons.online);
 }
Beispiel #6
0
 private void _TeamAutomatchExit()
 {
     try
     {
         this.mSearchingForAutomatch = false;
         this.mIsInGame = false;
         this.ShowWelcome();
         this.mSupcomGameManager = null;
         this.ChangeStatus("<LOC>Online", StatusIcons.online);
         this.SetStatusButtons(0);
         this.EnableControls();
         if (this.IsInTeamGame)
         {
             this.DisableGameButtons();
             this.DlgTeamGame.Automatch_OnExit();
         }
         if (this.BeforeTeamGameChatroom != null)
         {
             this.CloseHomePage();
             this.JoinChat(this.BeforeTeamGameChatroom);
             this.BeforeTeamGameChatroom = null;
         }
         this.SubmitReplay();
     }
     catch (Exception exception)
     {
         ErrorLog.WriteLine(exception);
     }
 }
Beispiel #7
0
 private void SupcomGameExit()
 {
     VGen0 method = null;
     this.mSearchingForAutomatch = false;
     try
     {
         for (int i = 0; i < 20; i++)
         {
             try
             {
                 Thread.Sleep(100);
             }
             catch (ThreadInterruptedException exception)
             {
                 GPG.Logging.EventLog.WriteLine("The thread was woken up: " + exception.Message, new object[0]);
             }
         }
         if ((base.InvokeRequired && !base.Disposing) && !base.IsDisposed)
         {
             if (method == null)
             {
                 method = delegate {
                     try
                     {
                         this.CloseHomePage();
                         if ((this.BeforeGameChatroom != null) && (this.BeforeGameChatroom.Length > 0))
                         {
                             this.JoinChat(this.BeforeGameChatroom);
                         }
                         this.SubmitReplay();
                         this.GatherLadderReports();
                         this.mSupcomGameManager = null;
                         this.ChangeStatus("<LOC>Online", StatusIcons.online);
                         this.SetStatusButtons(0);
                     }
                     catch (Exception exception)
                     {
                         ErrorLog.WriteLine(exception);
                     }
                 };
             }
             base.BeginInvoke(method);
         }
         else if (!base.Disposing && !base.IsDisposed)
         {
             this.CloseHomePage();
             if (this.BeforeGameChatroom != null)
             {
                 this.JoinChat(this.BeforeGameChatroom);
             }
             this.SubmitReplay();
             this.GatherLadderReports();
             this.mSupcomGameManager = null;
             this.ChangeStatus("<LOC>Online", StatusIcons.online);
             this.SetStatusButtons(0);
         }
     }
     catch (Exception exception2)
     {
         ErrorLog.WriteLine(exception2);
     }
 }
Beispiel #8
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;
         }
     }
 }
Beispiel #9
0
 private void SubmitReplay()
 {
     SupComGameManager mSupcomGameManager = this.mSupcomGameManager;
     if (mSupcomGameManager == null)
     {
         mSupcomGameManager = SupcomAutomatch.GetSupcomAutomatch().GetManager();
     }
     if (((mSupcomGameManager == null) || ((mSupcomGameManager.GameState != GameState.Lobby) && (mSupcomGameManager.GameState != GameState.StartingApp))) && (ConfigSettings.GetBool("SubmitReplays", true) && (((mSupcomGameManager.GameName == null) || (this.mGameName.IndexOf("AUTOMATCH") >= 0)) || ConfigSettings.GetBool("SubmitCustomReplays", true))))
     {
         string path = null;
         string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
         string str3 = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
         if (GameInformation.SelectedGame.GameID == 2)
         {
             folderPath = (folderPath + @"\Gas Powered Games\SupremeCommander\Replays\" + User.Current.Name) + @"\LastGame.SupremeCommanderReplay";
         }
         else if (GameInformation.SelectedGame.GameID == 0x11)
         {
             folderPath = (folderPath + @"\Gas Powered Games\Supreme Commander Forged Alliance\Replays\" + User.Current.Name) + @"\LastGame.SCFAReplay";
         }
         else if (GameInformation.SelectedGame.GameID == 0x12)
         {
             folderPath = (folderPath + @"\Gas Powered Games\Supreme Commander Forged Alliance Beta\Replays\" + User.Current.Name) + @"\LastGame.SCFABReplay";
         }
         if (GameInformation.SelectedGame.GameID == 2)
         {
             str3 = (str3 + @"\My Games\Gas Powered Games\SupremeCommander\Replays\" + User.Current.Name) + @"\LastGame.SupremeCommanderReplay";
         }
         else if (GameInformation.SelectedGame.GameID == 0x11)
         {
             str3 = (str3 + @"\My Games\Gas Powered Games\Supreme Commander Forged Alliance\Replays\" + User.Current.Name) + @"\LastGame.SCFAReplay";
         }
         else if (GameInformation.SelectedGame.GameID == 0x12)
         {
             str3 = (str3 + @"\My Games\Gas Powered Games\Supreme Commander Forged Alliance Beta\Replays\" + User.Current.Name) + @"\LastGame.SCFABReplay";
         }
         if (System.IO.File.Exists(folderPath) && System.IO.File.Exists(str3))
         {
             if (new FileInfo(folderPath).LastWriteTime > new FileInfo(str3).LastWriteTime)
             {
                 path = folderPath;
             }
             else
             {
                 path = str3;
             }
         }
         else if (!(!System.IO.File.Exists(folderPath) || System.IO.File.Exists(str3)))
         {
             path = folderPath;
         }
         else if (!(System.IO.File.Exists(folderPath) || !System.IO.File.Exists(str3)))
         {
             path = str3;
         }
         else
         {
             path = null;
         }
         if ((((path != null) && System.IO.File.Exists(path)) && Program.Settings.SupcomPrefs.Replays.ShowReplayDialog) && !mSupcomGameManager.DoReplay)
         {
             DlgSubmitReplay replay = new DlgSubmitReplay();
             try
             {
                 if (mSupcomGameManager.GameName.IndexOf("AUTOMATCH") >= 0)
                 {
                     try
                     {
                         string str4 = "Ranked" + SupcomAutomatch.GetSupcomAutomatch().Kind;
                         replay.GameType = (SupcomLookups._GameTypes) System.Enum.Parse(typeof(SupcomLookups._GameTypes), str4, true);
                     }
                     catch
                     {
                         replay.GameType = SupcomLookups._GameTypes.Custom;
                     }
                 }
                 else
                 {
                     replay.GameType = SupcomLookups._GameTypes.Custom;
                 }
                 if (replay.GameType == SupcomLookups._GameTypes.Ranked1v1)
                 {
                     foreach (SupcomPlayerInfo info in mSupcomGameManager.GameInfo.Players)
                     {
                         if (info.PlayerName.ToLower() == User.Current.Name.ToLower())
                         {
                             try
                             {
                                 replay.PlayerFaction = (SupcomLookups._Factions) System.Enum.Parse(typeof(SupcomLookups._Factions), info.Faction, true);
                             }
                             catch
                             {
                                 replay.PlayerFaction = SupcomLookups._Factions.Any;
                             }
                         }
                         else
                         {
                             try
                             {
                                 replay.OpponentFaction = (SupcomLookups._Factions) System.Enum.Parse(typeof(SupcomLookups._Factions), info.Faction, true);
                             }
                             catch
                             {
                                 replay.OpponentFaction = SupcomLookups._Factions.Any;
                             }
                         }
                     }
                 }
                 replay.SetMap(mSupcomGameManager.mLaunchMap);
                 TimeSpan span = (TimeSpan) (DateTime.Now - mSupcomGameManager.GameInfo.StartTime);
                 replay.GameLength = (int) span.TotalSeconds;
                 string opponentname = "";
                 string str6 = "";
                 foreach (SupcomPlayerInfo info2 in mSupcomGameManager.GameInfo.Players)
                 {
                     if (info2.PlayerName != User.Current.Name)
                     {
                         opponentname = opponentname + str6 + info2.PlayerName;
                         str6 = ", ";
                     }
                 }
                 replay.SetOpponent(opponentname);
             }
             catch (Exception exception)
             {
                 ErrorLog.WriteLine(exception);
             }
             replay.SetFile(path);
             replay.Show();
         }
     }
 }
Beispiel #10
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]);
 }
Beispiel #11
0
 private void mSupcomGameManager_OnExit(object sender, EventArgs e)
 {
     this.Ladder = null;
     if (this.mSupcomGameManager.GameState == GameState.Lobby)
     {
         this.mSupcomGameManager.MessageGame("//AUTOABORT " + User.Current.Name.ToString());
     }
     this.NotifyStatus(Loc.Get("<LOC>Automatch Complete"));
     if (this.OnExit != null)
     {
         this.OnExit(this, EventArgs.Empty);
     }
     if (ConfigSettings.GetBool("AbortState", true))
     {
         Thread.Sleep(ConfigSettings.GetInt("AutoExitSleep", 100));
         try
         {
             this.mSupcomGameManager.SetAbort();
             if (ConfigSettings.GetBool("DisposeManager", false))
             {
                 this.mSupcomGameManager.Dispose();
             }
         }
         catch (Exception exception)
         {
             ErrorLog.WriteLine(exception);
         }
         if (ConfigSettings.GetBool("NullOutManagerManager", true))
         {
             this.mSupcomGameManager = null;
         }
     }
 }
Beispiel #12
0
 private void HostTheGame(int playerID, string name)
 {
     ThreadQueue.Quazal.Enqueue(typeof(Chatroom), "Leave", null, null, new object[0]);
     int num = 0;
     while (Chatroom.InChatroom)
     {
         Thread.Sleep(10);
         Application.DoEvents();
         num++;
         if (num > 300)
         {
             break;
         }
     }
     this.NotifyStatus(Loc.Get("<LOC>Automatch Confirm with player "));
     this.mPolling = false;
     EventLog.WriteLine("AutomatchConfirm Enter: " + name, LogCategory.Get("Automatch"), new object[0]);
     if (this.mState == SupcomAutoState.MatchAccept)
     {
         EventLog.WriteLine("AutomatchConfirm Success: " + name, LogCategory.Get("Automatch"), new object[0]);
         this.mState = SupcomAutoState.MatchConfirm;
         this.RemoveMatch();
         string gamename = "AUTOMATCH" + Guid.NewGuid().ToString();
         this.mSupcomGameManager = new SupComGameManager();
         this.mSupcomGameManager.OnGameLaunched += new EventHandler(this.mSupcomGameManager_OnGameLaunched);
         this.mSupcomGameManager.MyTeam = this.mTeamName;
         this.mSupcomGameManager.OtherTeam = this.mOpponentTeamName;
         this.mSupcomGameManager.BeforeExit += new EventHandler(this.mSupcomGameManager_BeforeExit);
         if (this.mSupcomGameManager.OnExitCount() == 0)
         {
             this.mSupcomGameManager.OnExit += new EventHandler(this.mSupcomGameManager_OnExit);
         }
         string map = this.GetMap();
         string str2 = "/team 3";
         string str3 = "/players 2";
         if (this.mKind == "2v2")
         {
             str3 = "/players 4";
         }
         else if (this.mKind == "3v3")
         {
             str3 = "/players 6";
         }
         else if (this.mKind == "4v4")
         {
             str3 = "/players 8";
         }
         else if (this.mKind == "FFA")
         {
             str2 = "/team 1";
             str3 = "/players " + this.mFFAPlayers.Count.ToString();
         }
         this.RegisterGameInfo(gamename);
         this.NotifyStatus(Loc.Get("<LOC>Automatch is being hosted vs. ") + Loc.Get("<LOC>Opponent"));
         this.mSupcomGameManager.mLaunchMap = map;
         this.mSupcomGameManager.HostGame(true, gamename, " /gpgnetmap " + map + " " + this.Faction + " " + str2 + " " + str3);
         this.mSupcomGameManager.ForceAddPlayer(User.Current.Name, "random");
         this.mSupcomGameManager.ForceAddPlayer(name, "random");
         this.mSupcomGameManager.ForceMap(map);
         if (this.OnLaunchGame != null)
         {
             this.OnLaunchGame(this, EventArgs.Empty);
         }
         EventLog.WriteLine("AutomatchConfirm: Game has been hosted: " + gamename, LogCategory.Get("Automatch"), new object[0]);
         Thread thread = new Thread(new ThreadStart(((VGen0)delegate {
             try
             {
                 EventLog.WriteLine("AutomatchConfirm: Entered poll for lobby thread.", LogCategory.Get("Automatch"), new object[0]);
                 while (this.mSupcomGameManager.GameState != GameState.Lobby)
                 {
                     EventLog.WriteLine("AutomatchConfirm: Gamestate is not in lobby.", LogCategory.Get("Automatch"), new object[0]);
                     Thread.Sleep(0x3e8);
                 }
                 EventLog.WriteLine("AutomatchConfirm: SENT LAUNCH COMMAND TO OPPONENT.", LogCategory.Get("Automatch"), new object[0]);
                 if (this.mAllies != null)
                 {
                     Messaging.SendCustomCommand(name, CustomCommands.AutomatchNotifyAllies, new object[] { gamename, 2, User.Current.Name });
                 }
                 if (((this.mKind == "2v2") || (this.mKind == "3v3")) || (this.mKind == "4v4"))
                 {
                     Thread.Sleep(ConfigSettings.GetInt("TeamDelayTime", 0x2710));
                 }
                 if (this.mKind == "FFA")
                 {
                     foreach (KeyValuePair<int, string> pair in this.mFFAPlayers)
                     {
                         Messaging.SendCustomCommand(pair.Value, CustomCommands.AutomatchLaunch, new object[] { gamename, 1, User.Current.Name, "" });
                     }
                 }
                 else
                 {
                     Messaging.SendCustomCommand(name, CustomCommands.AutomatchLaunch, new object[] { gamename, 2, User.Current.Name, "" });
                 }
                 this.AutomatchNotifyOpponentTeam(playerID, name, this.mTeamName, gamename);
                 if (this.mAllies != null)
                 {
                     foreach (string str in this.mAllies)
                     {
                         if (str != User.Current.Name)
                         {
                             Messaging.SendCustomCommand(str, CustomCommands.AutomatchLaunch, new object[] { gamename, 3, User.Current.Name, this.Faction });
                         }
                     }
                 }
             }
             catch (Exception exception)
             {
                 ErrorLog.WriteLine(exception);
             }
         }).Invoke));
         thread.IsBackground = true;
         thread.Start();
     }
     else
     {
         Messaging.SendCustomCommand(name, CustomCommands.AutomatchBusy, new object[0]);
     }
 }
Beispiel #13
0
 private void DoJoin(DataList data)
 {
     try
     {
         try
         {
             EventLog.WriteLine("Joining a game.", new object[0]);
             EventLog.DoStackTrace();
         }
         catch
         {
         }
         this.NotifyStatus(Loc.Get("<LOC>Joining player "));
         this.mSupcomGameManager = new SupComGameManager();
         this.mSupcomGameManager.OnGameLaunched += new EventHandler(this.mSupcomGameManager_OnGameLaunched);
         this.mSupcomGameManager.MyTeam = this.mTeamName;
         this.mSupcomGameManager.OtherTeam = this.mOpponentTeamName;
         this.mSupcomGameManager.BeforeExit += new EventHandler(this.mSupcomGameManager_BeforeExit);
         this.mSupcomGameManager.ForceAddPlayer(this.mHost, "random");
         this.mSupcomGameManager.ForceAddPlayer(User.Current.Name, "random");
         if (this.mSupcomGameManager.OnExitCount() == 0)
         {
             this.mSupcomGameManager.OnExit += new EventHandler(this.mSupcomGameManager_OnExit);
         }
         string str = data[0]["url"];
         string gamedesc = data[0]["description"];
         this.RegisterGameInfo(gamedesc);
         string[] strArray = str.Split("=;".ToCharArray());
         if (strArray.Length > 3)
         {
             string address = strArray[1];
             int port = Convert.ToInt32(strArray[3]);
             if (!this.mSupcomGameManager.JoinGame(true, gamedesc, address, port, this.mHost, " " + this.Faction + " " + this.mTeamArg))
             {
             }
             if (this.OnLaunchGame != null)
             {
                 this.OnLaunchGame(this, EventArgs.Empty);
             }
         }
         else
         {
             this.AutomatchLaunch(0, "", gamedesc, this.mTeam, this.mHost, this.Faction);
         }
     }
     catch (Exception exception)
     {
         ErrorLog.WriteLine(exception);
         throw exception;
     }
 }