Beispiel #1
0
        public void mputl(string bucket, string inputfile)
        {
            try
            {
                // open input file
                StreamReader files = new StreamReader(inputfile);

                // for threading library
                ThreadPool.SetMaxThreads(maxThreads, maxThreads);
                ThreadPoolWait threads = new ThreadPoolWait();

                // loop over and add to S3
                string file;
                while ((file = files.ReadLine()) != null)
                {
                    if (file.Trim() != "")
                    {
                        string key = file.Substring(file.LastIndexOf('\\') + 1);
                        s3Put  put = new s3Put(awsKey, awsSecret, region, bucket, file, key, maxRetry, ACL, putTimeout);
                        threads.QueueUserWorkItem(new WaitCallback(put.Run));
                    }
                }

                // wait for all threads to complete
                threads.WaitOne();
            }
            catch (Exception e)
            {
                Console.WriteLine("Error in: '" + inputfile + "': " + e.Message);
            }
        }
Beispiel #2
0
        public void mputr(string bucket, string dir, string filter)
        {
            try
            {
                // get all files
                ArrayList files = GetFilesRecursive(dir, filter);

                // for threading library
                ThreadPool.SetMaxThreads(maxThreads, maxThreads);
                ThreadPoolWait threads = new ThreadPoolWait();

                // loop over and add to S3
                foreach (string file in files)
                {
                    string key = file.Substring(file.LastIndexOf('\\') + 1);
                    s3Put  put = new s3Put(awsKey, awsSecret, bucket, region, file, key, maxRetry, ACL, putTimeout);
                    threads.QueueUserWorkItem(new WaitCallback(put.Run));
                }

                // wait for all threads to complete
                threads.WaitOne();
            }
            catch (Exception e)
            {
                Console.WriteLine("Error in: '" + dir + "': " + e.Message);
            }
        }
Beispiel #3
0
        public void put(string bucket, string file, string key, string acl)
        {
            s3Put put = new s3Put(awsKey, awsSecret, region, bucket, file, key, maxRetry, acl, putTimeout);

            put.Run(null);
        }
Beispiel #4
0
 public void put(string bucket, string file, string key, string acl)
 {
     s3Put put = new s3Put(awsKey, awsSecret, region, bucket, file, key, maxRetry, acl, putTimeout);
     put.Run(null);
 }
Beispiel #5
0
        public void mputr(string bucket, string dir, string filter)
        {
            try
            {
                // get all files
                ArrayList files = GetFilesRecursive(dir, filter);

                // for threading library
                ThreadPool.SetMaxThreads(maxThreads, maxThreads);
                ThreadPoolWait threads = new ThreadPoolWait();

                // loop over and add to S3
                foreach (string file in files)
                {
                    string key = file.Substring(file.LastIndexOf('\\') + 1);
                    s3Put put = new s3Put(awsKey, awsSecret, bucket, region, file, key, maxRetry, ACL, putTimeout);
                    threads.QueueUserWorkItem(new WaitCallback(put.Run));
                }

                // wait for all threads to complete
                threads.WaitOne();
            }
            catch(Exception e)
            {
                Console.WriteLine("Error in: '" + dir + "': " + e.Message);
            }
        }
Beispiel #6
0
        public void mputl(string bucket, string inputfile)
        {
            try
            {

                // open input file
                StreamReader files = new StreamReader(inputfile);

                // for threading library
                ThreadPool.SetMaxThreads(maxThreads, maxThreads);
                ThreadPoolWait threads = new ThreadPoolWait();

                // loop over and add to S3
                string file;
                while((file = files.ReadLine()) != null)
                {
                    if(file.Trim() != "")
                    {
                        string key = file.Substring(file.LastIndexOf('\\') + 1);
                        s3Put put = new s3Put(awsKey, awsSecret, region, bucket, file, key, maxRetry, ACL, putTimeout);
                        threads.QueueUserWorkItem(new WaitCallback(put.Run));
                    }
                }

                // wait for all threads to complete
                threads.WaitOne();
            }
            catch (Exception e)
            {
                Console.WriteLine("Error in: '" + inputfile + "': " + e.Message);
            }
        }