当前位置: 首页>>代码示例>>C#>>正文


C# CkanModule类代码示例

本文整理汇总了C#中CkanModule的典型用法代码示例。如果您正苦于以下问题:C# CkanModule类的具体用法?C# CkanModule怎么用?C# CkanModule使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CkanModule类属于命名空间,在下文中一共展示了CkanModule类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Compatible

        public bool Compatible(KSPVersion gameVersion, CkanModule module)
        {
            KSPVersion ksp_version = module.ksp_version;
            KSPVersion ksp_version_min = module.ksp_version_min;
            KSPVersion ksp_version_max = module.ksp_version_max;

            // Check the min and max versions.

            if (ksp_version_min.IsNotAny() && gameVersion < ksp_version_min)
            {
                return false;
            }

            if (ksp_version_max.IsNotAny() && gameVersion > ksp_version_max)
            {
                return false;
            }

            // We didn't hit the min/max guards. They may not have existed.

            // Note that since ksp_version is "any" if not specified, this
            // will work fine if there's no target, or if there were min/max
            // fields and we passed them successfully.

            return ksp_version.Targets(gameVersion);
        }
开发者ID:adamhomer88,项目名称:CKAN,代码行数:26,代码来源:StrictGameComparator.cs

示例2: GetInternalAvc

 public AvcVersion GetInternalAvc(CkanModule module, string filePath, string internalFilePath = null)
 {
     using (var zipfile = new ZipFile(filePath))
     {
         return GetInternalAvc(module, zipfile, internalFilePath);
     }
 }
开发者ID:Zor-X-L,项目名称:CKAN,代码行数:7,代码来源:ModuleService.cs

示例3: GeneratorRandomModule

 public CkanModule GeneratorRandomModule(
     KSPVersion ksp_version = null,
     List<RelationshipDescriptor> conflicts = null,
     List<RelationshipDescriptor> depends = null,
     List<RelationshipDescriptor> sugests = null,
     List<String> provides = null,
     string identifier = null,
     Version version = null)
 {
     var mod = new CkanModule
     {
         name = Generator.Next().ToString(CultureInfo.InvariantCulture),
         @abstract = Generator.Next().ToString(CultureInfo.InvariantCulture),
         identifier = identifier??Generator.Next().ToString(CultureInfo.InvariantCulture),
         spec_version = new Version(1.ToString(CultureInfo.InvariantCulture)),
         ksp_version = ksp_version ?? new KSPVersion("0." + Generator.Next()),
         version = version ?? new Version(Generator.Next().ToString(CultureInfo.InvariantCulture))
     };
     mod.ksp_version_max = mod.ksp_version_min = new KSPVersion(null);
     mod.conflicts = conflicts;
     mod.depends = depends;
     mod.suggests = sugests;
     mod.provides = provides;
     return mod;
 }
开发者ID:Rusk85,项目名称:CKAN,代码行数:25,代码来源:TestData.cs

示例4: SingleVersionsCompatible

        public override bool SingleVersionsCompatible(KspVersion gameVersion, CkanModule module)
        {
            // Otherwise, check if it's "generally recognise as safe".

            // If we're running KSP 1.0.4, then allow the mod to run if we would have
            // considered it compatible under 1.0.3 (as 1.0.4 was "just a hotfix").
            if (gameVersion.Equals (KspVersion.Parse ("1.0.4")))
                return strict.SingleVersionsCompatible (v103, module);

            return false;
        }
开发者ID:KSP-CKAN,项目名称:CKAN,代码行数:11,代码来源:GrasGameComparator.cs

示例5: Compatible

        public override bool Compatible(KspVersionCriteria gameVersionCriteria, CkanModule module)
        {
            // If it's strictly compatible, then it's compatible.
            if (strict.Compatible (gameVersionCriteria, module))
                return true;

            // If we're in strict mode, and it's not strictly compatible, then it's
            // not compatible.
            if (module.ksp_version_strict)
                return false;

            return base.Compatible (gameVersionCriteria, module);
        }
开发者ID:KSP-CKAN,项目名称:CKAN,代码行数:13,代码来源:GrasGameComparator.cs

