예제 #1
0
        /// <summary>
        /// Loads the default stat values. Returns true if successful.
        /// </summary>
        /// <returns></returns>
        private bool LoadStatValues(Values values)
        {
            bool success = false;

            try
            {
                values = values.LoadValues();

                if (values.modsManifest == null)
                {
                    _ = Task.Run(async() => await LoadModsManifestAsync(values));
                }
                if (values.serverMultipliersPresets == null)
                {
                    LoadServerMultiplierPresets(values);
                }

                success = true;
            }
            catch (DirectoryNotFoundException)
            {
                if (MessageBox.Show($"One of the following folders where the values-file is expected was not found.\n{FileService.GetJsonPath(FileService.ValuesFolder, FileService.ValuesJson)}\n\n" +
                                    "ARK Smart Breeding will not work properly without that file.\n\n" +
                                    "Do you want to visit the releases page to redownload it?",
                                    "Error", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)
                {
                    System.Diagnostics.Process.Start(Updater.ReleasesUrl);
                }
            }
            catch (FileNotFoundException)
            {
                if (MessageBox.Show($"Values-File {FileService.ValuesJson} not found. " +
                                    "ARK Smart Breeding will not work properly without that file.\n\n" +
                                    "Do you want to visit the releases page to redownload it?",
                                    "Error", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)
                {
                    System.Diagnostics.Process.Start(Updater.ReleasesUrl);
                }
            }
            catch (FormatException)
            {
                FormatExceptionMessageBox(FileService.ValuesJson);
                if ((DateTime.Now - Properties.Settings.Default.lastUpdateCheck).TotalMinutes < 10)
                {
                    CheckForUpdates();
                }
            }
            catch (SerializationException e)
            {
                DeserializeExceptionMessageBox(FileService.ValuesJson, e.Message);
            }

            return(success);
        }
예제 #2
0
        /// <summary>
        /// Loads the default stat values. Returns true if successful.
        /// </summary>
        /// <returns></returns>
        private bool LoadStatValues(Values values)
        {
            bool success = false;

            try
            {
                values = values.LoadValues();

                if (values.modsManifest == null)
                {
                    _ = Task.Run(async() => await LoadModsManifestAsync(values));
                }
                if (values.serverMultipliersPresets == null)
                {
                    LoadServerMultiplierPresets(values);
                }

                success = true;
            }
            catch (FileNotFoundException)
            {
                if (MessageBox.Show($"Values-File {FileService.ValuesJson} not found. " +
                                    "ARK Smart Breeding will not work properly without that file.\n\n" +
                                    "Do you want to visit the releases page to redownload it?",
                                    "Error", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)
                {
                    System.Diagnostics.Process.Start(Updater.ReleasesUrl);
                }
            }
            catch (FormatException)
            {
                FormatExceptionMessageBox(FileService.ValuesJson);
            }
            catch (SerializationException e)
            {
                DeserializeExceptionMessageBox(FileService.ValuesJson, e.Message);
            }

            return(success);
        }