/// <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, FileCollectionCommand sourceFileCollection) : base(activator) { if (sourceFileCollection != null) { if (!sourceFileCollection.IsShareDefinition) { SetImpossible("Only ShareDefinition files can be imported"); } _shareDefinitionFile = sourceFileCollection.Files.Single(); } }
public ExecuteCommandAddPlugins(IActivateItems itemActivator, FileCollectionCommand fileCommand) : base(itemActivator) { if (!fileCommand.Files.All(f => f.Extension == PackPluginRunner.PluginPackageSuffix)) { SetImpossible("Plugins must " + PackPluginRunner.PluginPackageSuffix); return; } var existing = Activator.RepositoryLocator.CatalogueRepository.PluginManager.GetCompatiblePlugins(); _files = fileCommand.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(IActivateItems activator, FileCollectionCommand fileCollectionCommand, Catalogue targetCatalogue) : base(activator) { _fileCollectionCommand = fileCollectionCommand; _targetCatalogue = targetCatalogue; var allExisting = targetCatalogue.GetAllSupportingDocuments(FetchOptions.AllGlobalsAndAllLocals); foreach (var doc in allExisting) { FileInfo filename = doc.GetFileName(); if (filename == null) { continue; } var collisions = _fileCollectionCommand.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 ExecuteCommandCreateNewCatalogueByImportingFile(IActivateItems activator, FileCollectionCommand 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, FileCollectionCommand 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)"); } }
public ExecuteCommandImportCatalogueDescriptionsFromShare(IActivateItems activator, FileCollectionCommand sourceFileCollection, Catalogue targetCatalogue) : base(activator, sourceFileCollection) { _targetCatalogue = targetCatalogue; UseTripleDotSuffix = true; }