コード例 #1
0
ファイル: Program.cs プロジェクト: jchristn/komodo
        static void S3Crawler()
        {
            string    endpoint  = Common.InputString("Endpoint:", null, true);
            bool      ssl       = Common.InputBoolean("SSL:", true);
            string    bucket    = Common.InputString("Bucket:", null, false);
            string    key       = Common.InputString("Key:", null, false);
            string    accessKey = Common.InputString("Access Key:", null, false);
            string    secretKey = Common.InputString("Secret Key:", null, false);
            AwsRegion region    = (AwsRegion)(Enum.Parse(typeof(AwsRegion), Common.InputString("Region:", "USWest1", false)));
            string    baseUrl   = Common.InputString("Base URL:", "http://localhost:8000/{bucket}/{key}", false);

            S3Crawler s3c = null;

            if (!String.IsNullOrEmpty(endpoint))
            {
                s3c = new S3Crawler(endpoint, ssl, bucket, key, accessKey, secretKey, region, baseUrl);
            }
            else
            {
                s3c = new S3Crawler(bucket, key, accessKey, secretKey, region);
            }

            CrawlResult cr = s3c.Get();

            Console.WriteLine("Success        : " + cr.Success);
            Console.WriteLine("Start time     : " + cr.Time.Start.ToString());
            Console.WriteLine("End time       : " + cr.Time.End.ToString());
            Console.WriteLine("Total ms       : " + cr.Time.TotalMs.ToString() + "ms");
            Console.WriteLine("Content length : " + cr.ContentLength + " bytes");
            Console.WriteLine("Metadata       : " + Common.SerializeJson(cr.Metadata, false));
            Console.WriteLine("Data           :" + Environment.NewLine + Encoding.UTF8.GetString(cr.Data));
        }
コード例 #2
0
        static void S3Crawler()
        {
            string    endpoint  = Common.InputString("Endpoint:", null, true);
            bool      ssl       = Common.InputBoolean("SSL:", true);
            string    bucket    = Common.InputString("Bucket:", null, false);
            string    key       = Common.InputString("Key:", null, false);
            string    accessKey = Common.InputString("Access Key:", null, false);
            string    secretKey = Common.InputString("Secret Key:", null, false);
            AwsRegion region    = (AwsRegion)(Enum.Parse(typeof(AwsRegion), Common.InputString("Region:", "USWest1", false)));
            string    baseUrl   = Common.InputString("Base URL:", "http://localhost:8000/{bucket}/{key}", false);

            S3Crawler s3c = null;

            if (!String.IsNullOrEmpty(endpoint))
            {
                s3c = new S3Crawler(endpoint, ssl, bucket, key, accessKey, secretKey, region, baseUrl);
            }
            else
            {
                s3c = new S3Crawler(bucket, key, accessKey, secretKey, region);
            }
            CrawlResult cr = s3c.Get();

            if (_OutputType.Equals("console"))
            {
                EnumerateCrawlResult(cr);
            }
            ParseCrawlResult(cr);
        }