예제 #1
0
 protected static void DownloadFile(IAsyncResult Result)
 {
     try {
         AmazonS3          s3  = Result.AsyncState as AmazonS3;
         GetObjectResponse r   = s3.EndGetObject(Result);
         string            dir = Path.GetDirectoryName(Settings.LocalDirectory + "/" + r.Key);
         if (!Directory.Exists(dir))
         {
             Directory.CreateDirectory(dir);
         }
         r.WriteResponseStreamToFile(Settings.LocalDirectory + "/" + r.Key);
     } catch (Exception ex) {
         ErrorCount++;
         Console.WriteLine(ex.Message);
     }
     DownloadCount--;
 }
예제 #2
0
파일: MainForm.cs 프로젝트: fsfod/Echo
        protected void DownloadFile(IAsyncResult Result)
        {
            string file = "unknown";

            try {
                AmazonS3          s3 = Result.AsyncState as AmazonS3;
                GetObjectResponse r  = s3.EndGetObject(Result);
                System.Console.WriteLine(r.Key);
                string dir = Path.GetDirectoryName(Settings.LocalDirectory + "/" + r.Key);
                if (!Directory.Exists(dir))
                {
                    Directory.CreateDirectory(dir);
                }
                r.WriteResponseStreamToFile(Settings.LocalDirectory + "/" + r.Key);
            } catch (Exception ex) {
                ErrorCount++;
                System.Console.WriteLine(ex.Message);
                AddTextToConsole("ERROR:" + ex.Message + Environment.NewLine);
            }
            DownloadCount--;
        }