public DiskProfileBase(IEventAggregator events, params IConverterProfile[] converters) : base(events, converters) { MetadataProvider = new MetadataProviderBase(new BasicMetadataProvider(), new FileBasedMetadataProvider()); CommandProviders.Add(new FileBasedCommandProvider()); //Open, Cut, Copy, Paste etc DeleteCommand = ScriptCommands.AssignProperty("{DeleteEntries}", "Length", "{DeleteEntries-Length}", //Assign DeleteEntries Length ScriptCommands.IfValue <int>(ComparsionOperator.GreaterThanOrEqual, "{DeleteEntries.Length}", 1, //If DeleteEntries Length >= 1 UIScriptCommands.MessageBoxYesNo("FileExplorer", "Delete {DeleteEntries[0]} and {DeleteEntries-Length} Item(s)?", //IfTrue CoreScriptCommands.DiskDeleteMultiple("{DeleteEntries}", true)))); CreateFolderCommand = CoreScriptCommands.DiskCreateFolder("{BaseFolder.Profile}", "{BaseFolder.FullPath}\\{FolderName}", "{CreatedFolder}", NameGenerationMode.Rename); }
public int?OnOptionsParsed(Parser parser) { if (commandObject is ICommandObject commandObjectInterface) { var exitCode = commandObjectInterface.OnOptionsParsed(parser); if (exitCode != null) { return(exitCode); } } return(CommandProviders.Select(_ => _.OnOptionsParsed(parser)) .FirstOrDefault(_ => _ != null)); }
public FileSystemInfoExProfile(IEventAggregator events, IWindowManager windowManager, params IConverterProfile[] converters) : base(events, converters) { ProfileName = "FileSystem (Ex)"; ProfileIcon = ResourceUtils.GetEmbeddedResourceAsByteArray(this, "/Model/DirectoryInfoEx/My_Computer.png"); DiskIO = new HardDriveDiskIOHelper(this); HierarchyComparer = new ExHierarchyComparer(this); MetadataProvider = new ExMetadataProvider(); CommandProviders.Add(new ExCommandProvider(this)); //DragDrop = new FileSystemInfoExDragDropHandler(this); DragDrop = new FileBasedDragDropHandler(this, em => false); //PathMapper = IODiskPatheMapper.Instance; PathPatterns = new string[] { RegexPatterns.FileSystemGuidPattern, RegexPatterns.FileSystemPattern }; }
/// <summary> /// Gets the command provider of the given type. /// </summary> /// <returns>The command provider of the specified type, or <c>null</c> if not found.</returns> /// <typeparam name="T">The type of the command provider to get.</typeparam> public T GetCommandProvider <T>() where T : ICommandProvider { var commandProvider = CommandProviders.Select(c => c.Value).OfType <T>().FirstOrDefault(); return(commandProvider); }