{"action":"created","issue":{"url":"https://api.github.com/repos/Rambalac/AmazonCloudDriveApi/issues/7","repository_url":"https://api.github.com/repos/Rambalac/AmazonCloudDriveApi","labels_url":"https://api.github.com/repos/Rambalac/AmazonCloudDriveApi/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/Rambalac/AmazonCloudDriveApi/issues/7/comments","events_url":"https://api.github.com/repos/Rambalac/AmazonCloudDriveApi/issues/7/events","html_url":"https://github.com/Rambalac/AmazonCloudDriveApi/issues/7","id":142049115,"number":7,"title":"We need a way to break the download process","user":{"login":"denisvmedia","id":5462781,"avatar_url":"https://avatars.githubusercontent.com/u/5462781?v=3","gravatar_id":"","url":"https://api.github.com/users/denisvmedia","html_url":"https://github.com/denisvmedia","followers_url":"https://api.github.com/users/denisvmedia/followers","following_url":"https://api.github.com/users/denisvmedia/following{/other_user}","gists_url":"https://api.github.com/users/denisvmedia/gists{/gist_id}","starred_url":"https://api.github.com/users/denisvmedia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/denisvmedia/subscriptions","organizations_url":"https://api.github.com/users/denisvmedia/orgs","repos_url":"https://api.github.com/users/denisvmedia/repos","events_url":"https://api.github.com/users/denisvmedia/events{/privacy}","received_events_url":"https://api.github.com/users/denisvmedia/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-03-19T10:10:19Z","updated_at":"2016-03-19T11:42:09Z","closed_at":null,"body":"Currently, there is no way to break the download process. Maybe instead of nextProgress should be checked for being set to -1. Somehow this way:\r\n\r\n    while ((read = await input.ReadAsync(buff, 0, buff.Length).ConfigureAwait(false)) > 0)\r\n    {\r\n        await stream.WriteAsync(buff, 0, read).ConfigureAwait(false);\r\n        totalRead += read;\r\n        if (progress != null && totalRead >= nextProgress)\r\n        {\r\n            nextProgress = progress.Invoke(totalRead);\r\n            if (nextProgress == -1) // passing -1 from the progress function, will allow us breaking the download\r\n            {\r\n                break;\r\n            }\r\n        }\r\n    }\r\n"},"comment":{"url":"https://api.github.com/repos/Rambalac/AmazonCloudDriveApi/issues/comments/198688393","html_url":"https://github.com/Rambalac/AmazonCloudDriveApi/issues/7#issuecomment-198688393","issue_url":"https://api.github.com/repos/Rambalac/AmazonCloudDriveApi/issues/7","id":198688393,"user":{"login":"denisvmedia","id":5462781,"avatar_url":"https://avatars.githubusercontent.com/u/5462781?v=3","gravatar_id":"","url":"https://api.github.com/users/denisvmedia","html_url":"https://github.com/denisvmedia","followers_url":"https://api.github.com/users/denisvmedia/followers","following_url":"https://api.github.com/users/denisvmedia/following{/other_user}","gists_url":"https://api.github.com/users/denisvmedia/gists{/gist_id}","starred_url":"https://api.github.com/users/denisvmedia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/denisvmedia/subscriptions","organizations_url":"https://api.github.com/users/denisvmedia/orgs","repos_url":"https://api.github.com/users/denisvmedia/repos","events_url":"https://api.github.com/users/denisvmedia/events{/privacy}","received_events_url":"https://api.github.com/users/denisvmedia/received_events","type":"User","site_admin":false},"created_at":"2016-03-19T11:42:09Z","updated_at":"2016-03-19T11:42:09Z","body":"Well, but how would it work from the site of the application? Still passing nextProgress == -1? BTW, I changed that locally to what I proposed, and it works properly for me, no issues."}}