コード例 #1
0
        public BattlelogiumConfigEditor(BattlelogiumConfiguration config)
        {
            System.Windows.Forms.Application.EnableVisualStyles();
            InitializeComponent();
            this.config = config;

            //Load General Settings
            this.waitTimeToKillOrigin_input.Value = config.WaitTimeToKillOrigin;
            this.customJsEnabled_input.Checked = config.CustomJsEnabled;
            this.directToCampaign_input.Checked = config.DirectToCampaign;
            this.checkUpdates_input.Checked = config.CheckUpdates;
            this.useSoftwareRender_input.Checked = config.UseSoftwareRender;
            this.startOrigin_input.Checked = config.HandleOrigin;

            //Apply window height maximum and minimums
            this.windowHeight_input.Maximum = (decimal) SystemParameters.PrimaryScreenHeight;
            this.windowWidth_input.Maximum = (decimal) SystemParameters.PrimaryScreenWidth;

            this.windowHeight_input.Minimum = 400;
            this.windowWidth_input.Minimum = 400;

            //Load Window Settings
            this.windowedMode_input.Checked = config.WindowedMode;
            this.startMaximized_input.Checked = config.StartMaximized;
            this.noBorder_input.Checked = config.NoBorder;
            this.windowHeight_input.Value = config.WindowHeight;
            this.windowWidth_input.Value = config.WindowWidth;

            if (this.CheckForParFix()) this.parFixBtn.Text = "Restore Origin Requirement";
            if (!File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "BattlelogiumParManager.exe"))) this.parFixBtn.Enabled = false;

            this.Refresh();
        }
コード例 #2
0
        public BattlelogiumConfigEditor(BattlelogiumConfiguration config)
        {
            System.Windows.Forms.Application.EnableVisualStyles();
            InitializeComponent();
            this.config = config;

            //Load General Settings
            this.waitTimeToKillOrigin_input.Value = config.WaitTimeToKillOrigin;
            this.customJsEnabled_input.Checked    = config.CustomJsEnabled;
            this.directToCampaign_input.Checked   = config.DirectToCampaign;
            this.checkUpdates_input.Checked       = config.CheckUpdates;
            this.useSoftwareRender_input.Checked  = config.UseSoftwareRender;
            this.startOrigin_input.Checked        = config.HandleOrigin;

            //Apply window height maximum and minimums
            this.windowHeight_input.Maximum = (decimal)SystemParameters.PrimaryScreenHeight;
            this.windowWidth_input.Maximum  = (decimal)SystemParameters.PrimaryScreenWidth;

            this.windowHeight_input.Minimum = 400;
            this.windowWidth_input.Minimum  = 400;

            //Load Window Settings
            this.windowedMode_input.Checked   = config.WindowedMode;
            this.startMaximized_input.Checked = config.StartMaximized;
            this.noBorder_input.Checked       = config.NoBorder;
            this.windowHeight_input.Value     = config.WindowHeight;
            this.windowWidth_input.Value      = config.WindowWidth;

            if (this.CheckForParFix())
            {
                this.parFixBtn.Text = "Restore Origin Requirement";
            }
            if (!File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "BattlelogiumParManager.exe")))
            {
                this.parFixBtn.Enabled = false;
            }

            this.Refresh();
        }
コード例 #3
0
        public BattlelogiumMain()
        {
            // Attach a console instance to process
            Utilities.AttachConsole(-1);
            //The Steam Overlay will not work if we show splash by the SplashScreen build action, so we manually show it.
            splash.Show(true);
            Console.WriteLine(String.Empty);
            Utilities.Log("Battlelogium is licensed under GNU GPL v3");
            Utilities.Log("Battlelogium does not come with any warranty");
            Utilities.Log("neither express nor implied");
            Console.WriteLine(String.Empty);
            Utilities.Log("!---Begin Log---!");
            Utilities.Log("Version: " + Assembly.GetEntryAssembly().GetName().Version.ToString());
            Utilities.Log("==================");
            Console.WriteLine(String.Empty);
            Utilities.Log("new BattlelogiumConfiguration()");
            config = new BattlelogiumConfiguration();
            Utilities.Log(config.ConfigDump());
            Utilities.Log("StartupConnectionCheck()");
            this.StartupConnectionCheck();

            if (config.DirectToCampaign) //If we're going directly to campaign, there is no need to initialize the main window
            {
                splash.Close(TimeSpan.Zero); //Close the splash screen or it will hang.
                Utilities.Log("Closing += WrapperClosing");
                this.Closing += WrapperClosing; //Since we don't call InitializeComponent, we need to manually add the closing event handler
                Utilities.Log("StartBF3Campaign");
                this.StartBF3Campaign();
            }
            else
            {
                if (config.HandleOrigin)
                {
                    Utilities.Log("StartOriginProcess(/StartClientMinimized)");
                    this.StartOriginProcess("/StartClientMinimized");
                }

                Utilities.Log("InitializeComponent()");
                this.InitializeComponent();

                Utilities.Log("SetupStoryboards()");
                this.SetupStoryboards();

                Utilities.Log("ApplyWindowedModeSettings()");
                this.ApplyWindowedModeSettings();

                Utilities.Log("blinkLoading.Begin()");
                this.blinkLoading.Begin();

                Utilities.Log("Battlelog.Websession = CreateBattlelogWebSession()");
                this.Battlelog.WebSession = CreateBattlelogWebSession();

                if (config.CheckUpdates)
                {
                    Utilities.Log("new UpdateNotifier(Assembly.GetEntryAssembly().GetName().Version).run()");
                    new UpdateNotifier(Assembly.GetEntryAssembly().GetName().Version, this.Dispatcher).run();
                }

                if (config.UseSoftwareRender)
                {
                    Utilities.Log("RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly");
                    RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly;
                }
            }
        }
