Esempio n. 1
0
 bool TryGetFinalOutputPath(IServiceProvider serviceProvider, Properties props, out string outputPath)
 {
     while (true)
     {
         var useOutputPath = (bool)props.Item(nameof(MDKOptions.UseManualOutputPath)).Value;
         outputPath = ((string)props.Item(nameof(MDKOptions.OutputPath))?.Value)?.Trim() ?? "";
         if (!useOutputPath || outputPath == "")
         {
             outputPath = _spaceEngineers.GetDataPath("IngameScripts", "local");
         }
         var outputDirectory = new DirectoryInfo(outputPath);
         try
         {
             if (!outputDirectory.Exists)
             {
                 outputDirectory.Create();
             }
         }
         catch
         {
             var res = VsShellUtilities.ShowMessageBox(serviceProvider, string.Format(Text.IngameScriptWizard_TryGetFinalOutputPath_CannotCreateOutputPathDescription, outputDirectory), Text.IngameScriptWizard_TryGetFinalOutputPath_CannotCreateOutputPath, OLEMSGICON.OLEMSGICON_CRITICAL, OLEMSGBUTTON.OLEMSGBUTTON_RETRYCANCEL, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_SECOND);
             if (res == 4)
             {
                 continue;
             }
             return(false);
         }
         outputPath = outputDirectory.ToString().TrimEnd('\\');
         return(true);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Creates an instance of <see cref="MDKOptions" />
        /// </summary>
        public MDKOptions()
        {
            _spaceEngineers = new SpaceEngineers();

            ((MDKOptionsControl)Child).Options = this;
            _gameBinPath = _spaceEngineers.GetInstallPath("Bin64");
            _outputPath  = _spaceEngineers.GetDataPath("IngameScripts", "local");
        }