示例#1
0
 public FrmMain()
 {
     WaitCallback callBack = null;
     MessageEventHandler handler = null;
     EventHandler handler2 = null;
     EventHandler handler3 = null;
     this.components = null;
     this.WebURL = null;
     this.IsGPGNetPatching = true;
     this.mNotFound = "";
     this.IsLatestVer = false;
     this.mPatchFileName = "";
     this.mServerGameVersion = null;
     this.mLastSelectedGame = null;
     this.mIsSupComVersionEnforced = null;
     this.mIsSupComPatching = false;
     this.DlgUpdate = null;
     this.SupComPatchThread = null;
     this.FriendsLoaded = false;
     this.FriendContainers = new BoundContainerList();
     this.FriendContainerLookup = new Dictionary<string, TextContainer>();
     this.ActiveDialogRequests = new List<string>();
     this.FriendRequests = new MappedObjectList<FriendRequest>();
     this.AwaitingLogin = true;
     this.ContinueLoading = null;
     this.LadderViews = new Dictionary<int, FrmLadderView>();
     this.mGameMenuItems = new List<ToolStripMenuItem>();
     this.mLastMoveItem = null;
     this.mConfigSleepRate = 0x493e0;
     this.mFirstConfig = true;
     this.mLastMOTD = "";
     this.mLastProcessList = "";
     this.mConfigThread = null;
     this.mConnected = true;
     this.mShuttingDown = false;
     this.CancelFade = false;
     this.HasFadeStarted = false;
     this.IsFading = false;
     this.TargetFade = 0.0;
     this.FadeIncrement = 0.0;
     this.StayActive = false;
     this.mIsActiveWindow = false;
     this.mWelcomePage = null;
     this.mRanInitializeChat = false;
     this.mHeightDiff = 0;
     this.mWidthDiff = 0;
     this.mLastX = 0;
     this.mLastY = 0;
     this.mLastMouseX = 0;
     this.mLastMouseY = 0;
     this.mLastWidth = 0;
     this.mLastHeight = 0;
     this.mIsMoving = false;
     this.mIsResizing = false;
     this.mStartResizing = false;
     this.RESIZE_RECT = 40;
     this.mResizeRect = new Rectangle();
     this.FirstPaint = true;
     this.mIsMaximized = false;
     this.mRestore = new Rectangle(0, 0, 100, 100);
     this.MinimizeLoc = new Point(-32000, -32000);
     this.MinimizeSize = new Size(640, 500);
     this.StatusTimer = null;
     this.mActiveDialogs = new List<DlgBase>();
     this.mActiveWindow = null;
     this.DlgAbout = null;
     this.DlgOptions = null;
     this.DlgUserFeedback = null;
     this.FrmStatsLadders = new List<FrmStatsLadder>();
     this.DlgGameKeys = null;
     this.DlgEmotes = null;
     this.DlgSelectChannel = null;
     this.DlgKeywordSearch = null;
     this.DlgSearchResults = null;
     this.DlgSolution = null;
     this.DlgSearchReplays = null;
     this.DlgTeamGame = null;
     this.DlgSelectGame = null;
     this.DlgActiveEfforts = null;
     this.DlgContentManager = null;
     this.mSearchingForAutomatch = false;
     this.mLastStatus = "";
     this.mCalcGridHeight = false;
     this.ToolstripSizeChanged = false;
     this.mCustomPaint = new List<ToolStripItem>();
     this.mLastCheckTime = DateTime.Now;
     this.mDlgWorldMap = null;
     this.mSelectedTab = null;
     this.mGameLinkClickTime = DateTime.Now;
     this.ChatRowPoints = new Dictionary<int, Rectangle>();
     this.ChatRowHeights = new Dictionary<int, int>();
     this.mFirstChatDraw = true;
     this.SelectedEmote = null;
     this.LastTick = 0;
     this.Divider = 1;
     this.CurrentFrame = 1;
     this.EmoteCount = 0;
     this.CountEmotes = true;
     this.PaintPending = false;
     this.mSelectedParticipantView = null;
     this.UIQueue = new ThreadQueue(true);
     this.IsSortingChatroom = false;
     this.IsSynchronizingChatroom = false;
     this.ChatSyncTimer = null;
     this._AddUser = null;
     this._UpdateUser = null;
     this._RemoveUser = null;
     this.mSelectedChatParticipant = null;
     this.ChatContainerLookup = new Dictionary<string, TextContainer<StatusTextLine>>();
     this.ChatContainers = new BoundContainerList<StatusTextLine>();
     this.RefreshData = false;
     this.BetweenChannels = false;
     this.mMainChatrom = "";
     this.ChatroomQueue = new ThreadQueue(true);
     this.mLastChatTimes = Hashtable.Synchronized(new Hashtable());
     this.mLastChatContent = Hashtable.Synchronized(new Hashtable());
     this.mChatLines = new BindingList<ChatLine>();
     this.PlayerChatEffects = new Dictionary<string, ChatEffectBase>();
     this.mSpeakingTimers = new Dictionary<string, StateTimer>();
     this.AwayTimer = new StateTimer();
     this.SelfLeaveTimer = new StateTimer();
     this.LastAction = DateTime.Now;
     this.mChatHistory = new LinkedList<string>();
     this.HistoryIndex = -1;
     this.SelectingTextList = false;
     this.PMTargets = new List<string>();
     this.mPrivateChats = new Dictionary<string, FrmPrivateChat>();
     this.PlayerProfileForm = null;
     this.ClanLoaded = false;
     this.ClanContainers = new BoundContainerList();
     this.ClanContainerLookup = new Dictionary<string, TextContainer>();
     this.ClanRequests = null;
     this.ClanInvites = null;
     this.ClanProfileForm = null;
     this.mBeforeGameChatroom = "";
     this.mIsInGame = false;
     this.StatusButtonRankedGameCancel = new SkinStatusButton();
     this.mGameName = "";
     this.mGameURL = "";
     this.mHostName = "";
     this.mSupcomGameManager = null;
     this.mPassword = "";
     this.mFirstRankedSupcomGame = true;
     this.PlayNowMatch = false;
     this.mAutoStatus = Loc.Get("<LOC>Searching for game ");
     this.LastGameChallenges = new Dictionary<int, bool>();
     this.LadderInvitePending = false;
     this.mCanDirectChallenge = true;
     this.mDirectChallengePlayer = "";
     this.AllowDirectChallenge = true;
     this.BeforeTeamGameChatroom = null;
     this.mTeamAutomatchExit = false;
     this.InviteAccepted = false;
     this.InvitePending = false;
     this.PendingJoinFrom = null;
     ThreadID = Thread.CurrentThread.ManagedThreadId;
     if (new DlgLogin().ShowDialog() == DialogResult.OK)
     {
         if (callBack == null)
         {
             callBack = delegate (object p) {
                 GameInformation.LoadGamesFromDB();
                 new QuazalQuery("RemoveSpaceSiegeGame", new object[0]).ExecuteNonQuery();
                 ConfigSettings.LoadSettings(DataAccess.GetQueryData("GetAllConfigs", new object[0]));
                 try
                 {
                     DataList queryData = null;
                     queryData = DataAccess.GetQueryData("GetTOSPrompt", new object[0]);
                     if ((queryData != null) && (queryData.Count < 1))
                     {
                         DataAccess.ExecuteQuery("CreatePlayerInfo", new object[0]);
                         queryData = DataAccess.GetQueryData("GetTOSPrompt", new object[0]);
                     }
                     if ((queryData != null) && (queryData.Count > 0))
                     {
                         if (Convert.ToInt32(queryData[0]["term_of_service_prompt"]) > 0)
                         {
                             if (new DlgTermsOfService(this, queryData[0]["url"]).ShowDialog() == DialogResult.OK)
                             {
                                 ThreadQueue.Quazal.Enqueue((VGen0)delegate {
                                     DataAccess.ExecuteQuery("SetTOSPrompt", new object[] { 0 });
                                 }, new object[0]);
                                 this.ContinueLoading = true;
                             }
                             else
                             {
                                 this.ContinueLoading = false;
                             }
                         }
                         else
                         {
                             this.ContinueLoading = true;
                         }
                     }
                     else
                     {
                         AuditLog.WriteLine("Unable to find Terms of Service agreement.", new object[0]);
                         this.ContinueLoading = true;
                     }
                 }
                 catch (Exception exception)
                 {
                     ErrorLog.WriteLine(exception);
                     this.ContinueLoading = false;
                 }
             };
         }
         ThreadQueue.QueueUserWorkItem(callBack, new object[0]);
         while (!this.ContinueLoading.HasValue)
         {
             Thread.Sleep(100);
         }
         if (this.ContinueLoading.Value)
         {
             if (ConfigSettings.GetBool("DoOldGameList", false))
             {
                 if (((User.Current.IsAdmin || (GameInformation.SelectedGame.GameID == -1)) || (GameKey.BetaKeys.Count > 0)) || ((GameKey.BetaKeys.Count < 1) && (new DlgNoBetaKey(this).ShowDialog() == DialogResult.OK)))
                 {
                     this.AwaitingLogin = false;
                 }
                 else
                 {
                     User.Logout();
                     this.ContinueLoading = false;
                     this.AwaitingLogin = false;
                 }
             }
             else if (((User.Current.IsAdmin || (GameInformation.SelectedGame.GameID == -1)) || (GameInformation.SelectedGame.CDKey != "")) || (new DlgNoBetaKey(this).ShowDialog() == DialogResult.OK))
             {
                 this.AwaitingLogin = false;
             }
             else
             {
                 User.Logout();
                 this.ContinueLoading = false;
                 this.AwaitingLogin = false;
             }
         }
         else
         {
             Application.Exit();
             this.AwaitingLogin = false;
         }
     }
     else
     {
         this.AwaitingLogin = false;
         if (OnCancelLoad != null)
         {
             OnCancelLoad(this, EventArgs.Empty);
         }
     }
     if (((User.Current == null) || base.Disposing) || base.IsDisposed)
     {
         if (OnCancelLoad != null)
         {
             OnCancelLoad(this, EventArgs.Empty);
         }
         base.Close();
     }
     else if (!(!this.ContinueLoading.HasValue ? false : this.ContinueLoading.Value))
     {
         if (OnCancelLoad != null)
         {
             OnCancelLoad(this, EventArgs.Empty);
         }
         base.Close();
     }
     else
     {
         Exception exception;
         this.InitializeComponent();
         this.InitializePlugins();
         this.SetToolTips();
         this.gpgChatGrid.IsCheckingExpand = false;
         DlgMessage.RegistermainForm(this);
         DlgSupcomTeamSelection.sFrmMain = this;
         if (this.GatheringDisplaycontrol is SkinGatheringDisplay)
         {
             (this.GatheringDisplaycontrol as SkinGatheringDisplay).MainForm = this;
         }
         this.ResetLobby();
         base.ShowInTaskbar = false;
         IntPtr handle = base.Handle;
         this.DoubleBuffered = true;
         this.SetSkin(Program.Settings.SkinName);
         this.StyleApplication(this, null);
         this.StyleChatroom(this, null);
         base.FormBorderStyle = FormBorderStyle.Sizable;
         User.LoggedOut += new EventHandler(this.LogoutLobby);
         this.SetRegion();
         this.PopulateLadderMenuItems();
         this.InitStatusDropdown();
         this.ChatFiltersChanged();
         this.SetLogo(this);
         this.ciChat_TeamInvite.DrawItem += new DrawItemEventHandler(this.miArrangedTeamsPopup_DrawItem);
         this.skinDropDownStatus.Enabled = false;
         this.textBoxMsg.Properties.MaxLength = 300;
         this.GatheringDisplaycontrol.Popup += new EventHandler(this.comboBoxGatherings_Popup);
         this.CheckControl(this);
         Messaging.NetDataRecieved += new NetDataEventHandler(FrmMain.Messaging_NetDataRecieved);
         Messaging.MessageRecieved += new MessageEventHandler(this.Messaging_MessageRecieved);
         Messaging.CommandRecieved += new MessageEventHandler(this.Messaging_CommandRecieved);
         if (handler == null)
         {
             handler = delegate (MessageEventArgs e) {
                 this.ParseCustomCommand(e.Command, e.CommandArgs);
             };
         }
         Messaging.CustomCommandRecieved += handler;
         if (handler2 == null)
         {
             handler2 = delegate (object s, EventArgs e) {
                 base.Invalidate(false);
             };
         }
         base.SizeChanged += handler2;
         if (handler3 == null)
         {
             handler3 = delegate (object s, EventArgs e) {
                 if (this.ActiveWindow != null)
                 {
                     this.ActiveWindow = null;
                 }
             };
         }
         base.Activated += handler3;
         base.MouseDown += new MouseEventHandler(this.this_MouseDown);
         this.pbTop.MouseDown += new MouseEventHandler(this.this_MouseDown);
         this.pbTopLeft.MouseDown += new MouseEventHandler(this.this_MouseDown);
         this.pbTopRight.MouseDown += new MouseEventHandler(this.this_MouseDown);
         this.pbBottomRight.MouseDown += new MouseEventHandler(this.this_MouseDown);
         base.MouseUp += new MouseEventHandler(this.this_MouseUp);
         this.pbTop.MouseUp += new MouseEventHandler(this.this_MouseUp);
         this.pbTopLeft.MouseUp += new MouseEventHandler(this.this_MouseUp);
         this.pbTopRight.MouseUp += new MouseEventHandler(this.this_MouseUp);
         this.gvChat.RowSeparatorHeight = Program.Settings.Chat.Appearance.ChatLineSpacing;
         this.BindToSettings();
         this.PreLoadChat();
         while (this.AwaitingLogin && (!base.Disposing && !base.IsDisposed))
         {
             Thread.Sleep(100);
         }
         ThreadQueue.Quazal.Enqueue(typeof(DataAccess), "GetQueryData", this, "OnGetConfigs", new object[] { "GetAllConfigs" });
         ThreadQueue.Quazal.Enqueue(typeof(DataAccess), "GetQueryData", this, "AddMenuItems", new object[] { "GetMenuItems" });
         try
         {
             ThreadQueue.QueueUserWorkItem(delegate (object state) {
                 DataAccess.ExecuteQuery("SetIP2", new object[] { User.HashPassword(DlgLogin.LastPass) });
                 DlgLogin.LastPass = "";
             }, new object[0]);
         }
         catch (Exception exception1)
         {
             exception = exception1;
             ErrorLog.WriteLine(exception);
         }
         ThreadQueue.QueueUserWorkItem(delegate (object state) {
             DataAccess.ExecuteQuery("AcceptAllLadderChallenges", new object[] { User.Current.ID });
         }, new object[0]);
         if (User.Current.IsAdmin)
         {
             this.miTranslate.Visible = true;
         }
         if (AccessControlList.HasAccessTo("PatchAdmins"))
         {
             this.miTools_LocPatches.Visible = true;
             this.miTools_LocPatches.Enabled = true;
         }
         if (AccessControlList.HasAccessTo("PrizeWinners"))
         {
             this.miGame_RedeemPrize.Visible = true;
             this.miGame_RedeemPrize.Enabled = true;
         }
         try
         {
             this.CreateGameList();
             this.RefreshGameList();
         }
         catch (Exception exception2)
         {
             exception = exception2;
         }
     }
 }
示例#2
0
 private void ShowPatchMessage()
 {
     VGen0 method = null;
     if (Program.Settings.SupcomPrefs.ShowPatchMsg)
     {
         try
         {
             if (method == null)
             {
                 method = delegate {
                     if (((this.DlgUpdate == null) || this.DlgUpdate.Disposing) || this.DlgUpdate.IsDisposed)
                     {
                         if ((GameInformation.SelectedGame.GameDescription != null) && (GameInformation.SelectedGame.GameDescription != string.Empty))
                         {
                             this.DlgUpdate = new DlgGameUpdate(this, GameInformation.SelectedGame.GameDescription);
                         }
                         else
                         {
                             this.DlgUpdate = new DlgGameUpdate(this, "Selected Product");
                         }
                         this.DlgUpdate.Show(this);
                     }
                     else
                     {
                         this.DlgUpdate.BringToFront();
                     }
                 };
             }
             base.BeginInvoke(method);
         }
         catch (Exception exception)
         {
             ErrorLog.WriteLine(exception);
             this.DlgUpdate = null;
         }
     }
 }