本文整理汇总了C#中CkanModule.IsCompatibleKSP方法的典型用法代码示例。如果您正苦于以下问题:C# CkanModule.IsCompatibleKSP方法的具体用法?C# CkanModule.IsCompatibleKSP怎么用?C# CkanModule.IsCompatibleKSP使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CkanModule
的用法示例。
在下文中一共展示了CkanModule.IsCompatibleKSP方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GUIMod
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 = [email protected];
// 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)
{
//.........这里部分代码省略.........