diff --git a/CHANGELOG.md b/CHANGELOG.md index 6929c1988f..5ebe318615 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,8 @@ All notable changes to this project will be documented in this file. - [NetKAN] Add regexp second test for filespecs (#1919 by: politas; reviewed: ayan4m1) - [Core] Changed name of registry lock file to registry.lock (#1944 by: politas; reviewed: ayan4m1) - [GUI] Modlist hides epochs by default (#1942 by: politas; reviewed: ayan4m1) +- [Core/GUI] Let users select compatible KSP versions (#1957 by: grzegrzk; reviewed: dbent, politas) +- [Core] Add IntersectWith method to KspVersionRange (#1958 by: dbent; reviewed: grzegrzk, politas) ## v1.20.1 diff --git a/Cmdline/Action/List.cs b/Cmdline/Action/List.cs index 9ce6a992dd..0dcd405538 100644 --- a/Cmdline/Action/List.cs +++ b/Cmdline/Action/List.cs @@ -72,7 +72,7 @@ public int RunCommand(CKAN.KSP ksp, object raw_options) try { // Check if upgrades are available, and show appropriately. - CkanModule latest = registry.LatestAvailable(mod.Key, ksp.Version()); + CkanModule latest = registry.LatestAvailable(mod.Key, ksp.VersionCriteria()); log.InfoFormat("Latest {0} is {1}", mod.Key, latest); diff --git a/Cmdline/Action/Search.cs b/Cmdline/Action/Search.cs index 23ba55ed34..5173798cb2 100644 --- a/Cmdline/Action/Search.cs +++ b/Cmdline/Action/Search.cs @@ -56,7 +56,7 @@ public List PerformSearch(CKAN.KSP ksp, string term) { var registry = RegistryManager.Instance(ksp).registry; return registry - .Available(ksp.Version()) + .Available(ksp.VersionCriteria()) .Where((module) => { // Extract the description. This is an optional field and may be null. diff --git a/Cmdline/Action/Show.cs b/Cmdline/Action/Show.cs index b3070c1ffe..5ad147b891 100644 --- a/Cmdline/Action/Show.cs +++ b/Cmdline/Action/Show.cs @@ -38,7 +38,7 @@ public int RunCommand(CKAN.KSP ksp, object raw_options) // Module was not installed, look for an exact match in the available modules, // either by "name" (the user-friendly display name) or by identifier CkanModule moduleToShow = registry - .Available(ksp.Version()) + .Available(ksp.VersionCriteria()) .SingleOrDefault( mod => mod.name == options.Modname || mod.identifier == options.Modname diff --git a/Cmdline/Action/Update.cs b/Cmdline/Action/Update.cs index cfa49cbff4..50302a2f4a 100644 --- a/Cmdline/Action/Update.cs +++ b/Cmdline/Action/Update.cs @@ -26,7 +26,7 @@ public int RunCommand(CKAN.KSP ksp, object raw_options) { // Get a list of available modules prior to the update. var registry = RegistryManager.Instance(ksp).registry; - available_prior = registry.Available(ksp.Version()); + available_prior = registry.Available(ksp.VersionCriteria()); } // If no repository is selected, select all. @@ -56,7 +56,7 @@ public int RunCommand(CKAN.KSP ksp, object raw_options) if (options.list_changes) { var registry = RegistryManager.Instance(ksp).registry; - PrintChanges(available_prior, registry.Available(ksp.Version())); + PrintChanges(available_prior, registry.Available(ksp.VersionCriteria())); } return Exit.OK; diff --git a/Cmdline/Action/Upgrade.cs b/Cmdline/Action/Upgrade.cs index 2d1460213f..7ea95fe122 100644 --- a/Cmdline/Action/Upgrade.cs +++ b/Cmdline/Action/Upgrade.cs @@ -86,7 +86,7 @@ public int RunCommand(CKAN.KSP ksp, object raw_options) try { // Check if upgrades are available - var latest = registry.LatestAvailable(mod.Key, ksp.Version()); + var latest = registry.LatestAvailable(mod.Key, ksp.VersionCriteria()); // This may be an unindexed mod. If so, // skip rather than crash. See KSP-CKAN/CKAN#841. diff --git a/Cmdline/Main.cs b/Cmdline/Main.cs index 81aa0f21a6..bd356ea811 100644 --- a/Cmdline/Main.cs +++ b/Cmdline/Main.cs @@ -322,7 +322,7 @@ private static int Version(IUser user) private static int Available(CKAN.KSP current_instance, IUser user) { - List available = RegistryManager.Instance(current_instance).registry.Available(current_instance.Version()); + List available = RegistryManager.Instance(current_instance).registry.Available(current_instance.VersionCriteria()); user.RaiseMessage("Mods available for KSP {0}", current_instance.Version()); user.RaiseMessage(""); diff --git a/Core/CKAN-core.csproj b/Core/CKAN-core.csproj index 88ddc0b460..3d1d8d68d8 100644 --- a/Core/CKAN-core.csproj +++ b/Core/CKAN-core.csproj @@ -48,6 +48,7 @@ + @@ -110,6 +111,8 @@ + + diff --git a/Core/CompatibleKspVersionsDto.cs b/Core/CompatibleKspVersionsDto.cs new file mode 100644 index 0000000000..c1095e8928 --- /dev/null +++ b/Core/CompatibleKspVersionsDto.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace CKAN +{ + // + //This is DTO object to be serialized/deserialized as JSON + // + class CompatibleKspVersionsDto + { + public CompatibleKspVersionsDto() + { + this.CompatibleKspVersions = new List(); + } + + public String VersionOfKspWhenWritten { get; set; } + + public List CompatibleKspVersions { get; set; } + } +} diff --git a/Core/GameVersionProviders/IKspBuildMap.cs b/Core/GameVersionProviders/IKspBuildMap.cs index 549441bee2..2aece6f31d 100644 --- a/Core/GameVersionProviders/IKspBuildMap.cs +++ b/Core/GameVersionProviders/IKspBuildMap.cs @@ -1,4 +1,5 @@ using CKAN.Versioning; +using System.Collections.Generic; namespace CKAN.GameVersionProviders { @@ -6,6 +7,8 @@ public interface IKspBuildMap { KspVersion this[string buildId] { get; } + List KnownVersions { get; } + void Refresh(); } } diff --git a/Core/GameVersionProviders/KspBuildMap.cs b/Core/GameVersionProviders/KspBuildMap.cs index b899ad26f3..9857b7ae96 100644 --- a/Core/GameVersionProviders/KspBuildMap.cs +++ b/Core/GameVersionProviders/KspBuildMap.cs @@ -32,6 +32,20 @@ public sealed class KspBuildMap : IKspBuildMap } } + public List KnownVersions + { + get + { + EnsureBuildMap(); + List knownVersions = new List(); + foreach (var version in _jBuilds.Builds) + { + knownVersions.Add(KspVersion.Parse(version.Value)); + } + return knownVersions; + } + } + public KspBuildMap(IWin32Registry registry) { _registry = registry; diff --git a/Core/KSP.cs b/Core/KSP.cs index c9c85b9f8f..8904e138a5 100644 --- a/Core/KSP.cs +++ b/Core/KSP.cs @@ -10,6 +10,7 @@ using CKAN.GameVersionProviders; using CKAN.Versioning; using log4net; +using Newtonsoft.Json; [assembly: InternalsVisibleTo("CKAN.Tests")] @@ -29,6 +30,9 @@ public class KSP : IDisposable private readonly string gameDir; private KspVersion version; + private List _compatibleVersions = new List(); + public KspVersion VersionOfKspWhenCompatibleVersionsWereStored { get; private set; } + public bool CompatibleVersionsAreFromDifferentKsp { get { return _compatibleVersions.Count > 0 && VersionOfKspWhenCompatibleVersionsWereStored != Version(); } } public NetFileCache Cache { get; private set; } @@ -92,9 +96,53 @@ private void Init() foreach (DirectoryInfo subDirectory in directory.GetDirectories()) subDirectory.Delete(true); } + LoadCompatibleVersions(); + log.DebugFormat("Initialised {0}", CkanDir()); } + public void SetCompatibleVersions(List compatibleVersions) + { + this._compatibleVersions = compatibleVersions.Distinct().ToList(); + SaveCompatibleVersions(); + } + + private void SaveCompatibleVersions() + { + CompatibleKspVersionsDto compatibleKspVersionsDto = new CompatibleKspVersionsDto(); + + compatibleKspVersionsDto.VersionOfKspWhenWritten = Version().ToString(); + compatibleKspVersionsDto.CompatibleKspVersions = _compatibleVersions.Select(v => v.ToString()).ToList(); + + String json = JsonConvert.SerializeObject(compatibleKspVersionsDto); + File.WriteAllText(CompatibleKspVersionsFile(), json); + + this.VersionOfKspWhenCompatibleVersionsWereStored = Version(); + } + + private void LoadCompatibleVersions() + { + String path = CompatibleKspVersionsFile(); + if (File.Exists(path)) + { + string json = File.ReadAllText(path); + CompatibleKspVersionsDto compatibleKspVersionsDto = JsonConvert.DeserializeObject(json); + + _compatibleVersions = compatibleKspVersionsDto.CompatibleKspVersions.Select(v => KspVersion.Parse(v)).ToList(); + this.VersionOfKspWhenCompatibleVersionsWereStored = KspVersion.Parse(compatibleKspVersionsDto.VersionOfKspWhenWritten); + } + } + + private string CompatibleKspVersionsFile() + { + return Path.Combine(CkanDir(), "compatible_ksp_versions.json"); + } + + public List GetCompatibleVersions() + { + return new List(this._compatibleVersions); + } + #endregion #region Destructors and Disposal @@ -334,6 +382,12 @@ public KspVersion Version() return version = DetectVersion(GameDir()); } + + public KspVersionCriteria VersionCriteria () + { + return new KspVersionCriteria(version, _compatibleVersions); + } + #endregion #region CKAN/GameData Directory Maintenance diff --git a/Core/ModuleInstaller.cs b/Core/ModuleInstaller.cs index f99898a9b1..1c3e96f167 100644 --- a/Core/ModuleInstaller.cs +++ b/Core/ModuleInstaller.cs @@ -152,7 +152,7 @@ public static string CachedOrDownload(string identifier, Version version, Uri ur IDownloader downloader = null ) { - var resolver = new RelationshipResolver(modules, options, registry_manager.registry, ksp.Version()); + var resolver = new RelationshipResolver(modules, options, registry_manager.registry, ksp.VersionCriteria()); var modsToInstall = resolver.ModList().ToList(); InstallList(modsToInstall, options, downloader); } @@ -173,7 +173,7 @@ public static string CachedOrDownload(string identifier, Version version, Uri ur IDownloader downloader = null ) { - var resolver = new RelationshipResolver(modules, options, registry_manager.registry, ksp.Version()); + var resolver = new RelationshipResolver(modules, options, registry_manager.registry, ksp.VersionCriteria()); var modsToInstall = resolver.ModList().ToList(); List downloads = new List (); @@ -993,7 +993,7 @@ public void Upgrade(IEnumerable identifiers, NetAsyncModulesDownloader n options.with_recommends = false; options.with_suggests = false; - var resolver = new RelationshipResolver(identifiers.ToList(), options, registry_manager.registry, ksp.Version()); + var resolver = new RelationshipResolver(identifiers.ToList(), options, registry_manager.registry, ksp.VersionCriteria()); Upgrade(resolver.ModList(), netAsyncDownloader, enforceConsistency); } diff --git a/Core/Net/Repo.cs b/Core/Net/Repo.cs index 0314635281..3240cb71e9 100644 --- a/Core/Net/Repo.cs +++ b/Core/Net/Repo.cs @@ -107,7 +107,7 @@ public static int UpdateAllRepositories(RegistryManager registry_manager, KSP ks ShowUserInconsistencies(registry_manager.registry, user); // Return how many we got! - return registry_manager.registry.Available(ksp.Version()).Count; + return registry_manager.registry.Available(ksp.VersionCriteria()).Count; } public static int Update(RegistryManager registry_manager, KSP ksp, IUser user, Boolean clear = true, string repo = null) @@ -414,7 +414,7 @@ private static int Update(RegistryManager registry_manager, KSP ksp, IUser user, ShowUserInconsistencies(registry_manager.registry, user); // Return how many we got! - return registry_manager.registry.Available(ksp.Version()).Count; + return registry_manager.registry.Available(ksp.VersionCriteria()).Count; } /// diff --git a/Core/Registry/AvailableModule.cs b/Core/Registry/AvailableModule.cs index 03b8edf783..8e8d5f8a0c 100644 --- a/Core/Registry/AvailableModule.cs +++ b/Core/Registry/AvailableModule.cs @@ -72,7 +72,7 @@ public void Remove(Version version) /// If not null only consider mods which match this ksp version. /// If not null only consider mods which satisfy the RelationshipDescriptor. /// - public CkanModule Latest(KspVersion ksp_version = null, RelationshipDescriptor relationship=null) + public CkanModule Latest(KspVersionCriteria ksp_version = null, RelationshipDescriptor relationship=null) { var available_versions = new List(module_version.Keys); CkanModule module; diff --git a/Core/Registry/IRegistryQuerier.cs b/Core/Registry/IRegistryQuerier.cs index 36bc855a96..81b777aca3 100644 --- a/Core/Registry/IRegistryQuerier.cs +++ b/Core/Registry/IRegistryQuerier.cs @@ -16,7 +16,7 @@ public interface IRegistryQuerier /// the specified version of KSP. /// // TODO: This name is misleading. It's more a LatestAvailable's' - List Available(KspVersion ksp_version); + List Available(KspVersionCriteria ksp_version); /// /// Returns the latest available version of a module that @@ -25,7 +25,7 @@ public interface IRegistryQuerier /// If no ksp_version is provided, the latest module for *any* KSP is returned. /// Throws if asked for a non-existent module. /// - CkanModule LatestAvailable(string identifier, KspVersion ksp_version, RelationshipDescriptor relationship_descriptor = null); + CkanModule LatestAvailable(string identifier, KspVersionCriteria ksp_version, RelationshipDescriptor relationship_descriptor = null); /// /// Returns the latest available version of a module that satisifes the specified version and @@ -34,7 +34,7 @@ public interface IRegistryQuerier /// Returns an empty list if nothing is available for our system, which includes if no such module exists. /// If no KSP version is provided, the latest module for *any* KSP version is given. /// - List LatestAvailableWithProvides(string identifier, KspVersion ksp_version, RelationshipDescriptor relationship_descriptor = null); + List LatestAvailableWithProvides(string identifier, KspVersionCriteria ksp_version, RelationshipDescriptor relationship_descriptor = null); /// /// Checks the sanity of the registry, to ensure that all dependencies are met, @@ -65,7 +65,7 @@ public interface IRegistryQuerier /// Returns a simple array of all incompatible modules for /// the specified version of KSP. /// - List Incompatible(KspVersion ksp_version); + List Incompatible(KspVersionCriteria ksp_version); /// /// Returns a dictionary of all modules installed, along with their @@ -128,7 +128,7 @@ public static bool IsAutodetected(this IRegistryQuerier querier, string identifi /// Is the mod installed and does it have a newer version compatible with version /// We can't update AD mods /// - public static bool HasUpdate(this IRegistryQuerier querier, string identifier, KspVersion version) + public static bool HasUpdate(this IRegistryQuerier querier, string identifier, KspVersionCriteria version) { CkanModule newest_version; try diff --git a/Core/Registry/Registry.cs b/Core/Registry/Registry.cs index 177544dd2d..d879c9d1e4 100644 --- a/Core/Registry/Registry.cs +++ b/Core/Registry/Registry.cs @@ -403,7 +403,7 @@ public void RemoveAvailable(CkanModule module) /// /// /// - public List Available(KspVersion ksp_version) + public List Available(KspVersionCriteria ksp_version) { var candidates = new List(available_modules.Keys); var compatible = new List(); @@ -461,7 +461,7 @@ public List Available(KspVersion ksp_version) /// /// /// - public List Incompatible(KspVersion ksp_version) + public List Incompatible(KspVersionCriteria ksp_version) { var candidates = new List(available_modules.Keys); var incompatible = new List(); @@ -492,7 +492,7 @@ public List Incompatible(KspVersion ksp_version) // be calling LatestAvailableWithProvides() public CkanModule LatestAvailable( string module, - KspVersion ksp_version, + KspVersionCriteria ksp_version, RelationshipDescriptor relationship_descriptor =null) { log.DebugFormat("Finding latest available for {0}", module); @@ -514,7 +514,7 @@ public List Incompatible(KspVersion ksp_version) /// /// /// - public List LatestAvailableWithProvides(string module, KspVersion ksp_version, RelationshipDescriptor relationship_descriptor = null) + public List LatestAvailableWithProvides(string module, KspVersionCriteria ksp_version, RelationshipDescriptor relationship_descriptor = null) { // This public interface calculates a cache of modules which // are compatible with the current version of KSP, and then @@ -530,7 +530,7 @@ public List LatestAvailableWithProvides(string module, KspVersion ks /// the `available_for_current_version` list has been correctly /// calculated. Not for direct public consumption. ;) /// - private List LatestAvailableWithProvides(string module, KspVersion ksp_version, + private List LatestAvailableWithProvides(string module, KspVersionCriteria ksp_version, IEnumerable available_for_current_version, RelationshipDescriptor relationship_descriptor=null) { log.DebugFormat("Finding latest available with provides for {0}", module); diff --git a/Core/Relationships/RelationshipResolver.cs b/Core/Relationships/RelationshipResolver.cs index f9d621fbbd..503d91a8a6 100644 --- a/Core/Relationships/RelationshipResolver.cs +++ b/Core/Relationships/RelationshipResolver.cs @@ -89,7 +89,7 @@ public class RelationshipResolver new Dictionary(new NameComparer()); private readonly IRegistryQuerier registry; - private readonly KspVersion kspversion; + private readonly KspVersionCriteria kspversion; private readonly RelationshipResolverOptions options; private readonly HashSet installed_modules; @@ -99,7 +99,7 @@ public class RelationshipResolver /// /// The registry to use /// The version of the install that the registry corresponds to - public RelationshipResolver(RelationshipResolverOptions options, IRegistryQuerier registry, KspVersion kspversion) + public RelationshipResolver(RelationshipResolverOptions options, IRegistryQuerier registry, KspVersionCriteria kspversion) { this.registry = registry; this.kspversion = kspversion; @@ -121,7 +121,7 @@ public RelationshipResolver(RelationshipResolverOptions options, IRegistryQuerie /// /// public RelationshipResolver(IEnumerable module_names, RelationshipResolverOptions options, IRegistryQuerier registry, - KspVersion kspversion) : + KspVersionCriteria kspversion) : this(module_names.Select(name => CkanModule.FromIDandVersion(registry, name, kspversion)).ToList(), options, registry, @@ -134,7 +134,7 @@ public RelationshipResolver(RelationshipResolverOptions options, IRegistryQuerie /// Creates a new resolver that will find a way to install all the modules specified. /// public RelationshipResolver(IEnumerable modules, RelationshipResolverOptions options, IRegistryQuerier registry, - KspVersion kspversion):this(options,registry,kspversion) + KspVersionCriteria kspversion):this(options,registry,kspversion) { AddModulesToInstall(modules); } diff --git a/Core/Types/CkanModule.cs b/Core/Types/CkanModule.cs index 2a0af64009..528c4abb04 100644 --- a/Core/Types/CkanModule.cs +++ b/Core/Types/CkanModule.cs @@ -416,7 +416,7 @@ private static bool validate_json_against_schema(string json) /// Tries to parse an identifier in the format Modname=version /// If the module cannot be found in the registry, throws a ModuleNotFoundKraken. /// - public static CkanModule FromIDandVersion(IRegistryQuerier registry, string mod, KspVersion ksp_version) + public static CkanModule FromIDandVersion(IRegistryQuerier registry, string mod, KspVersionCriteria ksp_version) { CkanModule module; @@ -498,20 +498,12 @@ internal static bool UniConflicts(CkanModule mod1, CkanModule mod2) mod1.conflicts.Any( conflict => mod2.ProvidesList.Contains(conflict.name) && conflict.version_within_bounds(mod2.version)); - } - - /// - /// Returns true if our mod is compatible with the KSP version specified. - /// - public bool IsCompatibleKSP(string version) - { - return IsCompatibleKSP(KspVersion.Parse(version)); - } + } /// /// Returns true if our mod is compatible with the KSP version specified. /// - public bool IsCompatibleKSP(KspVersion version) + public bool IsCompatibleKSP(KspVersionCriteria version) { log.DebugFormat("Testing if {0} is compatible with KSP {1}", this, version); diff --git a/Core/Types/GameComparator/BaseGameComparator.cs b/Core/Types/GameComparator/BaseGameComparator.cs new file mode 100644 index 0000000000..12e4766ac7 --- /dev/null +++ b/Core/Types/GameComparator/BaseGameComparator.cs @@ -0,0 +1,27 @@ +using CKAN.Versioning; + +namespace CKAN +{ + public abstract class BaseGameComparator: IGameComparator + { + public BaseGameComparator () + { + } + + public virtual bool Compatible (KspVersionCriteria gameVersionCriteria, CkanModule module) + { + if(gameVersionCriteria.Versions.Count == 0) + { + return true; + } + foreach (KspVersion gameVersion in gameVersionCriteria.Versions) { + if (SingleVersionsCompatible (gameVersion, module)) { + return true; + } + } + return false; + } + + public abstract bool SingleVersionsCompatible (KspVersion gameVersionCriteria, CkanModule module); + } +} diff --git a/Core/Types/GameComparator/GrasGameComparator.cs b/Core/Types/GameComparator/GrasGameComparator.cs index bfb2518655..f73275eca2 100644 --- a/Core/Types/GameComparator/GrasGameComparator.cs +++ b/Core/Types/GameComparator/GrasGameComparator.cs @@ -7,15 +7,15 @@ namespace CKAN /// with extra understanding of which KSP versions are "safe" (ie: 1.0.5 mostly works with 1.0.4 mods). /// If the mod has `ksp_version_strict` set then this is identical to strict checking. /// - public class GrasGameComparator : IGameComparator + public class GrasGameComparator : BaseGameComparator { - static readonly StrictGameComparator strict = new StrictGameComparator(); - static readonly KspVersion v103 = KspVersion.Parse("1.0.3"); + static readonly StrictGameComparator strict = new StrictGameComparator (); + static readonly KspVersion v103 = KspVersion.Parse ("1.0.3"); - public bool Compatible(KspVersion gameVersion, CkanModule module) + public override bool Compatible (KspVersionCriteria gameVersionCriteria, CkanModule module) { // If it's strictly compatible, then it's compatible. - if (strict.Compatible(gameVersion, module)) + if (strict.Compatible (gameVersionCriteria, module)) return true; // If we're in strict mode, and it's not strictly compatible, then it's @@ -23,12 +23,17 @@ public bool Compatible(KspVersion gameVersion, CkanModule module) if (module.ksp_version_strict) return false; + return base.Compatible (gameVersionCriteria, module); + } + + 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.Compatible(v103, module); + if (gameVersion.Equals (KspVersion.Parse ("1.0.4"))) + return strict.SingleVersionsCompatible (v103, module); return false; } diff --git a/Core/Types/GameComparator/IGameComparator.cs b/Core/Types/GameComparator/IGameComparator.cs index 79e660b71f..c8ca2cfb1c 100644 --- a/Core/Types/GameComparator/IGameComparator.cs +++ b/Core/Types/GameComparator/IGameComparator.cs @@ -11,7 +11,7 @@ public interface IGameComparator /// Returns true if the given module is compatible with the supplied /// gameVersion, false otherwise. /// - bool Compatible(KspVersion gameVersion, CkanModule module); + bool Compatible(KspVersionCriteria gameVersion, CkanModule module); } } diff --git a/Core/Types/GameComparator/StrictGameComparator.cs b/Core/Types/GameComparator/StrictGameComparator.cs index 0049d8195f..330af5af38 100644 --- a/Core/Types/GameComparator/StrictGameComparator.cs +++ b/Core/Types/GameComparator/StrictGameComparator.cs @@ -1,4 +1,5 @@ using CKAN.Versioning; +using System; namespace CKAN { @@ -6,9 +7,9 @@ namespace CKAN /// Test to see if a module is compatible with the user's installed game, /// using strict tests. /// - public class StrictGameComparator : IGameComparator + public class StrictGameComparator : BaseGameComparator { - public bool Compatible(KspVersion gameVersion, CkanModule module) + public override bool SingleVersionsCompatible(KspVersion gameVersion, CkanModule module) { var gameVersionRange = gameVersion.ToVersionRange(); @@ -52,7 +53,7 @@ public bool Compatible(KspVersion gameVersion, CkanModule module) return true; } - return moduleRange.IsSupersetOf(gameVersionRange); + return gameVersionRange.IntersectWith(moduleRange) != null; } } } diff --git a/Core/Types/GameComparator/YoyoGameComparator.cs b/Core/Types/GameComparator/YoyoGameComparator.cs index 8824cd43fb..77d18d8280 100644 --- a/Core/Types/GameComparator/YoyoGameComparator.cs +++ b/Core/Types/GameComparator/YoyoGameComparator.cs @@ -8,7 +8,7 @@ namespace CKAN /// public class YoyoGameComparator : IGameComparator { - public bool Compatible(KspVersion gameVersion, CkanModule module) + public bool Compatible(KspVersionCriteria gameVersion, CkanModule module) { return true; } diff --git a/Core/Versioning/KspVersionBound.cs b/Core/Versioning/KspVersionBound.cs index 1240fee81f..05b01e812b 100644 --- a/Core/Versioning/KspVersionBound.cs +++ b/Core/Versioning/KspVersionBound.cs @@ -1,4 +1,5 @@ using System; +using System.Linq; namespace CKAN.Versioning { @@ -72,4 +73,57 @@ public override int GetHashCode() return !Equals(left, right); } } + + public sealed partial class KspVersionBound + { + /// + /// Returns the lowest of a set of objects. Analagous to + /// but does not produce a stable sort because in the event of a + /// tie inclusive bounds are treated as both lower and higher than equivalent exclusive bounds. + /// + /// The set of objects to compare. + /// The lowest value in . + public static KspVersionBound Lowest(params KspVersionBound[] versionBounds) + { + if (versionBounds == null) + throw new ArgumentNullException("versionBounds"); + + if (!versionBounds.Any()) + throw new ArgumentException("Value cannot be empty.", "versionBounds"); + + if (versionBounds.Any(i => i == null)) + throw new ArgumentException("Value cannot contain null.", "versionBounds"); + + return versionBounds + .OrderBy(i => i == Unbounded) + .ThenBy(i => i.Value) + .ThenBy(i => i.Inclusive) + .First(); + } + + /// + /// Returns the highest of a set of objects. Analagous to + /// but does not produce a stable sort because in the event of a + /// tie inclusive bounds are treated as both lower and higher than equivalent exclusive bounds. + /// + /// The set of objects to compare. + /// The highest value in . + public static KspVersionBound Highest(params KspVersionBound[] versionBounds) + { + if (versionBounds == null) + throw new ArgumentNullException("versionBounds"); + + if (!versionBounds.Any()) + throw new ArgumentException("Value cannot be empty.", "versionBounds"); + + if (versionBounds.Any(i => i == null)) + throw new ArgumentException("Value cannot contain null.", "versionBounds"); + + return versionBounds + .OrderBy(i => i == Unbounded) + .ThenByDescending(i => i.Value) + .ThenBy(i => i.Inclusive) + .First(); + } + } } diff --git a/Core/Versioning/KspVersionCriteria.cs b/Core/Versioning/KspVersionCriteria.cs new file mode 100644 index 0000000000..3e53487ebd --- /dev/null +++ b/Core/Versioning/KspVersionCriteria.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +namespace CKAN.Versioning +{ + public class KspVersionCriteria + { + private List _versions = new List (); + + public KspVersionCriteria (KspVersion v) + { + if (v != null) + { + this._versions.Add(v); + } + } + + public KspVersionCriteria(KspVersion v, List compatibleVersions) + { + if(v != null) + { + this._versions.Add(v); + } + this._versions.AddRange(compatibleVersions); + this._versions = this._versions.Distinct().ToList(); + } + + public IList Versions { + get + { + return _versions.AsReadOnly(); + } + } + + public override String ToString() + { + return "[Versions: " + _versions.ToString() + "]"; + } + } +} diff --git a/Core/Versioning/KspVersionRange.cs b/Core/Versioning/KspVersionRange.cs index e69609d393..0842c26bbe 100644 --- a/Core/Versioning/KspVersionRange.cs +++ b/Core/Versioning/KspVersionRange.cs @@ -32,6 +32,17 @@ public override string ToString() return _string; } + public KspVersionRange IntersectWith(KspVersionRange other) + { + if (ReferenceEquals(other, null)) + throw new ArgumentNullException("other"); + + var highestLow = KspVersionBound.Highest(Lower, other.Lower); + var lowestHigh = KspVersionBound.Lowest(Upper, other.Upper); + + return IsEmpty(highestLow, lowestHigh) ? null : new KspVersionRange(highestLow, lowestHigh); + } + public bool IsSupersetOf(KspVersionRange other) { if (ReferenceEquals(other, null)) @@ -48,6 +59,12 @@ public bool IsSupersetOf(KspVersionRange other) return lowerIsOkay && upperIsOkay; } + private static bool IsEmpty(KspVersionBound lower, KspVersionBound upper) + { + return upper.Value < lower.Value || + (lower.Value == upper.Value && (!lower.Inclusive || !upper.Inclusive)); + } + private static string DeriveString(KspVersionRange versionRange) { var sb = new StringBuilder(); diff --git a/GUI/CKAN-GUI.csproj b/GUI/CKAN-GUI.csproj index bf181777dd..cf487e388c 100644 --- a/GUI/CKAN-GUI.csproj +++ b/GUI/CKAN-GUI.csproj @@ -37,6 +37,9 @@ true + + ..\packages\Autofac.3.5.2\lib\net40\Autofac.dll + packages\ini-parser.2.1.1\lib\INIFileParser.dll @@ -60,12 +63,6 @@ - - Form - - - AboutDialog.cs - Form @@ -106,6 +103,12 @@ KSPCommandLineOptionsDialog.cs + + Form + + + CompatibleKspVersionsDialog.cs + Form @@ -195,6 +198,9 @@ KSPCommandLineOptionsDialog.cs + + CompatibleKspVersionsDialog.cs + Main.cs Designer @@ -240,6 +246,12 @@ Component + + Form + + + AboutDialog.cs + @@ -306,4 +318,4 @@ - + \ No newline at end of file diff --git a/GUI/CompatibleKspVersionsDialog.Designer.cs b/GUI/CompatibleKspVersionsDialog.Designer.cs new file mode 100644 index 0000000000..a92b500381 --- /dev/null +++ b/GUI/CompatibleKspVersionsDialog.Designer.cs @@ -0,0 +1,251 @@ +namespace CKAN +{ + partial class CompatibleKspVersionsDialog + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.GameVersionLabel = new System.Windows.Forms.Label(); + this.SelectedVersionsCheckedListBox = new System.Windows.Forms.CheckedListBox(); + this.ClearSelectionButton = new System.Windows.Forms.Button(); + this.AddVersionToListButton = new System.Windows.Forms.Button(); + this.label5 = new System.Windows.Forms.Label(); + this.AddVersionToListTextBox = new System.Windows.Forms.TextBox(); + this.label6 = new System.Windows.Forms.Label(); + this.label7 = new System.Windows.Forms.Label(); + this.SaveButton = new System.Windows.Forms.Button(); + this.label8 = new System.Windows.Forms.Label(); + this.GameLocationLabel = new System.Windows.Forms.Label(); + this.CancelChooseCompatibleVersionsButton = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(11, 54); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(306, 13); + this.label1.TabIndex = 0; + this.label1.Text = "Additionally install mods compatible with following KSP versions:"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(11, 32); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(75, 13); + this.label2.TabIndex = 1; + this.label2.Text = "Game version:"; + // + // label3 + // + this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.label3.ForeColor = System.Drawing.Color.Red; + this.label3.Location = new System.Drawing.Point(9, 296); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(401, 32); + this.label3.TabIndex = 2; + this.label3.Text = "Warning! There is no way to check if mod is trully compatible with versions selec" + + "ted here! Please act carefully."; + // + // gameVersionLabel + // + this.GameVersionLabel.AutoSize = true; + this.GameVersionLabel.Location = new System.Drawing.Point(86, 32); + this.GameVersionLabel.Name = "gameVersionLabel"; + this.GameVersionLabel.Size = new System.Drawing.Size(53, 13); + this.GameVersionLabel.TabIndex = 3; + this.GameVersionLabel.Text = ""; + // + // selectedVersionsCheckedListBox + // + this.SelectedVersionsCheckedListBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.SelectedVersionsCheckedListBox.CheckOnClick = true; + this.SelectedVersionsCheckedListBox.FormattingEnabled = true; + this.SelectedVersionsCheckedListBox.Location = new System.Drawing.Point(12, 79); + this.SelectedVersionsCheckedListBox.Name = "selectedVersionsCheckedListBox"; + this.SelectedVersionsCheckedListBox.Size = new System.Drawing.Size(406, 124); + this.SelectedVersionsCheckedListBox.TabIndex = 4; + // + // clearSelectionButton + // + this.ClearSelectionButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.ClearSelectionButton.Location = new System.Drawing.Point(12, 211); + this.ClearSelectionButton.Name = "clearSelectionButton"; + this.ClearSelectionButton.Size = new System.Drawing.Size(92, 23); + this.ClearSelectionButton.TabIndex = 5; + this.ClearSelectionButton.Text = "Clear selection"; + this.ClearSelectionButton.UseVisualStyleBackColor = true; + this.ClearSelectionButton.Click += new System.EventHandler(this.ClearSelectionButton_Click); + // + // addVersionToListButton + // + this.AddVersionToListButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.AddVersionToListButton.Location = new System.Drawing.Point(343, 209); + this.AddVersionToListButton.Name = "addVersionToListButton"; + this.AddVersionToListButton.Size = new System.Drawing.Size(75, 23); + this.AddVersionToListButton.TabIndex = 6; + this.AddVersionToListButton.Text = "Add"; + this.AddVersionToListButton.UseVisualStyleBackColor = true; + this.AddVersionToListButton.Click += new System.EventHandler(this.AddVersionToListButton_Click); + // + // label5 + // + this.label5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(106, 216); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(93, 13); + this.label5.TabIndex = 7; + this.label5.Text = "Add version to list:"; + // + // addVersionToListTextBox + // + this.AddVersionToListTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.AddVersionToListTextBox.Location = new System.Drawing.Point(206, 211); + this.AddVersionToListTextBox.Name = "addVersionToListTextBox"; + this.AddVersionToListTextBox.Size = new System.Drawing.Size(131, 20); + this.AddVersionToListTextBox.TabIndex = 8; + // + // label6 + // + this.label6.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.label6.Location = new System.Drawing.Point(9, 240); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(422, 32); + this.label6.TabIndex = 9; + this.label6.Text = "Note: if you add version like \"1.2\" you will force all mods compatible with 1.2.x" + + "x (1.2.0, 1.2.1, etc) to be compatible with this KSP installation"; + // + // label7 + // + this.label7.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.label7.AutoSize = true; + this.label7.Location = new System.Drawing.Point(9, 273); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(382, 13); + this.label7.TabIndex = 10; + this.label7.Text = "If KSP is updated this dialog will be shown again so you can adjust your settings" + + ""; + // + // saveButton + // + this.SaveButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.SaveButton.Location = new System.Drawing.Point(362, 331); + this.SaveButton.Name = "saveButton"; + this.SaveButton.Size = new System.Drawing.Size(75, 23); + this.SaveButton.TabIndex = 11; + this.SaveButton.Text = "Save"; + this.SaveButton.UseVisualStyleBackColor = true; + this.SaveButton.Click += new System.EventHandler(this.SaveButton_Click); + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Location = new System.Drawing.Point(12, 11); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(60, 13); + this.label8.TabIndex = 12; + this.label8.Text = "Installation:"; + // + // gameLocationLabel + // + this.GameLocationLabel.AutoSize = true; + this.GameLocationLabel.Location = new System.Drawing.Point(69, 11); + this.GameLocationLabel.Name = "gameLocationLabel"; + this.GameLocationLabel.Size = new System.Drawing.Size(56, 13); + this.GameLocationLabel.TabIndex = 13; + this.GameLocationLabel.Text = ""; + // + // cancelButton + // + this.CancelChooseCompatibleVersionsButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.CancelChooseCompatibleVersionsButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.CancelChooseCompatibleVersionsButton.Location = new System.Drawing.Point(281, 331); + this.CancelChooseCompatibleVersionsButton.Name = "cancelButton"; + this.CancelChooseCompatibleVersionsButton.Size = new System.Drawing.Size(75, 23); + this.CancelChooseCompatibleVersionsButton.TabIndex = 14; + this.CancelChooseCompatibleVersionsButton.Text = "Cancel"; + this.CancelChooseCompatibleVersionsButton.UseVisualStyleBackColor = true; + this.CancelChooseCompatibleVersionsButton.Click += new System.EventHandler(this.CancelButton_Click); + // + // CompatibleKspVersionsDialog + // + this.AcceptButton = this.SaveButton; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.CancelChooseCompatibleVersionsButton; + this.ClientSize = new System.Drawing.Size(443, 364); + this.ControlBox = false; + this.Controls.Add(this.CancelChooseCompatibleVersionsButton); + this.Controls.Add(this.GameLocationLabel); + this.Controls.Add(this.label8); + this.Controls.Add(this.SaveButton); + this.Controls.Add(this.label7); + this.Controls.Add(this.label6); + this.Controls.Add(this.AddVersionToListTextBox); + this.Controls.Add(this.label5); + this.Controls.Add(this.AddVersionToListButton); + this.Controls.Add(this.ClearSelectionButton); + this.Controls.Add(this.SelectedVersionsCheckedListBox); + this.Controls.Add(this.GameVersionLabel); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.MaximizeBox = false; + this.Name = "CompatibleKspVersionsDialog"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Compatible Ksp Versions"; + this.Shown += new System.EventHandler(this.CompatibleKspVersionsDialog_Shown); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label GameVersionLabel; + private System.Windows.Forms.CheckedListBox SelectedVersionsCheckedListBox; + private System.Windows.Forms.Button ClearSelectionButton; + private System.Windows.Forms.Button AddVersionToListButton; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.TextBox AddVersionToListTextBox; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.Button SaveButton; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.Label GameLocationLabel; + private System.Windows.Forms.Button CancelChooseCompatibleVersionsButton; + } +} \ No newline at end of file diff --git a/GUI/CompatibleKspVersionsDialog.cs b/GUI/CompatibleKspVersionsDialog.cs new file mode 100644 index 0000000000..6cdc2c3cd6 --- /dev/null +++ b/GUI/CompatibleKspVersionsDialog.cs @@ -0,0 +1,115 @@ +using CKAN.GameVersionProviders; +using System.Windows.Forms; +using System.Collections.Generic; +using Autofac; +using CKAN.Versioning; +using System; + +namespace CKAN +{ + public partial class CompatibleKspVersionsDialog : Form + { + private KSP _ksp; + + public CompatibleKspVersionsDialog(KSP ksp) + { + + this._ksp = ksp; + InitializeComponent(); + + List compatibleVersions = ksp.GetCompatibleVersions(); + + GameVersionLabel.Text = ksp.Version().ToString(); + GameLocationLabel.Text = ksp.GameDir(); + List knownVersions = new List(ServiceLocator.Container.Resolve().KnownVersions); + List majorVersionsList = CreateMajorVersionsList(knownVersions); + List compatibleVersionsLeftOthers = new List(compatibleVersions); + compatibleVersionsLeftOthers.RemoveAll((el)=>knownVersions.Contains(el) || majorVersionsList.Contains(el)); + + SortAndAddVersionsToList(compatibleVersionsLeftOthers, compatibleVersions); + SortAndAddVersionsToList(majorVersionsList, compatibleVersions); + SortAndAddVersionsToList(knownVersions, compatibleVersions); + } + + private void CompatibleKspVersionsDialog_Shown(object sender, EventArgs e) + { + if (_ksp.CompatibleVersionsAreFromDifferentKsp) + { + MessageBox.Show("KSP has been updated since you last reviewed your compatible KSP versions. Please make sure that settings are correct."); + CancelChooseCompatibleVersionsButton.Visible = false; + GameVersionLabel.Text = _ksp.Version().ToString() + " (previous game version: " + _ksp.VersionOfKspWhenCompatibleVersionsWereStored + ")"; + GameVersionLabel.ForeColor = System.Drawing.Color.Red; + } + } + + private static List CreateMajorVersionsList(List knownVersions) + { + Dictionary majorVersions = new Dictionary(); + foreach (var version in knownVersions) + { + KspVersion fullKnownVersion = version.ToVersionRange().Lower.Value; + KspVersion toAdd = new KspVersion(fullKnownVersion.Major, fullKnownVersion.Minor); + if (!majorVersions.ContainsKey(toAdd)) + { + majorVersions.Add(toAdd, true); + } + } + return new List(majorVersions.Keys); + } + + private void SortAndAddVersionsToList(List versions, List compatibleVersions) + { + versions.Sort(); + versions.Reverse(); + foreach (var version in versions) + { + if (!version.Equals(_ksp.Version())) + { + SelectedVersionsCheckedListBox.Items.Add(version, compatibleVersions.Contains(version)); + } + } + } + + private void AddVersionToListButton_Click(object sender, System.EventArgs e) + { + if(AddVersionToListTextBox.Text.Length == 0) + { + return; + } + try + { + var version = KspVersion.Parse(AddVersionToListTextBox.Text); + SelectedVersionsCheckedListBox.Items.Insert(0, version); + } + catch(FormatException) + { + MessageBox.Show("Version has invalid format", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ClearSelectionButton_Click(object sender, EventArgs e) + { + foreach (int index in SelectedVersionsCheckedListBox.CheckedIndices) + { + SelectedVersionsCheckedListBox.SetItemChecked(index, false); + } + } + + private void CancelButton_Click(object sender, EventArgs e) + { + this.Close(); + } + + private void SaveButton_Click(object sender, EventArgs e) + { + List selectedVersion = new List(); + foreach (KspVersion item in SelectedVersionsCheckedListBox.CheckedItems) + { + selectedVersion.Add(item); + } + _ksp.SetCompatibleVersions(selectedVersion); + + this.Close(); + } + } +} diff --git a/GUI/CompatibleKspVersionsDialog.resx b/GUI/CompatibleKspVersionsDialog.resx new file mode 100644 index 0000000000..1af7de150c --- /dev/null +++ b/GUI/CompatibleKspVersionsDialog.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/GUI/GUIMod.cs b/GUI/GUIMod.cs index 2ca1cfbe85..e7ae4ea8db 100644 --- a/GUI/GUIMod.cs +++ b/GUI/GUIMod.cs @@ -47,7 +47,7 @@ public string Version get { return IsInstalled ? InstalledVersion : LatestVersion; } } - public GUIMod(CkanModule mod, IRegistryQuerier registry, KspVersion current_ksp_version) + 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 diff --git a/GUI/Main.Designer.cs b/GUI/Main.Designer.cs index e076ff8c02..fce85ecd11 100644 --- a/GUI/Main.Designer.cs +++ b/GUI/Main.Designer.cs @@ -141,6 +141,7 @@ private void InitializeComponent() this.columnHeader6 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader8 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.ChooseProvidedModsLabel = new System.Windows.Forms.Label(); + this.compatibleKSPVersionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.reportAnIssueToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.menuStrip1.SuspendLayout(); this.menuStrip2.SuspendLayout(); @@ -167,9 +168,9 @@ private void InitializeComponent() this.ChooseRecommendedModsTabPage.SuspendLayout(); this.ChooseProvidedModsTabPage.SuspendLayout(); this.SuspendLayout(); - // + // // menuStrip1 - // + // this.menuStrip1.ImageScalingSize = new System.Drawing.Size(24, 24); this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.fileToolStripMenuItem, @@ -181,9 +182,9 @@ private void InitializeComponent() this.menuStrip1.Size = new System.Drawing.Size(1544, 35); this.menuStrip1.TabIndex = 0; this.menuStrip1.Text = "menuStrip1"; - // + // // fileToolStripMenuItem - // + // this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.selectKSPInstallMenuItem, this.openKspDirectoryToolStripMenuItem, @@ -194,96 +195,97 @@ private void InitializeComponent() this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; this.fileToolStripMenuItem.Size = new System.Drawing.Size(50, 29); this.fileToolStripMenuItem.Text = "File"; - // + // // selectKSPInstallMenuItem - // + // this.selectKSPInstallMenuItem.Name = "selectKSPInstallMenuItem"; this.selectKSPInstallMenuItem.Size = new System.Drawing.Size(281, 30); this.selectKSPInstallMenuItem.Text = "Select KSP Install..."; this.selectKSPInstallMenuItem.Click += new System.EventHandler(this.selectKSPInstallMenuItem_Click); - // + // // openKspDirectoryToolStripMenuItem - // + // this.openKspDirectoryToolStripMenuItem.Name = "openKspDirectoryToolStripMenuItem"; this.openKspDirectoryToolStripMenuItem.Size = new System.Drawing.Size(281, 30); this.openKspDirectoryToolStripMenuItem.Text = "Open KSP Directory"; this.openKspDirectoryToolStripMenuItem.Click += new System.EventHandler(this.openKspDirectoryToolStripMenuItem_Click); - // + // // installFromckanToolStripMenuItem - // + // this.installFromckanToolStripMenuItem.Name = "installFromckanToolStripMenuItem"; this.installFromckanToolStripMenuItem.Size = new System.Drawing.Size(281, 30); this.installFromckanToolStripMenuItem.Text = "Install from .ckan..."; this.installFromckanToolStripMenuItem.Click += new System.EventHandler(this.installFromckanToolStripMenuItem_Click); - // + // // exportModListToolStripMenuItem - // + // this.exportModListToolStripMenuItem.Name = "exportModListToolStripMenuItem"; this.exportModListToolStripMenuItem.Size = new System.Drawing.Size(281, 30); this.exportModListToolStripMenuItem.Text = "&Export installed mods..."; this.exportModListToolStripMenuItem.Click += new System.EventHandler(this.exportModListToolStripMenuItem_Click); - // + // // toolStripSeparator1 - // + // this.toolStripSeparator1.Name = "toolStripSeparator1"; this.toolStripSeparator1.Size = new System.Drawing.Size(278, 6); - // + // // ExitToolButton - // + // this.ExitToolButton.Name = "ExitToolButton"; this.ExitToolButton.Size = new System.Drawing.Size(281, 30); this.ExitToolButton.Text = "Exit"; this.ExitToolButton.Click += new System.EventHandler(this.ExitToolButton_Click); - // + // // settingsToolStripMenuItem - // + // this.settingsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.cKANSettingsToolStripMenuItem, this.pluginsToolStripMenuItem, - this.kSPCommandlineToolStripMenuItem}); + this.kSPCommandlineToolStripMenuItem, + this.compatibleKSPVersionsToolStripMenuItem}); this.settingsToolStripMenuItem.Name = "settingsToolStripMenuItem"; this.settingsToolStripMenuItem.Size = new System.Drawing.Size(88, 29); this.settingsToolStripMenuItem.Text = "Settings"; - // + // // cKANSettingsToolStripMenuItem - // + // this.cKANSettingsToolStripMenuItem.Name = "cKANSettingsToolStripMenuItem"; this.cKANSettingsToolStripMenuItem.Size = new System.Drawing.Size(247, 30); this.cKANSettingsToolStripMenuItem.Text = "CKAN settings"; this.cKANSettingsToolStripMenuItem.Click += new System.EventHandler(this.CKANSettingsToolStripMenuItem_Click); - // + // // pluginsToolStripMenuItem - // + // this.pluginsToolStripMenuItem.Name = "pluginsToolStripMenuItem"; this.pluginsToolStripMenuItem.Size = new System.Drawing.Size(247, 30); this.pluginsToolStripMenuItem.Text = "CKAN plugins"; this.pluginsToolStripMenuItem.Click += new System.EventHandler(this.pluginsToolStripMenuItem_Click); - // + // // kSPCommandlineToolStripMenuItem - // + // this.kSPCommandlineToolStripMenuItem.Name = "kSPCommandlineToolStripMenuItem"; this.kSPCommandlineToolStripMenuItem.Size = new System.Drawing.Size(247, 30); this.kSPCommandlineToolStripMenuItem.Text = "KSP command-line"; this.kSPCommandlineToolStripMenuItem.Click += new System.EventHandler(this.KSPCommandlineToolStripMenuItem_Click); - // + // // helpToolStripMenuItem - // + // this.helpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.reportAnIssueToolStripMenuItem, this.aboutToolStripMenuItem}); this.helpToolStripMenuItem.Name = "helpToolStripMenuItem"; this.helpToolStripMenuItem.Size = new System.Drawing.Size(61, 29); this.helpToolStripMenuItem.Text = "Help"; - // + // // aboutToolStripMenuItem - // + // this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem"; this.aboutToolStripMenuItem.Size = new System.Drawing.Size(230, 30); this.aboutToolStripMenuItem.Text = "About"; this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click); - // + // // statusStrip1 - // + // this.statusStrip1.ImageScalingSize = new System.Drawing.Size(24, 24); this.statusStrip1.Location = new System.Drawing.Point(0, 1016); this.statusStrip1.Name = "statusStrip1"; @@ -291,10 +293,10 @@ private void InitializeComponent() this.statusStrip1.Size = new System.Drawing.Size(1544, 22); this.statusStrip1.TabIndex = 1; this.statusStrip1.Text = "statusStrip1"; - // + // // menuStrip2 - // - this.menuStrip2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + // + this.menuStrip2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.menuStrip2.AutoSize = false; this.menuStrip2.BackColor = System.Drawing.SystemColors.Control; @@ -314,45 +316,45 @@ private void InitializeComponent() this.menuStrip2.Size = new System.Drawing.Size(5876, 62); this.menuStrip2.TabIndex = 2; this.menuStrip2.Text = "menuStrip2"; - // + // // launchKSPToolStripMenuItem - // + // this.launchKSPToolStripMenuItem.Image = global::CKAN.Properties.Resources.ksp; this.launchKSPToolStripMenuItem.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; this.launchKSPToolStripMenuItem.Name = "launchKSPToolStripMenuItem"; this.launchKSPToolStripMenuItem.Size = new System.Drawing.Size(146, 56); this.launchKSPToolStripMenuItem.Text = "Launch KSP"; this.launchKSPToolStripMenuItem.Click += new System.EventHandler(this.launchKSPToolStripMenuItem_Click); - // + // // RefreshToolButton - // + // this.RefreshToolButton.Image = global::CKAN.Properties.Resources.refresh; this.RefreshToolButton.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; this.RefreshToolButton.Name = "RefreshToolButton"; this.RefreshToolButton.Size = new System.Drawing.Size(114, 56); this.RefreshToolButton.Text = "Refresh"; this.RefreshToolButton.Click += new System.EventHandler(this.RefreshToolButton_Click); - // + // // UpdateAllToolButton - // + // this.UpdateAllToolButton.Image = global::CKAN.Properties.Resources.update; this.UpdateAllToolButton.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; this.UpdateAllToolButton.Name = "UpdateAllToolButton"; this.UpdateAllToolButton.Size = new System.Drawing.Size(232, 56); this.UpdateAllToolButton.Text = "Add available updates"; this.UpdateAllToolButton.Click += new System.EventHandler(this.MarkAllUpdatesToolButton_Click); - // + // // ApplyToolButton - // + // this.ApplyToolButton.Image = global::CKAN.Properties.Resources.apply; this.ApplyToolButton.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; this.ApplyToolButton.Name = "ApplyToolButton"; this.ApplyToolButton.Size = new System.Drawing.Size(173, 56); this.ApplyToolButton.Text = "Apply changes"; this.ApplyToolButton.Click += new System.EventHandler(this.ApplyToolButton_Click); - // + // // FilterToolButton - // + // this.FilterToolButton.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.FilterCompatibleButton, this.FilterInstalledButton, @@ -367,105 +369,105 @@ private void InitializeComponent() this.FilterToolButton.Name = "FilterToolButton"; this.FilterToolButton.Size = new System.Drawing.Size(201, 56); this.FilterToolButton.Text = "Filter (Compatible)"; - // + // // FilterCompatibleButton - // + // this.FilterCompatibleButton.Name = "FilterCompatibleButton"; this.FilterCompatibleButton.Size = new System.Drawing.Size(307, 30); this.FilterCompatibleButton.Text = "Compatible"; this.FilterCompatibleButton.Click += new System.EventHandler(this.FilterCompatibleButton_Click); - // + // // FilterInstalledButton - // + // this.FilterInstalledButton.Name = "FilterInstalledButton"; this.FilterInstalledButton.Size = new System.Drawing.Size(307, 30); this.FilterInstalledButton.Text = "Installed"; this.FilterInstalledButton.Click += new System.EventHandler(this.FilterInstalledButton_Click); - // + // // FilterInstalledUpdateButton - // + // this.FilterInstalledUpdateButton.Name = "FilterInstalledUpdateButton"; this.FilterInstalledUpdateButton.Size = new System.Drawing.Size(307, 30); this.FilterInstalledUpdateButton.Text = "Installed (update available)"; this.FilterInstalledUpdateButton.Click += new System.EventHandler(this.FilterInstalledUpdateButton_Click); - // + // // cachedToolStripMenuItem - // + // this.cachedToolStripMenuItem.Name = "cachedToolStripMenuItem"; this.cachedToolStripMenuItem.Size = new System.Drawing.Size(307, 30); this.cachedToolStripMenuItem.Text = "Cached"; this.cachedToolStripMenuItem.Click += new System.EventHandler(this.cachedToolStripMenuItem_Click); - // + // // FilterNewButton - // + // this.FilterNewButton.Name = "FilterNewButton"; this.FilterNewButton.Size = new System.Drawing.Size(307, 30); this.FilterNewButton.Text = "New in repository"; this.FilterNewButton.Click += new System.EventHandler(this.FilterNewButton_Click); - // + // // FilterNotInstalledButton - // + // this.FilterNotInstalledButton.Name = "FilterNotInstalledButton"; this.FilterNotInstalledButton.Size = new System.Drawing.Size(307, 30); this.FilterNotInstalledButton.Text = "Not installed"; this.FilterNotInstalledButton.Click += new System.EventHandler(this.FilterNotInstalledButton_Click); - // + // // FilterIncompatibleButton - // + // this.FilterIncompatibleButton.Name = "FilterIncompatibleButton"; this.FilterIncompatibleButton.Size = new System.Drawing.Size(307, 30); this.FilterIncompatibleButton.Text = "Incompatible"; this.FilterIncompatibleButton.Click += new System.EventHandler(this.FilterIncompatibleButton_Click); - // + // // FilterAllButton - // + // this.FilterAllButton.Name = "FilterAllButton"; this.FilterAllButton.Size = new System.Drawing.Size(307, 30); this.FilterAllButton.Text = "All"; this.FilterAllButton.Click += new System.EventHandler(this.FilterAllButton_Click); - // + // // NavBackwardToolButton - // + // this.NavBackwardToolButton.Image = global::CKAN.Properties.Resources.backward; this.NavBackwardToolButton.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; this.NavBackwardToolButton.Name = "NavBackwardToolButton"; this.NavBackwardToolButton.Size = new System.Drawing.Size(44, 56); this.NavBackwardToolButton.ToolTipText = "Previous selected mod..."; this.NavBackwardToolButton.Click += new System.EventHandler(this.NavBackwardToolButton_Click); - // + // // NavForwardToolButton - // + // this.NavForwardToolButton.Image = global::CKAN.Properties.Resources.forward; this.NavForwardToolButton.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; this.NavForwardToolButton.Name = "NavForwardToolButton"; this.NavForwardToolButton.Size = new System.Drawing.Size(44, 56); this.NavForwardToolButton.ToolTipText = "Next selected mod..."; this.NavForwardToolButton.Click += new System.EventHandler(this.NavForwardToolButton_Click); - // + // // splitContainer1 - // - this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) + // + this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel2; this.splitContainer1.Location = new System.Drawing.Point(0, 111); this.splitContainer1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.splitContainer1.Name = "splitContainer1"; - // + // // splitContainer1.Panel1 - // + // this.splitContainer1.Panel1.Controls.Add(this.ModList); - // + // // splitContainer1.Panel2 - // + // this.splitContainer1.Panel2.Controls.Add(this.ModInfoTabControl); this.splitContainer1.Size = new System.Drawing.Size(1522, 836); this.splitContainer1.SplitterDistance = 1156; this.splitContainer1.SplitterWidth = 6; this.splitContainer1.TabIndex = 7; - // + // // ModList - // + // this.ModList.AllowUserToAddRows = false; this.ModList.AllowUserToDeleteRows = false; this.ModList.AllowUserToResizeRows = false; @@ -498,78 +500,78 @@ private void InitializeComponent() this.ModList.SelectionChanged += new System.EventHandler(this.ModList_SelectedIndexChanged); this.ModList.KeyDown += new System.Windows.Forms.KeyEventHandler(this.ModList_KeyDown); this.ModList.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.ModList_KeyPress); - // + // // Installed - // + // this.Installed.HeaderText = "Installed"; this.Installed.Name = "Installed"; this.Installed.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Programmatic; this.Installed.Width = 50; - // + // // UpdateCol - // + // this.UpdateCol.HeaderText = "Update"; this.UpdateCol.Name = "Update"; this.UpdateCol.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Programmatic; this.UpdateCol.Width = 46; - // + // // ModName - // + // this.ModName.HeaderText = "Name"; this.ModName.Name = "ModName"; this.ModName.ReadOnly = true; this.ModName.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Programmatic; this.ModName.Width = 250; - // + // // Author - // + // this.Author.HeaderText = "Author"; this.Author.Name = "Author"; this.Author.ReadOnly = true; this.Author.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Programmatic; this.Author.Width = 120; - // + // // InstalledVersion - // + // this.InstalledVersion.HeaderText = "Installed version"; this.InstalledVersion.Name = "InstalledVersion"; this.InstalledVersion.ReadOnly = true; this.InstalledVersion.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Programmatic; this.InstalledVersion.Width = 70; - // + // // LatestVersion - // + // this.LatestVersion.HeaderText = "Latest version"; this.LatestVersion.Name = "LatestVersion"; this.LatestVersion.ReadOnly = true; this.LatestVersion.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Programmatic; this.LatestVersion.Width = 70; - // + // // KSPCompatibility - // + // this.KSPCompatibility.HeaderText = "Max KSP version"; this.KSPCompatibility.Name = "KSPCompatibility"; this.KSPCompatibility.ReadOnly = true; this.KSPCompatibility.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Programmatic; this.KSPCompatibility.Width = 78; - // + // // SizeCol - // + // this.SizeCol.HeaderText = "Download (KB)"; this.SizeCol.Name = "SizeCol"; this.SizeCol.ReadOnly = true; this.SizeCol.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Programmatic; - // + // // Description - // + // this.Description.HeaderText = "Description"; this.Description.Name = "Description"; this.Description.ReadOnly = true; this.Description.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Programmatic; this.Description.Width = 821; - // + // // ModInfoTabControl - // + // this.ModInfoTabControl.Appearance = System.Windows.Forms.TabAppearance.FlatButtons; this.ModInfoTabControl.Controls.Add(this.MetadataTabPage); this.ModInfoTabControl.Controls.Add(this.RelationshipTabPage); @@ -582,9 +584,9 @@ private void InitializeComponent() this.ModInfoTabControl.Size = new System.Drawing.Size(360, 836); this.ModInfoTabControl.TabIndex = 0; this.ModInfoTabControl.SelectedIndexChanged += new System.EventHandler(this.ModInfoIndexChanged); - // + // // MetadataTabPage - // + // this.MetadataTabPage.Controls.Add(this.splitContainer2); this.MetadataTabPage.Location = new System.Drawing.Point(4, 32); this.MetadataTabPage.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); @@ -594,30 +596,30 @@ private void InitializeComponent() this.MetadataTabPage.TabIndex = 0; this.MetadataTabPage.Text = "Metadata"; this.MetadataTabPage.UseVisualStyleBackColor = true; - // + // // splitContainer2 - // + // this.splitContainer2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill; this.splitContainer2.Location = new System.Drawing.Point(4, 5); this.splitContainer2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.splitContainer2.Name = "splitContainer2"; this.splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal; - // + // // splitContainer2.Panel1 - // + // this.splitContainer2.Panel1.Controls.Add(this.MetaDataUpperLayoutPanel); - // + // // splitContainer2.Panel2 - // + // this.splitContainer2.Panel2.Controls.Add(this.MetaDataLowerLayoutPanel); this.splitContainer2.Size = new System.Drawing.Size(344, 790); this.splitContainer2.SplitterDistance = 379; this.splitContainer2.SplitterWidth = 6; this.splitContainer2.TabIndex = 0; - // + // // MetaDataUpperLayoutPanel - // + // this.MetaDataUpperLayoutPanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.MetaDataUpperLayoutPanel.ColumnCount = 1; this.MetaDataUpperLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); @@ -632,9 +634,9 @@ private void InitializeComponent() this.MetaDataUpperLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 80F)); this.MetaDataUpperLayoutPanel.Size = new System.Drawing.Size(342, 377); this.MetaDataUpperLayoutPanel.TabIndex = 0; - // + // // MetadataModuleNameLabel - // + // this.MetadataModuleNameLabel.Dock = System.Windows.Forms.DockStyle.Fill; this.MetadataModuleNameLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.MetadataModuleNameLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); @@ -645,9 +647,9 @@ private void InitializeComponent() this.MetadataModuleNameLabel.TabIndex = 0; this.MetadataModuleNameLabel.Text = "Mod Name"; this.MetadataModuleNameLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // + // // MetadataModuleAbstractLabel - // + // this.MetadataModuleAbstractLabel.BorderStyle = System.Windows.Forms.BorderStyle.None; this.MetadataModuleAbstractLabel.Dock = System.Windows.Forms.DockStyle.Fill; this.MetadataModuleAbstractLabel.Location = new System.Drawing.Point(4, 80); @@ -657,9 +659,9 @@ private void InitializeComponent() this.MetadataModuleAbstractLabel.Size = new System.Drawing.Size(334, 292); this.MetadataModuleAbstractLabel.TabIndex = 27; this.MetadataModuleAbstractLabel.Text = ""; - // + // // MetaDataLowerLayoutPanel - // + // this.MetaDataLowerLayoutPanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.MetaDataLowerLayoutPanel.ColumnCount = 2; this.MetaDataLowerLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 26.16279F)); @@ -696,9 +698,9 @@ private void InitializeComponent() this.MetaDataLowerLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); this.MetaDataLowerLayoutPanel.Size = new System.Drawing.Size(342, 403); this.MetaDataLowerLayoutPanel.TabIndex = 0; - // + // // IdentifierLabel - // + // this.IdentifierLabel.AutoSize = true; this.IdentifierLabel.Dock = System.Windows.Forms.DockStyle.Fill; this.IdentifierLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); @@ -708,9 +710,9 @@ private void InitializeComponent() this.IdentifierLabel.Size = new System.Drawing.Size(81, 31); this.IdentifierLabel.TabIndex = 28; this.IdentifierLabel.Text = "Identifier"; - // + // // MetadataIdentifierLabel - // + // this.MetadataIdentifierLabel.AutoSize = true; this.MetadataIdentifierLabel.Dock = System.Windows.Forms.DockStyle.Fill; this.MetadataIdentifierLabel.ForeColor = System.Drawing.Color.Black; @@ -720,9 +722,9 @@ private void InitializeComponent() this.MetadataIdentifierLabel.Size = new System.Drawing.Size(245, 31); this.MetadataIdentifierLabel.TabIndex = 27; this.MetadataIdentifierLabel.Text = "-"; - // + // // KSPCompatibilityLabel - // + // this.KSPCompatibilityLabel.AutoSize = true; this.KSPCompatibilityLabel.Dock = System.Windows.Forms.DockStyle.Fill; this.KSPCompatibilityLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); @@ -732,9 +734,9 @@ private void InitializeComponent() this.KSPCompatibilityLabel.Size = new System.Drawing.Size(81, 46); this.KSPCompatibilityLabel.TabIndex = 13; this.KSPCompatibilityLabel.Text = "Max KSP ver.:"; - // + // // ReleaseLabel - // + // this.ReleaseLabel.AutoSize = true; this.ReleaseLabel.Dock = System.Windows.Forms.DockStyle.Fill; this.ReleaseLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); @@ -744,9 +746,9 @@ private void InitializeComponent() this.ReleaseLabel.Size = new System.Drawing.Size(81, 46); this.ReleaseLabel.TabIndex = 12; this.ReleaseLabel.Text = "Release status:"; - // + // // GitHubLabel - // + // this.GitHubLabel.AutoSize = true; this.GitHubLabel.Dock = System.Windows.Forms.DockStyle.Fill; this.GitHubLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); @@ -756,9 +758,9 @@ private void InitializeComponent() this.GitHubLabel.Size = new System.Drawing.Size(81, 46); this.GitHubLabel.TabIndex = 10; this.GitHubLabel.Text = "Source Code:"; - // + // // HomePageLabel - // + // this.HomePageLabel.AutoSize = true; this.HomePageLabel.Dock = System.Windows.Forms.DockStyle.Fill; this.HomePageLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); @@ -768,9 +770,9 @@ private void InitializeComponent() this.HomePageLabel.Size = new System.Drawing.Size(81, 46); this.HomePageLabel.TabIndex = 7; this.HomePageLabel.Text = "Homepage:"; - // + // // AuthorLabel - // + // this.AuthorLabel.AutoSize = true; this.AuthorLabel.Dock = System.Windows.Forms.DockStyle.Fill; this.AuthorLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); @@ -780,9 +782,9 @@ private void InitializeComponent() this.AuthorLabel.Size = new System.Drawing.Size(81, 46); this.AuthorLabel.TabIndex = 5; this.AuthorLabel.Text = "Author:"; - // + // // LicenseLabel - // + // this.LicenseLabel.AutoSize = true; this.LicenseLabel.Dock = System.Windows.Forms.DockStyle.Fill; this.LicenseLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); @@ -792,9 +794,9 @@ private void InitializeComponent() this.LicenseLabel.Size = new System.Drawing.Size(81, 46); this.LicenseLabel.TabIndex = 3; this.LicenseLabel.Text = "License:"; - // + // // MetadataModuleVersionLabel - // + // this.MetadataModuleVersionLabel.AutoSize = true; this.MetadataModuleVersionLabel.Dock = System.Windows.Forms.DockStyle.Fill; this.MetadataModuleVersionLabel.Location = new System.Drawing.Point(93, 0); @@ -803,9 +805,9 @@ private void InitializeComponent() this.MetadataModuleVersionLabel.Size = new System.Drawing.Size(245, 46); this.MetadataModuleVersionLabel.TabIndex = 2; this.MetadataModuleVersionLabel.Text = "0.0.0"; - // + // // MetadataModuleLicenseLabel - // + // this.MetadataModuleLicenseLabel.AutoSize = true; this.MetadataModuleLicenseLabel.Dock = System.Windows.Forms.DockStyle.Fill; this.MetadataModuleLicenseLabel.Location = new System.Drawing.Point(93, 46); @@ -814,9 +816,9 @@ private void InitializeComponent() this.MetadataModuleLicenseLabel.Size = new System.Drawing.Size(245, 46); this.MetadataModuleLicenseLabel.TabIndex = 4; this.MetadataModuleLicenseLabel.Text = "None"; - // + // // MetadataModuleAuthorLabel - // + // this.MetadataModuleAuthorLabel.AutoSize = true; this.MetadataModuleAuthorLabel.Dock = System.Windows.Forms.DockStyle.Fill; this.MetadataModuleAuthorLabel.Location = new System.Drawing.Point(93, 92); @@ -825,9 +827,9 @@ private void InitializeComponent() this.MetadataModuleAuthorLabel.Size = new System.Drawing.Size(245, 46); this.MetadataModuleAuthorLabel.TabIndex = 6; this.MetadataModuleAuthorLabel.Text = "Nobody"; - // + // // VersionLabel - // + // this.VersionLabel.AutoSize = true; this.VersionLabel.Dock = System.Windows.Forms.DockStyle.Fill; this.VersionLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); @@ -837,9 +839,9 @@ private void InitializeComponent() this.VersionLabel.Size = new System.Drawing.Size(81, 46); this.VersionLabel.TabIndex = 1; this.VersionLabel.Text = "Version:"; - // + // // MetadataModuleReleaseStatusLabel - // + // this.MetadataModuleReleaseStatusLabel.AutoSize = true; this.MetadataModuleReleaseStatusLabel.Dock = System.Windows.Forms.DockStyle.Fill; this.MetadataModuleReleaseStatusLabel.Location = new System.Drawing.Point(93, 230); @@ -848,9 +850,9 @@ private void InitializeComponent() this.MetadataModuleReleaseStatusLabel.Size = new System.Drawing.Size(245, 46); this.MetadataModuleReleaseStatusLabel.TabIndex = 11; this.MetadataModuleReleaseStatusLabel.Text = "Stable"; - // + // // MetadataModuleHomePageLinkLabel - // + // this.MetadataModuleHomePageLinkLabel.AutoEllipsis = true; this.MetadataModuleHomePageLinkLabel.Dock = System.Windows.Forms.DockStyle.Fill; this.MetadataModuleHomePageLinkLabel.Location = new System.Drawing.Point(93, 138); @@ -861,9 +863,9 @@ private void InitializeComponent() this.MetadataModuleHomePageLinkLabel.TabStop = true; this.MetadataModuleHomePageLinkLabel.Text = "linkLabel1"; this.MetadataModuleHomePageLinkLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.LinkLabel_LinkClicked); - // + // // MetadataModuleKSPCompatibilityLabel - // + // this.MetadataModuleKSPCompatibilityLabel.AutoSize = true; this.MetadataModuleKSPCompatibilityLabel.Dock = System.Windows.Forms.DockStyle.Fill; this.MetadataModuleKSPCompatibilityLabel.Location = new System.Drawing.Point(93, 276); @@ -872,9 +874,9 @@ private void InitializeComponent() this.MetadataModuleKSPCompatibilityLabel.Size = new System.Drawing.Size(245, 46); this.MetadataModuleKSPCompatibilityLabel.TabIndex = 14; this.MetadataModuleKSPCompatibilityLabel.Text = "0.0.0"; - // + // // MetadataModuleGitHubLinkLabel - // + // this.MetadataModuleGitHubLinkLabel.AutoEllipsis = true; this.MetadataModuleGitHubLinkLabel.Dock = System.Windows.Forms.DockStyle.Fill; this.MetadataModuleGitHubLinkLabel.Location = new System.Drawing.Point(93, 184); @@ -885,9 +887,9 @@ private void InitializeComponent() this.MetadataModuleGitHubLinkLabel.TabStop = true; this.MetadataModuleGitHubLinkLabel.Text = "linkLabel2"; this.MetadataModuleGitHubLinkLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.LinkLabel_LinkClicked); - // + // // RelationshipTabPage - // + // this.RelationshipTabPage.Controls.Add(this.ModuleRelationshipType); this.RelationshipTabPage.Controls.Add(this.DependsGraphTree); this.RelationshipTabPage.Location = new System.Drawing.Point(4, 32); @@ -898,10 +900,10 @@ private void InitializeComponent() this.RelationshipTabPage.TabIndex = 1; this.RelationshipTabPage.Text = "Relationships"; this.RelationshipTabPage.UseVisualStyleBackColor = true; - // + // // ModuleRelationshipType - // - this.ModuleRelationshipType.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + // + this.ModuleRelationshipType.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.ModuleRelationshipType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.ModuleRelationshipType.FormattingEnabled = true; @@ -917,11 +919,11 @@ private void InitializeComponent() this.ModuleRelationshipType.Size = new System.Drawing.Size(508, 28); this.ModuleRelationshipType.TabIndex = 1; this.ModuleRelationshipType.SelectedIndexChanged += new System.EventHandler(this.ModuleRelationshipType_SelectedIndexChanged); - // + // // DependsGraphTree - // - this.DependsGraphTree.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) + // + this.DependsGraphTree.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.DependsGraphTree.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.DependsGraphTree.Location = new System.Drawing.Point(4, 52); @@ -930,9 +932,9 @@ private void InitializeComponent() this.DependsGraphTree.Size = new System.Drawing.Size(518, 771); this.DependsGraphTree.TabIndex = 0; this.DependsGraphTree.NodeMouseDoubleClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.DependsGraphTree_NodeMouseDoubleClick); - // + // // ContentTabPage - // + // this.ContentTabPage.Controls.Add(this.ContentsPreviewTree); this.ContentTabPage.Controls.Add(this.ContentsDownloadButton); this.ContentTabPage.Controls.Add(this.NotCachedLabel); @@ -944,11 +946,11 @@ private void InitializeComponent() this.ContentTabPage.TabIndex = 2; this.ContentTabPage.Text = "Contents"; this.ContentTabPage.UseVisualStyleBackColor = true; - // + // // ContentsPreviewTree - // - this.ContentsPreviewTree.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) + // + this.ContentsPreviewTree.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.ContentsPreviewTree.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.ContentsPreviewTree.Enabled = false; @@ -958,9 +960,9 @@ private void InitializeComponent() this.ContentsPreviewTree.Size = new System.Drawing.Size(522, 728); this.ContentsPreviewTree.TabIndex = 2; this.ContentsPreviewTree.NodeMouseDoubleClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.ContentsPreviewTree_NodeMouseDoubleClick); - // + // // ContentsDownloadButton - // + // this.ContentsDownloadButton.Location = new System.Drawing.Point(9, 55); this.ContentsDownloadButton.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.ContentsDownloadButton.Name = "ContentsDownloadButton"; @@ -969,18 +971,18 @@ private void InitializeComponent() this.ContentsDownloadButton.Text = "Download"; this.ContentsDownloadButton.UseVisualStyleBackColor = true; this.ContentsDownloadButton.Click += new System.EventHandler(this.ContentsDownloadButton_Click); - // + // // NotCachedLabel - // + // this.NotCachedLabel.Location = new System.Drawing.Point(4, 5); this.NotCachedLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.NotCachedLabel.Name = "NotCachedLabel"; this.NotCachedLabel.Size = new System.Drawing.Size(324, 46); this.NotCachedLabel.TabIndex = 0; this.NotCachedLabel.Text = "This mod is not in the cache, click \'Download\' to preview contents"; - // + // // StatusPanel - // + // this.StatusPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.StatusPanel.Controls.Add(this.StatusLabel); this.StatusPanel.Location = new System.Drawing.Point(0, 1074); @@ -988,9 +990,9 @@ private void InitializeComponent() this.StatusPanel.Name = "StatusPanel"; this.StatusPanel.Size = new System.Drawing.Size(1196, 29); this.StatusPanel.TabIndex = 8; - // + // // StatusLabel - // + // this.StatusLabel.Dock = System.Windows.Forms.DockStyle.Fill; this.StatusLabel.Location = new System.Drawing.Point(0, 0); this.StatusLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); @@ -998,9 +1000,9 @@ private void InitializeComponent() this.StatusLabel.Size = new System.Drawing.Size(1050, 29); this.StatusLabel.TabIndex = 0; this.StatusLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // + // // MainTabControl - // + // this.MainTabControl.Controls.Add(this.ManageModsTabPage); this.MainTabControl.Controls.Add(this.ChangesetTabPage); this.MainTabControl.Controls.Add(this.WaitTabPage); @@ -1013,9 +1015,9 @@ private void InitializeComponent() this.MainTabControl.SelectedIndex = 0; this.MainTabControl.Size = new System.Drawing.Size(1544, 981); this.MainTabControl.TabIndex = 9; - // + // // ManageModsTabPage - // + // this.ManageModsTabPage.BackColor = System.Drawing.SystemColors.Control; this.ManageModsTabPage.Controls.Add(this.FilterByAuthorTextBox); this.ManageModsTabPage.Controls.Add(this.FilterByAuthorLabel); @@ -1032,9 +1034,9 @@ private void InitializeComponent() this.ManageModsTabPage.Size = new System.Drawing.Size(1536, 948); this.ManageModsTabPage.TabIndex = 0; this.ManageModsTabPage.Text = "Manage mods"; - // + // // FilterByAuthorTextBox - // + // this.FilterByAuthorTextBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.FilterByAuthorTextBox.Location = new System.Drawing.Point(543, 74); this.FilterByAuthorTextBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); @@ -1042,9 +1044,9 @@ private void InitializeComponent() this.FilterByAuthorTextBox.Size = new System.Drawing.Size(185, 26); this.FilterByAuthorTextBox.TabIndex = 10; this.FilterByAuthorTextBox.TextChanged += new System.EventHandler(this.FilterByAuthorTextBox_TextChanged); - // + // // FilterByAuthorLabel - // + // this.FilterByAuthorLabel.AutoSize = true; this.FilterByAuthorLabel.BackColor = System.Drawing.Color.Transparent; this.FilterByAuthorLabel.Location = new System.Drawing.Point(372, 77); @@ -1053,9 +1055,9 @@ private void InitializeComponent() this.FilterByAuthorLabel.Size = new System.Drawing.Size(162, 20); this.FilterByAuthorLabel.TabIndex = 11; this.FilterByAuthorLabel.Text = "Filter by author name:"; - // + // // FilterByNameLabel - // + // this.FilterByNameLabel.AutoSize = true; this.FilterByNameLabel.BackColor = System.Drawing.Color.Transparent; this.FilterByNameLabel.Location = new System.Drawing.Point(6, 77); @@ -1064,9 +1066,9 @@ private void InitializeComponent() this.FilterByNameLabel.Size = new System.Drawing.Size(147, 20); this.FilterByNameLabel.TabIndex = 10; this.FilterByNameLabel.Text = "Filter by mod name:"; - // + // // FilterByNameTextBox - // + // this.FilterByNameTextBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.FilterByNameTextBox.Location = new System.Drawing.Point(160, 74); this.FilterByNameTextBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); @@ -1074,9 +1076,9 @@ private void InitializeComponent() this.FilterByNameTextBox.Size = new System.Drawing.Size(185, 26); this.FilterByNameTextBox.TabIndex = 9; this.FilterByNameTextBox.TextChanged += new System.EventHandler(this.FilterByNameTextBox_TextChanged); - // + // // FilterByDescriptionLabel - // + // this.FilterByDescriptionLabel.AutoSize = true; this.FilterByDescriptionLabel.BackColor = System.Drawing.Color.Transparent; this.FilterByDescriptionLabel.Location = new System.Drawing.Point(754, 77); @@ -1085,9 +1087,9 @@ private void InitializeComponent() this.FilterByDescriptionLabel.Size = new System.Drawing.Size(149, 20); this.FilterByDescriptionLabel.TabIndex = 10; this.FilterByDescriptionLabel.Text = "Filter by description:"; - // + // // FilterByDescriptionTextBox - // + // this.FilterByDescriptionTextBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.FilterByDescriptionTextBox.Location = new System.Drawing.Point(912, 74); this.FilterByDescriptionTextBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); @@ -1095,9 +1097,9 @@ private void InitializeComponent() this.FilterByDescriptionTextBox.Size = new System.Drawing.Size(185, 26); this.FilterByDescriptionTextBox.TabIndex = 9; this.FilterByDescriptionTextBox.TextChanged += new System.EventHandler(this.FilterByDescriptionTextBox_TextChanged); - // + // // ChangesetTabPage - // + // this.ChangesetTabPage.Controls.Add(this.CancelChangesButton); this.ChangesetTabPage.Controls.Add(this.ConfirmChangesButton); this.ChangesetTabPage.Controls.Add(this.ChangesListView); @@ -1109,9 +1111,9 @@ private void InitializeComponent() this.ChangesetTabPage.TabIndex = 2; this.ChangesetTabPage.Text = "Changeset"; this.ChangesetTabPage.UseVisualStyleBackColor = true; - // + // // CancelChangesButton - // + // this.CancelChangesButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.CancelChangesButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.CancelChangesButton.Location = new System.Drawing.Point(1288, 949); @@ -1122,9 +1124,9 @@ private void InitializeComponent() this.CancelChangesButton.Text = "Clear"; this.CancelChangesButton.UseVisualStyleBackColor = true; this.CancelChangesButton.Click += new System.EventHandler(this.CancelChangesButton_Click); - // + // // ConfirmChangesButton - // + // this.ConfirmChangesButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.ConfirmChangesButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.ConfirmChangesButton.Location = new System.Drawing.Point(1410, 949); @@ -1135,11 +1137,11 @@ private void InitializeComponent() this.ConfirmChangesButton.Text = " Apply"; this.ConfirmChangesButton.UseVisualStyleBackColor = true; this.ConfirmChangesButton.Click += new System.EventHandler(this.ConfirmChangesButton_Click); - // + // // ChangesListView - // - this.ChangesListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) + // + this.ChangesListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.ChangesListView.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.ChangesListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { @@ -1154,24 +1156,24 @@ private void InitializeComponent() this.ChangesListView.TabIndex = 4; this.ChangesListView.UseCompatibleStateImageBehavior = false; this.ChangesListView.View = System.Windows.Forms.View.Details; - // + // // Mod - // + // this.Mod.Text = "Mod"; this.Mod.Width = 332; - // + // // ChangeType - // + // this.ChangeType.Text = "Change"; this.ChangeType.Width = 111; - // + // // Reason - // + // this.Reason.Text = "Reason for action"; this.Reason.Width = 606; - // + // // WaitTabPage - // + // this.WaitTabPage.BackColor = System.Drawing.SystemColors.Control; this.WaitTabPage.Controls.Add(this.CancelCurrentActionButton); this.WaitTabPage.Controls.Add(this.LogTextBox); @@ -1184,9 +1186,9 @@ private void InitializeComponent() this.WaitTabPage.Size = new System.Drawing.Size(1536, 1001); this.WaitTabPage.TabIndex = 1; this.WaitTabPage.Text = "Status log"; - // + // // CancelCurrentActionButton - // + // this.CancelCurrentActionButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.CancelCurrentActionButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.CancelCurrentActionButton.Location = new System.Drawing.Point(1410, 951); @@ -1197,11 +1199,11 @@ private void InitializeComponent() this.CancelCurrentActionButton.Text = "Cancel"; this.CancelCurrentActionButton.UseVisualStyleBackColor = true; this.CancelCurrentActionButton.Click += new System.EventHandler(this.CancelCurrentActionButton_Click); - // + // // LogTextBox - // - this.LogTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) + // + this.LogTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.LogTextBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.LogTextBox.Location = new System.Drawing.Point(14, 89); @@ -1212,10 +1214,10 @@ private void InitializeComponent() this.LogTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; this.LogTextBox.Size = new System.Drawing.Size(1505, 851); this.LogTextBox.TabIndex = 8; - // + // // DialogProgressBar - // - this.DialogProgressBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + // + this.DialogProgressBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.DialogProgressBar.Location = new System.Drawing.Point(14, 45); this.DialogProgressBar.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); @@ -1223,10 +1225,10 @@ private void InitializeComponent() this.DialogProgressBar.Size = new System.Drawing.Size(1506, 35); this.DialogProgressBar.Style = System.Windows.Forms.ProgressBarStyle.Marquee; this.DialogProgressBar.TabIndex = 7; - // + // // MessageTextBox - // - this.MessageTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + // + this.MessageTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.MessageTextBox.BackColor = System.Drawing.SystemColors.Control; this.MessageTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None; @@ -1240,9 +1242,9 @@ private void InitializeComponent() this.MessageTextBox.TabIndex = 6; this.MessageTextBox.Text = "Waiting for operation to complete"; this.MessageTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - // + // // ChooseRecommendedModsTabPage - // + // this.ChooseRecommendedModsTabPage.Controls.Add(this.RecommendedModsCancelButton); this.ChooseRecommendedModsTabPage.Controls.Add(this.RecommendedModsContinueButton); this.ChooseRecommendedModsTabPage.Controls.Add(this.RecommendedModsToggleCheckbox); @@ -1256,9 +1258,9 @@ private void InitializeComponent() this.ChooseRecommendedModsTabPage.TabIndex = 3; this.ChooseRecommendedModsTabPage.Text = "Choose recommended mods"; this.ChooseRecommendedModsTabPage.UseVisualStyleBackColor = true; - // + // // RecommendedModsCancelButton - // + // this.RecommendedModsCancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.RecommendedModsCancelButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.RecommendedModsCancelButton.Location = new System.Drawing.Point(1288, 949); @@ -1269,9 +1271,9 @@ private void InitializeComponent() this.RecommendedModsCancelButton.Text = "Cancel"; this.RecommendedModsCancelButton.UseVisualStyleBackColor = true; this.RecommendedModsCancelButton.Click += new System.EventHandler(this.RecommendedModsCancelButton_Click); - // + // // RecommendedModsContinueButton - // + // this.RecommendedModsContinueButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.RecommendedModsContinueButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.RecommendedModsContinueButton.Location = new System.Drawing.Point(1410, 949); @@ -1282,9 +1284,9 @@ private void InitializeComponent() this.RecommendedModsContinueButton.Text = "Continue"; this.RecommendedModsContinueButton.UseVisualStyleBackColor = true; this.RecommendedModsContinueButton.Click += new System.EventHandler(this.RecommendedModsContinueButton_Click); - // + // // RecommendedModsToggleCheckbox - // + // this.RecommendedModsToggleCheckbox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.RecommendedModsToggleCheckbox.AutoSize = true; this.RecommendedModsToggleCheckbox.FlatStyle = System.Windows.Forms.FlatStyle.Flat; @@ -1296,9 +1298,9 @@ private void InitializeComponent() this.RecommendedModsToggleCheckbox.Text = "Toggle * Mods"; this.RecommendedModsToggleCheckbox.UseVisualStyleBackColor = true; this.RecommendedModsToggleCheckbox.CheckedChanged += new System.EventHandler(this.RecommendedModsToggleCheckbox_CheckedChanged); - // + // // RecommendedDialogLabel - // + // this.RecommendedDialogLabel.AutoSize = true; this.RecommendedDialogLabel.Location = new System.Drawing.Point(4, 20); this.RecommendedDialogLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); @@ -1307,11 +1309,11 @@ private void InitializeComponent() this.RecommendedDialogLabel.TabIndex = 6; this.RecommendedDialogLabel.Text = "The following modules have been recommended by one or more of the chosen modules:" + ""; - // + // // RecommendedModsListView - // - this.RecommendedModsListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) + // + this.RecommendedModsListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.RecommendedModsListView.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.RecommendedModsListView.CheckBoxes = true; @@ -1327,24 +1329,24 @@ private void InitializeComponent() this.RecommendedModsListView.TabIndex = 5; this.RecommendedModsListView.UseCompatibleStateImageBehavior = false; this.RecommendedModsListView.View = System.Windows.Forms.View.Details; - // + // // columnHeader3 - // + // this.columnHeader3.Text = "Mod"; this.columnHeader3.Width = 332; - // + // // columnHeader4 - // + // this.columnHeader4.Text = "Recommended by"; this.columnHeader4.Width = 180; - // + // // columnHeader5 - // + // this.columnHeader5.Text = "Mod description"; this.columnHeader5.Width = 606; - // + // // ChooseProvidedModsTabPage - // + // this.ChooseProvidedModsTabPage.Controls.Add(this.ChooseProvidedModsCancelButton); this.ChooseProvidedModsTabPage.Controls.Add(this.ChooseProvidedModsContinueButton); this.ChooseProvidedModsTabPage.Controls.Add(this.ChooseProvidedModsListView); @@ -1357,9 +1359,9 @@ private void InitializeComponent() this.ChooseProvidedModsTabPage.TabIndex = 4; this.ChooseProvidedModsTabPage.Text = "Choose mods"; this.ChooseProvidedModsTabPage.UseVisualStyleBackColor = true; - // + // // ChooseProvidedModsCancelButton - // + // this.ChooseProvidedModsCancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.ChooseProvidedModsCancelButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.ChooseProvidedModsCancelButton.Location = new System.Drawing.Point(1286, 948); @@ -1370,9 +1372,9 @@ private void InitializeComponent() this.ChooseProvidedModsCancelButton.Text = "Cancel"; this.ChooseProvidedModsCancelButton.UseVisualStyleBackColor = true; this.ChooseProvidedModsCancelButton.Click += new System.EventHandler(this.ChooseProvidedModsCancelButton_Click); - // + // // ChooseProvidedModsContinueButton - // + // this.ChooseProvidedModsContinueButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.ChooseProvidedModsContinueButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.ChooseProvidedModsContinueButton.Location = new System.Drawing.Point(1407, 948); @@ -1383,11 +1385,11 @@ private void InitializeComponent() this.ChooseProvidedModsContinueButton.Text = "Continue"; this.ChooseProvidedModsContinueButton.UseVisualStyleBackColor = true; this.ChooseProvidedModsContinueButton.Click += new System.EventHandler(this.ChooseProvidedModsContinueButton_Click); - // + // // ChooseProvidedModsListView - // - this.ChooseProvidedModsListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) + // + this.ChooseProvidedModsListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.ChooseProvidedModsListView.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.ChooseProvidedModsListView.CheckBoxes = true; @@ -1404,19 +1406,19 @@ private void InitializeComponent() this.ChooseProvidedModsListView.TabIndex = 8; this.ChooseProvidedModsListView.UseCompatibleStateImageBehavior = false; this.ChooseProvidedModsListView.View = System.Windows.Forms.View.Details; - // + // // columnHeader6 - // + // this.columnHeader6.Text = "Mod"; this.columnHeader6.Width = 332; - // + // // columnHeader8 - // + // this.columnHeader8.Text = "Mod description"; this.columnHeader8.Width = 606; - // + // // ChooseProvidedModsLabel - // + // this.ChooseProvidedModsLabel.AutoSize = true; this.ChooseProvidedModsLabel.Location = new System.Drawing.Point(9, 18); this.ChooseProvidedModsLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); @@ -1424,16 +1426,23 @@ private void InitializeComponent() this.ChooseProvidedModsLabel.Size = new System.Drawing.Size(568, 20); this.ChooseProvidedModsLabel.TabIndex = 7; this.ChooseProvidedModsLabel.Text = "Several mods provide the virtual module Foo, choose one of the following mods:"; - // + // // reportAnIssueToolStripMenuItem - // + // this.reportAnIssueToolStripMenuItem.Name = "reportAnIssueToolStripMenuItem"; this.reportAnIssueToolStripMenuItem.Size = new System.Drawing.Size(230, 30); this.reportAnIssueToolStripMenuItem.Text = "Report an issue..."; this.reportAnIssueToolStripMenuItem.Click += new System.EventHandler(this.reportAnIssueToolStripMenuItem_Click); - // + // + // compatibleKSPVersionsToolStripMenuItem + // + this.compatibleKSPVersionsToolStripMenuItem.Name = "compatibleKSPVersionsToolStripMenuItem"; + this.compatibleKSPVersionsToolStripMenuItem.Size = new System.Drawing.Size(233, 24); + this.compatibleKSPVersionsToolStripMenuItem.Text = "Compatible KSP versions"; + this.compatibleKSPVersionsToolStripMenuItem.Click += new System.EventHandler(this.CompatibleKspVersionsToolStripMenuItem_Click); + // // Main - // + // this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(1544, 1038); @@ -1597,5 +1606,6 @@ private void InitializeComponent() private ToolStripMenuItem NavBackwardToolButton; private ToolStripMenuItem NavForwardToolButton; private ToolStripMenuItem reportAnIssueToolStripMenuItem; + private ToolStripMenuItem compatibleKSPVersionsToolStripMenuItem; } } diff --git a/GUI/Main.cs b/GUI/Main.cs index 415af46b4f..de13461943 100644 --- a/GUI/Main.cs +++ b/GUI/Main.cs @@ -435,6 +435,13 @@ public void CurrentInstanceUpdated() Path.Combine(CurrentInstance.GameDir(), "CKAN/GUIConfig.xml"), Repo.default_ckan_repo.ToString() ); + + if (CurrentInstance.CompatibleVersionsAreFromDifferentKsp) + { + CompatibleKspVersionsDialog dialog = new CompatibleKspVersionsDialog(CurrentInstance); + dialog.ShowDialog(); + } + UpdateModsList(); ChangeSet = null; Conflicts = null; @@ -753,13 +760,13 @@ private async Task UpdateChangeSetAndConflicts(IRegistryQuerier registry) var module_installer = ModuleInstaller.GetInstance(CurrentInstance, GUI.user); full_change_set = await mainModList.ComputeChangeSetFromModList(registry, user_change_set, module_installer, - CurrentInstance.Version()); + CurrentInstance.VersionCriteria()); } catch (InconsistentKraken) { //Need to be recomputed due to ComputeChangeSetFromModList possibly changing it with too many provides handling. user_change_set = mainModList.ComputeUserChangeSet(); - new_conflicts = MainModList.ComputeConflictsFromModList(registry, user_change_set, CurrentInstance.Version()); + new_conflicts = MainModList.ComputeConflictsFromModList(registry, user_change_set, CurrentInstance.VersionCriteria()); full_change_set = null; } catch (TooManyModsProvideKraken) @@ -971,7 +978,7 @@ private void installFromckanToolStripMenuItem_Click(object sender, EventArgs e) var changeset = new List(); changeset.Add(new ModChange( - new GUIMod(module,registry_manager.registry,CurrentInstance.Version()), + new GUIMod(module,registry_manager.registry,CurrentInstance.VersionCriteria()), GUIModChangeType.Install, null)); menuStrip1.Enabled = false; @@ -1064,6 +1071,13 @@ private void openKspDirectoryToolStripMenuItem_Click(object sender, EventArgs e) Process.Start(Instance.manager.CurrentInstance.GameDir()); } + private void CompatibleKspVersionsToolStripMenuItem_Click(object sender, EventArgs e) + { + var instanceSettingsDialog = new CompatibleKspVersionsDialog(Instance.manager.CurrentInstance); + instanceSettingsDialog.ShowDialog(); + UpdateModsList(repo_updated: false); + } + private void DependsGraphTree_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) { FilterByNameTextBox.Text = ""; diff --git a/GUI/MainInstall.cs b/GUI/MainInstall.cs index 37f88a382c..e69251502d 100644 --- a/GUI/MainInstall.cs +++ b/GUI/MainInstall.cs @@ -158,7 +158,7 @@ public partial class Main // the mod is not installed _and_ // the mod is not already in the install list if ( - registry.LatestAvailable(mod.name, CurrentInstance.Version()) != null && + 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 @@ -457,14 +457,14 @@ private void ChooseProvidedModsContinueButton_Click(object sender, EventArgs e) try { var resolver = new RelationshipResolver(new List { pair.Key }, opts, - RegistryManager.Instance(manager.CurrentInstance).registry, CurrentInstance.Version()); + RegistryManager.Instance(manager.CurrentInstance).registry, CurrentInstance.VersionCriteria()); if (!resolver.ModList().Any()) { continue; } module = RegistryManager.Instance(manager.CurrentInstance) - .registry.LatestAvailable(pair.Key, CurrentInstance.Version()); + .registry.LatestAvailable(pair.Key, CurrentInstance.VersionCriteria()); } catch { diff --git a/GUI/MainModInfo.cs b/GUI/MainModInfo.cs index 37d54e1dc4..b507fb9cc6 100644 --- a/GUI/MainModInfo.cs +++ b/GUI/MainModInfo.cs @@ -111,13 +111,13 @@ private TreeNode UpdateModDependencyGraphRecursively(TreeNode parentNode, CkanMo try { var dependencyModule = registry.LatestAvailable - (dependency.name, manager.CurrentInstance.Version()); + (dependency.name, manager.CurrentInstance.VersionCriteria()); UpdateModDependencyGraphRecursively(node, dependencyModule, relationship, depth + 1); } catch (ModuleNotFoundKraken) { List dependencyModules = registry.LatestAvailableWithProvides - (dependency.name, manager.CurrentInstance.Version()); + (dependency.name, manager.CurrentInstance.VersionCriteria()); if (dependencyModules == null) { diff --git a/GUI/MainModList.cs b/GUI/MainModList.cs index c17b3f1f1f..bf0f535cd0 100644 --- a/GUI/MainModList.cs +++ b/GUI/MainModList.cs @@ -147,14 +147,14 @@ private void _UpdateModsList(bool repo_updated) { log.Debug("Updating the mod list"); - KspVersion version = CurrentInstance.Version(); + KspVersionCriteria versionCriteria = CurrentInstance.VersionCriteria(); IRegistryQuerier registry = RegistryManager.Instance(CurrentInstance).registry; - var gui_mods = new HashSet(registry.Available(version) - .Select(m => new GUIMod(m, registry, version))); - gui_mods.UnionWith(registry.Incompatible(version) - .Select(m => new GUIMod(m, registry, version))); + var gui_mods = new HashSet(registry.Available(versionCriteria) + .Select(m => new GUIMod(m, registry, versionCriteria))); + gui_mods.UnionWith(registry.Incompatible(versionCriteria) + .Select(m => new GUIMod(m, registry, versionCriteria))); var installed = registry.InstalledModules - .Select(m => new GUIMod(m.Module, registry, version)); + .Select(m => new GUIMod(m.Module, registry, versionCriteria)); //Hashset does not define if add/unionwith replaces existing elements. //In this case that could cause a CkanModule to be replaced by a Module. @@ -364,7 +364,7 @@ public string ModDescriptionFilter /// The version of the current KSP install public async Task> ComputeChangeSetFromModList( IRegistryQuerier registry, HashSet changeSet, ModuleInstaller installer, - KspVersion version) + KspVersionCriteria version) { var modules_to_install = new HashSet(); var modules_to_remove = new HashSet(); @@ -610,7 +610,7 @@ private bool IsModInFilter(GUIMod m) public static Dictionary ComputeConflictsFromModList(IRegistryQuerier registry, - IEnumerable change_set, KspVersion ksp_version) + IEnumerable change_set, KspVersionCriteria ksp_version) { var modules_to_install = new HashSet(); var modules_to_remove = new HashSet(); diff --git a/GUI/packages.config b/GUI/packages.config index c7adfdabe3..df33cec1ea 100644 --- a/GUI/packages.config +++ b/GUI/packages.config @@ -1,5 +1,6 @@  + diff --git a/Tests/Core/ModuleInstaller.cs b/Tests/Core/ModuleInstaller.cs index 498bd4de51..52cbe85244 100644 --- a/Tests/Core/ModuleInstaller.cs +++ b/Tests/Core/ModuleInstaller.cs @@ -407,11 +407,11 @@ public void CanInstallMod() // Mark it as available in the registry. var registry = CKAN.RegistryManager.Instance(ksp.KSP).registry; - Assert.AreEqual(0, registry.Available(ksp.KSP.Version()).Count()); + Assert.AreEqual(0, registry.Available(ksp.KSP.VersionCriteria()).Count()); registry.AddAvailable(TestData.DogeCoinFlag_101_module()); - Assert.AreEqual(1, registry.Available(ksp.KSP.Version()).Count()); + Assert.AreEqual(1, registry.Available(ksp.KSP.VersionCriteria()).Count()); // Attempt to install it. List modules = new List {TestData.DogeCoinFlag_101_module().identifier}; diff --git a/Tests/Core/Net/Repo.cs b/Tests/Core/Net/Repo.cs index c349cef188..bd583edcc2 100644 --- a/Tests/Core/Net/Repo.cs +++ b/Tests/Core/Net/Repo.cs @@ -33,7 +33,7 @@ public void UpdateRegistryTarGz() CKAN.Repo.UpdateRegistry(TestData.TestKANTarGz(), registry, ksp.KSP, new NullUser()); // Test we've got an expected module. - CkanModule far = registry.LatestAvailable("FerramAerospaceResearch", KspVersion.Parse("0.25.0")); + CkanModule far = registry.LatestAvailable("FerramAerospaceResearch", new KspVersionCriteria(KspVersion.Parse("0.25.0"))); Assert.AreEqual("v0.14.3.2", far.version.ToString()); } @@ -44,7 +44,7 @@ public void UpdateRegistryZip() CKAN.Repo.UpdateRegistry(TestData.TestKANZip(), registry, ksp.KSP, new NullUser()); // Test we've got an expected module. - CkanModule far = registry.LatestAvailable("FerramAerospaceResearch", KspVersion.Parse("0.25.0")); + CkanModule far = registry.LatestAvailable("FerramAerospaceResearch", new KspVersionCriteria (KspVersion.Parse("0.25.0"))); Assert.AreEqual("v0.14.3.2", far.version.ToString()); } diff --git a/Tests/Core/Registry/Registry.cs b/Tests/Core/Registry/Registry.cs index 68a5e02e83..ab67197392 100644 --- a/Tests/Core/Registry/Registry.cs +++ b/Tests/Core/Registry/Registry.cs @@ -11,8 +11,8 @@ public class Registry { private static readonly CkanModule module = TestData.kOS_014_module(); private static readonly string identifier = module.identifier; - private static readonly KspVersion v0_24_2 = KspVersion.Parse("0.24.2"); - private static readonly KspVersion v0_25_0 = KspVersion.Parse("0.25.0"); + private static readonly KspVersionCriteria v0_24_2 = new KspVersionCriteria(KspVersion.Parse("0.24.2")); + private static readonly KspVersionCriteria v0_25_0 = new KspVersionCriteria (KspVersion.Parse("0.25.0")); private CKAN.Registry registry; diff --git a/Tests/Core/Registry/RegistryLive.cs b/Tests/Core/Registry/RegistryLive.cs index 233f964f28..683573a272 100644 --- a/Tests/Core/Registry/RegistryLive.cs +++ b/Tests/Core/Registry/RegistryLive.cs @@ -1,4 +1,5 @@ using CKAN; +using CKAN.Versioning; using NUnit.Framework; using Tests.Data; @@ -36,7 +37,7 @@ public void TearDown() public void LatestAvailable() { CkanModule module = - registry.LatestAvailable("AGExt", temp_ksp.KSP.Version()); + registry.LatestAvailable("AGExt", new KspVersionCriteria (temp_ksp.KSP.Version())); Assert.AreEqual("AGExt", module.identifier); Assert.AreEqual("1.24a", module.version.ToString()); diff --git a/Tests/Core/Relationships/RelationshipResolver.cs b/Tests/Core/Relationships/RelationshipResolver.cs index 4db2578198..0b94809b7f 100644 --- a/Tests/Core/Relationships/RelationshipResolver.cs +++ b/Tests/Core/Relationships/RelationshipResolver.cs @@ -806,7 +806,7 @@ public void AutodetectedCanSatisfyRelationships() new CKAN.CkanModule[] { mod }, RelationshipResolver.DefaultOpts(), registry, - KspVersion.Parse("1.0.0") + new KspVersionCriteria (KspVersion.Parse("1.0.0")) ); } } diff --git a/Tests/Core/Types/GameComparator.cs b/Tests/Core/Types/GameComparator.cs index aa953e4734..41b954f3eb 100644 --- a/Tests/Core/Types/GameComparator.cs +++ b/Tests/Core/Types/GameComparator.cs @@ -32,7 +32,7 @@ public void TotallyCompatible(Type type, bool expected) = KspVersion.Parse("1.0.4"); // Now test! - Assert.AreEqual(expected, comparator.Compatible(gameVersion, gameMod)); + Assert.AreEqual(expected, comparator.Compatible(new KspVersionCriteria (gameVersion), gameMod)); } [Test] @@ -48,7 +48,7 @@ public void GenerallySafeLax(Type type, bool expected) = KspVersion.Parse("1.0.3"); // Now test! - Assert.AreEqual(expected, comparator.Compatible(gameVersion, gameMod)); + Assert.AreEqual(expected, comparator.Compatible(new KspVersionCriteria (gameVersion), gameMod)); } [Test] @@ -66,8 +66,8 @@ public void GenerallySafeStrict(Type type, bool expected) gameMod.ksp_version_strict = true; // Now test! - Assert.AreEqual(expected, comparator.Compatible(gameVersion, gameMod)); - } + Assert.AreEqual(expected, comparator.Compatible(new KspVersionCriteria (gameVersion), gameMod)); + } [Test] [TestCase(typeof(CKAN.StrictGameComparator), false)] @@ -78,7 +78,102 @@ public void Incompatible(Type type, bool expected) var comparator = (CKAN.IGameComparator) Activator.CreateInstance(type); // The mod already starts off being incompatible, so just do the test. :) - Assert.AreEqual(expected, comparator.Compatible(gameVersion, gameMod)); + Assert.AreEqual(expected, comparator.Compatible(new KspVersionCriteria (gameVersion), gameMod)); + } + + public static readonly object[] TestStrictGameComparatorCases = + { + //MOD comapat. //KSP //expected + new object[] { "1.0", "1.0.4", true }, + new object[] { "1.1", "1.0.4", false }, + + new object[] { "1.0.4.1234", "1.0.4.1234", true }, + new object[] { "1.0.4.1235", "1.0.4.1234", false }, + new object[] { "1.0.4", "1.0.4.1234", true }, + new object[] { "1.0.4.1234", "1.0.4", true }, + + new object[] { "1.0.4.0000", "1.0.4", true }, + new object[] { "1.0", "1.0", true }, + new object[] { "1.1", "1.1", true }, + new object[] { "1.1", "1.0", false }, + new object[] { "1.0", "1.1", false }, + + new object[] { "1.0.4", "1", true }, + new object[] { "1.0.4", "1.0", true }, + new object[] { "1.0.4", "1.0.4", true }, + new object[] { "1.0.4", "1.0.4.1234", true }, + new object[] { "1.0.4", "1.0.5", false }, + new object[] { "1.0.4", "1.0.3", false }, + new object[] { "1.0.4", "1.1", false }, + new object[] { "1.0.4", "0.9", false }, + + new object[] { "1", "1", true }, + new object[] { "1", "1.0", true }, + new object[] { "1", "1.0.4", true }, + new object[] { "1", "1.0.4.1234", true }, + new object[] { "1", "2", false }, + new object[] { "1", "2.1", false }, + new object[] { "1", "0", false }, + new object[] { "1", "0.9", false }, + }; + + [TestCaseSource("TestStrictGameComparatorCases")] + public void TestStrictGameComparator(String modVersion, String gameVersion, bool expectedResult) + { + var comparator = new CKAN.StrictGameComparator(); + + // We're going to tweak compatibly of the mod + gameMod.ksp_version = KspVersion.Parse(modVersion); + + // Now test! + Assert.AreEqual(expectedResult, comparator.Compatible(new KspVersionCriteria(KspVersion.Parse(gameVersion)), gameMod)); + } + + public static readonly object[] TestStrictGameComparatorMinMaxCases = + { + //Min comapat //Max comapat //KSP //expected + new object[] { "1.0.4", null, "1.0.3", false }, + new object[] { "1.0.4", null, "1.0.4", true }, + new object[] { "1.0.4", null, "1.0.5", true }, + new object[] { "1.0.4", null, "1.1", true }, + + new object[] { "1.0", null, "0.9", false }, + new object[] { "1.0", null, "1.0", true }, + new object[] { "1.0", null, "1.0.4", true }, + new object[] { "1.0", null, "1.1", true }, + + new object[] { "1.1", null, "1.0.4", false }, + new object[] { "1.1", null, "1.1", true }, + new object[] { "1.1", null, "1.1.1", true }, + new object[] { "1.1", null, "1.2", true }, + + new object[] { null, "1.0.4", "1.0.5", false }, + new object[] { null, "1.0.4", "1.0.4", true }, + new object[] { null, "1.0.4", "1.0.3", true }, + new object[] { null, "1.0.4", "1.0", true }, + + new object[] { null, "1.0", "0.9", true }, + new object[] { null, "1.0", "1.0", true }, + new object[] { null, "1.0", "1.0.4", true }, + new object[] { null, "1.0", "1.1", false }, + + new object[] { null, "1.1", "1.0", true }, + new object[] { null, "1.1", "1.1", true }, + new object[] { null, "1.1", "1.1.1", true }, + new object[] { null, "1.1", "1.2", false }, + }; + + [TestCaseSource("TestStrictGameComparatorMinMaxCases")] + public void TestStrictGameComparatorMinMax(String modMinVersion, String modMaxVersion, String gameVersion, bool expectedResult) + { + var comparator = new CKAN.StrictGameComparator(); + + gameMod.ksp_version = null; + gameMod.ksp_version_min = modMinVersion == null ? null : KspVersion.Parse(modMinVersion); + gameMod.ksp_version_max = modMaxVersion == null ? null : KspVersion.Parse(modMaxVersion); + + // Now test! + Assert.AreEqual(expectedResult, comparator.Compatible(new KspVersionCriteria(KspVersion.Parse(gameVersion)), gameMod)); } } } diff --git a/Tests/Core/Types/Module.cs b/Tests/Core/Types/Module.cs index 7a5aae53e5..3c656d875c 100644 --- a/Tests/Core/Types/Module.cs +++ b/Tests/Core/Types/Module.cs @@ -1,5 +1,6 @@ using System.Linq; using CKAN; +using CKAN.Versioning; using NUnit.Framework; using Tests.Data; using Newtonsoft.Json; @@ -15,7 +16,7 @@ public void CompatibleWith() { CkanModule module = CkanModule.FromJson(TestData.kOS_014()); - Assert.IsTrue(module.IsCompatibleKSP("0.24.2")); + Assert.IsTrue(module.IsCompatibleKSP(new KspVersionCriteria (KspVersion.Parse("0.24.2")))); } [Test] diff --git a/Tests/Core/Versioning/KspVersionRangeTests.cs b/Tests/Core/Versioning/KspVersionRangeTests.cs index cce9b8de10..0b54e14367 100644 --- a/Tests/Core/Versioning/KspVersionRangeTests.cs +++ b/Tests/Core/Versioning/KspVersionRangeTests.cs @@ -71,6 +71,253 @@ public sealed class KspVersionRangeTests } }; + private static readonly object[] IntersectWithCases = + { + new object[] + { + new KspVersionRange(new KspVersionBound(), new KspVersionBound()), + new KspVersionRange(new KspVersionBound(), new KspVersionBound()), + new KspVersionRange(new KspVersionBound(), new KspVersionBound()), + }, + new object[] + { + new KspVersionRange( + new KspVersionBound(new KspVersion(1, 2, 3, 4), true), + new KspVersionBound(new KspVersion(1, 2, 3, 4), true) + ), + new KspVersionRange( + new KspVersionBound(new KspVersion(1, 2, 3, 4), true), + new KspVersionBound(new KspVersion(1, 2, 3, 4), true) + ), + new KspVersionRange( + new KspVersionBound(new KspVersion(1, 2, 3, 4), true), + new KspVersionBound(new KspVersion(1, 2, 3, 4), true) + ), + }, + new object[] + { + new KspVersionRange( + new KspVersionBound(new KspVersion(1, 2, 3, 4), false), + new KspVersionBound(new KspVersion(1, 2, 3, 4), false) + ), + new KspVersionRange( + new KspVersionBound(new KspVersion(1, 2, 3, 4), false), + new KspVersionBound(new KspVersion(1, 2, 3, 4), false) + ), + null + }, + new object[] + { + new KspVersionRange( + new KspVersionBound(new KspVersion(1, 2, 3, 4), false), + new KspVersionBound(new KspVersion(1, 2, 3, 4), false) + ), + new KspVersionRange( + new KspVersionBound(new KspVersion(1, 2, 3, 4), true), + new KspVersionBound(new KspVersion(1, 2, 3, 4), true) + ), + null + }, + new object[] + { + new KspVersionRange( + new KspVersionBound(new KspVersion(1, 0, 0, 0), true), + new KspVersionBound(new KspVersion(1, 1, 0, 0), false) + ), + new KspVersionRange( + new KspVersionBound(new KspVersion(1, 0, 4, 0), true), + new KspVersionBound(new KspVersion(1, 0, 5, 0), false) + ), + new KspVersionRange( + new KspVersionBound(new KspVersion(1, 0, 4, 0), true), + new KspVersionBound(new KspVersion(1, 0, 5, 0), false) + ), + }, + new object[] + { + new KspVersionRange( + new KspVersionBound(new KspVersion(1, 1, 0, 0), true), + new KspVersionBound(new KspVersion(1, 2, 0, 0), false) + ), + new KspVersionRange( + new KspVersionBound(new KspVersion(1, 0, 4, 0), true), + new KspVersionBound(new KspVersion(1, 0, 5, 0), false) + ), + null + }, + new object[] + { + new KspVersionRange( + new KspVersionBound(new KspVersion(1, 0, 4, 1234), true), + new KspVersionBound(new KspVersion(1, 0, 4, 1234), true) + ), + new KspVersionRange( + new KspVersionBound(new KspVersion(1, 0, 4, 1234), true), + new KspVersionBound(new KspVersion(1, 0, 4, 1234), true) + ), + new KspVersionRange( + new KspVersionBound(new KspVersion(1, 0, 4, 1234), true), + new KspVersionBound(new KspVersion(1, 0, 4, 1234), true) + ), + }, + new object[] + { + new KspVersionRange( + new KspVersionBound(new KspVersion(1, 0, 4, 1235), true), + new KspVersionBound(new KspVersion(1, 0, 4, 1235), true) + ), + new KspVersionRange( + new KspVersionBound(new KspVersion(1, 0, 4, 1234), true), + new KspVersionBound(new KspVersion(1, 0, 4, 1234), true) + ), + null + }, + new object[] + { + new KspVersionRange( + new KspVersionBound(new KspVersion(1, 0, 4, 0), true), + new KspVersionBound(new KspVersion(1, 0, 5, 0), false) + ), + new KspVersionRange( + new KspVersionBound(new KspVersion(1, 0, 4, 1234), true), + new KspVersionBound(new KspVersion(1, 0, 4, 1234), true) + ), + new KspVersionRange( + new KspVersionBound(new KspVersion(1, 0, 4, 1234), true), + new KspVersionBound(new KspVersion(1, 0, 4, 1234), true) + ), + }, + new object[] + { + new KspVersionRange( + new KspVersionBound(new KspVersion(1, 0, 4, 1234), true), + new KspVersionBound(new KspVersion(1, 0, 4, 1234), true) + ), + new KspVersionRange( + new KspVersionBound(new KspVersion(1, 0, 4, 0), true), + new KspVersionBound(new KspVersion(1, 0, 5, 0), false) + ), + new KspVersionRange( + new KspVersionBound(new KspVersion(1, 0, 4, 1234), true), + new KspVersionBound(new KspVersion(1, 0, 4, 1234), true) + ), + }, + new object[] + { + new KspVersionRange( + new KspVersionBound(new KspVersion(1, 0, 4, 0), true), + new KspVersionBound(new KspVersion(1, 0, 4, 0), true) + ), + new KspVersionRange( + new KspVersionBound(new KspVersion(1, 0, 4, 0), true), + new KspVersionBound(new KspVersion(1, 0, 5, 0), false) + ), + new KspVersionRange( + new KspVersionBound(new KspVersion(1, 0, 4, 0), true), + new KspVersionBound(new KspVersion(1, 0, 4, 0), true) + ), + }, + new object[] + { + new KspVersionRange( + new KspVersionBound(new KspVersion(1, 0, 0, 0), true), + new KspVersionBound(new KspVersion(1, 1, 0, 0), false) + ), + new KspVersionRange( + new KspVersionBound(new KspVersion(1, 0, 0, 0), true), + new KspVersionBound(new KspVersion(1, 1, 0, 0), false) + ), + new KspVersionRange( + new KspVersionBound(new KspVersion(1, 0, 0, 0), true), + new KspVersionBound(new KspVersion(1, 1, 0, 0), false) + ), + }, + new object[] + { + new KspVersionRange( + new KspVersionBound(new KspVersion(1, 1, 0, 0), true), + new KspVersionBound(new KspVersion(1, 2, 0, 0), false) + ), + new KspVersionRange( + new KspVersionBound(new KspVersion(1, 1, 0, 0), true), + new KspVersionBound(new KspVersion(1, 2, 0, 0), false) + ), + new KspVersionRange( + new KspVersionBound(new KspVersion(1, 1, 0, 0), true), + new KspVersionBound(new KspVersion(1, 2, 0, 0), false) + ), + }, + new object[] + { + new KspVersionRange( + new KspVersionBound(new KspVersion(1, 1, 0, 0), true), + new KspVersionBound(new KspVersion(1, 2, 0, 0), false) + ), + new KspVersionRange( + new KspVersionBound(new KspVersion(1, 0, 0, 0), true), + new KspVersionBound(new KspVersion(1, 1, 0, 0), false) + ), + null + }, + new object[] + { + new KspVersionRange( + new KspVersionBound(new KspVersion(1, 0, 0, 0), true), + new KspVersionBound(new KspVersion(1, 1, 0, 0), false) + ), + new KspVersionRange( + new KspVersionBound(new KspVersion(1, 1, 0, 0), true), + new KspVersionBound(new KspVersion(1, 2, 0, 0), false) + ), + null + }, + new object[] + { + new KspVersionRange( + new KspVersionBound(new KspVersion(1, 0, 4, 0), true), + new KspVersionBound() + ), + new KspVersionRange( + new KspVersionBound(new KspVersion(1, 0, 4, 0), true), + new KspVersionBound(new KspVersion(1, 0, 5, 0), false) + ), + new KspVersionRange( + new KspVersionBound(new KspVersion(1, 0, 4, 0), true), + new KspVersionBound(new KspVersion(1, 0, 5, 0), false) + ) + }, + new object[] + { + new KspVersionRange( + new KspVersionBound(), + new KspVersionBound(new KspVersion(1, 0, 4, 0), true) + ), + new KspVersionRange( + new KspVersionBound(new KspVersion(1, 0, 4, 0), true), + new KspVersionBound(new KspVersion(1, 0, 5, 0), false) + ), + new KspVersionRange( + new KspVersionBound(new KspVersion(1, 0, 4, 0), true), + new KspVersionBound(new KspVersion(1, 0, 4, 0), true) + ) + }, + new object[] + { + new KspVersionRange( + new KspVersionBound(), + new KspVersionBound(new KspVersion(1, 0, 4, 0), false) + ), + new KspVersionRange( + new KspVersionBound(new KspVersion(1, 0, 3, 0), true), + new KspVersionBound(new KspVersion(1, 0, 4, 0), false) + ), + new KspVersionRange( + new KspVersionBound(new KspVersion(1, 0, 3, 0), true), + new KspVersionBound(new KspVersion(1, 0, 4, 0), false) + ) + } + }; + private static readonly object[] IsSupersetOfCases = { new object[] @@ -174,7 +421,7 @@ public sealed class KspVersionRangeTests new KspVersionBound(new KspVersion(2, 0, 0, 0), true) ), true - } + }, }; [Test] @@ -226,6 +473,16 @@ public void ToStringWorksCorrectly(KspVersionRange vr, string expected) Assert.That(result, Is.EqualTo(expected)); } + [TestCaseSource("IntersectWithCases")] + public void IntersectWithWorksCorrectly(KspVersionRange left, KspVersionRange right, KspVersionRange expected) + { + // Act + var result = left.IntersectWith(right); + + // Assert + Assert.That(result, Is.EqualTo(expected)); + } + [TestCaseSource("IsSupersetOfCases")] public void IsSupersetOfWorksCorrectly(KspVersionRange left, KspVersionRange right, bool expected) { diff --git a/Tests/GUI/GH1866.cs b/Tests/GUI/GH1866.cs index b8bbb8ab61..684dd2a791 100644 --- a/Tests/GUI/GH1866.cs +++ b/Tests/GUI/GH1866.cs @@ -107,7 +107,7 @@ public void Sanity() public void TestSimple() { var modules = _registry.available_modules - .Select((mod) => new GUIMod(mod.Value.Latest(), _registry, _instance.KSP.Version())) + .Select((mod) => new GUIMod(mod.Value.Latest(), _registry, _instance.KSP.VersionCriteria())) .ToList(); // varargs method signature means we must call .ToArray() diff --git a/Tests/GUI/GUIMod.cs b/Tests/GUI/GUIMod.cs index 62859e91f8..16aaa9f207 100644 --- a/Tests/GUI/GUIMod.cs +++ b/Tests/GUI/GUIMod.cs @@ -21,7 +21,7 @@ public void NewGuiModsAreNotSelectedForUpgrade() var registry = Registry.Empty(); var ckan_mod = TestData.kOS_014_module(); registry.AddAvailable(ckan_mod); - var mod = new GUIMod(ckan_mod, registry, manager.CurrentInstance.Version()); + var mod = new GUIMod(ckan_mod, registry, manager.CurrentInstance.VersionCriteria()); Assert.False(mod.IsUpgradeChecked); } } @@ -38,7 +38,7 @@ public void HasUpdateReturnsTrueWhenUpdateAvailible() registry.RegisterModule(old_version, Enumerable.Empty(), null); registry.AddAvailable(new_version); - var mod = new GUIMod(old_version, registry, tidy.KSP.Version()); + var mod = new GUIMod(old_version, registry, tidy.KSP.VersionCriteria()); Assert.True(mod.HasUpdate); } } diff --git a/Tests/GUI/MainModList.cs b/Tests/GUI/MainModList.cs index af46aa8b92..9f407a62c1 100644 --- a/Tests/GUI/MainModList.cs +++ b/Tests/GUI/MainModList.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Threading.Tasks; using CKAN; +using CKAN.Versioning; using NUnit.Framework; using Tests.Core; using Tests.Data; @@ -66,14 +67,14 @@ public async Task ComputeChangeSetFromModList_WithConflictingMods_ThrowsInconsis registry.RegisterModule(module, Enumerable.Empty(), tidy.KSP); var mainList = new MainModList(null, null, new GUIUser()); - var mod = new GUIMod(module, registry, tidy.KSP.Version()); - var mod2 = new GUIMod(TestData.kOS_014_module(), registry, tidy.KSP.Version()); + var mod = new GUIMod(module, registry, tidy.KSP.VersionCriteria()); + var mod2 = new GUIMod(TestData.kOS_014_module(), registry, tidy.KSP.VersionCriteria()); var mods = new List() { mod, mod2 }; mainList.ConstructModList(mods, true); mainList.Modules = new ReadOnlyCollection(mods); mod2.IsInstallChecked = true; var computeTask = mainList.ComputeChangeSetFromModList(registry, mainList.ComputeUserChangeSet(), null, - tidy.KSP.Version()); + tidy.KSP.VersionCriteria()); await UtilStatic.Throws(() => computeTask); } @@ -90,7 +91,7 @@ public void IsVisible_WithAllAndNoNameFilter_ReturnsTrueForCompatible() var registry = Registry.Empty(); registry.AddAvailable(ckan_mod); var item = new MainModList(delegate { }, null); - Assert.That(item.IsVisible(new GUIMod(ckan_mod, registry, manager.CurrentInstance.Version()))); + Assert.That(item.IsVisible(new GUIMod(ckan_mod, registry, manager.CurrentInstance.VersionCriteria()))); } } @@ -118,8 +119,8 @@ public void ConstructModList_NumberOfRows_IsEqualToNumberOfMods() var main_mod_list = new MainModList(null, null); var mod_list = main_mod_list.ConstructModList(new List { - new GUIMod(TestData.FireSpitterModule(), registry, manager.CurrentInstance.Version()), - new GUIMod(TestData.kOS_014_module(), registry, manager.CurrentInstance.Version()) + new GUIMod(TestData.FireSpitterModule(), registry, manager.CurrentInstance.VersionCriteria()), + new GUIMod(TestData.kOS_014_module(), registry, manager.CurrentInstance.VersionCriteria()) }); Assert.That(mod_list, Has.Count.EqualTo(2)); } @@ -151,14 +152,14 @@ public async Task TooManyProvidesCallsHandlers() var main_mod_list = new MainModList(null, async kraken => await Task.FromResult(choice_of_provide)); var a = new HashSet { - new ModChange(new GUIMod(mod,registry,ksp_version), GUIModChangeType.Install, null) + new ModChange(new GUIMod(mod,registry,new KspVersionCriteria(ksp_version)), GUIModChangeType.Install, null) }; - var mod_list = await main_mod_list.ComputeChangeSetFromModList(registry, a, installer, ksp_version); + var mod_list = await main_mod_list.ComputeChangeSetFromModList(registry, a, installer, new KspVersionCriteria (ksp_version)); CollectionAssert.AreEquivalent( new[] { - new ModChange(new GUIMod(mod,registry,ksp_version), GUIModChangeType.Install, null), - new ModChange(new GUIMod(modb,registry,ksp_version),GUIModChangeType.Install, null) + new ModChange(new GUIMod(mod,registry,new KspVersionCriteria(ksp_version)), GUIModChangeType.Install, null), + new ModChange(new GUIMod(modb,registry,new KspVersionCriteria(ksp_version)),GUIModChangeType.Install, null) }, mod_list); }