diff --git a/.vs/youtube-downloader/xs/UserPrefs.xml b/.vs/youtube-downloader/xs/UserPrefs.xml index b7efc0f..f152ceb 100644 --- a/.vs/youtube-downloader/xs/UserPrefs.xml +++ b/.vs/youtube-downloader/xs/UserPrefs.xml @@ -1,5 +1,5 @@  - + @@ -8,7 +8,7 @@ - + @@ -20,11 +20,11 @@ - + diff --git a/TYTD.Api/MyClass.cs b/TYTD.Api/MyClass.cs index b1a78b2..7bc0fc2 100644 --- a/TYTD.Api/MyClass.cs +++ b/TYTD.Api/MyClass.cs @@ -35,6 +35,10 @@ namespace TYTD t.Interval = timespan.TotalMilliseconds; t.Start(); + } + public virtual void SetProgress(double progress) + { + } public bool TimerEnabled { get { if (t != null) { return t.Enabled; } else { return false; } } set { if (t != null) { t.Enabled = value; } } } public virtual IEnumerable> GetUrls() @@ -90,6 +94,7 @@ namespace TYTD public SavedVideo Video { get; set; } } + public class DownloadInfoStartEventArgs : EventArgs { @@ -122,6 +127,13 @@ namespace TYTD api.SendDLComplete(sender, evt); } } + internal static void SetProgress(double progress) + { + foreach (var api in apis) + { + api.SetProgress(progress); + } + } internal static void DownloadInfoStart(object sender, DownloadInfoStartEventArgs evt) { foreach (var api in apis) diff --git a/TYTD.Api/Server/Functions/Downloader.cs b/TYTD.Api/Server/Functions/Downloader.cs index 84b3075..005fce1 100644 --- a/TYTD.Api/Server/Functions/Downloader.cs +++ b/TYTD.Api/Server/Functions/Downloader.cs @@ -61,7 +61,17 @@ namespace TYTD.Server.Functions static VideoDownloadProgress P = new VideoDownloadProgress(); const int NUM_WAITS = 5; static int WAITS = 0; - Progress DownloadP = new Progress((e) => { P.Progress = (int)(e * 100.0); P.ProgressRaw = e; }); + public static void SendProgress(double p) + { + WAITS++; + if (WAITS <= NUM_WAITS) + return; + + WAITS = 0; + ApiLoader.SetProgress(p); + + } + Progress DownloadP = new Progress((e) => { P.Progress = (int)(e * 100.0); P.ProgressRaw = e; SendProgress(e); }); public List Queue = new List(); diff --git a/TYTD.Api/bin/Release/TYTD.Api.dll b/TYTD.Api/bin/Release/TYTD.Api.dll index e15892e..813ef5f 100644 Binary files a/TYTD.Api/bin/Release/TYTD.Api.dll and b/TYTD.Api/bin/Release/TYTD.Api.dll differ diff --git a/TYTD.Api/obj/Release/TYTD.Api.csprojAssemblyReference.cache b/TYTD.Api/obj/Release/TYTD.Api.csprojAssemblyReference.cache index 94b757b..2ac38fe 100644 Binary files a/TYTD.Api/obj/Release/TYTD.Api.csprojAssemblyReference.cache and b/TYTD.Api/obj/Release/TYTD.Api.csprojAssemblyReference.cache differ diff --git a/TYTD.Api/obj/Release/TYTD.Api.dll b/TYTD.Api/obj/Release/TYTD.Api.dll index e15892e..813ef5f 100644 Binary files a/TYTD.Api/obj/Release/TYTD.Api.dll and b/TYTD.Api/obj/Release/TYTD.Api.dll differ diff --git a/bin/Release/TYTD.Api.dll b/bin/Release/TYTD.Api.dll index e15892e..813ef5f 100644 Binary files a/bin/Release/TYTD.Api.dll and b/bin/Release/TYTD.Api.dll differ diff --git a/bin/Release/youtube-downloader.exe b/bin/Release/youtube-downloader.exe index c3fa807..2af2e8c 100644 Binary files a/bin/Release/youtube-downloader.exe and b/bin/Release/youtube-downloader.exe differ diff --git a/obj/x86/Release/youtube-downloader.csprojAssemblyReference.cache b/obj/x86/Release/youtube-downloader.csprojAssemblyReference.cache index 4cec2c0..e3e0432 100644 Binary files a/obj/x86/Release/youtube-downloader.csprojAssemblyReference.cache and b/obj/x86/Release/youtube-downloader.csprojAssemblyReference.cache differ diff --git a/obj/x86/Release/youtube-downloader.exe b/obj/x86/Release/youtube-downloader.exe index c3fa807..2af2e8c 100644 Binary files a/obj/x86/Release/youtube-downloader.exe and b/obj/x86/Release/youtube-downloader.exe differ