Пример #1
0
        /// <summary>
        /// Shows information about the mod.
        /// </summary>
        /// <returns>Success status.</returns>
        /// <param name="module">The module to show.</param>
        public int ShowMod(Module module)
        {
            #region Abstract and description
            if (!string.IsNullOrEmpty(module.@abstract))
            {
                user.RaiseMessage("{0}: {1}", module.name, module.@abstract);
            }
            else
            {
                user.RaiseMessage("{0}", module.name);
            }

            if (!string.IsNullOrEmpty(module.description))
            {
                user.RaiseMessage("\n{0}\n", module.description);
            }
            #endregion

            #region General info (author, version...)
            user.RaiseMessage("\nModule info:");
            user.RaiseMessage("- version:\t{0}", module.version);

            if (module.author != null)
            {
                user.RaiseMessage("- authors:\t{0}", string.Join(", ", module.author));
            }
            else
            {
                // Did you know that authors are optional in the spec?
                // You do now. #673.
                user.RaiseMessage("- authors:\tUNKNOWN");
            }

            user.RaiseMessage("- status:\t{0}", module.release_status);
            user.RaiseMessage("- license:\t{0}", string.Join(", ", module.license));
            #endregion

            #region Relationships
            if (module.depends != null && module.depends.Count > 0)
            {
                user.RaiseMessage("\nDepends:");
                foreach (RelationshipDescriptor dep in module.depends)
                {
                    user.RaiseMessage("- {0}", RelationshipToPrintableString(dep));
                }
            }

            if (module.recommends != null && module.recommends.Count > 0)
            {
                user.RaiseMessage("\nRecommends:");
                foreach (RelationshipDescriptor dep in module.recommends)
                {
                    user.RaiseMessage("- {0}", RelationshipToPrintableString(dep));
                }
            }

            if (module.suggests != null && module.suggests.Count > 0)
            {
                user.RaiseMessage("\nSuggests:");
                foreach (RelationshipDescriptor dep in module.suggests)
                {
                    user.RaiseMessage("- {0}", RelationshipToPrintableString(dep));
                }
            }

            if (module.ProvidesList != null && module.ProvidesList.Count > 0)
            {
                user.RaiseMessage("\nProvides:");
                foreach (string prov in module.ProvidesList)
                {
                    user.RaiseMessage("- {0}", prov);
                }
            }
            #endregion

            user.RaiseMessage("\nResources:");
            if (module.resources != null)
            {
                if (module.resources.bugtracker != null)
                {
                    user.RaiseMessage("- bugtracker: {0}", Uri.EscapeUriString(module.resources.bugtracker.ToString()));
                }
                if (module.resources.homepage != null)
                {
                    user.RaiseMessage("- homepage: {0}", Uri.EscapeUriString(module.resources.homepage.ToString()));
                }
                if (module.resources.kerbalstuff != null)
                {
                    user.RaiseMessage("- kerbalstuff: {0}", Uri.EscapeUriString(module.resources.kerbalstuff.ToString()));
                }
                if (module.resources.repository != null)
                {
                    user.RaiseMessage("- repository: {0}", Uri.EscapeUriString(module.resources.repository.ToString()));
                }
            }

            // Compute the CKAN filename.
            string file_uri_hash = NetFileCache.CreateURLHash(module.download);
            string file_name     = CkanModule.StandardName(module.identifier, module.version);

            user.RaiseMessage("\nFilename: {0}", file_uri_hash + "-" + file_name);

            return(Exit.OK);
        }
Пример #2
0
        /// <summary>
        /// Shows information about the mod.
        /// </summary>
        /// <returns>Success status.</returns>
        /// <param name="module">The module to show.</param>
        public int ShowMod(CfanModule module)
        {
            #region Abstract and description
            user.RaiseMessage("{0}", module.title);

            if (!string.IsNullOrEmpty(module.description))
            {
                user.RaiseMessage("\n{0}\n", module.description);
            }
            #endregion

            #region General info (author, version...)
            user.RaiseMessage("\nModule info:");
            user.RaiseMessage("- version:\t{0}", module.modVersion);

            if (module.authors != null)
            {
                user.RaiseMessage("- authors:\t{0}", string.Join(", ", module.authors));
            }
            else
            {
                // Did you know that authors are optional in the spec?
                // You do now. #673.
                user.RaiseMessage("- authors:\tUNKNOWN");
            }

            #endregion

            #region Relationships
            if (module.depends != null && module.depends.Any())
            {
                user.RaiseMessage("\nDepends:");
                foreach (var dep in module.depends)
                {
                    user.RaiseMessage("- {0}", RelationshipToPrintableString(dep));
                }
            }

            if (module.recommends != null && module.recommends.Any())
            {
                user.RaiseMessage("\nRecommends:");
                foreach (var dep in module.recommends)
                {
                    user.RaiseMessage("- {0}", RelationshipToPrintableString(dep));
                }
            }

            if (module.suggests != null && module.suggests.Any())
            {
                user.RaiseMessage("\nSuggests:");
                foreach (var dep in module.suggests)
                {
                    user.RaiseMessage("- {0}", RelationshipToPrintableString(dep));
                }
            }

            if (module.providesNames != null && module.providesNames.Any())
            {
                user.RaiseMessage("\nProvides:");
                foreach (string prov in module.providesNames)
                {
                    user.RaiseMessage("- {0}", prov);
                }
            }
            #endregion

            user.RaiseMessage("\nResources:");
            if (!String.IsNullOrEmpty(module.homepage))
            {
                user.RaiseMessage("- homepage: {0}", Uri.EscapeUriString(module.homepage));
            }
            if (!String.IsNullOrEmpty(module.contact))
            {
                user.RaiseMessage("- contact: {0}", Uri.EscapeUriString(module.contact));
            }

            if (!module.isMetapackage)
            {
                // Compute the CKAN filename.
                string file_uri_hash = NetFileCache.CreateURLHash(module.download);
                string file_name     = CfanModule.createStandardFileName(module.identifier, module.modVersion.ToString());

                user.RaiseMessage("\nFilename: {0}", file_uri_hash + "-" + file_name);
            }

            return(Exit.OK);
        }
