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);
                }
            }
        }
        public async virtual Task InitializeAsync(string pathToUpdatingData = null, X509Certificate2 assemblyCertificate = null)
        {
            this.assemblyCertificate = assemblyCertificate;

            // clear old data
            Clear();

            if (string.IsNullOrWhiteSpace(pathToUpdatingData))
            {
                pathToUpdatingData = UpdaterPaths.GetUpdaterDataPath();
            }
            else
            {
                pathToUpdatingData = UpdaterPaths.GetUpdatePath(pathToUpdatingData);
            }

            using (var operationScope = new OperationScope(currentOperation, OperationStatus.Getting))
            {
                var response = await loader.LoadApplicationInfoAsync(pathToUpdatingData);

                applicationInfo = response.ToArray();
                isInitialized   = true;
            }
        }