예제 #1
0
        private void LoadSettings()
        {
            // make sure to load our data as invariant
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

            // don't populate if switching configs
            if (buttonCaller != 21)
            {
                SplashScreen.SetStatus("Set available systems lists...");

                BuildOutput(true);

                SplashScreen.SetStatus("Set pilot's log...");

                BuildPilotsLog();
            }

            // populate the notes page
            if (File.Exists(notesFile))
            {
                txtNotes.LoadFile(notesFile, RichTextBoxStreamType.PlainText);
            }

            // reset our selected command for safety
            cboMethod.SelectedIndex = 0;

            // reset to our previous culture type
            Thread.CurrentThread.CurrentCulture = userCulture;
        }
예제 #2
0
 /// <summary>
 /// Displays the status message if the splash screen is visible.
 /// </summary>
 /// <param name="message">The message to be displayed.</param>
 public static void SetSplashScreenStatus(string message)
 {
     if (SplashScreen.IsVisible)
     {
         SplashScreen.SetStatus(message);
     }
 }
예제 #3
0
        public void ValidateSettings(bool firstRun = false)
        {
            if (firstRun)
            {
                SplashScreen.SetStatus("Validating the settings...");
            }

            // check our paths.
            ValidatePython(null);
            ValidateTDPath(null);
            ValidateEdcePath(null);

            if (firstRun)
            {
                SplashScreen.SetStatus("Validating the net logs...");
            }

            ValidateNetLogPath(null);

            // sanity check our inputs
            if (settingsRef.Credits < creditsBox.Minimum)
            {
                settingsRef.Credits = creditsBox.Minimum; // this is a requirement
            }
            else if (settingsRef.Credits > creditsBox.Maximum)
            {
                settingsRef.Credits = creditsBox.Maximum;
            }

            if (settingsRef.Capacity < capacityBox.Minimum)
            {
                settingsRef.Capacity = capacityBox.Minimum;
            }
            else if (settingsRef.Capacity > capacityBox.Maximum)
            {
                settingsRef.Capacity = capacityBox.Maximum;
            }

            if (settingsRef.AbovePrice < abovePriceBox.Minimum)
            {
                settingsRef.AbovePrice = abovePriceBox.Minimum;
            }
            else if (settingsRef.AbovePrice > abovePriceBox.Maximum)
            {
                settingsRef.AbovePrice = abovePriceBox.Maximum;
            }

            if (settingsRef.BelowPrice < belowPriceBox.Minimum)
            {
                settingsRef.BelowPrice = belowPriceBox.Minimum;
            }
            else if (settingsRef.BelowPrice > belowPriceBox.Maximum)
            {
                settingsRef.BelowPrice = belowPriceBox.Maximum;
            }

            if (settingsRef.PruneHops < pruneHopsBox.Minimum)
            {
                settingsRef.PruneHops = pruneHopsBox.Minimum;
            }
            else if (settingsRef.PruneHops > pruneHopsBox.Maximum)
            {
                settingsRef.PruneHops = pruneHopsBox.Maximum;
            }

            if (settingsRef.PruneScore < pruneScoreBox.Minimum)
            {
                settingsRef.PruneScore = pruneScoreBox.Minimum;
            }
            else if (settingsRef.PruneScore > pruneScoreBox.Maximum)
            {
                settingsRef.PruneScore = pruneScoreBox.Maximum;
            }

            if (settingsRef.Limit < limitBox.Minimum)
            {
                settingsRef.Limit = limitBox.Minimum;
            }
            else if (settingsRef.Limit > limitBox.Maximum)
            {
                settingsRef.Limit = limitBox.Maximum;
            }

            if (settingsRef.MaxLSDistance < maxLSDistanceBox.Minimum)
            {
                settingsRef.MaxLSDistance = maxLSDistanceBox.Minimum;
            }
            else if (settingsRef.MaxLSDistance > maxLSDistanceBox.Maximum)
            {
                settingsRef.MaxLSDistance = maxLSDistanceBox.Maximum;
            }

            if (settingsRef.LSPenalty < lsPenaltyBox.Minimum)
            {
                settingsRef.LSPenalty = lsPenaltyBox.Minimum;
            }
            else if (settingsRef.LSPenalty > lsPenaltyBox.Maximum)
            {
                settingsRef.LSPenalty = lsPenaltyBox.Maximum;
            }

            if (settingsRef.Stock < numStock.Minimum)
            {
                settingsRef.Stock = numStock.Minimum;
            }
            else if (settingsRef.Stock > numStock.Maximum)
            {
                settingsRef.Stock = numStock.Maximum;
            }

            if (settingsRef.GPT < gptBox.Minimum)
            {
                settingsRef.GPT = gptBox.Minimum;
            }
            else if (settingsRef.GPT > gptBox.Maximum)
            {
                settingsRef.GPT = gptBox.Maximum;
            }

            if (settingsRef.MaxGPT < maxGPTBox.Minimum)
            {
                settingsRef.MaxGPT = maxGPTBox.Minimum;
            }
            else if (settingsRef.MaxGPT > maxGPTBox.Maximum)
            {
                settingsRef.MaxGPT = maxGPTBox.Maximum;
            }

            if (settingsRef.Insurance < insuranceBox.Minimum)
            {
                settingsRef.Insurance = insuranceBox.Minimum;
            }
            else if (settingsRef.Insurance > insuranceBox.Maximum)
            {
                settingsRef.Insurance = insuranceBox.Maximum;
            }

            if (settingsRef.Margin < marginBox.Minimum)
            {
                settingsRef.Margin = marginBox.Minimum;
            }
            else if (settingsRef.Margin > marginBox.Maximum)
            {
                settingsRef.Margin = marginBox.Maximum;
            }

            if (settingsRef.Age < ageBox.Minimum)
            {
                settingsRef.Age = ageBox.Minimum;
            }
            else if (settingsRef.Age > ageBox.Maximum)
            {
                settingsRef.Age = ageBox.Maximum;
            }

            if (settingsRef.LadenLY < ladenLYBox.Minimum)
            {
                settingsRef.LadenLY = ladenLYBox.Minimum; // this is a requirement
            }
            else if (settingsRef.LadenLY > ladenLYBox.Maximum)
            {
                settingsRef.LadenLY = ladenLYBox.Maximum;
            }

            if (settingsRef.UnladenLY < unladenLYBox.Minimum)
            {
                settingsRef.UnladenLY = unladenLYBox.Minimum;
            }
            else if (settingsRef.UnladenLY > unladenLYBox.Maximum)
            {
                settingsRef.UnladenLY = unladenLYBox.Maximum;
            }

            // convert verbosity to a string
            switch (settingsRef.Verbosity)
            {
            case 3:
                t_outputVerbosity = "-vvv";
                break;

            case 2:
                t_outputVerbosity = "-vv";
                break;

            case 1:
                t_outputVerbosity = "-v";
                break;

            default:
                t_outputVerbosity = string.Empty;
                break;
            }

            if (settingsRef.Hops < hopsBox.Minimum && !settingsRef.Loop)
            {
                settingsRef.Hops = hopsBox.Minimum;
            }
            else if (settingsRef.Loop && settingsRef.Hops < 2)
            {
                settingsRef.Hops = 2;
                hopsBox.Text     = "2";
            }
            else if (settingsRef.Hops > hopsBox.Maximum)
            {
                settingsRef.Hops = hopsBox.Maximum;
            }

            if (settingsRef.Jumps < jumpsBox.Minimum)
            {
                settingsRef.Jumps = jumpsBox.Minimum;
            }
            else if (settingsRef.Jumps > jumpsBox.Maximum)
            {
                settingsRef.Jumps = jumpsBox.Maximum;
            }

            // these only apply if we haven't copied them already
            if (t_StartJumps < startJumpsBox.Minimum)
            {
                t_StartJumps = startJumpsBox.Minimum;
            }
            else if (t_StartJumps > startJumpsBox.Maximum)
            {
                t_StartJumps = startJumpsBox.Maximum;
            }

            if (t_EndJumps < endJumpsBox.Minimum)
            {
                t_EndJumps = endJumpsBox.Minimum;
            }
            else if (t_EndJumps > endJumpsBox.Maximum)
            {
                t_EndJumps = endJumpsBox.Maximum;
            }

            if (settingsRef.CSVSelect < 0 && settingsRef.CSVSelect > 5)
            {
                settingsRef.CSVSelect = 0;
            }

            if (!ContainsPadSizes(settingsRef.Padsizes))
            {
                settingsRef.Padsizes = string.Empty;
            }

            if (!ContainsPlanetary(settingsRef.Planetary))
            {
                settingsRef.Planetary = string.Empty;
            }

            // an exception is made for checkboxes, we shouldn't ever get here
            if (settingsRef.Towards && settingsRef.Loop)
            {
                settingsRef.Loop = false;
            }
            else if (settingsRef.Towards && string.IsNullOrEmpty(temp_dest))
            {
                settingsRef.Towards = false;
            }

            // sanity check in case of invalid input paths
            if (buttonCaller == 14)
            {
                ValidateImportPath();
            }
            else if (buttonCaller == 13)
            {
                ValidateUploadPath();
            }

            // default to Run command if unset
            methodDropDown.SelectedIndex = methodIndex;

            // make sure we pull CSV paths after we validate our inputs
            if (!string.IsNullOrEmpty(settingsRef.TDPath))
            {
                t_itemListPath = settingsRef.TDPath + @"\data\Item.csv";
            }

            if (!string.IsNullOrEmpty(settingsRef.TDPath))
            {
                t_shipListPath = settingsRef.TDPath + @"\data\Ship.csv";
            }

            // Set the default rebuy percentage to 5%.
            if (settingsRef.RebuyPercentage == 0)
            {
                settingsRef.RebuyPercentage = 5.00M;
            }

            // Disable the Cmdr Profile button if EDCE is not set.
            this.btnCmdrProfile.Enabled = !string.IsNullOrEmpty(settingsRef.EdcePath);
        }