Exemple #1
0
        private void settingsButton_Click(object sender, EventArgs e)
        {
            SettingsDialog settingsDialog = new SettingsDialog(this);

            settingsDialog.Icon = Program.LoncherSettings.Icon;
            if (settingsDialog.ShowDialog(this) == DialogResult.OK)
            {
                LauncherConfig.StartPage        = settingsDialog.OpeningPanel;
                LauncherConfig.GameDir          = settingsDialog.GamePath;
                LauncherConfig.LaunchFromGalaxy = settingsDialog.LaunchViaGalaxy;
                bool prevOffline = LauncherConfig.StartOffline;
                LauncherConfig.StartOffline  = settingsDialog.OfflineMode;
                LauncherConfig.CloseOnLaunch = settingsDialog.CloseOnLaunch;
                LauncherConfig.Save();
                settingsDialog.Dispose();
                if (LauncherConfig.GameDir != Program.GamePath)
                {
                    Hide();
                    new PreloaderForm(this).Show();
                }
                else if (prevOffline != LauncherConfig.StartOffline)
                {
                    if (YobaDialog.ShowDialog(Locale.Get(LauncherConfig.StartOffline ? "OfflineModeSet" : "OnlineModeSet"), YobaDialog.YesNoBtns) == DialogResult.Yes)
                    {
                        Hide();
                        new PreloaderForm(this).Show();
                    }
                }
            }
            this.Focus();
        }
Exemple #2
0
 private void MainForm_Shown(object sender, EventArgs e)
 {
     if (!(Program.FirstRun || Program.OfflineMode) &&
         Program.LoncherSettings.Survey != null &&
         YU.stringHasText(Program.LoncherSettings.Survey.Text) &&
         YU.stringHasText(Program.LoncherSettings.Survey.Url) &&
         YU.stringHasText(Program.LoncherSettings.Survey.ID) &&
         (LauncherConfig.LastSurveyId is null || LauncherConfig.LastSurveyId != Program.LoncherSettings.Survey.ID))
     {
         int    showSurvey   = new Random().Next(0, 100);
         string discardId    = "-0" + Program.LoncherSettings.Survey.ID;
         bool   wasDiscarded = discardId.Equals(LauncherConfig.LastSurveyId);
         if ((!wasDiscarded && showSurvey > 70) || (showSurvey > 7 && showSurvey < 10))
         {
             DialogResult result = YobaDialog.ShowDialog(Program.LoncherSettings.Survey.Text, YobaDialog.YesNoBtns);
             if (result == DialogResult.Yes)
             {
                 Process.Start(Program.LoncherSettings.Survey.Url);
                 LauncherConfig.LastSurveyId = Program.LoncherSettings.Survey.ID;
                 LauncherConfig.Save();
             }
             else if (result == DialogResult.No)
             {
                 LauncherConfig.LastSurveyId = discardId;
                 LauncherConfig.Save();
             }
         }
     }
 }
Exemple #3
0
        private void updateGameVersion()
        {
            string curVer = FileVersionInfo.GetVersionInfo(Program.GamePath + Program.LoncherSettings.ExeName).FileVersion.Replace(',', '.');

            Program.GameVersion = curVer;

            Program.ModsDisabledPath = Program.GamePath + "_loncher_disabled_mods\\";
            Program.LoncherSettings.LoadFileListForVersion(curVer);
            LauncherConfig.SaveMods();
        }
Exemple #4
0
 private void PreloaderForm_ShownAsync(object sender, EventArgs e)
 {
     LauncherConfig.Load();
     if (LauncherConfig.StartOffline)
     {
         InitializeOffline();
     }
     else
     {
         Initialize();
     }
 }
Exemple #5
0
 public void Enable()
 {
     foreach (FileInfo fi in CurrentVersionFiles)
     {
         if (File.Exists(Program.ModsDisabledPath + fi.Path))
         {
             File.Move(Program.ModsDisabledPath + fi.Path, Program.GamePath + fi.Path);
         }
     }
     ModConfigurationInfo.Active = true;
     LauncherConfig.SaveMods();
 }
Exemple #6
0
        public void Delete()
        {
            string prefix = ModConfigurationInfo.Active ? Program.GamePath : Program.ModsDisabledPath;

            foreach (FileInfo fi in CurrentVersionFiles)
            {
                File.Delete(prefix + fi.Path);
                fi.IsOK = false;
            }
            LauncherConfig.InstalledMods.Remove(ModConfigurationInfo);
            ModConfigurationInfo = null;
            LauncherConfig.SaveMods();
        }
Exemple #7
0
        public void Install()
        {
            List <string> fileList = new List <string>();

            foreach (FileInfo fi in CurrentVersionFiles)
            {
                fileList.Add(fi.Path);
            }
            ModConfigurationInfo = new ModCfgInfo(Name, Program.GameVersion, fileList, true);
            int oldModConfInfoIdx = LauncherConfig.InstalledMods.FindIndex(x => x.Name.Equals(Name));

            if (oldModConfInfoIdx > -1)
            {
                LauncherConfig.InstalledMods.RemoveAt(oldModConfInfoIdx);
            }
            LauncherConfig.InstalledMods.Add(ModConfigurationInfo);
            LauncherConfig.SaveMods();
        }
Exemple #8
0
        private string showPathSelection(string path)
        {
            if (!YU.stringHasText(path))
            {
                path = Program.GamePath;
            }
            GamePathSelectForm gamePathSelectForm = new GamePathSelectForm();

            gamePathSelectForm.Icon    = Program.LoncherSettings.Icon;
            gamePathSelectForm.ThePath = path;
            if (gamePathSelectForm.ShowDialog(this) == DialogResult.Yes)
            {
                path = gamePathSelectForm.ThePath;
                gamePathSelectForm.Dispose();
                if (path != null && path.Equals(_GOGpath) && LauncherConfig.GalaxyDir != null)
                {
                    if (YobaDialog.ShowDialog(Locale.Get("GogGalaxyDetected"), YobaDialog.YesNoBtns) == DialogResult.Yes)
                    {
                        LauncherConfig.LaunchFromGalaxy = true;
                        LauncherConfig.Save();
                    }
                }
                if (path.Length == 0)
                {
                    path = Program.GamePath;
                }
                else
                {
                    if (path[path.Length - 1] != '\\')
                    {
                        path += "\\";
                    }
                    Program.GamePath = path;
                }
                LauncherConfig.GameDir = path;
                LauncherConfig.Save();
                return(path);
            }
            else
            {
                Application.Exit();
                return(null);
            }
        }
Exemple #9
0
 public void Disable()
 {
     MoveToDisabled(CurrentVersionFiles);
     ModConfigurationInfo.Active = false;
     LauncherConfig.SaveMods();
 }