Пример #1
0
        private void isExperimental_Click(object sender, RoutedEventArgs e)
        {
            Launcher.isExperimental = isExperimental.IsChecked.Value;

            XmlBuilder.CreateConfigXml();

            MainWindowReference.CallUpdateGame();
            MainWindowReference.SettingButton.IsEnabled = false;
            this.Hide();
        }
Пример #2
0
        private void BrowseHLFolderButton_Click(object sender, RoutedEventArgs e)
        {
            // BROWSE AND CHANGE THE FOLDER FILE. DONT FORGET TO UPDATE THE GLOBAL VARIABLE
            bool   IsItNLPack = Launcher.IsNLPack();
            string folderPath = Util.AskForHLFolder();

            if (folderPath != null)
            {
                XmlBuilder.CreateConfigXml();
                Launcher.HLFolder = folderPath;
                Launcher.NSFolder = folderPath + System.IO.Path.DirectorySeparatorChar + "ns";
            }
            else
            {
                // throw new FileNotFoundException("Could not find HL folder"); // no need to crash the launcher for this
            }

            MainWindowReference.CallUpdateGame();
        }
Пример #3
0
        public static void AskForCustomFiles()
        {
            string sMessageBoxText = "Do you want to preserve your custom files?" + Environment.NewLine + "(can be changed in the settings)";
            string sCaption        = "Keep Custom Files";

            MessageBoxButton btnMessageBox = MessageBoxButton.YesNo;
            MessageBoxImage  icnMessageBox = MessageBoxImage.Warning;

            MessageBoxResult rsltMessageBox = System.Windows.MessageBox.Show(sMessageBoxText, sCaption, btnMessageBox, icnMessageBox);

            switch (rsltMessageBox)
            {
            case MessageBoxResult.Yes:
                Launcher.keepCustomFiles = true;
                break;

            case MessageBoxResult.No:
                Launcher.keepCustomFiles = false;
                break;
            }

            XmlBuilder.CreateConfigXml();

            // if we keept the custom files, it's better to use them (thus the hud_style 0)
            if (Launcher.keepCustomFiles)
            {
                try
                {
                    Util.ChangeAValueInCfg("hud_style ", "0"); // change
                }
                catch
                {
                    MessageBoxResult AlertBox = System.Windows.MessageBox.Show("Could not write config file to change hud_style 0" + Environment.NewLine +
                                                                               "please note that you might need to change it manually to use your custom files");
                }
            }
        }
Пример #4
0
 public static void SetIsNLPack(bool IsNlPack)
 {
     XmlBuilder.CreateConfigXml();
 }
Пример #5
0
        public static void CheckInstallDirectory()
        {
            bool NeedDirectory = false;

            if (File.Exists(curDir + Path.DirectorySeparatorChar + configName))
            {
                string IndicatedFolder = "";
                bool   isXP            = false;
                XmlBuilder.ReadConfigXml(out IndicatedFolder, out isXP, out string discordStatus, out bool keepAlive, out bool keepcustoms);

                if (IndicatedFolder.Length > 0)
                {
                    HLFolder            = IndicatedFolder;
                    isExperimental      = isXP;
                    discordCustomStatus = discordStatus;
                    keepLauncherAlive   = keepAlive;
                    keepCustomFiles     = keepcustoms;
                }
                else
                {
                    NeedDirectory = true;
                }

                if (!Directory.Exists(IndicatedFolder))
                {
                    NeedDirectory = true;
                }
            }
            else
            {
                NeedDirectory = true;
            }

            if (NeedDirectory)
            {
                string folderPath = Util.AskForHLFolder();

                if (folderPath != null)
                {
                    HLFolder = folderPath;
                    NSFolder = HLFolder + Path.DirectorySeparatorChar + "ns";
                    XmlBuilder.CreateConfigXml();

                    if (Directory.Exists(NSFolder))
                    {
                        if (System.Windows.Forms.MessageBox.Show("Warning, you are updating an existing NS installation: "
                                                                 + Environment.NewLine + "A backup of your old ns folder can be made under the name ns_saved.zip"
                                                                 + Environment.NewLine + "Please choose if you want to backup your current ns folder.", "", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
                        {
                            Util.ZipDirectory(NSFolder);
                        }
                    }
                    else
                    {
                        Directory.CreateDirectory(NSFolder);
                    }
                }
                else
                {
                    Environment.Exit(0); //stop the process
                }

                // Because it's first launch, ask if we want to keep custom files
                Util.AskForCustomFiles();
            }

            NSFolder = HLFolder + Path.DirectorySeparatorChar + "ns";
        }
Пример #6
0
        private void KeepCustom_Click(object sender, RoutedEventArgs e)
        {
            Launcher.keepCustomFiles = isKeepingCustoms.IsChecked.Value;

            XmlBuilder.CreateConfigXml();
        }
Пример #7
0
 private void ChangeDiscord_Click(object sender, RoutedEventArgs e)
 {
     Launcher.discordCustomStatus = DiscordTxtbox.Text;
     Launcher.UpdateDiscord(false);
     XmlBuilder.CreateConfigXml();
 }
Пример #8
0
        private void StopAfterLaunch_Click(object sender, RoutedEventArgs e)
        {
            Launcher.keepLauncherAlive = KeepAliveChecker.IsChecked.Value;

            XmlBuilder.CreateConfigXml();
        }