public static webModel.ModuleDescriptor ToWebModel(this moduleModel.ModuleDescriptor descriptor) { var retVal = new webModel.ModuleDescriptor(); retVal.InjectFrom(descriptor); if (descriptor.Dependencies != null) { retVal.Dependencies = descriptor.Dependencies.Select(d => d.ToWebModel()).ToList(); } return(retVal); }
public string[] GetDependencyErrors(ModuleDescriptor package) { var dependencyErrors = GetDependencyErrors(package, GetModules()); return dependencyErrors.ToArray(); }
private static ModuleDescriptor ConvertToModuleDescriptor(ModuleManifest manifest, List<string> installedPackages = null) { ModuleDescriptor result = null; if (manifest != null) { result = new ModuleDescriptor { Id = manifest.Id, Version = manifest.Version, PlatformVersion = manifest.PlatformVersion, Title = manifest.Title, Description = manifest.Description, Authors = manifest.Authors, Owners = manifest.Owners, RequireLicenseAcceptance = manifest.RequireLicenseAcceptance, ReleaseNotes = manifest.ReleaseNotes, Copyright = manifest.Copyright, Tags = manifest.Tags, }; if (manifest.Dependencies != null) result.Dependencies = manifest.Dependencies.Select(d => new ModuleIdentity { Id = d.Id, Version = d.Version }); if (manifest.LicenseUrl != null) result.LicenseUrl = new Uri(manifest.LicenseUrl); if (manifest.ProjectUrl != null) result.ProjectUrl = new Uri(manifest.ProjectUrl); if (manifest.IconUrl != null) result.IconUrl = new Uri(manifest.IconUrl); if (installedPackages != null && installedPackages.Any()) { var packageFileName = GetPackageFileName(manifest.Id, manifest.Version); result.IsRemovable = installedPackages.Contains(packageFileName, StringComparer.OrdinalIgnoreCase); } } return result; }
private static List<string> GetDependencyErrors(ModuleDescriptor package, IEnumerable<ModuleIdentity> installedModules) { var errors = new List<string>(); var platformVersion = GetPlatformVersion(); if (!IsCompatibleVersion(platformVersion, package.PlatformVersion)) { errors.Add(string.Format(CultureInfo.CurrentCulture, "Required platform version: '{0}'.", package.PlatformVersion)); } else { var missingDependencies = GetMissingDependencies(package.Dependencies, installedModules); missingDependencies.ForEach(d => errors.Add(string.Format(CultureInfo.CurrentCulture, "Dependency is not installed: '{0} {1}'.", d.Id, d.Version))); } return errors; }
private static bool CheckDependencies(ModuleDescriptor package, IEnumerable<ModuleIdentity> installedModules, IProgress<ProgressMessage> progress) { var dependencyErrors = GetDependencyErrors(package, installedModules); dependencyErrors.ForEach(e => Report(progress, ProgressMessageLevel.Error, e)); return !dependencyErrors.Any(); }
public static moduleModel.ModuleDescriptor ToModuleModel(this webModel.ModuleDescriptor descriptor) { var retVal = new moduleModel.ModuleDescriptor(); return retVal; }
static void WriteModuleLine(ModuleDescriptor module) { Debug.WriteLine("{0} {1}", module.Id, module.Version); }
public static moduleModel.ModuleDescriptor ToModuleModel(this webModel.ModuleDescriptor descriptor) { var retVal = new moduleModel.ModuleDescriptor(); return(retVal); }