コード例 #1
0
ファイル: ClientPatch.cs プロジェクト: CairoLee/svn-dump
        public void Download(OnDownloadProgressHandler ProgressEvent, OnDownloadFinishHandler FinishEvent)
        {
            OnDownloadProgress = ProgressEvent;
            OnDownloadFinish   = FinishEvent;

            // just Delete a File
            if (this.PatchAction == EPatchAction.DataDelete || this.PatchAction == EPatchAction.GrfDelete)
            {
                if (OnDownloadFinish != null)
                {
                    OnDownloadFinish(this, false);
                }
                return;
            }

            FilePath = Path.GetTempFileName();
            if (File.Exists(FilePath))
            {
                File.Delete(FilePath);
            }


            TimeoutWebClient client = new TimeoutWebClient();

            client.BaseAddress = DownloadUrl;

            client.DownloadFileCompleted   += new System.ComponentModel.AsyncCompletedEventHandler(client_DownloadFileCompleted);
            client.DownloadProgressChanged += new System.Net.DownloadProgressChangedEventHandler(client_DownloadProgressChanged);
            client.DownloadFileAsync(new Uri(DownloadUrl), FilePath, client);
        }
コード例 #2
0
        public void Download(string Url)
        {
            mPatchListUrl  = Url.Substring(0, Url.LastIndexOf('/') + 1);
            mPatchListPath = Path.GetTempFileName();

            mClient.BaseAddress            = Url;
            mClient.TimeOut                = 2000;
            mClient.DownloadFileCompleted += new System.ComponentModel.AsyncCompletedEventHandler(CLient_DownloadFileCompleted);
            mClient.DownloadFileAsync(new Uri(Url), mPatchListPath);
        }