/// <summary> /// Sets up the base command to read ShareDefinitions from the selected <paramref name="sourceFileCollection"/> (pass null to have the user pick at Execute) /// </summary> /// <param name="activator"></param> /// <param name="sourceFileCollection"></param> protected ExecuteCommandImportShare(IActivateItems activator, FileCollectionCombineable sourceFileCollection) : base(activator) { if (sourceFileCollection != null) { if (!sourceFileCollection.IsShareDefinition) { SetImpossible("Only ShareDefinition files can be imported"); } _shareDefinitionFile = sourceFileCollection.Files.Single(); } }
public ExecuteCommandAddPlugins(IBasicActivateItems itemActivator, FileCollectionCombineable fileCombineable) : base(itemActivator) { if (!fileCombineable.Files.All(f => f.Extension == PackPluginRunner.PluginPackageSuffix)) { SetImpossible("Plugins must " + PackPluginRunner.PluginPackageSuffix); return; } var existing = BasicActivator.RepositoryLocator.CatalogueRepository.PluginManager.GetCompatiblePlugins(); _files = fileCombineable.Files; var collision = existing.FirstOrDefault(p => _files.Any(f => f.Name.Equals(p.Name))); if (collision != null) { SetImpossible("There is already a plugin called '" + collision + "'"); } }
public ExecuteCommandAddNewSupportingDocument(IBasicActivateItems activator, FileCollectionCombineable fileCollectionCombineable, Catalogue targetCatalogue) : base(activator) { _fileCollectionCombineable = fileCollectionCombineable; _targetCatalogue = targetCatalogue; var allExisting = targetCatalogue.GetAllSupportingDocuments(FetchOptions.AllGlobalsAndAllLocals); foreach (var doc in allExisting) { FileInfo filename = doc.GetFileName(); if (filename == null) { continue; } var collisions = _fileCollectionCombineable.Files.FirstOrDefault(f => f.FullName.Equals(filename.FullName, StringComparison.CurrentCultureIgnoreCase)); if (collisions != null) { SetImpossible("File '" + collisions.Name + "' is already a SupportingDocument (ID=" + doc.ID + " - '" + doc.Name + "')"); } } }
public ExecuteCommandImportCatalogueDescriptionsFromShare(IBasicActivateItems activator, FileCollectionCombineable sourceFileCollection, Catalogue targetCatalogue) : base(activator, sourceFileCollection) { _targetCatalogue = targetCatalogue; UseTripleDotSuffix = true; }
public ExecuteCommandCreateNewCatalogueByImportingFile(IBasicActivateItems activator, FileCollectionCombineable file) : base(activator) { if (file.Files.Length != 1) { SetImpossible("Only one file can be imported at once"); return; } File = file.Files[0]; UseTripleDotSuffix = true; CheckFile(); }
public ExecuteCommandImportFilterDescriptionsFromShare(IActivateItems activator, IFilter toPopulate, FileCollectionCombineable cmd = null) : base(activator, cmd) { _toPopulate = toPopulate; if (!string.IsNullOrWhiteSpace(_toPopulate.WhereSQL) || !string.IsNullOrWhiteSpace(_toPopulate.Description) || _toPopulate.GetAllParameters().Any()) { SetImpossible("Filter is not empty (import requires a new blank filter)"); } }