public static void ShowAeriaLogin(string url, string urlFirst, ProfileLoginWindow parent, AeriaEventHandler loginCallback)
 {
     if (instance != null)
     {
         try
         {
             instance.Close();
             instance = null;
         }
         catch (Exception)
         {
         }
     }
     vidLoaded = false;
     AeriaWindow window = new AeriaWindow();
     m_parent = parent;
     Point point = new Point(parent.Location.X + ((parent.Width - window.Width) / 2), parent.Location.Y + ((parent.Height - window.Height) / 2));
     window.closeCallback = new MyFormBase.MFBClose(AeriaWindow.closing);
     window.Location = point;
     window.Show(parent);
     instance = window;
     instance.login = (AeriaEventHandler) Delegate.Combine(instance.login, loginCallback);
     while (!vidLoaded)
     {
         Thread.Sleep(100);
         Application.DoEvents();
     }
     Thread.Sleep(500);
     if (urlFirst.Length > 0)
     {
         futureURL = url;
         url = urlFirst;
     }
     window.webBrowser1.Navigate(url);
 }
 public static void ShowFacebookLogin(string url, string urlFirst, Form parent)
 {
     if (instance != null)
     {
         try
         {
             instance.Close();
             instance = null;
         }
         catch (Exception)
         {
         }
     }
     vidLoaded = false;
     FacebookWindow window = new FacebookWindow();
     m_parent = null;
     Point point = new Point(parent.Location.X + ((parent.Width - window.Width) / 2), parent.Location.Y + ((parent.Height - window.Height) / 2));
     window.Location = point;
     window.Show(parent);
     instance = window;
     while (!vidLoaded)
     {
         Thread.Sleep(100);
         Application.DoEvents();
     }
     Thread.Sleep(500);
     if (urlFirst.Length > 0)
     {
         futureURL = url;
         url = urlFirst;
     }
     window.webBrowser1.Navigate(url);
 }
 public void init(ProfileLoginWindow parentForm)
 {
     this.m_parentForm = parentForm;
     base.clearControls();
     this.BackColor = ARGBColors.White;
     this.headingLabel.Text = SK.Text("BIGPOINT_PleaseLogin", "Please Log into Bigpoint in your Browser");
     this.headingLabel.Position = new Point(0, 10);
     this.headingLabel.Size = new Size(600, 30);
     this.headingLabel.Color = ARGBColors.Black;
     this.headingLabel.Font = FontManager.GetFont("Arial", 11f, FontStyle.Bold);
     this.headingLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_CENTER;
     base.addControl(this.headingLabel);
     this.bodyLabel.Text = SK.Text("BIGPOINT_ClickHere", "Click here once you have completed your Login");
     this.bodyLabel.Position = new Point(0, 80);
     this.bodyLabel.Size = new Size(600, 30);
     this.bodyLabel.Color = ARGBColors.Black;
     this.bodyLabel.Font = FontManager.GetFont("Arial", 10f, FontStyle.Bold);
     this.bodyLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_CENTER;
     this.bodyLabel.Visible = false;
     base.addControl(this.bodyLabel);
     this.closeButton.ImageNorm = this.CloseImage;
     this.closeButton.ImageOver = this.CloseImageOver;
     this.closeButton.Position = new Point(370, 160);
     this.closeButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.closeClick), "WorldSelectPopupPanel_close");
     base.addControl(this.closeButton);
     this.completeButton.ImageNorm = this.CompleteImage;
     this.completeButton.ImageOver = this.CompleteImageOver;
     this.completeButton.Position = new Point(100, 100);
     this.completeButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.completeClick), "WorldSelectPopupPanel_close");
     this.completeButton.Visible = false;
     base.addControl(this.completeButton);
     this.startedTime = DateTime.Now;
     this.firstAttemptTried = false;
 }
 public BPPopupWindow openBPPopupWindow(ProfileLoginWindow parentForm)
 {
     this.openGreyOutWindowLogin(true);
     this.closePopupWindow(this.m_BPPopupWindow);
     this.m_BPPopupWindow = new BPPopupWindow();
     this.positionWindow(this.m_BPPopupWindow, true, false);
     this.m_BPPopupWindow.init(parentForm);
     this.m_BPPopupWindow.Show(this.getGreyOutWindow());
     GameEngine.Instance.DisableMouseClicks();
     this.m_BPPopupWindow.Location = new Point(Program.profileLogin.Location.X + ((Program.profileLogin.Width - this.m_BPPopupWindow.Width) / 2), (Program.profileLogin.Location.Y + ((Program.profileLogin.Height - this.m_BPPopupWindow.Height) / 2)) + 10);
     Program.profileLogin.TopMost = false;
     this.m_greyOutWindow.BringToFront();
     this.m_BPPopupWindow.BringToFront();
     this.m_BPPopupWindow.TopMost = true;
     this.m_BPPopupWindow.Focus();
     this.m_BPPopupWindow.TopMost = false;
     return this.m_BPPopupWindow;
 }
