protected async virtual Task <string> DownloadUpdateAsync(ApplicationInfo appInfo)
        {
            if (appInfo == null)
            {
                throw new ArgumentNullException("appInfo");
            }

            DirectoryInfo dir = new DirectoryInfo(UpdaterPaths.GetTempUpdatesFolder());

            if (!dir.Exists)
            {
                dir.Create();
            }

            string pathToCopyUpdate = Path.Combine(dir.FullName, appInfo.Version.Md5hash);

            using (var operationScope = new OperationScope(currentOperation, OperationStatus.Downloading))
            {
                try
                {
                    using (var webClient = new WebClient())
                    {
                        using (var stream = await webClient.OpenReadTaskAsync(UpdaterPaths.GetUpdatePath(appInfo.Version.Path)))
                        {
                            int bytesTotal = Convert.ToInt32(webClient.ResponseHeaders["Content-Length"]);

                            using (FileStream fs = new FileStream(pathToCopyUpdate, FileMode.Create))
                            {
                                int    bytesRead   = 0;
                                int    bytesLoaded = 0;
                                byte[] buffer      = new byte[4096];

                                do
                                {
                                    bytesRead = await stream.ReadAsync(buffer, 0, buffer.Length);

                                    fs.Write(buffer, 0, bytesRead);

                                    bytesLoaded += bytesRead;

                                    double progress = (double)bytesLoaded / bytesTotal * 100;
                                    ProgressReport((int)progress);
                                }while (bytesRead > 0);
                            }
                        }
                    }

                    return(pathToCopyUpdate);
                }
                catch
                {
                    throw new UpdaterException(UpdaterError.DownloadingFailed);
                }
            }
        }
        private void Clear()
        {
            DirectoryInfo dir = new DirectoryInfo(UpdaterPaths.GetTempUpdatesFolder());

            try
            {
                if (dir.Exists)
                {
                    dir.Delete(true);
                }
            }
            catch
            {
            }
        }