public string GetMangaPath(string id, DownloadOption option = null) { return(option?.RootDirectory ?? Path.Combine(Settings.Global.DownloadLocation, id)); }
public string GetIllustrationPath(DownloadOption option = null) { return(option?.RootDirectory ?? Settings.Global.DownloadLocation); }
public string GetIllustrationPath(DownloadOption option = null) { return(option?.RootDirectory ?? Path.Combine(Settings.Global.DownloadLocation, UserName)); }
public string GetSpotlightPath(string title, DownloadOption option = null) { return(option?.RootDirectory ?? Path.Combine(Settings.Global.DownloadLocation, "Spotlight", Strings.FormatPath(title))); }
static DownloadableIllustration CreateDownloadableIllustration(Illustration downloadContent, bool isFromMange, DownloadOption option, int index = -1) { var filePathProvider = option.CreateNewWhenFromUser ? new CreateNewFolderForUserDownloadPathProvider(downloadContent.UserName) : (IDownloadPathProvider) new DefaultDownloadPathProvider(); var fileNameFormatter = new DefaultIllustrationFileNameFormatter(); var model = new DownloadableIllustration(downloadContent, fileNameFormatter, filePathProvider, isFromMange, index) { Option = option }; model.DownloadState.ValueChanged += (sender, args) => Application.Current.Dispatcher.Invoke(() => { switch (args.NewValue) { case DownloadStateEnum.Finished: model.Freeze(); Downloading.Remove(model); if (Downloaded.All(i => model.DownloadContent.GetDownloadUrl() != i.DownloadContent.GetDownloadUrl())) { Downloaded.Add(model); } break; case DownloadStateEnum.Downloading: Downloaded.Remove(model); Downloading.Add(model); break; case var stat when stat == DownloadStateEnum.Canceled || stat == DownloadStateEnum.Queue || stat == DownloadStateEnum.Exceptional: if (stat == DownloadStateEnum.Canceled) { Downloading.Remove(model); } break; default: throw new ArgumentOutOfRangeException(); } }); return(model); }