private void UpdateModInfo(GUIMod gui_module) { CkanModule module = gui_module.ToModule(); Util.Invoke(MetadataModuleNameTextBox, () => MetadataModuleNameTextBox.Text = gui_module.Name); Util.Invoke(MetadataModuleVersionTextBox, () => MetadataModuleVersionTextBox.Text = gui_module.LatestVersion.ToString()); Util.Invoke(MetadataModuleLicenseTextBox, () => MetadataModuleLicenseTextBox.Text = string.Join(", ", module.license)); Util.Invoke(MetadataModuleAuthorTextBox, () => MetadataModuleAuthorTextBox.Text = gui_module.Authors); Util.Invoke(MetadataModuleAbstractLabel, () => MetadataModuleAbstractLabel.Text = gui_module.Abstract); Util.Invoke(MetadataModuleDescriptionTextBox, () => { MetadataModuleDescriptionTextBox.Text = gui_module.Description ?.Replace("\r\n", "\n").Replace("\n", Environment.NewLine); MetadataModuleDescriptionTextBox.ScrollBars = string.IsNullOrWhiteSpace(gui_module.Description) ? ScrollBars.None : ScrollBars.Vertical; }); Util.Invoke(MetadataIdentifierTextBox, () => MetadataIdentifierTextBox.Text = gui_module.Identifier); // If we have a homepage provided, use that; otherwise use the spacedock page, curse page or the github repo so that users have somewhere to get more info than just the abstract. Util.Invoke(MetadataModuleHomePageLinkLabel, () => MetadataModuleHomePageLinkLabel.Text = gui_module.Homepage.ToString()); Util.Invoke(MetadataModuleGitHubLinkLabel, () => MetadataModuleGitHubLinkLabel.Text = module.resources?.repository?.ToString() ?? Properties.Resources.MainModInfoNSlashA); Util.Invoke(MetadataModuleReleaseStatusTextBox, () => MetadataModuleReleaseStatusTextBox.Text = module.release_status?.ToString() ?? Properties.Resources.MainModInfoNSlashA); Util.Invoke(MetadataModuleKSPCompatibilityTextBox, () => MetadataModuleKSPCompatibilityTextBox.Text = gui_module.KSPCompatibilityLong); Util.Invoke(ReplacementTextBox, () => ReplacementTextBox.Text = gui_module.ToModule()?.replaced_by?.ToString() ?? Properties.Resources.MainModInfoNSlashA); }
private void UpdateModInfo(GUIMod gui_module) { CkanModule module = gui_module.ToModule(); Util.Invoke(MetadataModuleNameLabel, () => MetadataModuleNameLabel.Text = gui_module.Name); Util.Invoke(MetadataModuleVersionLabel, () => MetadataModuleVersionLabel.Text = gui_module.LatestVersion.ToString()); Util.Invoke(MetadataModuleLicenseLabel, () => MetadataModuleLicenseLabel.Text = string.Join(", ", module.license)); Util.Invoke(MetadataModuleAuthorLabel, () => MetadataModuleAuthorLabel.Text = gui_module.Authors); Util.Invoke(MetadataModuleAbstractLabel, () => MetadataModuleAbstractLabel.Text = module.@abstract); Util.Invoke(MetadataModuleDescriptionLabel, () => MetadataModuleDescriptionLabel.Text = module.description); Util.Invoke(MetadataIdentifierLabel, () => MetadataIdentifierLabel.Text = module.identifier); // If we have a homepage provided, use that; otherwise use the spacedock page, curse page or the github repo so that users have somewhere to get more info than just the abstract. Util.Invoke(MetadataModuleHomePageLinkLabel, () => MetadataModuleHomePageLinkLabel.Text = gui_module.Homepage.ToString()); if (module.resources != null && module.resources.repository != null) { Util.Invoke(MetadataModuleGitHubLinkLabel, () => MetadataModuleGitHubLinkLabel.Text = module.resources.repository.ToString()); } else { Util.Invoke(MetadataModuleGitHubLinkLabel, () => MetadataModuleGitHubLinkLabel.Text = "N/A"); } if (module.release_status != null) { Util.Invoke(MetadataModuleReleaseStatusLabel, () => MetadataModuleReleaseStatusLabel.Text = module.release_status.ToString()); } Util.Invoke(MetadataModuleKSPCompatibilityLabel, () => MetadataModuleKSPCompatibilityLabel.Text = gui_module.KSPCompatibilityLong); }
private void UpdateModInfo(GUIMod gui_module) { CfanModule module = gui_module.ToModule(); Util.Invoke(MetadataModuleNameLabel, () => MetadataModuleNameLabel.Text = gui_module.Name); Util.Invoke(MetadataModuleVersionLabel, () => MetadataModuleVersionLabel.Text = gui_module.LatestVersion.ToString()); Util.Invoke(MetadataModuleLicenseLabel, () => MetadataModuleLicenseLabel.Text = ""); Util.Invoke(MetadataModuleAuthorLabel, () => MetadataModuleAuthorLabel.Text = gui_module.Authors); Util.Invoke(MetadataModuleAbstractLabel, () => MetadataModuleAbstractLabel.Text = module.@abstract); Util.Invoke(MetadataIdentifierLabel, () => MetadataIdentifierLabel.Text = module.identifier); // If we have homepage provided use that, otherwise use the spacedock page or the github repo so that users have somewhere to get more info than just the abstract. Util.Invoke(MetadataModuleHomePageLinkLabel, () => MetadataModuleHomePageLinkLabel.Text = gui_module.Homepage.ToString()); if (string.IsNullOrEmpty(gui_module.Homepage)) { Util.Invoke(MetadataModuleGitHubLinkLabel, () => MetadataModuleGitHubLinkLabel.Text = "N/A"); } if (module.release_status != null) { Util.Invoke(MetadataModuleReleaseStatusLabel, () => MetadataModuleReleaseStatusLabel.Text = module.release_status.ToString()); } Util.Invoke(MetadataModuleKSPCompatibilityLabel, () => MetadataModuleKSPCompatibilityLabel.Text = gui_module.KSPCompatibilityLong); }
private void UpdateModInfo(GUIMod gui_module) { CkanModule module = gui_module.ToModule(); Util.Invoke(MetadataModuleNameLabel, () => MetadataModuleNameLabel.Text = gui_module.Name); Util.Invoke(MetadataModuleVersionLabel, () => MetadataModuleVersionLabel.Text = gui_module.LatestVersion.ToString()); Util.Invoke(MetadataModuleLicenseLabel, () => MetadataModuleLicenseLabel.Text = string.Join(", ",module.license)); Util.Invoke(MetadataModuleAuthorLabel, () => MetadataModuleAuthorLabel.Text = gui_module.Authors); Util.Invoke(MetadataModuleAbstractLabel, () => MetadataModuleAbstractLabel.Text = module.@abstract); Util.Invoke(MetadataIdentifierLabel, () => MetadataIdentifierLabel.Text = module.identifier); // If we have homepage provided use that, otherwise use the kerbalstuff page or the github repo so that users have somewhere to get more info than just the abstract. Util.Invoke(MetadataModuleHomePageLinkLabel, () => MetadataModuleHomePageLinkLabel.Text = gui_module.Homepage.ToString()); if (module.resources != null && module.resources.repository != null) { Util.Invoke(MetadataModuleGitHubLinkLabel, () => MetadataModuleGitHubLinkLabel.Text = module.resources.repository.ToString()); } else { Util.Invoke(MetadataModuleGitHubLinkLabel, () => MetadataModuleGitHubLinkLabel.Text = "N/A"); } if (module.release_status != null) { Util.Invoke(MetadataModuleReleaseStatusLabel, () => MetadataModuleReleaseStatusLabel.Text = module.release_status.ToString()); } Util.Invoke(MetadataModuleKSPCompatibilityLabel, () => MetadataModuleKSPCompatibilityLabel.Text = gui_module.KSPCompatibilityLong); }
private void UpdateModInfo(GUIMod gui_module) { CkanModule module = gui_module.ToModule(); Util.Invoke(MetadataModuleNameTextBox, () => MetadataModuleNameTextBox.Text = gui_module.Name); UpdateTagsAndLabels(gui_module.ToModule()); Util.Invoke(MetadataModuleAbstractLabel, () => MetadataModuleAbstractLabel.Text = gui_module.Abstract); Util.Invoke(MetadataModuleDescriptionTextBox, () => { MetadataModuleDescriptionTextBox.Text = gui_module.Description ?.Replace("\r\n", "\n").Replace("\n", Environment.NewLine); MetadataModuleDescriptionTextBox.ScrollBars = string.IsNullOrWhiteSpace(gui_module.Description) ? ScrollBars.None : ScrollBars.Vertical; }); Util.Invoke(MetadataModuleVersionTextBox, () => MetadataModuleVersionTextBox.Text = gui_module.LatestVersion.ToString()); Util.Invoke(MetadataModuleLicenseTextBox, () => MetadataModuleLicenseTextBox.Text = string.Join(", ", module.license)); Util.Invoke(MetadataModuleAuthorTextBox, () => MetadataModuleAuthorTextBox.Text = gui_module.Authors); Util.Invoke(MetadataIdentifierTextBox, () => MetadataIdentifierTextBox.Text = gui_module.Identifier); Util.Invoke(MetadataModuleReleaseStatusTextBox, () => MetadataModuleReleaseStatusTextBox.Text = module.release_status?.ToString() ?? Properties.Resources.ModInfoNSlashA); Util.Invoke(MetadataModuleGameCompatibilityTextBox, () => MetadataModuleGameCompatibilityTextBox.Text = gui_module.GameCompatibilityLong); Util.Invoke(ReplacementTextBox, () => ReplacementTextBox.Text = gui_module.ToModule()?.replaced_by?.ToString() ?? Properties.Resources.ModInfoNSlashA); Util.Invoke(MetaDataLowerLayoutPanel, () => { ClearResourceLinks(); var res = module.resources; if (res != null) { AddResourceLink(Properties.Resources.ModInfoHomepageLabel, res.homepage); AddResourceLink(Properties.Resources.ModInfoSpaceDockLabel, res.spacedock); AddResourceLink(Properties.Resources.ModInfoCurseLabel, res.curse); AddResourceLink(Properties.Resources.ModInfoRepositoryLabel, res.repository); AddResourceLink(Properties.Resources.ModInfoBugTrackerLabel, res.bugtracker); AddResourceLink(Properties.Resources.ModInfoContinuousIntegrationLabel, res.ci); AddResourceLink(Properties.Resources.ModInfoLicenseLabel, res.license); AddResourceLink(Properties.Resources.ModInfoManualLabel, res.manual); AddResourceLink(Properties.Resources.ModInfoMetanetkanLabel, res.metanetkan); AddResourceLink(Properties.Resources.ModInfoRemoteAvcLabel, res.remoteAvc); AddResourceLink(Properties.Resources.ModInfoStoreLabel, res.store); AddResourceLink(Properties.Resources.ModInfoSteamStoreLabel, res.steamstore); } }); }
private bool MatchesTags(GUIMod mod) { var tagsInMod = mod.ToModule().Tags; return(TagNames.Count < 1 || TagNames.All(tn => string.IsNullOrEmpty(tn) ? tagsInMod == null : tagsInMod?.Contains(tn) ?? false)); }
private void UpdateModInfo(GUIMod gui_module) { CkanModule module = gui_module.ToModule(); Util.Invoke(MetadataModuleNameTextBox, () => MetadataModuleNameTextBox.Text = gui_module.Name); Util.Invoke(MetadataModuleVersionTextBox, () => MetadataModuleVersionTextBox.Text = gui_module.LatestVersion.ToString()); Util.Invoke(MetadataModuleLicenseTextBox, () => MetadataModuleLicenseTextBox.Text = string.Join(", ", module.license)); Util.Invoke(MetadataModuleAuthorTextBox, () => MetadataModuleAuthorTextBox.Text = gui_module.Authors); Util.Invoke(MetadataModuleAbstractLabel, () => MetadataModuleAbstractLabel.Text = gui_module.Abstract); Util.Invoke(MetadataModuleDescriptionTextBox, () => MetadataModuleDescriptionTextBox.Text = gui_module.Description); Util.Invoke(MetadataIdentifierTextBox, () => MetadataIdentifierTextBox.Text = gui_module.Identifier); // If we have a homepage provided, use that; otherwise use the spacedock page, curse page or the github repo so that users have somewhere to get more info than just the abstract. Util.Invoke(MetadataModuleHomePageLinkLabel, () => MetadataModuleHomePageLinkLabel.Text = gui_module.Homepage.ToString()); Util.Invoke(MetadataModuleGitHubLinkLabel, () => MetadataModuleGitHubLinkLabel.Text = module.resources?.repository?.ToString() ?? "N/A"); Util.Invoke(MetadataModuleReleaseStatusTextBox, () => MetadataModuleReleaseStatusTextBox.Text = module.release_status?.ToString() ?? "N/A"); Util.Invoke(MetadataModuleKSPCompatibilityTextBox, () => MetadataModuleKSPCompatibilityTextBox.Text = gui_module.KSPCompatibilityLong); Util.Invoke(ReplacementTextBox, () => ReplacementTextBox.Text = gui_module.ToModule()?.replaced_by?.ToString() ?? "N/A"); }
private bool MatchesTags(GUIMod mod) { var tagsInMod = mod.ToModule().Tags; return(TagNames.Count < 1 || TagNames.All(tn => ShouldNegateTerm(tn, out string subTag) ^ ( string.IsNullOrEmpty(subTag) ? tagsInMod == null : tagsInMod?.Contains(subTag) ?? false))); }
private bool MatchesLocalizations(GUIMod mod) { var ckm = mod.ToModule(); return(Localizations.Count < 1 || ( ckm.localizations != null && Localizations.All(searchLoc => ckm.localizations.Any(modLoc => modLoc.StartsWith(searchLoc, StringComparison.InvariantCultureIgnoreCase))) )); }
private bool MatchesLocalization(GUIMod mod) { var ckm = mod.ToModule(); return(string.IsNullOrWhiteSpace(Localization) || ( ckm.localizations != null && ckm.localizations.Any(loc => loc.IndexOf(Localization, StringComparison.InvariantCultureIgnoreCase) != -1) )); }
private DataGridViewRow MakeRow(GUIMod mod, List <ModChange> changes, string instanceName, bool hideEpochs = false, bool hideV = false) { DataGridViewRow item = new DataGridViewRow() { Tag = mod }; Color?myColor = ModuleLabels.LabelsFor(instanceName) .FirstOrDefault(l => l.ModuleIdentifiers.Contains(mod.Identifier)) ?.Color; if (myColor.HasValue) { item.DefaultCellStyle.BackColor = myColor.Value; } ModChange myChange = changes?.FindLast((ModChange ch) => ch.Mod.Equals(mod)); var selecting = mod.IsAutodetected ? new DataGridViewTextBoxCell() { Value = Properties.Resources.MainModListAutoDetected } : mod.IsInstallable() ? (DataGridViewCell) new DataGridViewCheckBoxCell() { Value = myChange == null ? mod.IsInstalled : myChange.ChangeType == GUIModChangeType.Install ? true : myChange.ChangeType == GUIModChangeType.Remove ? false : mod.IsInstalled } : new DataGridViewTextBoxCell() { Value = "-" }; var autoInstalled = mod.IsInstalled && !mod.IsAutodetected ? (DataGridViewCell) new DataGridViewCheckBoxCell() { Value = mod.IsAutoInstalled } : new DataGridViewTextBoxCell() { Value = "-" }; var updating = mod.IsInstallable() && mod.HasUpdate ? (DataGridViewCell) new DataGridViewCheckBoxCell() { Value = myChange == null ? false : myChange.ChangeType == GUIModChangeType.Update ? true : false } : new DataGridViewTextBoxCell() { Value = "-" }; var replacing = IsModInFilter(GUIModFilter.Replaceable, null, null, mod) ? (DataGridViewCell) new DataGridViewCheckBoxCell() { Value = myChange == null ? false : myChange.ChangeType == GUIModChangeType.Replace ? true : false } : new DataGridViewTextBoxCell() { Value = "-" }; var name = new DataGridViewTextBoxCell { Value = mod.Name.Replace("&", "&&") }; var author = new DataGridViewTextBoxCell { Value = mod.Authors.Replace("&", "&&") }; var installVersion = new DataGridViewTextBoxCell() { Value = hideEpochs ? (hideV ? ModuleInstaller.StripEpoch(ModuleInstaller.StripV(mod.InstalledVersion ?? "")) : ModuleInstaller.StripEpoch(mod.InstalledVersion ?? "")) : (hideV ? ModuleInstaller.StripV(mod.InstalledVersion ?? "") : mod.InstalledVersion ?? "") }; var latestVersion = new DataGridViewTextBoxCell() { Value = hideEpochs ? (hideV ? ModuleInstaller.StripEpoch(ModuleInstaller.StripV(mod.LatestVersion)) : ModuleInstaller.StripEpoch(mod.LatestVersion)) : (hideV ? ModuleInstaller.StripV(mod.LatestVersion) : mod.LatestVersion) }; var downloadCount = new DataGridViewTextBoxCell { Value = $"{mod.DownloadCount:N0}" }; var compat = new DataGridViewTextBoxCell { Value = mod.GameCompatibility }; var size = new DataGridViewTextBoxCell { Value = mod.DownloadSize }; var releaseDate = new DataGridViewTextBoxCell { Value = mod.ToModule().release_date }; var installDate = new DataGridViewTextBoxCell { Value = mod.InstallDate }; var desc = new DataGridViewTextBoxCell { Value = mod.Abstract.Replace("&", "&&") }; item.Cells.AddRange(selecting, autoInstalled, updating, replacing, name, author, installVersion, latestVersion, compat, size, releaseDate, installDate, downloadCount, desc); selecting.ReadOnly = selecting is DataGridViewTextBoxCell; autoInstalled.ReadOnly = autoInstalled is DataGridViewTextBoxCell; updating.ReadOnly = updating is DataGridViewTextBoxCell; return(item); }
private bool MatchesConflicts(GUIMod mod) { return(RelationshipMatch(mod.ToModule().conflicts, ConflictsWith)); }
private bool MatchesSuggests(GUIMod mod) { return(RelationshipMatch(mod.ToModule().suggests, Suggests)); }
private bool MatchesRecommends(GUIMod mod) { return(RelationshipMatch(mod.ToModule().recommends, Recommends)); }
private bool MatchesDepends(GUIMod mod) { return(RelationshipMatch(mod.ToModule().depends, DependsOn)); }
private void UpdateModInfo(GUIMod gui_module) { CkanModule module = gui_module.ToModule(); Util.Invoke(MetadataModuleNameTextBox, () => MetadataModuleNameTextBox.Text = module.name); UpdateTagsAndLabels(module); Util.Invoke(MetadataModuleAbstractLabel, () => MetadataModuleAbstractLabel.Text = module.@abstract); Util.Invoke(MetadataModuleDescriptionTextBox, () => { MetadataModuleDescriptionTextBox.Text = module.description ?.Replace("\r\n", "\n").Replace("\n", Environment.NewLine); MetadataModuleDescriptionTextBox.ScrollBars = string.IsNullOrWhiteSpace(module.description) ? ScrollBars.None : ScrollBars.Vertical; }); Util.Invoke(MetadataModuleVersionTextBox, () => MetadataModuleVersionTextBox.Text = gui_module.LatestVersion.ToString()); Util.Invoke(MetadataModuleLicenseTextBox, () => MetadataModuleLicenseTextBox.Text = string.Join(", ", module.license)); Util.Invoke(MetadataModuleAuthorTextBox, () => MetadataModuleAuthorTextBox.Text = gui_module.Authors); Util.Invoke(MetadataIdentifierTextBox, () => MetadataIdentifierTextBox.Text = module.identifier); Util.Invoke(MetadataModuleReleaseStatusTextBox, () => { if (module.release_status == null) { ReleaseLabel.Visible = false; MetadataModuleReleaseStatusTextBox.Visible = false; MetaDataLowerLayoutPanel.LayoutSettings.RowStyles[3].Height = 0; } else { ReleaseLabel.Visible = true; MetadataModuleReleaseStatusTextBox.Visible = true; MetaDataLowerLayoutPanel.LayoutSettings.RowStyles[3].Height = 30; MetadataModuleReleaseStatusTextBox.Text = module.release_status.ToString(); } }); Util.Invoke(MetadataModuleGameCompatibilityTextBox, () => MetadataModuleGameCompatibilityTextBox.Text = gui_module.GameCompatibilityLong); Util.Invoke(ModInfoTabControl, () => { // Mono doesn't draw TabPage.ImageIndex, so fake it const string fakeStopSign = "<!> "; ComponentResourceManager resources = new SingleAssemblyComponentResourceManager(typeof(ModInfo)); resources.ApplyResources(RelationshipTabPage, "RelationshipTabPage"); resources.ApplyResources(AllModVersionsTabPage, "AllModVersionsTabPage"); if (gui_module.IsIncompatible) { if (!module.IsCompatibleKSP(manager.CurrentInstance.VersionCriteria())) { AllModVersionsTabPage.Text = fakeStopSign + AllModVersionsTabPage.Text; } else { RelationshipTabPage.Text = fakeStopSign + RelationshipTabPage.Text; } } }); Util.Invoke(ReplacementTextBox, () => { if (module.replaced_by == null) { ReplacementLabel.Visible = false; ReplacementTextBox.Visible = false; MetaDataLowerLayoutPanel.LayoutSettings.RowStyles[6].Height = 0; } else { ReplacementLabel.Visible = true; ReplacementTextBox.Visible = true; MetaDataLowerLayoutPanel.LayoutSettings.RowStyles[6].Height = 30; ReplacementTextBox.Text = module.replaced_by.ToString(); } }); Util.Invoke(MetaDataLowerLayoutPanel, () => { ClearResourceLinks(); var res = module.resources; if (res != null) { AddResourceLink(Properties.Resources.ModInfoHomepageLabel, res.homepage); AddResourceLink(Properties.Resources.ModInfoSpaceDockLabel, res.spacedock); AddResourceLink(Properties.Resources.ModInfoCurseLabel, res.curse); AddResourceLink(Properties.Resources.ModInfoRepositoryLabel, res.repository); AddResourceLink(Properties.Resources.ModInfoBugTrackerLabel, res.bugtracker); AddResourceLink(Properties.Resources.ModInfoContinuousIntegrationLabel, res.ci); AddResourceLink(Properties.Resources.ModInfoLicenseLabel, res.license); AddResourceLink(Properties.Resources.ModInfoManualLabel, res.manual); AddResourceLink(Properties.Resources.ModInfoMetanetkanLabel, res.metanetkan); AddResourceLink(Properties.Resources.ModInfoRemoteAvcLabel, res.remoteAvc); AddResourceLink(Properties.Resources.ModInfoStoreLabel, res.store); AddResourceLink(Properties.Resources.ModInfoSteamStoreLabel, res.steamstore); } }); }