Skip to content

Commit

Permalink
Fixed bug: prevent every following upload from beeing started and sto…
Browse files Browse the repository at this point in the history
…pped immediately, after stopping upload.
  • Loading branch information
Drexel2k committed Jun 4, 2020
1 parent 1219afe commit 8545348
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
6 changes: 3 additions & 3 deletions VidUp.UI/CommonAssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
[assembly: System.Reflection.AssemblyProductAttribute("VidUp")]
[assembly: System.Reflection.AssemblyTitleAttribute("VidUp")]
[assembly: System.Reflection.AssemblyCompanyAttribute("Drexel Development")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.2.0.2")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.2.0.3")]
//Shown in Gui/Setup
[assembly: System.Reflection.AssemblyVersionAttribute("1.2.0.2")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.2.0.2")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.2.0.3")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.2.0.3")]
[assembly: System.Reflection.AssemblyCopyright("©2020 Drexel Development")]
[assembly: ComVisible(false)]

Expand Down
2 changes: 1 addition & 1 deletion VidUp.UI/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ private void stopUploading(object obj)
Uploader uploader = this.uploader;
if (uploader != null)
{
uploader.StopUpload();
uploader.StopUpload = true;
}
}
}
Expand Down
13 changes: 7 additions & 6 deletions VidUp.YouTube/Uploader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ public long MaxUploadInBytesPerSecond
}
}

public bool StopUpload
{
get => this.stopUpload;
set => this.stopUpload = value;
}

public Uploader(UploadList uploadList)
{
if (uploadList == null)
Expand Down Expand Up @@ -74,7 +80,7 @@ public async Task<bool> Upload(Action<Upload> notifyUploadStart, Action<Upload>
List<Upload> uploadsOfSession = new List<Upload>();
Upload upload = this.uploadList.GetUpload(PredicateCombiner.Or(predicates.ToArray()));

while (upload != null)
while (upload != null && !this.stopUpload)
{
uploadsOfSession.Add(upload);
upload.UploadErrorMessage = null;
Expand Down Expand Up @@ -153,11 +159,6 @@ void updateUploadProgress(YoutubeUploadStats stats)
}
}

public void StopUpload()
{
this.stopUpload = true;
}

private bool isStopped()
{
return this.stopUpload;
Expand Down

0 comments on commit 8545348

Please sign in to comment.