private static void BackgoundWorker_DoWork(object sender, DoWorkEventArgs e) { BackgroundWorker backgroundWorker = sender as BackgroundWorker; IPathFormatter pathFormatter = e.Argument as IPathFormatter; string cacheDirectory = pathFormatter.GetCacheDirectory(); if (Directory.Exists(cacheDirectory)) { DirectoryInfo dirInfo = new DirectoryInfo(cacheDirectory); FileInfo[] coverFiles = dirInfo.GetFiles("*.jpg", SearchOption.TopDirectoryOnly); Random rand = new Random(); int randomIndex = rand.Next(coverFiles.Length); if (backgroundWorker.CancellationPending) { e.Cancel = true; } else { e.Result = coverFiles[randomIndex].FullName.Replace('\\', '/'); } } else { e.Cancel = true; } }
public SearchHandler( LibraryModel libraryModel , TabControlEx mainViewTabControl , TabPage libraryBrowserViewTabPage , TabPage galleryBrowserViewTabPage , Configuration.ConfigCache cacheSettings , ISearchResultCache searchResultCache , ILogger logger , BrowsingModel browsingModel , IPathFormatter pathFormatter , HttpClient httpClient , IQueryParser queryParser , GalleryModel galleryModel , DetailsModel detailsModel , GalleryDownloader galleryDownloader) { LibraryModel = libraryModel; MainViewTabControl = mainViewTabControl; LibraryBrowserViewTabPage = libraryBrowserViewTabPage; GalleryBrowserViewTabPage = galleryBrowserViewTabPage; CacheSettings = cacheSettings; SearchResultCache = searchResultCache; Logger = logger; BrowsingModel = browsingModel; PathFormatter = pathFormatter; HttpClient = httpClient; QueryParser = queryParser; GalleryModel = galleryModel; DetailsModel = detailsModel; GalleryDownloader = galleryDownloader; }
public SearchArgTextFormatter(IPathFormatter pathFormatter, MetadataKeywordLists metadataKeywordLists, TagsModel tagsModel, ITokenModifier[] tokenModifiers) { PathFormatter = pathFormatter; MetadataKeywordLists = metadataKeywordLists; TagsModel = tagsModel; TokenModifiers = tokenModifiers; }
public WebBrowserToolTip(IPathFormatter pathFormatter, DocumentTemplate <Metadata> galleryTooltipTemplate) { InitializeComponent(); Visible = false; PathFormatter = pathFormatter; GalleryTooltipTemplate = galleryTooltipTemplate; webBrowser = new WebBrowserEx(); associatedControls = new Dictionary <Control, int>(); SuspendLayout(); // // // webBrowser.AllowWebBrowserDrop = false; webBrowser.AllowNavigation = false; webBrowser.ScriptErrorsSuppressed = true; webBrowser.DocumentCompleted += WebBrowser_DocumentCompleted; // // // Controls.Add(webBrowser); ResumeLayout(false); }
public PageDownloader(HttpClient httpClient, IPathFormatter pathFormatter, ISearchResultCache searchResultCache, ICacheFileSystem cacheFileSystem) { HttpClient = httpClient; SearchResultCache = searchResultCache; PathFormatter = pathFormatter; CacheFileSystem = cacheFileSystem; }
public MutatorsTree(ModelConfigurationNode tree, IPathFormatter pathFormatter, IPathFormatterCollection pathFormatterCollection, int priority) { this.tree = tree; this.pathFormatterCollection = pathFormatterCollection; this.pathFormatter = pathFormatter; this.priority = priority; }
public WebBrowserTreeNodeToolTip(IPathFormatter pathFormatter, DocumentTemplate <Metadata> galleryTooltipTemplate) { InitializeComponent(); Visible = false; PathFormatter = pathFormatter; GalleryTooltipTemplate = galleryTooltipTemplate; associatedControls = new Dictionary <TreeNode, int>(); observedTreeViews = new List <TreeView>(); webBrowser = new WebBrowserEx(); SuspendLayout(); // // // webBrowser.AllowWebBrowserDrop = false; //webBrowser.AllowNavigation = false; webBrowser.ScriptErrorsSuppressed = true; webBrowser.WebBrowserShortcutsEnabled = false; webBrowser.Dock = DockStyle.Fill; webBrowser.Name = "tooltipWebBrowser"; webBrowser.TabIndex = 0; webBrowser.DocumentCompleted += WebBrowser_DocumentCompleted; // // this // Controls.Add(webBrowser); ResumeLayout(false); }
public DownloadGalleryRunArg(int galleryId, HttpClient httpClient, IPathFormatter pathFormatter, ISearchResultCache searchResultCache) { Id = galleryId; HttpClient = httpClient; PathFormatter = pathFormatter; SearchResultCache = searchResultCache; }
public MetadataTextFormatter(IPathFormatter pathFormatter, string[] languageNames, MetadataKeywordLists metadataKeywordLists, ITokenModifier[] tokenModifiers) { PathFormatter = pathFormatter; LanguageNames = languageNames; MetadataKeywordLists = metadataKeywordLists; TokenModifiers = tokenModifiers; }
public DocumentTemplate(string name, bool cacheEnabled, IPathFormatter pathFormatter, Func <string, T, string> formatText) { Name = name; CacheEnabled = cacheEnabled; PathFormatter = pathFormatter; FormatText = formatText; }
private AbsolutePath([NotNull][ItemNotNull] IReadOnlyList <string> components, bool isExtended) { Components = components; this.isExtended = isExtended; Formatter = new AbsolutePathFormatter(this); }
public static AssetResolver BuildTestResolver( IBundleLookup bundleLookup = null, IPathFormatter pathFormatter = null, IBunderCache cache = null, BunderSettings settings = null) { if (bundleLookup == null) { bundleLookup = new Mock <IBundleLookup>().Object; } if (pathFormatter == null) { pathFormatter = new MockPathFormatter(); } if (settings == null) { settings = new BunderSettings(); } if (cache == null) { cache = new Mock <IBunderCache>().Object; } return(new AssetResolver(bundleLookup, pathFormatter, cache, settings)); }
public SessionManager(IPathFormatter pathFormatter, ISearchResultCache searchResultCache, int recentSearchLifeSpan, int querySearchLifeSpan, int taggedSearchLifeSpan) { PathFormatter = pathFormatter; SearchResultCache = searchResultCache; RecentSearchLifeSpan = recentSearchLifeSpan; QuerySearchLifeSpan = querySearchLifeSpan; TaggedSearchLifeSpan = taggedSearchLifeSpan; }
public PathFormatterWrapper(IPathFormatter pathFormatter, IPathFormatter basePathFormatter, ModelConfigurationNode converterTree, CompositionPerformer performer, AliasesResolver resolver) { this.pathFormatter = pathFormatter; this.basePathFormatter = basePathFormatter; this.converterTree = converterTree; this.performer = performer; this.resolver = resolver; }
public DownloadCoversRunArg(HttpClient httpClient, IPathFormatter pathFormatter, SearchResult searchResult, MetadataKeywordLists metadataKeywordLists, CoverDownloaderFilters filters) { HttpClient = httpClient; PathFormatter = pathFormatter; SearchResult = searchResult; MetadataKeywordLists = metadataKeywordLists; Filters = filters; }
public SessionManager(IPathFormatter pathFormatter, ISearchResultCache searchResultCache, int recentSearchLifeSpan, int querySearchLifeSpan, int taggedSearchLifeSpan, ConfigNetwork networkSettings) { PathFormatter = pathFormatter; SearchResultCache = searchResultCache; RecentSearchLifeSpan = recentSearchLifeSpan; QuerySearchLifeSpan = querySearchLifeSpan; TaggedSearchLifeSpan = taggedSearchLifeSpan; NetworkSettings = networkSettings; }
public SearchProgressArgTextFormatter(IPathFormatter pathFormatter, MetadataKeywordLists metadataKeywordLists, TagsModel tagsModel, MetadataTextFormatter metadataTextFormatter, ITokenModifier[] searchTokenModifiers, DocumentTemplate <Metadata> searchCoverGridItemDocumentTemplate, DocumentTemplate <Metadata> libraryCoverGridItemDocumentTemplate) { PathFormatter = pathFormatter; MetadataKeywordLists = metadataKeywordLists; TagsModel = tagsModel; MetadataTextFormatter = metadataTextFormatter; SearchTokenModifiers = searchTokenModifiers; SearchCoverGridItemDocumentTemplate = searchCoverGridItemDocumentTemplate; LibraryCoverGridItemDocumentTemplate = libraryCoverGridItemDocumentTemplate; }
public FakeSystemChangeEventArgs(WatcherChangeTypes changeType, NotifyFilters filters, [NotNull] IPathFormatter pathFormatter, [CanBeNull] IPathFormatter previousPathInRenameFormatter) { Guard.NotNull(pathFormatter, nameof(pathFormatter)); ChangeType = changeType; Filters = filters; PathFormatter = pathFormatter; PreviousPathInRenameFormatter = previousPathInRenameFormatter; }
public AssetResolver( IBundleLookup bundleLookup, IPathFormatter pathFormatter, IBunderCache cache, BunderSettings settings) { BundleLookup = bundleLookup; PathFormatter = pathFormatter; Cache = cache; Settings = settings; }
public AbsolutePath([NotNull] string path) { Guard.NotNull(path, nameof(path)); var parser = new Parser(path); Components = parser.GetComponents(); isExtended = parser.IsExtended; HasTrailingSeparator = parser.HasTrailingSeparator; Formatter = new AbsolutePathFormatter(this); }
public BookmarkFormatter(Configuration.ConfigBookmarksList bookmarkListSettings, Configuration.ConfigTagsList tagsListSettings , TagsModel tagsModel , IPathFormatter pathFormatter , ITokenModifier[] tokenModifiers ) { BookmarkListSettings = bookmarkListSettings; TagsListSettings = tagsListSettings; TagsModel = tagsModel; PathFormatter = pathFormatter; TokenModifiers = tokenModifiers; }
public DownloadPagesRunArg(int galleryId, int[] pageIndices , HttpClient httpClient , IPathFormatter pathFormatter , ISearchResultCache searchResultCache , ICacheFileSystem cacheFileSystem) { Id = galleryId; PageIndices = pageIndices; HttpClient = httpClient; PathFormatter = pathFormatter; SearchResultCache = searchResultCache; CacheFileSystem = cacheFileSystem; }
public LibraryLoadRunArg(IPathFormatter pathFormatter, ISearchResultCache searchResultCache, SearchArg searchArg, int numItemsPerPage, string libraryPath , GallerySortType sortType, LibrarySortType globalSortType , SortOrder sortOrder, SortOrder globalSortOrder) { PathFormatter = pathFormatter; SearchResultCache = searchResultCache; SearchArg = searchArg; NumItemsPerPage = numItemsPerPage; LibraryPath = libraryPath; SortType = sortType; GlobalSortType = globalSortType; SortOrder = sortOrder; GlobalSortOrder = globalSortOrder; }
public PluginSystem(ILogger logger , IPathFormatter pathFormatter , ICacheFileSystem cacheFileSystem , List <IArchiveWriter> archiveWriters , List <IMetadataConverter> metadataConverters , List <IMetadataProcessor> metadataProcessors) { Logger = logger; PathFormatter = pathFormatter; CacheFileSystem = cacheFileSystem; ArchiveWriters = archiveWriters; MetadataConverters = metadataConverters; MetadataProcessors = metadataProcessors; }
public GalleryDownloaderJob(HttpClient httpClient, IPathFormatter pathFormatter, ISearchResultCache searchResultCache, int galleryId) { GalleryId = galleryId; HttpClient = httpClient; PathFormatter = pathFormatter; SearchResultCache = searchResultCache; BackgroundWorker.WorkerReportsProgress = true; BackgroundWorker.WorkerSupportsCancellation = true; BackgroundWorker.DoWork += DownloadGalleryBackgroundWorker_DoWork; BackgroundWorker.ProgressChanged += DownloadGalleryBackgroundWorker_ProgressChanged; BackgroundWorker.RunWorkerCompleted += DownloadGalleryBackgroundWorker_RunWorkerCompleted; }
private void MoveSingleFile([NotNull] FileEntry sourceFile, [NotNull] DirectoryEntry destinationDirectory, [NotNull] string destinationFileName, [NotNull] IPathFormatter sourcePathFormatter, bool skipNotifyLastAccess) { if (sourceFile.Parent == destinationDirectory) { IPathFormatter sourcePathFormatterNonLazy = sourcePathFormatter.GetPath().Formatter; sourceFile.Parent.RenameFile(sourceFile.Name, destinationFileName, sourcePathFormatterNonLazy, skipNotifyLastAccess, true); } else { sourceFile.Parent.DeleteFile(sourceFile.Name, true); destinationDirectory.MoveFileToHere(sourceFile, destinationFileName, skipNotifyLastAccess, true); } }
private void MoveDirectory([NotNull] DirectoryEntry sourceDirectory, [NotNull] DirectoryEntry destinationDirectory, [NotNull] string destinationDirectoryName, [NotNull] IPathFormatter sourcePathFormatter) { if (sourceDirectory.Parent == destinationDirectory) { sourceDirectory.Parent.RenameDirectory(sourceDirectory.Name, destinationDirectoryName, sourcePathFormatter); } else { Container.ChangeTracker.NotifyContentsAccessed(destinationDirectory.PathFormatter, FileAccessKinds.Read); sourceDirectory.Parent?.DeleteDirectory(sourceDirectory.Name); destinationDirectory.MoveDirectoryToHere(sourceDirectory, destinationDirectoryName); } }
public CoverDownloaderJob(HttpClient httpClient, IPathFormatter pathFormatter, MetadataKeywordLists metadataKeywordLists, SearchResult searchResult, CoverDownloaderFilters filters) { HttpClient = httpClient; PathFormatter = pathFormatter; SearchResult = searchResult; MetadataKeywordLists = metadataKeywordLists; Filters = filters; BackgroundWorker.WorkerReportsProgress = true; BackgroundWorker.WorkerSupportsCancellation = true; BackgroundWorker.DoWork += DownloadCoverBackgroundWorker_DoWork; BackgroundWorker.ProgressChanged += DownloadCoverBackgroundWorker_ProgressChanged; BackgroundWorker.RunWorkerCompleted += DownloadCoverBackgroundWorker_RunWorkerCompleted; }
public void RenameDirectory([NotNull] string sourceDirectoryName, [NotNull] string destinationDirectoryName, [NotNull] IPathFormatter sourcePathFormatter) { Guard.NotNullNorWhiteSpace(sourceDirectoryName, nameof(sourceDirectoryName)); Guard.NotNullNorWhiteSpace(destinationDirectoryName, nameof(destinationDirectoryName)); Guard.NotNull(sourcePathFormatter, nameof(sourcePathFormatter)); DirectoryEntry directory = contents.RemoveDirectory(sourceDirectoryName); directory.Name = destinationDirectoryName; contents.Add(directory); HandleDirectoryContentsAccessed(); ChangeTracker.NotifyDirectoryRenamed(sourcePathFormatter, directory.PathFormatter); HandleDirectoryContentsChanged(false); }
public PageDownloaderJob(HttpClient httpClient, IPathFormatter pathFormatter, ISearchResultCache searchResultCache, ICacheFileSystem cacheFileSystem, int galleryId, int[] pageIndices) { HttpClient = httpClient; PathFormatter = pathFormatter; SearchResultCache = searchResultCache; CacheFileSystem = cacheFileSystem; GalleryId = galleryId; PageIndices = pageIndices; BackgroundWorker.WorkerReportsProgress = true; BackgroundWorker.WorkerSupportsCancellation = true; BackgroundWorker.DoWork += DownloadPagesBackgroundWorker_DoWork; BackgroundWorker.ProgressChanged += DownloadPagesBackgroundWorker_ProgressChanged; BackgroundWorker.RunWorkerCompleted += DownloadPagesBackgroundWorker_RunWorkerCompleted; }
public Aria2cFinder(Aria2cConfig config, IPathFormatter formatter = null) { _config = config; _formatter = formatter ?? new DefaultPathFormatter(); }