mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Remove file watcher from ManualDownloader
This was creating a file watcher in the system configured Downloads folder. This folder has absolutely no purpose for WJ as downloads go to the specified downloads tab. Additionally, this causes crashes to occur if the Downloads folder doesn't exist.
This commit is contained in:
parent
939e05ff65
commit
20821090c1
@ -13,11 +13,6 @@ namespace Wabbajack.Lib.Downloaders
|
||||
{
|
||||
public class ManualDownloader : IDownloader
|
||||
{
|
||||
private FileSystemWatcher _watcher;
|
||||
private Subject<FileEvent> _fileEvents = new Subject<FileEvent>();
|
||||
private KnownFolder _downloadfolder;
|
||||
public readonly AsyncLock Lock = new AsyncLock();
|
||||
|
||||
class FileEvent
|
||||
{
|
||||
public string FullPath { get; set; } = string.Empty;
|
||||
@ -27,36 +22,6 @@ namespace Wabbajack.Lib.Downloaders
|
||||
|
||||
public ManualDownloader()
|
||||
{
|
||||
_downloadfolder = new KnownFolder(KnownFolderType.Downloads);
|
||||
_watcher = new FileSystemWatcher(_downloadfolder.Path);
|
||||
_watcher.Created += _watcher_Created;
|
||||
_watcher.Changed += _watcher_Changed;
|
||||
}
|
||||
|
||||
private void _watcher_Changed(object sender, FileSystemEventArgs e)
|
||||
{
|
||||
PublishEvent(e);
|
||||
}
|
||||
private void _watcher_Created(object sender, FileSystemEventArgs e)
|
||||
{
|
||||
PublishEvent(e);
|
||||
}
|
||||
|
||||
private void PublishEvent(FileSystemEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_fileEvents.OnNext(new FileEvent
|
||||
{
|
||||
Size = new FileInfo(e.FullPath).Length,
|
||||
Name = e.Name!,
|
||||
FullPath = e.FullPath
|
||||
});
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<AbstractDownloadState?> GetDownloaderState(dynamic archiveINI, bool quickMode)
|
||||
@ -68,12 +33,12 @@ namespace Wabbajack.Lib.Downloaders
|
||||
public async Task Prepare()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
[JsonName("ManualDownloader")]
|
||||
public class State : AbstractDownloadState
|
||||
{
|
||||
public string Url { get; }
|
||||
|
||||
|
||||
[JsonIgnore]
|
||||
public override object[] PrimaryKey => new object[] { Url };
|
||||
|
||||
@ -111,7 +76,7 @@ namespace Wabbajack.Lib.Downloaders
|
||||
|
||||
public override string[] GetMetaIni()
|
||||
{
|
||||
return new []
|
||||
return new []
|
||||
{
|
||||
"[General]",
|
||||
$"manualURL={Url}",
|
||||
|
Loading…
Reference in New Issue
Block a user