Beispiel #5
0
        private static void Main(string[] args)
        {
            #if DEBUG
            AllocConsole();
            #endif
            try
            {
                args = new string[] { "-InstallerVersion", CurrentInstallerBuild.ToString(), "en" };
            #if DEBUG
                Console.WriteLine("Nichosy " + DataExport.version);
            #endif

                DataExport.Fill();
                bool flag = false;
                bool flag2 = false;
                string str = "en";
                if ((args == null) || (args.Length < 1))
                {
                    flag = true;
                }
                if ((args != null) && (args.Length > 1))
                {
                    if (args[0].ToLowerInvariant() == "-installerversion")
                    {
                        if (Convert.ToInt32(args[1]) < CurrentInstallerBuild)
                        {
                            flag2 = true;
                        }
                    }
                    else if (!(args[0].ToLowerInvariant() == "-installer"))
                    {
                        flag = true;
                    }
                    if (args.Length > 2)
                    {
                        if (args[2].Length > 0)
                        {
                            str = args[2];
                        }
                        if ((args.Length > 3) && (args[3].Length > 0))
                        {
                            if (args[3] == "st")
                            {
                                steamInstall = true;
                            }
                            if (args[3] == "bp")
                            {
                                bigpointInstall = true;
                            }
                            if (args[3] == "bp2")
                            {
                                bigpointPartnerInstall = true;
                            }
                            if (args[3] == "ae")
                            {
                                aeriaInstall = true;
                            }
                            if (args[3] == "gf")
                            {
                                gamersFirstInstall = true;
                                if ((args.Length > 4) && (args[4].Length > 0))
                                {
                                    gamersFirstTokenMD5 = args[4];
                                }
                            }
                            if (args[3] == "arc")
                            {
                                if (args.Length > 4)
                                {
                                    arcUsername = args[4];
                                    arcInstall = true;
                                    if (arcUsername.Length <= 0)
                                    {
                                        arcLauncherStart = true;
                                    }
                                }
                                else
                                {
                                    arcLauncherStart = true;
                                }
                            }
                        }
                    }
                }
                else
                {
                    flag2 = true;
                }
                xmas_period = HolidayPeriods.xmas(DateTime.Now);
                if (arcLauncherStart)
                {
                    arc_launchClient(str);
                }
                else if (flag)
                {
                    MessageBox.Show(SK.Text("ProgramMain_Launch_Failure1", "This is not the game exe!") + Environment.NewLine + Environment.NewLine + SK.Text("ProgramMain_Launch_Failure2", "Please run Stronghold Kingdoms in the normal manner."), SK.Text("ProgramMain_Launch_Failure", "Stronghold Kingdoms Error"), MessageBoxButtons.OK);
                }
                else if (flag2 && !steamInstall)
                {
                    MessageBoxButtons oKCancel = MessageBoxButtons.OKCancel;
                    if (MessageBox.Show(SK.Text("ProgramMain_New_nInstaller", "A new version of the Updater/Installer is needed") + Environment.NewLine + SK.Text("ProgramMain_Must_Install", "You cannot Launch Stronghold Kingdoms until this is installed") + Environment.NewLine + Environment.NewLine + SK.Text("ProgramMain_Install_Now", "Do you wish to install this now?"), SK.Text("ProgramMain_Installer_Update", "Stronghold Kingdoms Installer Update"), oKCancel) == DialogResult.OK)
                    {
                        string path = InstallerUpdater.downloadSelfUpdater(new Uri("http://static.strongholdkingdoms.com/Kingdoms/kingdoms-setup-update-" + CurrentInstallerBuild.ToString() + ".exe"));
                        if ((path != null) && (path.Length > 0))
                        {
                            InstallerUpdater.runInstaller(path);
                        }
                    }
                }
                else
                {
                    bool flag3;
                    string name = @"Global\StrongholdKingdoms";
                    using (new Mutex(true, name, out flag3))
                    {
                        bool flag4;
                        try
                        {
                            OperatingSystem oSVersion = Environment.OSVersion;
                            if ((oSVersion.Platform == PlatformID.Win32NT) && (oSVersion.Version.Major >= 6))
                            {
                                SetProcessDPIAware();
                            }
                        }
                        catch (Exception)
                        {
                        }
                        AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(Program.CurrentDomain_UnhandledException);
                        Application.ThreadException += new ThreadExceptionEventHandler(Program.CurrentDomain_ThreadException);
                        Application.EnableVisualStyles();
                        Application.SetCompatibleTextRenderingDefault(false);
                        communityLangs = SKLocalization.scanForLanguages(GameEngine.getLangsPath());
                        installedLangCode = str;
                        mySettings = MySettings.load();
                        if (mySettings.LanguageIdent.Length == 0)
                        {
                            mySettings.LanguageIdent = str;
                        }
                        else if (mySettings.InstalledLanguageIdent != str)
                        {
                            mySettings.LanguageIdent = str;
                            mySettings.InstalledLanguageIdent = str;
                        }
                        if (!mySettings.OwnLanguageAvailableAndChecked)
                        {
                            string str6 = Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName.ToLower();
                            if (str6 != mySettings.LanguageIdent)
                            {
                                if (str6 == "en")
                                {
                                    mySettings.OwnLanguageAvailableAndChecked = true;
                                }
                                else if ((((str6 == "de") || (str6 == "fr")) || ((str6 == "ru") || (str6 == "es"))) || (((str6 == "pl") || (str6 == "it")) || ((str6 == "tr") || (str6 == "pt"))))
                                {
                                    string str7 = SK.Text("ProgramMain_A_New_Language", "A New Language is available : ");
                                    switch (str6)
                                    {
                                        case "de":
                                            str7 = str7 + "Deutsch";
                                            break;

                                        case "fr":
                                            str7 = str7 + "Fran\x00e7ais";
                                            break;

                                        case "ru":
                                            str7 = str7 + "Русский";
                                            break;

                                        case "es":
                                            str7 = str7 + "Espa\x00f1ol";
                                            break;

                                        case "pl":
                                            str7 = str7 + "Polski";
                                            break;

                                        case "it":
                                            str7 = str7 + "Italiano";
                                            break;

                                        case "tr":
                                            str7 = str7 + "T\x00fcrk\x00e7e";
                                            break;

                                        case "pt":
                                            str7 = str7 + "Portugu\x00eas do Brasil";
                                            break;
                                    }
                                    if (MessageBox.Show(str7 + Environment.NewLine + SK.Text("ProgramMain_Use_New_Language", "Your system settings indicate you are using this language, do you wish to play Stronghold Kingdoms in this language?"), SK.Text("ProgramMain_NewLanguageAvailable", "New Language Available"), MessageBoxButtons.YesNo) == DialogResult.Yes)
                                    {
                                        mySettings.LanguageIdent = str6;
                                    }
                                    mySettings.OwnLanguageAvailableAndChecked = true;
                                }
                            }
                            else
                            {
                                mySettings.OwnLanguageAvailableAndChecked = true;
                            }
                        }
                        switch (mySettings.LanguageIdent)
                        {
                            case "en":
                            case "de":
                            case "fr":
                            case "ru":
                            case "es":
                            case "pl":
                            case "pt":
                            case "tr":
                            case "it":
                                SKLocalization.LoadLocalization(Application.StartupPath + @"\Localization\", mySettings.LanguageIdent);
                                goto Label_079B;

                            default:
                                flag4 = false;
                                foreach (SKLang lang in communityLangs)
                                {
                                    if (lang.id == mySettings.LanguageIdent)
                                    {
                                        SKLocalization.LoadLocalization(GameEngine.getLangsPath(), lang.id);
                                        if ((SKLocalization.Instance == null) || !SKLocalization.Instance.valid)
                                        {
                                            flag4 = false;
                                        }
                                        else
                                        {
                                            flag4 = true;
                                        }
                                        break;
                                    }
                                }
                                break;
                        }
                        if (!flag4)
                        {
                            mySettings.LanguageIdent = "en";
                            SKLocalization.LoadLocalization(Application.StartupPath + @"\Localization\", mySettings.LanguageIdent);
                        }
                    Label_079B:
                        if (steamInstall)
                        {
                            bool flag5 = false;
                            try
                            {
                                if (Steam_Init() > 0)
                                {
                                    steamActive = true;
                                    Steam_getTicket();
                                    string sessionid = BitConverter.ToString(steam_SessionTicket).Replace("-", "");
                                    XmlRpcAuthRequest req = new XmlRpcAuthRequest("", "", "", "", sessionid, "", "", "");
                                    XmlRpcAuthResponse response = XmlRpcAuthProvider.CreateForEndpoint(URLs.ProfileProtocol, URLs.ProfileServerAddressLogin, URLs.ProfileServerPort, URLs.ProfilePath).AuthenticateSteamAccount(req, null, null, 0x3a98);
                                    if (response.SuccessCode == 1)
                                    {
                                        flag5 = true;
                                        steamID = response.Message;
                                        steamEmail = response.UserGUID;
                                        mySettings.AutoLogin = false;
                                        if (steamEmail.Trim().Length > 0)
                                        {
                                            kingdomsAccountFound = true;
                                        }
                                        else
                                        {
                                            kingdomsAccountFound = false;
                                        }
                                    }
                                }
                            }
                            catch (Exception)
                            {
                                steamActive = false;
                            }
                            if (!flag5)
                            {
                                MessageBox.Show(SK.Text("Steam_steam_required", "Stronghold Kingdoms requires the Steam Client to be running in Online mode."), SK.Text("Steam_error", "Steam Error"));
                                Application.Exit();
                                return;
                            }
                        }
                        if (!arcInstall || arc_login(arcUsername))
                        {
                            if (gamersFirstInstall && (gamersFirstTokenMD5.Length == 0))
                            {
                                MessageBox.Show(SK.Text("GF_token_error", "Unable to verify your GamersFirst identity. Please try again. If this issue persists, please contact support."), SK.Text("GF_Error", "GamersFirst Error"));
                                Application.Exit();
                            }
                            else
                            {
                                LoadingPanel panel = new LoadingPanel();
                                panel.init();
                                panel.Show();
                                panel.TopMost = true;
                                panel.BringToFront();
                                panel.Focus();
                                panel.BringToFront();
                                panel.TopMost = false;
                                string basePath = Application.StartupPath + @"\geckofx\xulrunner";
                                loadGeckoDLLs(basePath);
                                Xpcom.Initialize(basePath);
                                bool flag6 = testMutex();
                                if (!flag3 || flag6)
                                {
                                    MessageBox.Show(SK.Text("ProgramMain_Already_Running", "Already running") + "...", "Stronghold Kingdoms");
                                }
                                else
                                {
                                    bool flag7 = true;
                                    TimerCaps caps = new TimerCaps();
                                    timeGetDevCaps(ref caps, Marshal.SizeOf(caps));
                                    timerPeriod = Math.Max(caps.periodMin, 1);
                                    timeBeginPeriod(timerPeriod);
                                    DXTimer.Init();
                                    GameEngine engine = null;
                                    try
                                    {
                                        engine = new GameEngine();
                                    }
                                    catch (FileNotFoundException exception)
                                    {
                                        if (exception.FileName.Contains("irectX"))
                                        {
                                            GameEngine.displayDirectXError();
                                        }
                                        timeEndPeriod(timerPeriod);
                                        panel.Close();
                                        return;
                                    }
                                    GraphicsMgr mgr = new GraphicsMgr();
                                    int maxRes = 2;
                                    Screen primaryScreen = Screen.PrimaryScreen;
                                    int width = primaryScreen.Bounds.Width;
                                    int height = primaryScreen.Bounds.Height;
                                    if ((width < 0x400) || (height < 0x300))
                                    {
                                        MessageBoxButtons yesNo = MessageBoxButtons.YesNo;
                                        panel.Close();
                                        panel = null;
                                        if (MessageBox.Show(SK.Text("ProgramMain_Screen_Too_Small", "Your screen resolution is too small to run Stronghold Kingdoms") + Environment.NewLine + Environment.NewLine + SK.Text("ProgramMain_Try_Anyway", "Try to anyway?"), SK.Text("ProgramMain_Error", "Error"), yesNo) != DialogResult.Yes)
                                        {
                                            timeEndPeriod(timerPeriod);
                                            return;
                                        }
                                    }
                                    int num6 = width - 80;
                                    int num7 = height - 100;
                                    if (num6 < 0x3b0)
                                    {
                                        num6 = 0x3b0;
                                    }
                                    if (num7 < 0x29c)
                                    {
                                        num7 = 0x29c;
                                    }
                                    mySettings.Save();
                                    CastleMap.displayCollapsed = mySettings.CastleWalls;
                                    MainWindow newParentMainWindow = null;
                                    Form form = null;
                                    form = new MainWindow
                                    {
                                        Visible = false
                                    };
                                    if (arcInstall)
                                    {
                                        arc_init(form);
                                    }
                                    ((MainWindow)form).allowResizing(false);
                                    int screenWidth = num6;
                                    int screenHeight = num7;
                                    if (mySettings.ScreenWidth > 0)
                                    {
                                        screenWidth = mySettings.ScreenWidth;
                                    }
                                    if (mySettings.ScreenHeight > 0)
                                    {
                                        screenHeight = mySettings.ScreenHeight;
                                    }
                                    if (screenWidth > width)
                                    {
                                        screenWidth = width;
                                    }
                                    if (screenHeight > height)
                                    {
                                        screenHeight = height;
                                    }
                                    if (flag7)
                                    {
                                        form.MaximumSize = new Size(0xf00, 0x870);
                                        form.ClientSize = new Size(screenWidth, screenHeight);
                                    }
                                    else
                                    {
                                        form.ClientSize = new Size(0x3e8, 720);
                                        form.MaximumSize = new Size(0x41a, 760);
                                    }
                                    if (mySettings.Maximize)
                                    {
                                        form.WindowState = FormWindowState.Maximized;
                                    }
                                    form.Text = "Stronghold Kingdoms";
                                    ((MainWindow)form).allowResizing(true);
                                    newParentMainWindow = (MainWindow)form;
                                    InterfaceMgr.Instance.registerForm(form, newParentMainWindow);
                                    if (!engine.Initialise(mgr, maxRes, 2))
                                    {
                                        if (panel != null)
                                        {
                                            panel.Close();
                                            panel = null;
                                        }
                                    }
                                    else
                                    {
                                        SVG_Source instance = SVG_Source.Instance;
                                        Sound.setMusicState(mySettings.Music);
                                        GameEngine.Instance.AudioEngine.setMP3MasterVolume(((float)mySettings.MusicVolume) / 100f, 0);
                                        Sound.setSFXState(mySettings.SFX);
                                        Sound.setBattleSFXState(mySettings.BattleSFX);
                                        GameEngine.Instance.AudioEngine.setSFXMasterVolume(((float)mySettings.SFXVolume) / 100f);
                                        Sound.setEnvironmentalState(mySettings.Environmentals);
                                        GameEngine.Instance.AudioEngine.setEnvironmentalMasterVolume(((float)mySettings.EnvironmentalVolume) / 100f);
                                        bool flag8 = true;
                                        if (panel != null)
                                        {
                                            panel.Close();
                                            panel = null;
                                        }
                                        RemoteServices.Instance.initChannel();
                                        while (flag8)
                                        {
                                            engine.reLogin();
                                            flag8 = false;
                                            RemoteServices.Instance.UserID = -1;
                                            RemoteServices.Instance.set_CommonData_UserCallBack(null);
                                            while (RemoteServices.Instance.UserID < 0)
                                            {
                                                engine.installKeyboardHook();
                                                GameEngine.Instance.reLogin();
                                                GameEngine.Instance.clearServerDowntime();
                                                profileLogin = engine.getLoginWindow();
                                                if (profileLogin == null)
                                                {
                                                    profileLogin = new ProfileLoginWindow();
                                                    GameEngine.Instance.setProfileLogin(profileLogin);
                                                    profileLogin.Show();
                                                    profileLogin.init();
                                                }
                                                else
                                                {
                                                    profileLogin.openAfterCancel();
                                                }
                                                RemoteServices.Instance.clearQueues();
                                                while (profileLogin.Created && profileLogin.UserEntryMode)
                                                {
                                                    RemoteServices.Instance.processData();
                                                    Thread.Sleep(1);
                                                    DoEvents();
                                                    profileLogin.update();
                                                    StatTrackingClient.Instance().Update(0.01);
                                                }
                                                GameEngine.Instance.reLogin();
                                                form.Text = "Stronghold Kingdoms";
                                                if (WorldName != string.Empty)
                                                {
                                                    form.Text = form.Text + " - " + WorldName;
                                                }
                                                if (RemoteServices.Instance.UserID == -1)
                                                {
                                                    GameEngine.Instance.killLoadThread();
                                                    mySettings.Maximize = form.WindowState == FormWindowState.Maximized;
                                                    form.Close();
                                                    shutdown();
                                                    return;
                                                }
                                            }
                                            engine.showConnectingPopup();
                                            engine.World.loadLocalWorldData();
                                            engine.World.updateWorldMapOwnership();
                                            bool flag9 = true;
                                            while (flag9)
                                            {
                                                flag9 = false;
                                                VillageMap.loadVillageBuildingsGFX();
                                                while (engine.isStillLoading())
                                                {
                                                    Thread.Sleep(10);
                                                    DoEvents();
                                                    RemoteServices.Instance.processData();
                                                    GameEngine.Instance.updateConnectingPopup();
                                                }
                                                GameEngine.Instance.World.initSprites(GameEngine.Instance.GFX);
                                                GameEngine.Instance.resumeCommonRemote();
                                                engine.enableConnectingPopup();
                                                while (!GameEngine.Instance.World.isDownloadComplete())
                                                {
                                                    Thread.Sleep(10);
                                                    Application.DoEvents();
                                                    RemoteServices.Instance.processData();
                                                    GameEngine.Instance.updateConnectingPopup();
                                                    if (engine.loginCancelled())
                                                    {
                                                        break;
                                                    }
                                                }

                                                if (DataExport.controlForm != null)
                                                    DataExport.controlForm.Close();
                                                DataExport.controlForm = new ControlForm();
                                                DataExport.controlForm.Show();

                                                if (engine.pendingError())
                                                {
                                                    engine.updateConnectingPopup();
                                                    engine.forceRelogin();
                                                }
                                                if (!engine.loginCancelled())
                                                {
                                                    engine.World.saveFactionData();
                                                    engine.World.saveNamesData();
            #if DEBUG
                                                    DataExport.saveFactionData(engine.World);
                                                    DataExport.saveNamesData(engine.World);
            #endif
                                                    engine.enableConnectingPopup2();
                                                    while (engine.waitForConnectingPopupToClose())
                                                    {
                                                        Thread.Sleep(10);
                                                        DoEvents();
                                                        RemoteServices.Instance.processData();
                                                        if (engine.loginCancelled())
                                                        {
                                                            break;
                                                        }
                                                    }
                                                }
                                                if (RemoteServices.Instance.UserID == -1)
                                                {
                                                    GameEngine.Instance.killLoadThread();
                                                    mySettings.Maximize = form.WindowState == FormWindowState.Maximized;
                                                    form.Close();
                                                    shutdown();
                                                    return;
                                                }
                                                Sound.playMusic();

                                                bool flag10 = false;
                                                if (!engine.reLogin())
                                                {
                                                    InterfaceMgr.Instance.setupVillageName();
                                                    form.Show();
                                                    form.Visible = true;
                                                    newParentMainWindow.MainWindowLarge_SizeChanged(null, null);
                                                    GameEngine.Instance.lateStart();
                                                    if ((GameEngine.Instance.World.numVillagesOwned() > 0) && RemoteServices.Instance.ShowAdminMessage)
                                                    {
                                                        AdminInfoPopup.showMessage();
                                                    }
                                                    while (form.Created)
                                                    {
                                                        engine.run();
                                                        if (engine.reLogin())
                                                        {
                                                            form.Hide();
                                                            form.Visible = false;
                                                            engine.windowClosing();
                                                            if (!engine.quitting())
                                                            {
                                                                flag8 = true;
                                                            }
                                                            flag10 = true;
                                                            break;
                                                        }
                                                        StatTrackingClient.Instance().Update(0.01);
                                                        RemoteServices.Instance.processData();
                                                        if (form.Created)
                                                        {
                                                            Thread.Sleep(1);
                                                        }
                                                    }
                                                }
                                                else
                                                {
                                                    flag8 = true;
                                                    flag10 = true;
                                                }
                                                if (!flag10)
                                                {
                                                    form.Hide();
                                                    form.Visible = false;
                                                    form = null;
                                                    newParentMainWindow = null;
                                                }
                                                engine.World.saveFactionData();
                                                engine.World.saveNamesData();
            #if DEBUG
                                                DataExport.saveFactionData(engine.World);
                                                DataExport.saveNamesData(engine.World);
            #endif
                                                Sound.stopMusic();
                                            }
                                        }
                                        try
                                        {
                                            if (form != null)
                                            {
                                                mySettings.Maximize = form.WindowState == FormWindowState.Maximized;
                                            }
                                        }
                                        catch (Exception)
                                        {
                                        }
                                        shutdown();
                                    }
                                }
                            }
                        }
                    }
                }

            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                File.WriteAllText("ex.txt", ex.ToString());
            }
            finally
            {
                if (DataExport.controlForm != null)
                    DataExport.controlForm.Close();
            }
        }
 public void init(ProfileLoginWindow parent)
 {
     this.createPopupPanel.init(parent);
 }
 public void setProfileLogin(ProfileLoginWindow loginWindow)
 {
     this.m_loginWindow = loginWindow;
 }