Exemplo n.º 1
0
        /// <summary>
        /// Initialize a GUIMod based on just an identifier
        /// </summary>
        /// <param name="identifier">The id of the module to represent</param>
        /// <param name="registry">CKAN registry object for current game instance</param>
        /// <param name="current_ksp_version">Current game version</param>
        /// <param name="incompatible">If true, mark this module as incompatible</param>
        public GUIMod(string identifier, IRegistryQuerier registry, KspVersionCriteria current_ksp_version, bool?incompatible = null)
        {
            Identifier     = identifier;
            IsAutodetected = registry.IsAutodetected(identifier);
            DownloadCount  = registry.DownloadCount(identifier);
            if (IsAutodetected)
            {
                IsInstalled = true;
            }

            ModuleVersion latest_version = null;

            try
            {
                LatestCompatibleMod = registry.LatestAvailable(identifier, current_ksp_version);
                latest_version      = LatestCompatibleMod?.version;
            }
            catch (ModuleNotFoundKraken)
            {
            }

            IsIncompatible = incompatible ?? LatestCompatibleMod == null;

            // Let's try to find the compatibility for this mod. If it's not in the registry at
            // all (because it's a DarkKAN mod) then this might fail.

            CkanModule latest_available_for_any_ksp = null;

            try
            {
                latest_available_for_any_ksp = registry.LatestAvailable(identifier, null);
            }
            catch
            { }

            // If there's known information for this mod in any form, calculate the highest compatible
            // KSP.
            if (latest_available_for_any_ksp != null)
            {
                KSPCompatibilityVersion = registry.LatestCompatibleKSP(identifier);
                KSPCompatibility        = KSPCompatibilityVersion?.ToYalovString()
                                          ?? Properties.Resources.GUIModUnknown;
                KSPCompatibilityLong = string.Format(Properties.Resources.GUIModKSPCompatibilityLong, KSPCompatibility, latest_available_for_any_ksp.version);
            }

            if (latest_version != null)
            {
                LatestVersion = latest_version.ToString();
            }
            else if (latest_available_for_any_ksp != null)
            {
                LatestVersion = latest_available_for_any_ksp.version.ToString();
            }
            else
            {
                LatestVersion = "-";
            }

            SearchableIdentifier = CkanModule.nonAlphaNums.Replace(Identifier, "");
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initialize a GUIMod based on just an identifier
        /// </summary>
        /// <param name="identifier">The id of the module to represent</param>
        /// <param name="registry">CKAN registry object for current game instance</param>
        /// <param name="current_ksp_version">Current game version</param>
        /// <param name="incompatible">If true, mark this module as incompatible</param>
        public GUIMod(string identifier, IRegistryQuerier registry, KspVersionCriteria current_ksp_version, bool incompatible = false)
        {
            Identifier     = identifier;
            IsIncompatible = incompatible;
            IsAutodetected = registry.IsAutodetected(identifier);
            DownloadCount  = registry.DownloadCount(identifier);

            ModuleVersion latest_version = null;

            try
            {
                latest_version = registry.LatestAvailable(identifier, current_ksp_version)?.version;
            }
            catch (ModuleNotFoundKraken)
            {
            }

            // Let's try to find the compatibility for this mod. If it's not in the registry at
            // all (because it's a DarkKAN mod) then this might fail.

            CkanModule latest_available_for_any_ksp = null;

            try
            {
                latest_available_for_any_ksp = registry.LatestAvailable(identifier, null);
            }
            catch
            { }

            // If there's known information for this mod in any form, calculate the highest compatible
            // KSP.
            if (latest_available_for_any_ksp != null)
            {
                KSPCompatibility = registry.LatestCompatibleKSP(identifier)?.ToYalovString()
                                   ?? "Unknown";
                KSPCompatibilityLong = $"{KSPCompatibility} (using mod version {latest_available_for_any_ksp.version})";
            }
            else
            {
                // No idea what this mod is, sorry!
                KSPCompatibility = KSPCompatibilityLong = "unknown";
            }

            if (latest_version != null)
            {
                LatestVersion = latest_version.ToString();
            }
            else if (latest_available_for_any_ksp != null)
            {
                LatestVersion = latest_available_for_any_ksp.version.ToString();
            }
            else
            {
                LatestVersion = "-";
            }

            // If we have a homepage provided, use that; otherwise use the spacedock page, curse page or the github repo so that users have somewhere to get more info than just the abstract.

            Homepage = "N/A";
        }
Exemplo n.º 3
0
        /// <summary>
        /// Tries to parse an identifier in the format Modname=version
        /// If the module cannot be found in the registry, throws a ModuleNotFoundKraken.
        /// </summary>
        public static CkanModule FromIDandVersion(IRegistryQuerier registry, string mod, KspVersion ksp_version)
        {
            CkanModule module;

            Match match = Regex.Match(mod, @"^(?<mod>[^=]*)=(?<version>.*)$");

            if (match.Success)
            {
                string ident   = match.Groups["mod"].Value;
                string version = match.Groups["version"].Value;

                module = registry.GetModuleByVersion(ident, version);

                if (module == null)
                {
                    throw new ModuleNotFoundKraken(ident, version,
                                                   string.Format("Cannot install {0}, version {1} not available", ident, version));
                }
            }
            else
            {
                module = registry.LatestAvailable(mod, ksp_version);
            }

            if (module == null)
            {
                throw new ModuleNotFoundKraken(mod, null,
                                               string.Format("Cannot install {0}, module not available", mod));
            }
            else
            {
                return(module);
            }
        }
Exemplo n.º 4
0
 private void AddMod(IEnumerable <RelationshipDescriptor> relations, Dictionary <string, List <string> > chooseAble,
                     string identifier, IRegistryQuerier registry)
 {
     if (relations == null)
     {
         return;
     }
     foreach (RelationshipDescriptor mod in relations)
     {
         try
         {
             // if the mod is available for the current KSP version _and_
             // the mod is not installed _and_
             // the mod is not already in the install list
             if (
                 registry.LatestAvailable(mod.name, CurrentInstance.VersionCriteria()) != null &&
                 !registry.IsInstalled(mod.name) && !toInstall.Contains(mod.name))
             {
                 // add it to the list of chooseAble mods we display to the user
                 if (!chooseAble.ContainsKey(mod.name))
                 {
                     chooseAble.Add(mod.name, new List <string>());
                 }
                 chooseAble[mod.name].Add(identifier);
             }
         }
         // XXX - Don't ignore all krakens! Those things are important!
         catch (Kraken)
         {
         }
     }
 }
Exemplo n.º 5
0
        private TreeNode findDependencyShallow(IRegistryQuerier registry, string identifier, RelationshipType relationship, KspVersionCriteria crit)
        {
            try
            {
                CkanModule dependencyModule = registry.LatestAvailable(identifier, crit);
                if (dependencyModule != null)
                {
                    return(indexedNode(registry, dependencyModule, relationship, crit != null));
                }
            }
            catch (ModuleNotFoundKraken)
            {
                // Maybe it's a DLC?
                ModuleVersion installedVersion = registry.InstalledVersion(identifier, false);
                if (installedVersion != null)
                {
                    return(nonModuleNode(identifier, installedVersion, relationship));
                }

                // If we don't find a module by this name, look for other modules that provide it.
                List <CkanModule> dependencyModules = registry.LatestAvailableWithProvides(identifier, crit);
                if (dependencyModules != null && dependencyModules.Count > 0)
                {
                    List <TreeNode> children = new List <TreeNode>();
                    foreach (CkanModule dep in dependencyModules)
                    {
                        children.Add(indexedNode(registry, dep, relationship, crit != null));
                    }
                    return(providesNode(identifier, relationship, children));
                }
            }
            return(null);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Tries to parse an identifier in the format Modname=version
        /// If the module cannot be found in the registry, throws a ModuleNotFoundKraken.
        /// </summary>
        public static CkanModule FromIDandVersion(IRegistryQuerier registry, string mod, KspVersionCriteria ksp_version)
        {
            CkanModule module;

            Match match = idAndVersionMatcher.Match(mod);

            if (match.Success)
            {
                string ident   = match.Groups["mod"].Value;
                string version = match.Groups["version"].Value;

                module = registry.GetModuleByVersion(ident, version);

                if (module == null ||
                    (ksp_version != null && !module.IsCompatibleKSP(ksp_version)))
                {
                    throw new ModuleNotFoundKraken(ident, version,
                                                   string.Format("Module {0} version {1} not available", ident, version));
                }
            }
            else
            {
                module = registry.LatestAvailable(mod, ksp_version)
                         ?? registry.InstalledModule(mod)?.Module;

                if (module == null)
                {
                    throw new ModuleNotFoundKraken(mod, null,
                                                   string.Format("Module {0} not installed or available", mod));
                }
            }
            return(module);
        }
Exemplo n.º 7
0
        public static ModuleReplacement GetReplacement(this IRegistryQuerier querier, CkanModule installedVersion, KspVersionCriteria version)
        {
            // Mod is not installed, so we don't care about replacements
            if (installedVersion == null)
            {
                return(null);
            }
            // No replaced_by relationship
            if (installedVersion.replaced_by == null)
            {
                return(null);
            }

            // Get the identifier from the replaced_by relationship, if it exists
            ModuleRelationshipDescriptor replacedBy = installedVersion.replaced_by;

            // Now we need to see if there is a compatible version of the replacement
            try
            {
                ModuleReplacement replacement = new ModuleReplacement();
                replacement.ToReplace = installedVersion;
                if (installedVersion.replaced_by.version != null)
                {
                    replacement.ReplaceWith = querier.GetModuleByVersion(installedVersion.replaced_by.name, installedVersion.replaced_by.version);
                    if (replacement.ReplaceWith != null)
                    {
                        if (replacement.ReplaceWith.IsCompatibleKSP(version))
                        {
                            return(replacement);
                        }
                    }
                }
                else
                {
                    replacement.ReplaceWith = querier.LatestAvailable(installedVersion.replaced_by.name, version);
                    if (replacement.ReplaceWith != null)
                    {
                        if (installedVersion.replaced_by.min_version != null)
                        {
                            if (!replacement.ReplaceWith.version.IsLessThan(replacedBy.min_version))
                            {
                                return(replacement);
                            }
                        }
                        else
                        {
                            return(replacement);
                        }
                    }
                }
                return(null);
            }
            catch (ModuleNotFoundKraken)
            {
                return(null);
            }
        }
Exemplo n.º 8
0
 /// <summary>
 /// Check whether an identifier is anywhere in the registry.
 /// </summary>
 /// <param name="registry">Reference to registry to query</param>
 /// <param name="identifier">Mod name to Find</param>
 /// <returns>
 /// True if there are any versions of this mod available, false otherwise.
 /// </returns>
 public static bool IsAnyAvailable(IRegistryQuerier registry, string identifier)
 {
     try {
         registry.LatestAvailable(identifier, null);
         return(true);
     } catch (ModuleNotFoundKraken) {
         return(false);
     }
 }
Exemplo n.º 9
0
 private void AddMod(IEnumerable <RelationshipDescriptor> relations, Dictionary <string, List <string> > chooseAble,
                     string identifier, IRegistryQuerier registry)
 {
     if (relations == null)
     {
         return;
     }
     foreach (RelationshipDescriptor mod in relations)
     {
         try
         {
             // if the mod is available for the current KSP version _and_
             // the mod is not installed _and_
             // the mod is not already in the install list
             if (registry.LatestAvailable(mod.name, CurrentInstance.VersionCriteria()) != null &&
                 !registry.IsInstalled(mod.name) &&
                 !toInstall.Any(m => m.identifier == mod.name))
             {
                 // add it to the list of chooseAble mods we display to the user
                 if (!chooseAble.ContainsKey(mod.name))
                 {
                     chooseAble.Add(mod.name, new List <string>());
                 }
                 chooseAble[mod.name].Add(identifier);
             }
         }
         catch (ModuleNotFoundKraken)
         {
             List <CkanModule> providers = registry.LatestAvailableWithProvides(
                 mod.name,
                 CurrentInstance.VersionCriteria(),
                 mod
                 );
             foreach (CkanModule provider in providers)
             {
                 if (!registry.IsInstalled(provider.identifier) &&
                     !toInstall.Any(m => m.identifier == provider.identifier))
                 {
                     // We want to show this mod to the user. Add it.
                     if (!chooseAble.ContainsKey(provider.identifier))
                     {
                         // Add a new entry if this provider isn't listed yet.
                         chooseAble.Add(provider.identifier, new List <string>());
                     }
                     // Add the dependent mod to the list of reasons this dependency is shown.
                     chooseAble[provider.identifier].Add(identifier);
                 }
             }
         }
         catch (Kraken)
         {
         }
     }
 }
Exemplo n.º 10
0
 public static CfanModule GetModuleByIdentifierAndOptionalVersion(this IRegistryQuerier querier, CfanModuleIdAndVersion moduleIdAndVersion, FactorioVersion factorioVersion)
 {
     if (moduleIdAndVersion.version != null)
     {
         return(GetModuleByVersion(querier, moduleIdAndVersion.identifier, moduleIdAndVersion.version.ToString()));
     }
     else
     {
         return(querier.LatestAvailable(moduleIdAndVersion.identifier, factorioVersion));
     }
 }
Exemplo n.º 11
0
 private static List <CfanModule> getModulesFromRegistry(
     IEnumerable <CfanModuleIdAndVersion> module_names, IRegistryQuerier registry, FactorioVersion kspversion)
 {
     return(module_names.Select(
                p =>
     {
         var mod = p.version != null
                     ? registry.GetModuleByVersion(p.identifier, p.version)
                     : registry.LatestAvailable(p.identifier, kspversion);
         if (mod == null)
         {
             throw new ModuleNotFoundKraken(p.identifier, p.version?.ToString(), "Module not found.");
         }
         return mod;
     }).ToList());
 }
Exemplo n.º 12
0
        /// <summary>
        /// Is the mod installed and does it have a newer version compatible with version
        /// </summary>
        public static bool HasUpdate(this IRegistryQuerier querier, string identifier, KSPVersion version)
        {
            CkanModule newest_version;

            try
            {
                newest_version = querier.LatestAvailable(identifier, version);
            }
            catch (ModuleNotFoundKraken)
            {
                return(false);
            }
            if (newest_version == null)
            {
                return(false);
            }
            return(querier.IsInstalled(identifier) && newest_version.version.IsGreaterThan(querier.InstalledVersion(identifier)));
        }
Exemplo n.º 13
0
        /// <summary>
        /// Is the mod installed and does it have a newer version compatible with version
        /// We can't update AD mods
        /// </summary>
        public static bool HasUpdate(this IRegistryQuerier querier, string identifier, FactorioVersion version)
        {
            CfanModule newest_version;

            try
            {
                newest_version = querier.LatestAvailable(identifier, version);
            }
            catch (ModuleNotFoundKraken)
            {
                return(false);
            }
            if (newest_version == null)
            {
                return(false);
            }
            return(!new List <string>(querier.InstalledPreexistingModules).Contains(identifier) && querier.IsInstalled(identifier, false) &&
                   newest_version.modVersion.IsGreaterThan(querier.InstalledVersion(identifier)));
        }
Exemplo n.º 14
0
 private void AddGroup(List <RelationshipDescriptor> relationships, ListViewGroup group, IRegistryQuerier registry)
 {
     if (relationships != null)
     {
         RelationshipsListView.Items.AddRange(relationships
                                              .OrderBy(r => (r as ModuleRelationshipDescriptor)?.name)
                                              .Select(r => new ListViewItem(new string[]
         {
             (r as ModuleRelationshipDescriptor)?.name,
             (r as ModuleRelationshipDescriptor)?.version?.ToString(),
             registry.LatestAvailable((r as ModuleRelationshipDescriptor)?.name, null, null)?.@abstract
         })
         {
             Tag   = r,
             Group = group,
         })
                                              .ToArray());
     }
 }
Exemplo n.º 15
0
        /// <summary>
        /// Is the mod installed and does it have a newer version compatible with version
        /// We can't update AD mods
        /// </summary>
        public static bool HasUpdate(this IRegistryQuerier querier, string identifier, GameVersionCriteria version)
        {
            CkanModule newest_version;

            try
            {
                newest_version = querier.LatestAvailable(identifier, version);
            }
            catch (Exception)
            {
                return(false);
            }
            if (newest_version == null ||
                !querier.IsInstalled(identifier, false) ||
                !newest_version.version.IsGreaterThan(querier.InstalledVersion(identifier)))
            {
                return(false);
            }
            // All quick checks pass. Now check the relationships.
            try
            {
                var instMod = querier.InstalledModule(identifier);
                RelationshipResolver resolver = new RelationshipResolver(
                    new CkanModule[] { newest_version },
                    // Remove the old module when installing the new one
                    instMod == null ? null : new CkanModule[] { instMod.Module },
                    new RelationshipResolverOptions()
                {
                    with_recommends = false,
                    without_toomanyprovides_kraken = true,
                },
                    querier,
                    version
                    );
            }
            catch (Exception)
            {
                return(false);
            }
            return(true);
        }
Exemplo n.º 16
0
        /// <summary>
        /// Is the mod installed and does it have a newer version compatible with version
        /// We can't update AD mods
        /// </summary>
        public static bool HasUpdate(this IRegistryQuerier querier, string identifier, KspVersionCriteria version)
        {
            CkanModule newest_version;

            try
            {
                newest_version = querier.LatestAvailable(identifier, version);
            }
            catch (Exception)
            {
                return(false);
            }
            if (newest_version == null ||
                !querier.IsInstalled(identifier, false) ||
                querier.InstalledDlls.Contains(identifier) ||
                !newest_version.version.IsGreaterThan(querier.InstalledVersion(identifier)))
            {
                return(false);
            }
            // All quick checks pass. Now check the relationships.
            try
            {
                RelationshipResolver resolver = new RelationshipResolver(
                    new CkanModule[] { newest_version },
                    null,
                    new RelationshipResolverOptions()
                {
                    with_recommends = false,
                    without_toomanyprovides_kraken = true,
                },
                    querier,
                    version
                    );
            }
            catch (Exception)
            {
                return(false);
            }
            return(true);
        }
Exemplo n.º 17
0
Arquivo: GUIMod.cs Projeto: dexen/CKAN
        public GUIMod(Module mod, IRegistryQuerier registry, KSPVersion current_ksp_version)
        {
            IsCKAN = mod is CkanModule;
            //Currently anything which could alter these causes a full reload of the modlist
            // If this is ever changed these could be moved into the properties
            Mod = mod;
            IsInstalled = registry.IsInstalled(mod.identifier, false);
            IsInstallChecked = IsInstalled;
            HasUpdate = registry.HasUpdate(mod.identifier, current_ksp_version);
            IsIncompatible = !mod.IsCompatibleKSP(current_ksp_version);
            IsAutodetected = registry.IsAutodetected(mod.identifier);
            Authors = mod.author == null ? "N/A" : String.Join(",", mod.author);

            var installed_version = registry.InstalledVersion(mod.identifier);
            Version latest_version = null;
            var ksp_version = mod.ksp_version;
            try
            {
                var latest_available = registry.LatestAvailable(mod.identifier, current_ksp_version);
                if (latest_available != null)
                    latest_version = latest_available.version;
            }
            catch (ModuleNotFoundKraken)
            {
                latest_version = installed_version;
            }

            InstalledVersion = installed_version != null ? installed_version.ToString() : "-";
            LatestVersion = latest_version != null ? latest_version.ToString() : "-";
            KSPversion = ksp_version != null ? ksp_version.ToString() : "-";

            Abstract = mod.@abstract;
            Homepage = mod.resources != null && mod.resources.homepage != null
                ? (object) mod.resources.homepage
                : "N/A";

            Identifier = mod.identifier;
        }
Exemplo n.º 18
0
        public GUIMod(CkanModule mod, IRegistryQuerier registry, KspVersionCriteria current_ksp_version, bool incompatible = false)
        {
            IsCKAN = mod is CkanModule;
            //Currently anything which could alter these causes a full reload of the modlist
            // If this is ever changed these could be moved into the properties
            Mod              = mod;
            IsInstalled      = registry.IsInstalled(mod.identifier, false);
            IsInstallChecked = IsInstalled;
            HasUpdate        = registry.HasUpdate(mod.identifier, current_ksp_version);
            IsIncompatible   = incompatible || !mod.IsCompatibleKSP(current_ksp_version);
            IsAutodetected   = registry.IsAutodetected(mod.identifier);
            Authors          = mod.author == null ? "N/A" : String.Join(",", mod.author);

            var           installed_version = registry.InstalledVersion(mod.identifier);
            ModuleVersion latest_version    = null;
            var           ksp_version       = mod.ksp_version;

            try
            {
                var latest_available = registry.LatestAvailable(mod.identifier, current_ksp_version);
                if (latest_available != null)
                {
                    latest_version = latest_available.version;
                }
            }
            catch (ModuleNotFoundKraken)
            {
                latest_version = installed_version;
            }

            InstalledVersion = installed_version != null?installed_version.ToString() : "-";

            // Let's try to find the compatibility for this mod. If it's not in the registry at
            // all (because it's a DarkKAN mod) then this might fail.

            CkanModule latest_available_for_any_ksp = null;

            try
            {
                latest_available_for_any_ksp = registry.LatestAvailable(mod.identifier, null);
            }
            catch
            {
                // If we can't find the mod in the CKAN, but we've a CkanModule installed, then
                // use that.
                if (IsCKAN)
                {
                    latest_available_for_any_ksp = (CkanModule)mod;
                }
            }

            // If there's known information for this mod in any form, calculate the highest compatible
            // KSP.
            if (latest_available_for_any_ksp != null)
            {
                KSPCompatibility = registry.LatestCompatibleKSP(mod.identifier)?.ToYalovString()
                                   ?? "Unknown";

                // If the mod we have installed is *not* the mod we have installed, or we don't know
                // what we have installed, indicate that an upgrade would be needed.
                if (installed_version == null || !latest_available_for_any_ksp.version.IsEqualTo(installed_version))
                {
                    KSPCompatibilityLong = string.Format("{0} (using mod version {1})",
                                                         KSPCompatibility, latest_available_for_any_ksp.version);
                }
                else
                {
                    KSPCompatibilityLong = KSPCompatibility;
                }
            }
            else
            {
                // No idea what this mod is, sorry!
                KSPCompatibility = KSPCompatibilityLong = "unknown";
            }

            if (latest_version != null)
            {
                LatestVersion = latest_version.ToString();
            }
            else if (latest_available_for_any_ksp != null)
            {
                LatestVersion = latest_available_for_any_ksp.version.ToString();
            }
            else
            {
                LatestVersion = "-";
            }

            KSPversion = ksp_version != null?ksp_version.ToString() : "-";

            Abstract = mod.@abstract;

            // If we have a homepage provided, use that; otherwise use the spacedock page, curse page or the github repo so that users have somewhere to get more info than just the abstract.

            Homepage = "N/A";
            if (mod.resources != null)
            {
                if (mod.resources.homepage != null)
                {
                    Homepage = mod.resources.homepage.ToString();
                }
                else if (mod.resources.spacedock != null)
                {
                    Homepage = mod.resources.spacedock.ToString();
                }
                else if (mod.resources.curse != null)
                {
                    Homepage = mod.resources.curse.ToString();
                }
                else if (mod.resources.repository != null)
                {
                    Homepage = mod.resources.repository.ToString();
                }
            }

            Identifier = mod.identifier;

            DownloadSize = (mod.download_size == 0)
                ? "N/A"
                : CkanModule.FmtSize(mod.download_size);

            Abbrevation = new string(mod.name.Split(' ').
                                     Where(s => s.Length > 0).Select(s => s[0]).ToArray());

            UpdateIsCached();
        }
Exemplo n.º 19
0
Arquivo: GUIMod.cs Projeto: yalov/CKAN
        public GUIMod(CkanModule mod, IRegistryQuerier registry, KspVersionCriteria current_ksp_version, bool incompatible = false)
        {
            IsCKAN = mod is CkanModule;
            //Currently anything which could alter these causes a full reload of the modlist
            // If this is ever changed these could be moved into the properties
            Mod              = mod;
            IsInstalled      = registry.IsInstalled(mod.identifier, false);
            IsInstallChecked = IsInstalled;
            HasUpdate        = registry.HasUpdate(mod.identifier, current_ksp_version);
            IsIncompatible   = incompatible || !mod.IsCompatibleKSP(current_ksp_version);
            IsAutodetected   = registry.IsAutodetected(mod.identifier);
            Authors          = mod.author == null ? "N/A" : String.Join(",", mod.author);

            var           installed_version = registry.InstalledVersion(mod.identifier);
            ModuleVersion latest_version    = null;
            var           ksp_version       = mod.ksp_version;

            try
            {
                var latest_available = registry.LatestAvailable(mod.identifier, current_ksp_version);
                if (latest_available != null)
                {
                    latest_version = latest_available.version;
                }
            }
            catch (ModuleNotFoundKraken)
            {
                latest_version = installed_version;
            }

            InstalledVersion = installed_version != null?installed_version.ToString() : "-";

            // Let's try to find the compatibility for this mod. If it's not in the registry at
            // all (because it's a DarkKAN mod) then this might fail.

            CkanModule latest_available_for_any_ksp = null;

            try
            {
                latest_available_for_any_ksp = registry.LatestAvailable(mod.identifier, null);
            }
            catch
            {
                // If we can't find the mod in the CKAN, but we've a CkanModule installed, then
                // use that.
                if (IsCKAN)
                {
                    latest_available_for_any_ksp = (CkanModule)mod;
                }
            }

            // If there's known information for this mod in any form, calculate the highest compatible
            // KSP.
            if (latest_available_for_any_ksp != null)
            {
                if (!VersionMaxWasGenerated)
                {
                    VersionMaxWasGenerated = true;
                    List <KspVersion> versions = new KspBuildMap(new Win32Registry()).KnownVersions;  // should be sorted

                    VersionsMax     = new Dictionary <string, KspVersion>();
                    VersionsMax[""] = versions.Last();

                    foreach (var v in versions)
                    {
                        VersionsMax[v.Major.ToString()]      = v;   // add or replace
                        VersionsMax[v.Major + "." + v.Minor] = v;
                    }
                }

                const int Undefined = -1;

                KspVersion ksp_ver = registry.LatestCompatibleKSP(mod.identifier);
                string     ver = ksp_ver?.ToString();
                int        major = ksp_ver.Major, minor = ksp_ver.Minor, patch = ksp_ver.Patch;
                KspVersion value;

                if (major == Undefined
                    //|| (major >= UptoNines(VersionsMax[""].Major))       // 9.99.99
                    || (major > VersionsMax[""].Major) ||                                                                                       // 2.0.0
                    (major == VersionsMax[""].Major && VersionsMax.TryGetValue(major.ToString(), out value) && minor >= UptoNines(value.Minor)) // 1.99.99 ?
                    )
                {
                    KSPCompatibility = "any";
                }

                else if (minor != Undefined &&
                         VersionsMax.TryGetValue(major + "." + minor, out value) &&
                         (patch == Undefined || patch >= UptoNines(value.Patch))
                         )
                {
                    KSPCompatibility = major + "." + minor + "." + UptoNines(value.Patch);
                }

                else
                {
                    KSPCompatibility = ver;
                }

                // KSPCompatibility += " | " + major + "." + minor + "." + patch;   // for testing

                // If the mod we have installed is *not* the mod we have installed, or we don't know
                // what we have installed, indicate that an upgrade would be needed.
                if (installed_version == null || !latest_available_for_any_ksp.version.IsEqualTo(installed_version))
                {
                    KSPCompatibilityLong = string.Format("{0} (using mod version {1})",
                                                         KSPCompatibility, latest_available_for_any_ksp.version);
                    //    ver, latest_available_for_any_ksp.version);   //  true values in the right tab
                }
                else
                {
                    KSPCompatibilityLong = KSPCompatibility;
                    // KSPCompatibilityLong = ver;   //  true values in the right tab
                }
            }
            else
            {
                // No idea what this mod is, sorry!
                KSPCompatibility = KSPCompatibilityLong = "unknown";
            }

            if (latest_version != null)
            {
                LatestVersion = latest_version.ToString();
            }
            else if (latest_available_for_any_ksp != null)
            {
                LatestVersion = latest_available_for_any_ksp.version.ToString();
            }
            else
            {
                LatestVersion = "-";
            }

            KSPversion = ksp_version != null?ksp_version.ToString() : "-";

            Abstract = mod.@abstract;

            // If we have a homepage provided, use that; otherwise use the spacedock page, curse page or the github repo so that users have somewhere to get more info than just the abstract.

            Homepage = "N/A";
            if (mod.resources != null)
            {
                if (mod.resources.homepage != null)
                {
                    Homepage = mod.resources.homepage.ToString();
                }
                else if (mod.resources.spacedock != null)
                {
                    Homepage = mod.resources.spacedock.ToString();
                }
                else if (mod.resources.curse != null)
                {
                    Homepage = mod.resources.curse.ToString();
                }
                else if (mod.resources.repository != null)
                {
                    Homepage = mod.resources.repository.ToString();
                }
            }

            Identifier = mod.identifier;

            DownloadSize = (mod.download_size == 0)
                ? "N/A"
                : CkanModule.FmtSize(mod.download_size);

            Abbrevation = new string(mod.name.Split(' ').
                                     Where(s => s.Length > 0).Select(s => s[0]).ToArray());

            UpdateIsCached();
        }
Exemplo n.º 20
0
        public GUIMod(Module mod, IRegistryQuerier registry, KSPVersion current_ksp_version)
        {
            IsCKAN = mod is CkanModule;
            //Currently anything which could alter these causes a full reload of the modlist
            // If this is ever changed these could be moved into the properties
            Mod              = mod;
            IsInstalled      = registry.IsInstalled(mod.identifier, false);
            IsInstallChecked = IsInstalled;
            HasUpdate        = registry.HasUpdate(mod.identifier, current_ksp_version);
            IsIncompatible   = !mod.IsCompatibleKSP(current_ksp_version);
            IsAutodetected   = registry.IsAutodetected(mod.identifier);
            Authors          = mod.author == null ? "N/A" : String.Join(",", mod.author);

            var     installed_version = registry.InstalledVersion(mod.identifier);
            Version latest_version    = null;
            var     ksp_version       = mod.ksp_version;

            try
            {
                var latest_available = registry.LatestAvailable(mod.identifier, current_ksp_version);
                if (latest_available != null)
                {
                    latest_version = latest_available.version;
                }
            }
            catch (ModuleNotFoundKraken)
            {
                latest_version = installed_version;
            }

            InstalledVersion = installed_version != null?installed_version.ToString() : "-";

            // Let's try to find the compatibility for this mod. If it's not in the registry at
            // all (because it's a DarkKAN mod) then this might fail.

            CkanModule latest_available_for_any_ksp = null;

            try
            {
                latest_available_for_any_ksp = registry.LatestAvailable(mod.identifier, null);
            }
            catch
            {
                // If we can't find the mod in the CKAN, but we've a CkanModule installed, then
                // use that.
                if (IsCKAN)
                {
                    latest_available_for_any_ksp = (CkanModule)mod;
                }
            }

            // If there's known information for this mod in any form, calculate the highest compatible
            // KSP.
            if (latest_available_for_any_ksp != null)
            {
                KSPCompatibility = KSPCompatibilityLong = latest_available_for_any_ksp.HighestCompatibleKSP();

                // If the mod we have installed is *not* the mod we have installed, or we don't know
                // what we have installed, indicate that an upgrade would be needed.
                if (installed_version == null || !latest_available_for_any_ksp.version.IsEqualTo(installed_version))
                {
                    KSPCompatibilityLong = string.Format("{0} (using mod version {1})",
                                                         KSPCompatibility, latest_available_for_any_ksp.version);
                }
            }
            else
            {
                // No idea what this mod is, sorry!
                KSPCompatibility = KSPCompatibilityLong = "unknown";
            }

            if (latest_version != null)
            {
                LatestVersion = latest_version.ToString();
            }
            else if (latest_available_for_any_ksp != null)
            {
                LatestVersion = latest_available_for_any_ksp.version.ToString();
            }
            else
            {
                LatestVersion = "-";
            }

            KSPversion = ksp_version != null?ksp_version.ToString() : "-";

            Abstract = mod.@abstract;

            // If we have homepage provided use that, otherwise use the kerbalstuff page or the github repo so that users have somewhere to get more info than just the abstract.

            Homepage = "N/A";
            if (mod.resources != null)
            {
                if (mod.resources.homepage != null)
                {
                    Homepage = mod.resources.homepage.ToString();
                }
                else if (mod.resources.kerbalstuff != null)
                {
                    Homepage = mod.resources.kerbalstuff.ToString();
                }
                else if (mod.resources.repository != null)
                {
                    Homepage = mod.resources.repository.ToString();
                }
            }

            Identifier = mod.identifier;

            if (mod.download_size == 0)
            {
                DownloadSize = "N/A";
            }
            else if (mod.download_size / 1024.0 < 1)
            {
                DownloadSize = "1<KB";
            }
            else
            {
                DownloadSize = mod.download_size / 1024 + "";
            }
        }
Exemplo n.º 21
0
        /// <summary>
        /// Initialize a GUIMod based on just an identifier
        /// </summary>
        /// <param name="identifier">The id of the module to represent</param>
        /// <param name="registry">CKAN registry object for current game instance</param>
        /// <param name="current_ksp_version">Current game version</param>
        /// <param name="incompatible">If true, mark this module as incompatible</param>
        public GUIMod(string identifier, IRegistryQuerier registry, KspVersionCriteria current_ksp_version, bool incompatible = false)
        {
            Identifier     = identifier;
            IsIncompatible = incompatible;
            IsAutodetected = registry.IsAutodetected(identifier);
            DownloadCount  = registry.DownloadCount(identifier);
            if (registry.IsAutodetected(identifier))
            {
                IsInstalled = true;
            }

            ModuleVersion latest_version = null;

            try
            {
                LatestCompatibleMod = registry.LatestAvailable(identifier, current_ksp_version);
                latest_version      = LatestCompatibleMod?.version;
            }
            catch (ModuleNotFoundKraken)
            {
            }

            // Let's try to find the compatibility for this mod. If it's not in the registry at
            // all (because it's a DarkKAN mod) then this might fail.

            CkanModule latest_available_for_any_ksp = null;

            try
            {
                latest_available_for_any_ksp = registry.LatestAvailable(identifier, null);
            }
            catch
            { }

            // If there's known information for this mod in any form, calculate the highest compatible
            // KSP.
            if (latest_available_for_any_ksp != null)
            {
                KSPCompatibility = registry.LatestCompatibleKSP(identifier)?.ToYalovString()
                                   ?? Properties.Resources.GUIModUnknown;
                KSPCompatibilityLong = string.Format(Properties.Resources.GUIModKSPCompatibilityLong, KSPCompatibility, latest_available_for_any_ksp.version);
            }
            else
            {
                // No idea what this mod is, sorry!
                KSPCompatibility = KSPCompatibilityLong = Properties.Resources.GUIModUnknown;
            }

            if (latest_version != null)
            {
                LatestVersion = latest_version.ToString();
            }
            else if (latest_available_for_any_ksp != null)
            {
                LatestVersion = latest_available_for_any_ksp.version.ToString();
            }
            else
            {
                LatestVersion = "-";
            }

            // If we have a homepage provided, use that; otherwise use the spacedock page, curse page or the github repo so that users have somewhere to get more info than just the abstract.
            Homepage = Properties.Resources.GUIModNSlashA;

            SearchableIdentifier = CkanModule.nonAlphaNums.Replace(Identifier, "");
        }
Exemplo n.º 22
0
        public GUIMod(CkanModule mod, IRegistryQuerier registry, KspVersionCriteria current_ksp_version)
        {
            IsCKAN = mod is CkanModule;
            //Currently anything which could alter these causes a full reload of the modlist
            // If this is ever changed these could be moved into the properties
            Mod = mod;
            IsInstalled = registry.IsInstalled(mod.identifier, false);
            IsInstallChecked = IsInstalled;
            HasUpdate = registry.HasUpdate(mod.identifier, current_ksp_version);
            IsIncompatible = !mod.IsCompatibleKSP(current_ksp_version);
            IsAutodetected = registry.IsAutodetected(mod.identifier);
            Authors = mod.author == null ? "N/A" : String.Join(",", mod.author);

            var installed_version = registry.InstalledVersion(mod.identifier);
            Version latest_version = null;
            var ksp_version = mod.ksp_version;

            try
            {
                var latest_available = registry.LatestAvailable(mod.identifier, current_ksp_version);
                if (latest_available != null)
                    latest_version = latest_available.version;
            }
            catch (ModuleNotFoundKraken)
            {
                latest_version = installed_version;
            }

            InstalledVersion = installed_version != null ? installed_version.ToString() : "-";

            // Let's try to find the compatibility for this mod. If it's not in the registry at
            // all (because it's a DarkKAN mod) then this might fail.

            CkanModule latest_available_for_any_ksp = null;

            try
            {
                latest_available_for_any_ksp = registry.LatestAvailable(mod.identifier, null);
            }
            catch
            {
                // If we can't find the mod in the CKAN, but we've a CkanModule installed, then
                // use that.
                if (IsCKAN)
                    latest_available_for_any_ksp = (CkanModule) mod;

            }

            // If there's known information for this mod in any form, calculate the highest compatible
            // KSP.
            if (latest_available_for_any_ksp != null)
            {
                KSPCompatibility = KSPCompatibilityLong = latest_available_for_any_ksp.HighestCompatibleKSP();

                // If the mod we have installed is *not* the mod we have installed, or we don't know
                // what we have installed, indicate that an upgrade would be needed.
                if (installed_version == null || !latest_available_for_any_ksp.version.IsEqualTo(installed_version))
                {
                    KSPCompatibilityLong = string.Format("{0} (using mod version {1})",
                        KSPCompatibility, latest_available_for_any_ksp.version);
                }
            }
            else
            {
                // No idea what this mod is, sorry!
                KSPCompatibility = KSPCompatibilityLong = "unknown";
            }

            if (latest_version != null)
            {
                LatestVersion = latest_version.ToString();
            }
            else if (latest_available_for_any_ksp != null)
            {
                LatestVersion = latest_available_for_any_ksp.version.ToString();
            }
            else
            {
                LatestVersion = "-";
            }

            KSPversion = ksp_version != null ? ksp_version.ToString() : "-";

            Abstract = mod.@abstract;

            // If we have a homepage provided, use that; otherwise use the spacedock page, curse page or the github repo so that users have somewhere to get more info than just the abstract.

            Homepage = "N/A";
            if (mod.resources != null)
            {
                if (mod.resources.homepage != null)
                {
                    Homepage = mod.resources.homepage.ToString();
                }
                else if (mod.resources.spacedock != null)
                {
                    Homepage = mod.resources.spacedock.ToString();
                }
                else if (mod.resources.curse != null)
                {
                    Homepage = mod.resources.curse.ToString();
                }
                else if (mod.resources.repository != null)
                {
                    Homepage = mod.resources.repository.ToString();
                }
            }

            Identifier = mod.identifier;

            if (mod.download_size == 0)
                DownloadSize = "N/A";
            else if (mod.download_size / 1024.0 < 1)
                DownloadSize = "1<KB";
            else
                DownloadSize = mod.download_size / 1024+"";

            Abbrevation = new string(mod.name.Split(' ').
                Where(s => s.Length > 0).Select(s => s[0]).ToArray());

            UpdateIsCached();
        }
Exemplo n.º 23
0
 private void AddMod(IEnumerable<RelationshipDescriptor> relations, Dictionary<string, List<string>> chooseAble, 
     string identifier, IRegistryQuerier registry)
 {
     if (relations == null)
         return;
     foreach (RelationshipDescriptor mod in relations)
     {
         try
         {
             // if the mod is available for the current KSP version _and_
             // the mod is not installed _and_
             // the mod is not already in the install list
             if (
                 registry.LatestAvailable(mod.name, CurrentInstance.Version()) != null &&
                 !registry.IsInstalled(mod.name) && !toInstall.Contains(mod.name))
             {
                 // add it to the list of chooseAble mods we display to the user
                 if (!chooseAble.ContainsKey(mod.name))
                 {
                     chooseAble.Add(mod.name, new List<string>());
                 }
                 chooseAble[mod.name].Add(identifier);
             }
         }
         // XXX - Don't ignore all krakens! Those things are important!
         catch (Kraken)
         {
         }
     }
 }
Exemplo n.º 24
0
        public GUIMod(CfanModule mod, IRegistryQuerier registry, FactorioVersion current_ksp_version)
        {
            IsCKAN = mod is CfanModule;
            //Currently anything which could alter these causes a full reload of the modlist
            // If this is ever changed these could be moved into the properties
            Mod              = mod;
            IsInstalled      = registry.IsInstalled(mod.identifier, false);
            IsInstallChecked = IsInstalled;
            HasUpdate        = registry.HasUpdate(mod.identifier, current_ksp_version);
            IsIncompatible   = !mod.IsCompatibleKSP(current_ksp_version);
            IsAutodetected   = registry.IsAutodetected(mod.identifier);
            Authors          = mod.authors == null ? "N/A" : String.Join(",", mod.authors);

            var             installed_version = registry.InstalledVersion(mod.identifier);
            AbstractVersion latest_version    = null;
            var             ksp_version       = mod.getMinFactorioVersion();

            CfanModule latest_available = null;

            try
            {
                latest_available = registry.LatestAvailable(mod.identifier, current_ksp_version);
                if (latest_available != null)
                {
                    latest_version = latest_available.modVersion;
                }
            }
            catch (ModuleNotFoundKraken)
            {
                latest_version = installed_version;
            }

            InstalledVersion = installed_version != null?installed_version.ToString() : "-";

            // Let's try to find the compatibility for this mod. If it's not in the registry at
            // all (because it's a DarkKAN mod) then this might fail.

            CfanModule latest_available_for_any_ksp = null;

            try
            {
                latest_available_for_any_ksp = registry.LatestAvailable(mod.identifier, null);
            }
            catch
            {
                // If we can't find the mod in the CKAN, but we've a CkanModule installed, then
                // use that.
                if (IsCKAN)
                {
                    latest_available_for_any_ksp = (CfanModule)mod;
                }
            }

            var showInfoFrom = latest_available ?? latest_available_for_any_ksp;

            // If there's known information for this mod in any form, calculate the highest compatible
            // KSP.
            if (showInfoFrom != null)
            {
                string minVersion = showInfoFrom.getMinFactorioVersion()?.ToString();
                string maxVersion = showInfoFrom.HighestCompatibleKSP()?.ToString();
                if (maxVersion != null && ModVersion.isMaxWithTheSameMinor(new ModVersion(maxVersion)))
                {
                    maxVersion = maxVersion.Replace(int.MaxValue.ToString(), "x");
                }

                if (minVersion != null && maxVersion != null)
                {
                    KSPCompatibility = minVersion.ToString() + " - " + maxVersion.ToString();
                }
                else if (minVersion != null)
                {
                    KSPCompatibility = " >= " + minVersion.ToString();
                }
                else if (maxVersion != null)
                {
                    KSPCompatibility = " <= " + maxVersion.ToString();
                }
                else
                {
                    KSPCompatibility = "any";
                }
                KSPCompatibilityLong = KSPCompatibility;

                // If the mod we have installed is *not* the mod we have installed, or we don't know
                // what we have installed, indicate that an upgrade would be needed.
                if (installed_version == null || !showInfoFrom.modVersion.Equals(installed_version))
                {
                    KSPCompatibilityLong = string.Format("{0} (using mod version {1})",
                                                         KSPCompatibility, showInfoFrom.modVersion);
                }
            }
            else
            {
                // No idea what this mod is, sorry!
                KSPCompatibility = KSPCompatibilityLong = "unknown";
            }

            if (latest_version != null)
            {
                LatestVersion = latest_version.ToString();
            }
            else if (latest_available_for_any_ksp != null)
            {
                LatestVersion = latest_available_for_any_ksp.modVersion.ToString();
            }
            else
            {
                LatestVersion = "-";
            }

            KSPversion = ksp_version != null?ksp_version.ToString() : "-";

            Abstract = mod.@abstract;

            // If we have homepage provided use that, otherwise use the spacedock page or the github repo so that users have somewhere to get more info than just the abstract.

            Homepage = "N/A";
            if (!string.IsNullOrEmpty(mod.homepage))
            {
                Homepage = mod.homepage;
            }

            Identifier = mod.identifier;

            if (mod.download_size == 0)
            {
                DownloadSize = "N/A";
            }
            else if (mod.download_size / 1024.0 < 1)
            {
                DownloadSize = "1<KB";
            }
            else
            {
                DownloadSize = mod.download_size / 1024 + "";
            }

            Abbrevation = new string(mod.title.Split(' ').
                                     Where(s => s.Length > 0).Select(s => s[0]).ToArray());

            if (Main.Instance != null)
            {
                IsCached = Main.Instance.CurrentInstance.Cache.IsMaybeCachedZip(mod.download);
            }
        }
Exemplo n.º 25
0
        private TreeNode UpdateModDependencyGraphRecursively(TreeNode parentNode, CfanModule module, RelationshipType relationship, int depth, bool virtualProvides = false)
        {
            if (module == null ||
                (depth > 0 && dependencyGraphRootModule == module) ||
                (alreadyVisited.Contains(module)))
            {
                return(null);
            }

            alreadyVisited.Add(module);

            string nodeText = module.title;

            if (virtualProvides)
            {
                nodeText = String.Format("provided by - {0}", module.title);
            }

            var node = parentNode == null ? new TreeNode(nodeText) : parentNode.Nodes.Add(nodeText);

            node.Name = module.title;

            IEnumerable <ModDependency> relationships = null;

            switch (relationship)
            {
            case RelationshipType.Depends:
                relationships = module.depends;
                break;

            case RelationshipType.Recommends:
                relationships = module.recommends;
                break;

            case RelationshipType.Suggests:
                relationships = module.suggests;
                break;

            case RelationshipType.Supports:
                relationships = module.supports;
                break;

            case RelationshipType.Conflicts:
                relationships = module.conflicts;
                break;
            }

            if (relationships == null)
            {
                return(node);
            }

            foreach (ModDependency dependency in relationships)
            {
                IRegistryQuerier registry = RegistryManager.Instance(manager.CurrentInstance).registry;

                try
                {
                    try
                    {
                        var dependencyModule = registry.LatestAvailable
                                                   (dependency.modName, manager.CurrentInstance.Version());
                        UpdateModDependencyGraphRecursively(node, dependencyModule, relationship, depth + 1);
                    }
                    catch (ModuleNotFoundKraken)
                    {
                        List <CfanModule> dependencyModules = registry.LatestAvailableWithProvides
                                                                  (dependency.modName, manager.CurrentInstance.Version());

                        if (dependencyModules == null)
                        {
                            continue;
                        }

                        var newNode = node.Nodes.Add(dependency.modName + " (virtual)");
                        newNode.ForeColor = Color.Gray;

                        foreach (var dep in dependencyModules)
                        {
                            UpdateModDependencyGraphRecursively(newNode, dep, relationship, depth + 1, true);
                        }
                    }
                }
                catch (Exception)
                {
                }
            }

            if (virtualProvides)
            {
                node.Collapse(true);
            }
            else
            {
                node.ExpandAll();
            }

            return(node);
        }
Exemplo n.º 26
0
        public int RunCommand(CKAN.KSP ksp, object raw_options)
        {
            ListOptions options = (ListOptions)raw_options;

            IRegistryQuerier registry = RegistryManager.Instance(ksp).registry;


            ExportFileType?exportFileType = null;

            if (!string.IsNullOrWhiteSpace(options.export))
            {
                exportFileType = GetExportFileType(options.export);

                if (exportFileType == null)
                {
                    user.RaiseError("Unknown export format: {0}", options.export);
                }
            }

            if (!(options.porcelain) && exportFileType == null)
            {
                user.RaiseMessage("\r\nKSP found at {0}\r\n", ksp.GameDir());
                user.RaiseMessage("KSP Version: {0}\r\n", ksp.Version());

                user.RaiseMessage("Installed Modules:\r\n");
            }

            if (exportFileType == null)
            {
                var installed = new SortedDictionary <string, Version>(registry.Installed());

                foreach (KeyValuePair <string, Version> mod in installed)
                {
                    Version current_version = mod.Value;

                    string bullet = "*";

                    if (current_version is ProvidesVersion)
                    {
                        // Skip virtuals for now.
                        continue;
                    }
                    else if (current_version is DllVersion)
                    {
                        // Autodetected dll
                        bullet = "-";
                    }
                    else
                    {
                        try
                        {
                            // Check if upgrades are available, and show appropriately.
                            CkanModule latest = registry.LatestAvailable(mod.Key, ksp.VersionCriteria());

                            log.InfoFormat("Latest {0} is {1}", mod.Key, latest);

                            if (latest == null)
                            {
                                // Not compatible!
                                bullet = "X";
                            }
                            else if (latest.version.IsEqualTo(current_version))
                            {
                                // Up to date
                                bullet = "-";
                            }
                            else if (latest.version.IsGreaterThan(mod.Value))
                            {
                                // Upgradable
                                bullet = "^";
                            }
                        }
                        catch (ModuleNotFoundKraken)
                        {
                            log.InfoFormat("{0} is installed, but no longer in the registry", mod.Key);
                            bullet = "?";
                        }
                    }

                    user.RaiseMessage("{0} {1} {2}", bullet, mod.Key, mod.Value);
                }
            }
            else
            {
                var stream = Console.OpenStandardOutput();
                new Exporter(exportFileType.Value).Export(registry, stream);
                stream.Flush();
            }

            if (!(options.porcelain) && exportFileType == null)
            {
                user.RaiseMessage("\r\nLegend: -: Up to date. X: Incompatible. ^: Upgradable. ?: Unknown. *: Broken. ");
                // Broken mods are in a state that CKAN doesn't understand, and therefore can't handle automatically
            }

            return(Exit.OK);
        }