Example #1
0
        public async void Download()
        {
            var tmpName = Guid.NewGuid().ToString();
            var tmpPath = Path.Combine(Program.CachePath, tmpName);

            try
            {
                var download = await HttpDownloader.GetResponseAsync(HttpMethod.Get, UrlDownload);

                if (download.IsSuccessStatusCode)
                {
                    using (var fs = new FileStream(tmpPath, FileMode.CreateNew, FileAccess.Write))
                    {
                        await download.Content.CopyToAsync(fs);

                        await fs.FlushAsync();
                    }

                    UpdateDatabase(tmpName);
                    return;
                }
            } catch { }

            UpdateDatabase("");
        }