コード例 #4
0
        public BattlelogiumMain()
        {
            // Attach a console instance to process
            Utilities.AttachConsole(-1);
            //The Steam Overlay will not work if we show splash by the SplashScreen build action, so we manually show it.
            splash.Show(true);
            Console.WriteLine(String.Empty);
            Utilities.Log("Battlelogium is licensed under GNU GPL v3");
            Utilities.Log("Battlelogium does not come with any warranty");
            Utilities.Log("neither express nor implied");
            Console.WriteLine(String.Empty);
            Utilities.Log("!---Begin Log---!");
            Utilities.Log("Version: " + Assembly.GetEntryAssembly().GetName().Version.ToString());
            Utilities.Log("==================");
            Console.WriteLine(String.Empty);
            if (Process.GetProcessesByName("Battlelogium").Length > 1)
            {
                Utilities.Log("Process.GetProcessesByName(Battlelogium).Length > 1");
                CustomMessageBox.Show("There can only be one instance of Battlelogium running at a time. Wait for the other instance to close and try again");
                this.Close();
                return;
            }
            Utilities.Log("BattlelogiumMain.config = new BattlelogiumConfiguration()");
            this.config = new BattlelogiumConfiguration();
            Utilities.Log(config.ConfigDump());
            Utilities.Log("BattlelogiumMain.StartupConnectionCheck()");
            this.StartupConnectionCheck();
            splash.Close(TimeSpan.Zero); //Close the splash screen or it will hang.

            if (config.DirectToCampaign) //If we're going directly to campaign, there is no need to initialize the main window
            {
                Utilities.Log("BattlelogiumMain.Closing += Window_Closing");
                this.Closing += Window_Closing; //Since we don't call InitializeComponent, we need to manually add the closing event handler
                Utilities.Log("BattlelogiumMain.StartBF3Campaign()");
                this.StartBF3Campaign();
            }
            else
            {
                if (config.HandleOrigin)
                {
                    Utilities.Log("BattlelogiumMain.StartOriginProcess(/StartClientMinimized)");
                    this.retainOrigin = ManagedOrigin.CheckIfOriginIsRunning();
                    Utilities.Log("retainOrigin = " + retainOrigin.ToString());

                    Utilities.Log("this.managedOrigin = new ManagedOrigin(/StartClientMinimized)");
                    this.managedOrigin = new ManagedOrigin("/StartClientMinimized");
                    try{
                        this.managedOrigin.StartOriginProcess();
                    }catch(Exception e){
                        HandleOriginException(e);
                    }
                }

                Utilities.Log("BattlelogiumMain.InitializeComponent()");
                this.InitializeComponent();
                this.VersionLabel.Content = "Battlelogium " + Assembly.GetEntryAssembly().GetName().Version.ToString();

                Utilities.Log("BattlelogiumMain.SetupStoryboards()");
                this.SetupStoryboards();

                if (config.WindowedMode)
                {
                    Utilities.Log("BattlelogiumMain.SetWindowed()");
                    this.SetWindowed();
                }

                Utilities.Log("this.blinkLoading.Begin()");
                this.blinkLoading.Begin();

                Utilities.Log("this.Battlelog.Websession = CreateBattlelogWebSession()");
                this.Battlelog.WebSession = CreateBattlelogWebSession();

                if (config.CheckUpdates)
                {
                    Utilities.Log("Check Updates: new UpdateNotifier(Assembly.GetEntryAssembly().GetName().Version).run()");
                    new UpdateNotifier(Assembly.GetEntryAssembly().GetName().Version, this.Dispatcher).run();
                }

                if (config.UseSoftwareRender)
                {
                    Utilities.Log("RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly");
                    RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly;
                }

                this.notifyIcon.Icon = System.Drawing.Icon.ExtractAssociatedIcon(Path.Combine(AppDomain.CurrentDomain.BaseDirectory,"Battlelogium.exe"));
                this.notifyIcon.Text = String.Format("Battlelogium {0} is running",Assembly.GetEntryAssembly().GetName().Version.ToString());
                this.notifyIcon.Visible = true;
            }
        }