示例6: OnModChanged

        public void OnModChanged(CkanModule module, GUIModChangeType changeType)
        {
            if (changeType == GUIModChangeType.Update || changeType == GUIModChangeType.Install)
            {
                var parts = GetInstalledModParts(module.identifier);
                foreach (var part in parts.Where(part => _mDisabledParts.ContainsKey(part.Key)))
                {
                    Cache.RemovePartFromCache(part.Key);
                    Cache.MovePartToCache(part.Key);
                }
            }

            RefreshInstalledModsList();
        }
开发者ID:WCapelle,项目名称:CKAN-plugins,代码行数:14,代码来源:PartManagerUI.cs

示例7: HasInstallableFiles

        public bool HasInstallableFiles(CkanModule module, string filePath)
        {
            try
            {
                ModuleInstaller.FindInstallableFiles(module, filePath, null);
            }
            catch (BadMetadataKraken)
            {
                // TODO: DBB: Let's not use exceptions for flow control
                return false;
            }

            return true;
        }
开发者ID:Zor-X-L,项目名称:CKAN,代码行数:14,代码来源:ModuleService.cs

示例8: Compatible

        public bool Compatible(KspVersion gameVersion, CkanModule module)
        {
            var gameVersionRange = gameVersion.ToVersionRange();

            var moduleRange = KspVersionRange.Any;

            if (module.ksp_version != null)
            {
                moduleRange = module.ksp_version.ToVersionRange();
            }
            else if (module.ksp_version_min != null || module.ksp_version_max != null)
            {
                if (module.ksp_version_min != null && module.ksp_version_max != null)
                {
                    if (module.ksp_version_min <= module.ksp_version_max)
                    {
                        var minRange = module.ksp_version_min.ToVersionRange();
                        var maxRange = module.ksp_version_max.ToVersionRange();

                        moduleRange = new KspVersionRange(minRange.Lower, maxRange.Upper);
                    }
                    else
                    {
                        return false;
                    }
                }
                else if (module.ksp_version_min != null)
                {
                    var minRange = module.ksp_version_min.ToVersionRange();

                    moduleRange = new KspVersionRange(minRange.Lower, KspVersionBound.Unbounded);
                }
                else if (module.ksp_version_max != null)
                {
                    var maxRange = module.ksp_version_max.ToVersionRange();

                    moduleRange = new KspVersionRange(KspVersionBound.Unbounded, maxRange.Upper);
                }
            }
            else
            {
                return true;
            }

            return moduleRange.IsSupersetOf(gameVersionRange);
        }
开发者ID:CliftonMarien,项目名称:CKAN,代码行数:46,代码来源:StrictGameComparator.cs

示例9: SingleVersionsCompatible

        public override bool SingleVersionsCompatible(KspVersion gameVersion, CkanModule module)
        {
            var gameVersionRange = gameVersion.ToVersionRange();

            var moduleRange = KspVersionRange.Any;

            if (module.ksp_version != null)
            {
                moduleRange = module.ksp_version.ToVersionRange();
            }
            else if (module.ksp_version_min != null || module.ksp_version_max != null)
            {
                if (module.ksp_version_min != null && module.ksp_version_max != null)
                {
                    if (module.ksp_version_min <= module.ksp_version_max)
                    {
                        var minRange = module.ksp_version_min.ToVersionRange();
                        var maxRange = module.ksp_version_max.ToVersionRange();

                        moduleRange = new KspVersionRange(minRange.Lower, maxRange.Upper);
                    }
                    else
                    {
                        return false;
                    }
                }
                else if (module.ksp_version_min != null)
                {
                    var minRange = module.ksp_version_min.ToVersionRange();

                    moduleRange = new KspVersionRange(minRange.Lower, KspVersionBound.Unbounded);
                }
                else if (module.ksp_version_max != null)
                {
                    var maxRange = module.ksp_version_max.ToVersionRange();

                    moduleRange = new KspVersionRange(KspVersionBound.Unbounded, maxRange.Upper);
                }
            }
            else
            {
                return true;
            }

            return gameVersionRange.IntersectWith(moduleRange) != null;
        }
开发者ID:KSP-CKAN,项目名称:CKAN,代码行数:46,代码来源:StrictGameComparator.cs

