示例#1
0
 /// <summary>
 /// Creates a new instance of <see cref="ScriptOptionsDialogModel"/>
 /// </summary>
 /// <param name="package"></param>
 /// <param name="projectProperties"></param>
 public ScriptOptionsDialogModel([NotNull] MDKPackage package, [NotNull] MDKProjectProperties projectProperties)
 {
     if (package == null)
     {
         throw new ArgumentNullException(nameof(package));
     }
     ActiveProject = projectProperties ?? throw new ArgumentNullException(nameof(projectProperties));
 }
示例#2
0
        /// <summary>
        /// Creates a new instance of this view model.
        /// </summary>
        /// <param name="package"></param>
        /// <param name="analyses"></param>
        public ProjectHealthDialogModel([NotNull] MDKPackage package, [NotNull] HealthAnalysis[] analyses)
        {
            Package = package ?? throw new ArgumentNullException(nameof(package));

            Projects = analyses.ToList().AsReadOnly();

            FixStatuses = new ReadOnlyObservableCollection <FixStatus>(_fixStatuses);
        }
 /// <summary>
 /// Creates a new instance of <see cref="ScriptOptionsDialogModel"/>
 /// </summary>
 /// <param name="package"></param>
 /// <param name="dte"></param>
 public RefreshWhitelistCacheDialogModel([NotNull] MDKPackage package, [NotNull] DTE dte)
 {
     if (dte == null)
     {
         throw new ArgumentNullException(nameof(dte));
     }
     _package = package ?? throw new ArgumentNullException(nameof(package));
 }
示例#4
0
 /// <summary>
 /// Creates a new instance of <see cref="ScriptOptionsDialogModel"/>
 /// </summary>
 /// <param name="package"></param>
 /// <param name="projectScriptInfo"></param>
 public ScriptOptionsDialogModel([NotNull] MDKPackage package, [NotNull] ProjectScriptInfo projectScriptInfo)
 {
     if (package == null)
     {
         throw new ArgumentNullException(nameof(package));
     }
     ActiveProject = projectScriptInfo ?? throw new ArgumentNullException(nameof(projectScriptInfo));
 }
示例#5
0
        /// <summary>
        /// Creates a new instance of <see cref="BuildModule"/>
        /// </summary>
        /// <param name="package"></param>
        /// <param name="solutionFileName"></param>
        /// <param name="selectedProjectFullName"></param>
        /// <param name="progress"></param>
        public BuildModule(MDKPackage package, [NotNull] string solutionFileName, string selectedProjectFullName = null, IProgress <float> progress = null)
        {
            _progress               = progress;
            Package                 = package;
            SolutionFileName        = Path.GetFullPath(solutionFileName ?? throw new ArgumentNullException(nameof(solutionFileName)));
            SelectedProjectFileName = selectedProjectFullName != null?Path.GetFullPath(selectedProjectFullName) : null;

            SynchronizationContext = SynchronizationContext.Current;
        }
        /// <summary>
        /// Creates a new instance of this view model.
        /// </summary>
        /// <param name="package"></param>
        /// <param name="analysisResults"></param>
        public RequestUpgradeDialogModel([NotNull] MDKPackage package, [NotNull] ScriptSolutionAnalysisResult analysisResults)
        {
            Package = package ?? throw new ArgumentNullException(nameof(package));

            AnalysisResults = analysisResults ?? throw new ArgumentNullException(nameof(analysisResults));
            if (analysisResults.BadProjects.IsDefaultOrEmpty)
            {
                Projects = new ReadOnlyCollection <ProjectScriptInfo>(new List <ProjectScriptInfo>());
            }
            else
            {
                Projects = new ReadOnlyCollection <ProjectScriptInfo>(analysisResults.BadProjects.Select(p => p.ProjectInfo).ToArray());
            }
        }
 /// <summary>
 /// Creates a new instance of <see cref="ScriptOptionsDialogModel"/>
 /// </summary>
 /// <param name="package"></param>
 /// <param name="projectProperties"></param>
 public ScriptOptionsDialogModel([NotNull] MDKPackage package, [NotNull] MDKProjectProperties projectProperties)
 {
     if (package == null)
     {
         throw new ArgumentNullException(nameof(package));
     }
     Minifiers = new Collection <KeyValuePair <MinifyLevel, string> >
     {
         new KeyValuePair <MinifyLevel, string>(MinifyLevel.None, "None"),
         new KeyValuePair <MinifyLevel, string>(MinifyLevel.StripComments, "Strip Comments"),
         new KeyValuePair <MinifyLevel, string>(MinifyLevel.Full, "Full"),
     };
     ActiveProject     = projectProperties ?? throw new ArgumentNullException(nameof(projectProperties));
     _selectedMinifier = this.Minifiers.FirstOrDefault(m => ActiveProject.Options.MinifyLevel == m.Key);
 }
示例#8
0
        /// <summary>
        /// Creates a new instance of this view model.
        /// </summary>
        /// <param name="package"></param>
        /// <param name="analysisResults"></param>
        public RequestUpgradeDialogModel([NotNull] MDKPackage package, [NotNull] ScriptSolutionAnalysisResult analysisResults)
        {
            Package = package ?? throw new ArgumentNullException(nameof(package));

            AnalysisResults = analysisResults ?? throw new ArgumentNullException(nameof(analysisResults));
            if (analysisResults.BadProjects.IsDefaultOrEmpty)
            {
                Projects = new ReadOnlyCollection <MDKProjectProperties>(new List <MDKProjectProperties>());
            }
            else
            {
                if (analysisResults.BadProjects.Any(p => !p.HasValidGamePath))
                {
                    Projects = new ReadOnlyCollection <MDKProjectProperties>(analysisResults.BadProjects.Where(p => !p.HasValidGamePath).Select(p => p.ProjectProperties).ToArray());
                    Message  = "The Space Engineers game folder could not be determined. Automatic upgrades cannot be completed. Please verify that the game is installed and that the MDK configuration is correct, and then reload the projects. This affects the following MDK projects:";
                    SaveAndCloseCommand.IsEnabled = false;
                }
                else
                {
                    Projects = new ReadOnlyCollection <MDKProjectProperties>(analysisResults.BadProjects.Select(p => p.ProjectProperties).ToArray());
                }
            }
        }