コード例 #5
0
        public BattlelogiumMain()
        {
            // Attach a console instance to process
            Utilities.AttachConsole(-1);
            //The Steam Overlay will not work if we show splash by the SplashScreen build action, so we manually show it.
            splash.Show(true);
            Console.WriteLine(String.Empty);
            Utilities.Log("Battlelogium is licensed under GNU GPL v3");
            Utilities.Log("Battlelogium does not come with any warranty");
            Utilities.Log("neither express nor implied");
            Console.WriteLine(String.Empty);
            Utilities.Log("!---Begin Log---!");
            Utilities.Log("Version: " + Assembly.GetEntryAssembly().GetName().Version.ToString());
            Utilities.Log("==================");
            Console.WriteLine(String.Empty);
            if (Process.GetProcessesByName("Battlelogium").Length > 1)
            {
                Utilities.Log("Process.GetProcessesByName(Battlelogium).Length > 1");
                CustomMessageBox.Show("There can only be one instance of Battlelogium running at a time. Wait for the other instance to close and try again");
                this.Close();
                return;
            }
            Utilities.Log("BattlelogiumMain.config = new BattlelogiumConfiguration()");
            this.config = new BattlelogiumConfiguration();
            Utilities.Log(config.ConfigDump());
            Utilities.Log("BattlelogiumMain.StartupConnectionCheck()");
            this.StartupConnectionCheck();
            splash.Close(TimeSpan.Zero); //Close the splash screen or it will hang.


            if (config.DirectToCampaign) //If we're going directly to campaign, there is no need to initialize the main window
            {
                Utilities.Log("BattlelogiumMain.Closing += Window_Closing");
                this.Closing += Window_Closing; //Since we don't call InitializeComponent, we need to manually add the closing event handler
                Utilities.Log("BattlelogiumMain.StartBF3Campaign()");
                this.StartBF3Campaign();
            }
            else
            {
                if (config.HandleOrigin)
                {
                    Utilities.Log("BattlelogiumMain.StartOriginProcess(/StartClientMinimized)");
                    this.retainOrigin = ManagedOrigin.CheckIfOriginIsRunning();
                    Utilities.Log("retainOrigin = " + retainOrigin.ToString());

                    Utilities.Log("this.managedOrigin = new ManagedOrigin(/StartClientMinimized)");
                    this.managedOrigin = new ManagedOrigin("/StartClientMinimized");
                    try{
                        this.managedOrigin.StartOriginProcess();
                    }catch (Exception e) {
                        HandleOriginException(e);
                    }
                }

                Utilities.Log("BattlelogiumMain.InitializeComponent()");
                this.InitializeComponent();
                this.VersionLabel.Content = "Battlelogium " + Assembly.GetEntryAssembly().GetName().Version.ToString();

                Utilities.Log("BattlelogiumMain.SetupStoryboards()");
                this.SetupStoryboards();

                if (config.WindowedMode)
                {
                    Utilities.Log("BattlelogiumMain.SetWindowed()");
                    this.SetWindowed();
                }

                Utilities.Log("this.blinkLoading.Begin()");
                this.blinkLoading.Begin();

                Utilities.Log("this.Battlelog.Websession = CreateBattlelogWebSession()");
                this.Battlelog.WebSession = CreateBattlelogWebSession();

                if (config.CheckUpdates)
                {
                    Utilities.Log("Check Updates: new UpdateNotifier(Assembly.GetEntryAssembly().GetName().Version).run()");
                    new UpdateNotifier(Assembly.GetEntryAssembly().GetName().Version, this.Dispatcher).run();
                }

                if (config.UseSoftwareRender)
                {
                    Utilities.Log("RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly");
                    RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly;
                }

                this.notifyIcon.Icon    = System.Drawing.Icon.ExtractAssociatedIcon(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Battlelogium.exe"));
                this.notifyIcon.Text    = String.Format("Battlelogium {0} is running", Assembly.GetEntryAssembly().GetName().Version.ToString());
                this.notifyIcon.Visible = true;
            }
        }