Exemple #1
0
        private void InitializeSplash()
        {
            var splashes = SplashManager.GetSplashList();

            SplashListView.LargeImageList = new ImageList
            {
                ImageSize        = new Size(117, 90),
                ColorDepth       = ColorDepth.Depth32Bit,
                TransparentColor = Color.Black
            };

            SplashListView.Items.Clear();

            foreach (var splash in splashes)
            {
                SplashListView.Items.Add(new ListViewItem
                {
                    Text       = splash.Name,
                    Name       = splash.Name,
                    Checked    = splash.Enabled,
                    ImageIndex = SplashListView.LargeImageList.Images.Count,
                });

                // TODO: clone the image in memory so we don't keep a lock on the file
                SplashListView.LargeImageList.Images.Add(Image.FromFile(splash.Path));
            }

            SplashListView.ItemCheck += (who, evt) =>
            {
                SplashManager.EnableSplash(SplashListView.Items[evt.Index].Name, evt.NewValue == CheckState.Checked);
            };
        }
Exemple #2
0
        static void Main()
        {
            UseEmbeddedDependencies();
            Patcher.Initialize();
            FileMapInfo.Initialize();
            ModManager.Initialize();
            SplashManager.Initialize();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new BNSBoostForm());
        }
Exemple #3
0
        private void LaunchButton_Click(object sender, EventArgs e)
        {
            LaunchButton.Enabled = false;

            // Need to save ourself since form doesn't do it automatically :/
            Properties.Settings.Default.Region = (string)RegionComboBox.SelectedItem;
            Properties.Settings.Default.Save();

            ToggleBitness(Properties.Settings.Default.Is64Bit);
            ToggleRegion(Properties.Settings.Default.Region);
            ToggleLoadingScreens(DisableLoadingScreensCheckBox.Checked);
            ToggleLauncherWarning();

            var worker = new BackgroundWorker();

            worker.DoWork += (_, arg) =>
            {
                Patcher.Patch(worker);
                ModManager.ApplyMods();
                SplashManager.ApplySplash();
            };

            worker.ProgressChanged += (_, arg) =>
            {
                string display = arg.UserState as string;
                Debug.WriteLine(display);
                LaunchButton.Text = display;
            };

            worker.RunWorkerCompleted += async(_, arg) =>
            {
                string baseDatDir = Path.Combine(GameDirectoryPathTextBox.Text, @"contents\Local\NCWEST\data\");
                foreach (string decompFile in Directory.GetDirectories(baseDatDir))
                {
                    if (!decompFile.EndsWith(".files"))
                    {
                        continue;
                    }
                    Directory.Delete(decompFile, true);
                }

                string extraClientFlags = " -UNATTENDED";
                if (DisableTextureStreamingCheckbox.Checked)
                {
                    extraClientFlags += " -NOTEXTURESTREAMING";
                }
                if (UseAllCoresCheckbox.Checked)
                {
                    extraClientFlags += " -USEALLAVAILABLECORES";
                }

                string launcherPath = LauncherPathTextBox.Text;

                Hide();

                int exitcode = await LaunchAsync(launcherPath, extraClientFlags);

                string message;
                switch (exitcode)
                {
                case 0:
                    Application.Exit();
                    return;

                case 740:
                    message = "You must run BNSBoost with administrator rights.";
                    break;

                default:
                    message = "Launcher exited with error: " + exitcode;
                    break;
                }

                Show();
                Focus();
                MessageBox.Show(message);

                // Launch failed :(
                LaunchButton.Enabled = true;
                LaunchButton.Text    = "Launch!";
            };

            worker.WorkerReportsProgress = true;
            worker.RunWorkerAsync();
        }