Пример #3
0
        /// <summary>
        /// Shows information about the mod.
        /// </summary>
        /// <returns>Success status.</returns>
        /// <param name="module">The module to show.</param>
        public int ShowMod(CkanModule module)
        {
            #region Abstract and description
            if (!string.IsNullOrEmpty(module.@abstract))
            {
                user.RaiseMessage("{0}: {1}", module.name, module.@abstract);
            }
            else
            {
                user.RaiseMessage("{0}", module.name);
            }

            if (!string.IsNullOrEmpty(module.description))
            {
                user.RaiseMessage("");
                user.RaiseMessage("{0}", module.description);
            }
            #endregion

            #region General info (author, version...)
            user.RaiseMessage("");
            user.RaiseMessage("Module info:");
            user.RaiseMessage("  Version:\t{0}", module.version);

            if (module.author != null)
            {
                user.RaiseMessage("  Authors:\t{0}", string.Join(", ", module.author));
            }
            else
            {
                // Did you know that authors are optional in the spec?
                // You do now. #673.
                user.RaiseMessage("  Authors:\tUNKNOWN");
            }

            if (module.release_status != null)
            {
                user.RaiseMessage("  Status:\t{0}", module.release_status);
            }
            user.RaiseMessage("  License:\t{0}", string.Join(", ", module.license));
            if (module.Tags != null && module.Tags.Count > 0)
            {
                // Need an extra space before the tab to line up with other fields
                user.RaiseMessage("  Tags: \t{0}", string.Join(", ", module.Tags));
            }
            if (module.localizations != null && module.localizations.Length > 0)
            {
                user.RaiseMessage("  Languages:\t{0}", string.Join(", ", module.localizations.OrderBy(l => l)));
            }
            #endregion

            #region Relationships
            if (module.depends != null && module.depends.Count > 0)
            {
                user.RaiseMessage("");
                user.RaiseMessage("Depends:");
                foreach (RelationshipDescriptor dep in module.depends)
                {
                    user.RaiseMessage("  - {0}", RelationshipToPrintableString(dep));
                }
            }

            if (module.recommends != null && module.recommends.Count > 0)
            {
                user.RaiseMessage("");
                user.RaiseMessage("Recommends:");
                foreach (RelationshipDescriptor dep in module.recommends)
                {
                    user.RaiseMessage("  - {0}", RelationshipToPrintableString(dep));
                }
            }

            if (module.suggests != null && module.suggests.Count > 0)
            {
                user.RaiseMessage("");
                user.RaiseMessage("Suggests:");
                foreach (RelationshipDescriptor dep in module.suggests)
                {
                    user.RaiseMessage("  - {0}", RelationshipToPrintableString(dep));
                }
            }

            if (module.provides != null && module.provides.Count > 0)
            {
                user.RaiseMessage("");
                user.RaiseMessage("Provides:");
                foreach (string prov in module.provides)
                {
                    user.RaiseMessage("  - {0}", prov);
                }
            }
            #endregion

            if (module.resources != null)
            {
                user.RaiseMessage("");
                user.RaiseMessage("Resources:");
                if (module.resources.homepage != null)
                {
                    user.RaiseMessage("  Home page:\t{0}", Uri.EscapeUriString(module.resources.homepage.ToString()));
                }
                if (module.resources.manual != null)
                {
                    user.RaiseMessage("  Manual:\t{0}", Uri.EscapeUriString(module.resources.manual.ToString()));
                }
                if (module.resources.spacedock != null)
                {
                    user.RaiseMessage("  SpaceDock:\t{0}", Uri.EscapeUriString(module.resources.spacedock.ToString()));
                }
                if (module.resources.repository != null)
                {
                    user.RaiseMessage("  Repository:\t{0}", Uri.EscapeUriString(module.resources.repository.ToString()));
                }
                if (module.resources.bugtracker != null)
                {
                    user.RaiseMessage("  Bug tracker:\t{0}", Uri.EscapeUriString(module.resources.bugtracker.ToString()));
                }
                if (module.resources.curse != null)
                {
                    user.RaiseMessage("  Curse:\t{0}", Uri.EscapeUriString(module.resources.curse.ToString()));
                }
                if (module.resources.store != null)
                {
                    user.RaiseMessage("  Store:\t{0}", Uri.EscapeUriString(module.resources.store.ToString()));
                }
                if (module.resources.steamstore != null)
                {
                    user.RaiseMessage("  Steam store:\t{0}", Uri.EscapeUriString(module.resources.steamstore.ToString()));
                }
                if (module.resources.remoteAvc != null)
                {
                    user.RaiseMessage("  Version file:\t{0}", Uri.EscapeUriString(module.resources.remoteAvc.ToString()));
                }
            }

            if (!module.IsDLC)
            {
                // Compute the CKAN filename.
                string file_uri_hash = NetFileCache.CreateURLHash(module.download);
                string file_name     = CkanModule.StandardName(module.identifier, module.version);

                user.RaiseMessage("");
                user.RaiseMessage("Filename: {0}", file_uri_hash + "-" + file_name);
            }

            return(Exit.OK);
        }