示例10: Compatible

        public bool Compatible(KSPVersion gameVersion, CkanModule module)
        {
            // If it's strictly compatible, then it's compatible.
            if (strict.Compatible(gameVersion, module))
                return true;

            // If we're in strict mode, and it's not strictly compatible, then it's
            // not compatible.
            if (module.ksp_version_strict)
                return false;

            // Otherwise, check if it's "generally recognise as safe".

            // If we're running KSP 1.0.4, then allow the mod to run if we would have
            // considered it compatible under 1.0.3 (as 1.0.4 was "just a hotfix").
            if (gameVersion.Equals("1.0.4"))
                return strict.Compatible(v103, module);

            return false;
        }
开发者ID:adamhomer88,项目名称:CKAN,代码行数:20,代码来源:GrasGameComparator.cs

示例11: Recommended

 public Recommended(CkanModule module)
 {
     if (module == null) throw new ArgumentNullException();
     Parent = module;
 }
开发者ID:sarbian,项目名称:CKAN,代码行数:5,代码来源:RelationshipResolver.cs

示例12: Suggested

 public Suggested(CkanModule module)
 {
     if (module == null) throw new ArgumentNullException();
     Parent = module;
 }
开发者ID:sarbian,项目名称:CKAN,代码行数:5,代码来源:RelationshipResolver.cs

示例13: Resolve

        /// <summary>
        /// Resolves all relationships for a module.
        /// May recurse to ResolveStanza, which may add additional modules to be installed.
        /// </summary>
        private void Resolve(CkanModule module, RelationshipResolverOptions options)
        {
            // Even though we may resolve top-level suggests for our module,
            // we don't install suggestions all the down unless with_all_suggests
            // is true.
            var sub_options = (RelationshipResolverOptions) options.Clone();
            sub_options.with_suggests = false;

            log.DebugFormat("Resolving dependencies for {0}", module.identifier);
            ResolveStanza(module.depends, new SelectionReason.Depends(module), sub_options);

            if (options.with_recommends)
            {
                log.DebugFormat("Resolving recommends for {0}", module.identifier);
                ResolveStanza(module.recommends, new SelectionReason.Recommended(module), sub_options, true);
            }

            if (options.with_suggests || options.with_all_suggests)
            {
                log.DebugFormat("Resolving suggests for {0}", module.identifier);
                ResolveStanza(module.suggests, new SelectionReason.Suggested(module), sub_options, true);
            }
        }
开发者ID:sarbian,项目名称:CKAN,代码行数:27,代码来源:RelationshipResolver.cs

示例14: Depends

 public Depends(CkanModule module)
 {
     if (module == null) throw new ArgumentNullException();
     Parent = module;
 }
开发者ID:sarbian,项目名称:CKAN,代码行数:5,代码来源:RelationshipResolver.cs

示例15: FindInstallableFiles

        /// <summary>
        /// Given a module and an open zipfile, return all the files that would be installed
        /// for this module.
        ///
        /// If a KSP instance is provided, it will be used to generate output paths, otherwise these will be null.
        ///
        /// Throws a BadMetadataKraken if the stanza resulted in no files being returned.
        /// </summary>
        public static List<InstallableFile> FindInstallableFiles(CkanModule module, ZipFile zipfile, KSP ksp)
        {
            var files = new List<InstallableFile> ();

            try
            {
                // Use the provided stanzas, or use the default install stanza if they're absent.
                if (module.install != null && module.install.Length != 0)
                {
                    foreach (ModuleInstallDescriptor stanza in module.install)
                    {
                        files.AddRange(FindInstallableFiles(stanza, zipfile, ksp));
                    }
                }
                else
                {
                    ModuleInstallDescriptor default_stanza = ModuleInstallDescriptor.DefaultInstallStanza(module.identifier, zipfile);
                    files.AddRange(FindInstallableFiles(default_stanza, zipfile, ksp));
                }
            }
            catch (BadMetadataKraken kraken)
            {
                // Decorate our kraken with the current module, as the lower-level
                // methods won't know it.
                kraken.module = module;
                throw;
            }

            return files;
        }
开发者ID:adamhomer88,项目名称:CKAN,代码行数:38,代码来源:ModuleInstaller.cs


注:本文中的CkanModule类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。