From 07c84a4e517608455a69ea7c662dc62cb9283ff4 Mon Sep 17 00:00:00 2001 From: cuiliang Date: Fri, 20 Jan 2017 10:34:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E7=9B=AE=E5=BD=95=EF=BC=8C?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0sample=E9=A1=B9=E7=9B=AE=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cuiliang.AliyunOssSdk.sln | 48 +++++ {Api => src/Api}/Base/BaseObjectCommand.cs | 0 {Api => src/Api}/Base/BaseOssCommand.cs | 0 .../Api}/Bucket/List/ListBucketCommand.cs | 0 .../Api}/Bucket/List/ListBucketsRequest.cs | 0 .../Api}/Bucket/List/ListBucketsResult.cs | 0 {Api => src/Api}/Common/Bucket.cs | 0 {Api => src/Api}/Common/Consts/HttpHeaders.cs | 0 {Api => src/Api}/Common/Consts/OssHeaders.cs | 0 .../Api}/Common/Consts/RequestParameters.cs | 0 {Api => src/Api}/Common/Owner.cs | 0 {Api => src/Api}/ErrorResult.cs | 0 .../Api}/Object/Append/AppendObjectCommand.cs | 0 .../Api}/Object/Append/AppentObjectResult.cs | 0 .../Api}/Object/Copy/CopyObjectCommand.cs | 0 .../Api}/Object/Copy/CopyObjectResult.cs | 0 .../Api}/Object/Delete/DeleteObjectCommand.cs | 0 .../Api}/Object/Delete/DeleteObjectResult.cs | 0 .../DeleteMultipleObjectsCommand.cs | 0 .../DeleteMultipleObjectsResult.cs | 0 .../DeleteObjectsRequestModel.cs | 0 {Api => src/Api}/Object/EmptyResult.cs | 0 .../Api}/Object/Get/GetObjectCommand.cs | 0 .../Api}/Object/Get/GetObjectParams.cs | 0 .../Api}/Object/Get/GetObjectResult.cs | 0 {Api => src/Api}/Object/Get/ObjectRange.cs | 0 .../Api}/Object/GetAcl/GetObjectAclCommand.cs | 0 .../Api}/Object/GetAcl/GetObjectAclResult.cs | 0 .../Object/GetMeta/GetObjectMetaCommand.cs | 0 .../Object/GetMeta/GetObjectMetaResult.cs | 0 .../Api}/Object/Head/HeadObjectCommand.cs | 0 .../Api}/Object/Head/HeadObjectParams.cs | 0 .../Api}/Object/Head/HeadObjectResult.cs | 0 .../Api}/Object/Put/PutObjectCommand.cs | 0 .../Api}/Object/Put/PutObjectResult.cs | 0 .../Api}/Object/PutAcl/PutObjectACLCommand.cs | 0 {Api => src/Api}/OssResult.cs | 0 .../Cuiliang.AliyunOssSdk.csproj | 0 .../Cuiliang.AliyunOssSdk.xproj | 0 {Entites => src/Entites}/BucketInfo.cs | 0 .../Entites}/ClientConfiguration.cs | 0 {Entites => src/Entites}/ObjectMetadata.cs | 0 {Entites => src/Entites}/OssCredential.cs | 0 {Entites => src/Entites}/OssRegions.cs | 0 {Entites => src/Entites}/RequestContent.cs | 0 OssClient.cs => src/OssClient.cs | 0 .../Properties}/AssemblyInfo.cs | 0 {Request => src/Request}/MyProxy.cs | 0 .../Request}/PresignedUrlCreator.cs | 0 .../Request}/RequestContentType.cs | 0 {Request => src/Request}/RequestContext.cs | 0 {Request => src/Request}/ServiceCaller.cs | 0 {Request => src/Request}/ServiceRequest.cs | 0 {Request => src/Request}/SignatureHelper.cs | 0 {Utility => src/Utility}/DateUtils.cs | 0 {Utility => src/Utility}/Ensure.cs | 0 {Utility => src/Utility}/HttpUtils.cs | 0 {Utility => src/Utility}/MimeHelper.cs | 0 {Utility => src/Utility}/OssUtils.cs | 0 .../Utility}/ResponseHeaderOverrides.cs | 0 {Utility => src/Utility}/SerializeHelper.cs | 0 project.json => src/project.json | 0 tests/Sample/NewSdkTester.cs | 169 ++++++++++++++++++ tests/Sample/Program.cs | 28 +++ tests/Sample/Sample.csproj | 16 ++ 65 files changed, 261 insertions(+) create mode 100644 Cuiliang.AliyunOssSdk.sln rename {Api => src/Api}/Base/BaseObjectCommand.cs (100%) rename {Api => src/Api}/Base/BaseOssCommand.cs (100%) rename {Api => src/Api}/Bucket/List/ListBucketCommand.cs (100%) rename {Api => src/Api}/Bucket/List/ListBucketsRequest.cs (100%) rename {Api => src/Api}/Bucket/List/ListBucketsResult.cs (100%) rename {Api => src/Api}/Common/Bucket.cs (100%) rename {Api => src/Api}/Common/Consts/HttpHeaders.cs (100%) rename {Api => src/Api}/Common/Consts/OssHeaders.cs (100%) rename {Api => src/Api}/Common/Consts/RequestParameters.cs (100%) rename {Api => src/Api}/Common/Owner.cs (100%) rename {Api => src/Api}/ErrorResult.cs (100%) rename {Api => src/Api}/Object/Append/AppendObjectCommand.cs (100%) rename {Api => src/Api}/Object/Append/AppentObjectResult.cs (100%) rename {Api => src/Api}/Object/Copy/CopyObjectCommand.cs (100%) rename {Api => src/Api}/Object/Copy/CopyObjectResult.cs (100%) rename {Api => src/Api}/Object/Delete/DeleteObjectCommand.cs (100%) rename {Api => src/Api}/Object/Delete/DeleteObjectResult.cs (100%) rename {Api => src/Api}/Object/DeleteMultiple/DeleteMultipleObjectsCommand.cs (100%) rename {Api => src/Api}/Object/DeleteMultiple/DeleteMultipleObjectsResult.cs (100%) rename {Api => src/Api}/Object/DeleteMultiple/DeleteObjectsRequestModel.cs (100%) rename {Api => src/Api}/Object/EmptyResult.cs (100%) rename {Api => src/Api}/Object/Get/GetObjectCommand.cs (100%) rename {Api => src/Api}/Object/Get/GetObjectParams.cs (100%) rename {Api => src/Api}/Object/Get/GetObjectResult.cs (100%) rename {Api => src/Api}/Object/Get/ObjectRange.cs (100%) rename {Api => src/Api}/Object/GetAcl/GetObjectAclCommand.cs (100%) rename {Api => src/Api}/Object/GetAcl/GetObjectAclResult.cs (100%) rename {Api => src/Api}/Object/GetMeta/GetObjectMetaCommand.cs (100%) rename {Api => src/Api}/Object/GetMeta/GetObjectMetaResult.cs (100%) rename {Api => src/Api}/Object/Head/HeadObjectCommand.cs (100%) rename {Api => src/Api}/Object/Head/HeadObjectParams.cs (100%) rename {Api => src/Api}/Object/Head/HeadObjectResult.cs (100%) rename {Api => src/Api}/Object/Put/PutObjectCommand.cs (100%) rename {Api => src/Api}/Object/Put/PutObjectResult.cs (100%) rename {Api => src/Api}/Object/PutAcl/PutObjectACLCommand.cs (100%) rename {Api => src/Api}/OssResult.cs (100%) rename Cuiliang.AliyunOssSdk.csproj => src/Cuiliang.AliyunOssSdk.csproj (100%) rename Cuiliang.AliyunOssSdk.xproj => src/Cuiliang.AliyunOssSdk.xproj (100%) rename {Entites => src/Entites}/BucketInfo.cs (100%) rename {Entites => src/Entites}/ClientConfiguration.cs (100%) rename {Entites => src/Entites}/ObjectMetadata.cs (100%) rename {Entites => src/Entites}/OssCredential.cs (100%) rename {Entites => src/Entites}/OssRegions.cs (100%) rename {Entites => src/Entites}/RequestContent.cs (100%) rename OssClient.cs => src/OssClient.cs (100%) rename {Properties => src/Properties}/AssemblyInfo.cs (100%) rename {Request => src/Request}/MyProxy.cs (100%) rename {Request => src/Request}/PresignedUrlCreator.cs (100%) rename {Request => src/Request}/RequestContentType.cs (100%) rename {Request => src/Request}/RequestContext.cs (100%) rename {Request => src/Request}/ServiceCaller.cs (100%) rename {Request => src/Request}/ServiceRequest.cs (100%) rename {Request => src/Request}/SignatureHelper.cs (100%) rename {Utility => src/Utility}/DateUtils.cs (100%) rename {Utility => src/Utility}/Ensure.cs (100%) rename {Utility => src/Utility}/HttpUtils.cs (100%) rename {Utility => src/Utility}/MimeHelper.cs (100%) rename {Utility => src/Utility}/OssUtils.cs (100%) rename {Utility => src/Utility}/ResponseHeaderOverrides.cs (100%) rename {Utility => src/Utility}/SerializeHelper.cs (100%) rename project.json => src/project.json (100%) create mode 100644 tests/Sample/NewSdkTester.cs create mode 100644 tests/Sample/Program.cs create mode 100644 tests/Sample/Sample.csproj diff --git a/Cuiliang.AliyunOssSdk.sln b/Cuiliang.AliyunOssSdk.sln new file mode 100644 index 0000000..413fded --- /dev/null +++ b/Cuiliang.AliyunOssSdk.sln @@ -0,0 +1,48 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26020.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cuiliang.AliyunOssSdk", "src\Cuiliang.AliyunOssSdk.csproj", "{07E0FD05-ED53-49DC-AD10-D24685A388D3}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample", "tests\Sample\Sample.csproj", "{A83B76BE-EAEA-4367-BC0C-28C20A9E6510}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {07E0FD05-ED53-49DC-AD10-D24685A388D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {07E0FD05-ED53-49DC-AD10-D24685A388D3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {07E0FD05-ED53-49DC-AD10-D24685A388D3}.Debug|x64.ActiveCfg = Debug|x64 + {07E0FD05-ED53-49DC-AD10-D24685A388D3}.Debug|x64.Build.0 = Debug|x64 + {07E0FD05-ED53-49DC-AD10-D24685A388D3}.Debug|x86.ActiveCfg = Debug|x86 + {07E0FD05-ED53-49DC-AD10-D24685A388D3}.Debug|x86.Build.0 = Debug|x86 + {07E0FD05-ED53-49DC-AD10-D24685A388D3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {07E0FD05-ED53-49DC-AD10-D24685A388D3}.Release|Any CPU.Build.0 = Release|Any CPU + {07E0FD05-ED53-49DC-AD10-D24685A388D3}.Release|x64.ActiveCfg = Release|x64 + {07E0FD05-ED53-49DC-AD10-D24685A388D3}.Release|x64.Build.0 = Release|x64 + {07E0FD05-ED53-49DC-AD10-D24685A388D3}.Release|x86.ActiveCfg = Release|x86 + {07E0FD05-ED53-49DC-AD10-D24685A388D3}.Release|x86.Build.0 = Release|x86 + {A83B76BE-EAEA-4367-BC0C-28C20A9E6510}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A83B76BE-EAEA-4367-BC0C-28C20A9E6510}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A83B76BE-EAEA-4367-BC0C-28C20A9E6510}.Debug|x64.ActiveCfg = Debug|x64 + {A83B76BE-EAEA-4367-BC0C-28C20A9E6510}.Debug|x64.Build.0 = Debug|x64 + {A83B76BE-EAEA-4367-BC0C-28C20A9E6510}.Debug|x86.ActiveCfg = Debug|x86 + {A83B76BE-EAEA-4367-BC0C-28C20A9E6510}.Debug|x86.Build.0 = Debug|x86 + {A83B76BE-EAEA-4367-BC0C-28C20A9E6510}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A83B76BE-EAEA-4367-BC0C-28C20A9E6510}.Release|Any CPU.Build.0 = Release|Any CPU + {A83B76BE-EAEA-4367-BC0C-28C20A9E6510}.Release|x64.ActiveCfg = Release|x64 + {A83B76BE-EAEA-4367-BC0C-28C20A9E6510}.Release|x64.Build.0 = Release|x64 + {A83B76BE-EAEA-4367-BC0C-28C20A9E6510}.Release|x86.ActiveCfg = Release|x86 + {A83B76BE-EAEA-4367-BC0C-28C20A9E6510}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Api/Base/BaseObjectCommand.cs b/src/Api/Base/BaseObjectCommand.cs similarity index 100% rename from Api/Base/BaseObjectCommand.cs rename to src/Api/Base/BaseObjectCommand.cs diff --git a/Api/Base/BaseOssCommand.cs b/src/Api/Base/BaseOssCommand.cs similarity index 100% rename from Api/Base/BaseOssCommand.cs rename to src/Api/Base/BaseOssCommand.cs diff --git a/Api/Bucket/List/ListBucketCommand.cs b/src/Api/Bucket/List/ListBucketCommand.cs similarity index 100% rename from Api/Bucket/List/ListBucketCommand.cs rename to src/Api/Bucket/List/ListBucketCommand.cs diff --git a/Api/Bucket/List/ListBucketsRequest.cs b/src/Api/Bucket/List/ListBucketsRequest.cs similarity index 100% rename from Api/Bucket/List/ListBucketsRequest.cs rename to src/Api/Bucket/List/ListBucketsRequest.cs diff --git a/Api/Bucket/List/ListBucketsResult.cs b/src/Api/Bucket/List/ListBucketsResult.cs similarity index 100% rename from Api/Bucket/List/ListBucketsResult.cs rename to src/Api/Bucket/List/ListBucketsResult.cs diff --git a/Api/Common/Bucket.cs b/src/Api/Common/Bucket.cs similarity index 100% rename from Api/Common/Bucket.cs rename to src/Api/Common/Bucket.cs diff --git a/Api/Common/Consts/HttpHeaders.cs b/src/Api/Common/Consts/HttpHeaders.cs similarity index 100% rename from Api/Common/Consts/HttpHeaders.cs rename to src/Api/Common/Consts/HttpHeaders.cs diff --git a/Api/Common/Consts/OssHeaders.cs b/src/Api/Common/Consts/OssHeaders.cs similarity index 100% rename from Api/Common/Consts/OssHeaders.cs rename to src/Api/Common/Consts/OssHeaders.cs diff --git a/Api/Common/Consts/RequestParameters.cs b/src/Api/Common/Consts/RequestParameters.cs similarity index 100% rename from Api/Common/Consts/RequestParameters.cs rename to src/Api/Common/Consts/RequestParameters.cs diff --git a/Api/Common/Owner.cs b/src/Api/Common/Owner.cs similarity index 100% rename from Api/Common/Owner.cs rename to src/Api/Common/Owner.cs diff --git a/Api/ErrorResult.cs b/src/Api/ErrorResult.cs similarity index 100% rename from Api/ErrorResult.cs rename to src/Api/ErrorResult.cs diff --git a/Api/Object/Append/AppendObjectCommand.cs b/src/Api/Object/Append/AppendObjectCommand.cs similarity index 100% rename from Api/Object/Append/AppendObjectCommand.cs rename to src/Api/Object/Append/AppendObjectCommand.cs diff --git a/Api/Object/Append/AppentObjectResult.cs b/src/Api/Object/Append/AppentObjectResult.cs similarity index 100% rename from Api/Object/Append/AppentObjectResult.cs rename to src/Api/Object/Append/AppentObjectResult.cs diff --git a/Api/Object/Copy/CopyObjectCommand.cs b/src/Api/Object/Copy/CopyObjectCommand.cs similarity index 100% rename from Api/Object/Copy/CopyObjectCommand.cs rename to src/Api/Object/Copy/CopyObjectCommand.cs diff --git a/Api/Object/Copy/CopyObjectResult.cs b/src/Api/Object/Copy/CopyObjectResult.cs similarity index 100% rename from Api/Object/Copy/CopyObjectResult.cs rename to src/Api/Object/Copy/CopyObjectResult.cs diff --git a/Api/Object/Delete/DeleteObjectCommand.cs b/src/Api/Object/Delete/DeleteObjectCommand.cs similarity index 100% rename from Api/Object/Delete/DeleteObjectCommand.cs rename to src/Api/Object/Delete/DeleteObjectCommand.cs diff --git a/Api/Object/Delete/DeleteObjectResult.cs b/src/Api/Object/Delete/DeleteObjectResult.cs similarity index 100% rename from Api/Object/Delete/DeleteObjectResult.cs rename to src/Api/Object/Delete/DeleteObjectResult.cs diff --git a/Api/Object/DeleteMultiple/DeleteMultipleObjectsCommand.cs b/src/Api/Object/DeleteMultiple/DeleteMultipleObjectsCommand.cs similarity index 100% rename from Api/Object/DeleteMultiple/DeleteMultipleObjectsCommand.cs rename to src/Api/Object/DeleteMultiple/DeleteMultipleObjectsCommand.cs diff --git a/Api/Object/DeleteMultiple/DeleteMultipleObjectsResult.cs b/src/Api/Object/DeleteMultiple/DeleteMultipleObjectsResult.cs similarity index 100% rename from Api/Object/DeleteMultiple/DeleteMultipleObjectsResult.cs rename to src/Api/Object/DeleteMultiple/DeleteMultipleObjectsResult.cs diff --git a/Api/Object/DeleteMultiple/DeleteObjectsRequestModel.cs b/src/Api/Object/DeleteMultiple/DeleteObjectsRequestModel.cs similarity index 100% rename from Api/Object/DeleteMultiple/DeleteObjectsRequestModel.cs rename to src/Api/Object/DeleteMultiple/DeleteObjectsRequestModel.cs diff --git a/Api/Object/EmptyResult.cs b/src/Api/Object/EmptyResult.cs similarity index 100% rename from Api/Object/EmptyResult.cs rename to src/Api/Object/EmptyResult.cs diff --git a/Api/Object/Get/GetObjectCommand.cs b/src/Api/Object/Get/GetObjectCommand.cs similarity index 100% rename from Api/Object/Get/GetObjectCommand.cs rename to src/Api/Object/Get/GetObjectCommand.cs diff --git a/Api/Object/Get/GetObjectParams.cs b/src/Api/Object/Get/GetObjectParams.cs similarity index 100% rename from Api/Object/Get/GetObjectParams.cs rename to src/Api/Object/Get/GetObjectParams.cs diff --git a/Api/Object/Get/GetObjectResult.cs b/src/Api/Object/Get/GetObjectResult.cs similarity index 100% rename from Api/Object/Get/GetObjectResult.cs rename to src/Api/Object/Get/GetObjectResult.cs diff --git a/Api/Object/Get/ObjectRange.cs b/src/Api/Object/Get/ObjectRange.cs similarity index 100% rename from Api/Object/Get/ObjectRange.cs rename to src/Api/Object/Get/ObjectRange.cs diff --git a/Api/Object/GetAcl/GetObjectAclCommand.cs b/src/Api/Object/GetAcl/GetObjectAclCommand.cs similarity index 100% rename from Api/Object/GetAcl/GetObjectAclCommand.cs rename to src/Api/Object/GetAcl/GetObjectAclCommand.cs diff --git a/Api/Object/GetAcl/GetObjectAclResult.cs b/src/Api/Object/GetAcl/GetObjectAclResult.cs similarity index 100% rename from Api/Object/GetAcl/GetObjectAclResult.cs rename to src/Api/Object/GetAcl/GetObjectAclResult.cs diff --git a/Api/Object/GetMeta/GetObjectMetaCommand.cs b/src/Api/Object/GetMeta/GetObjectMetaCommand.cs similarity index 100% rename from Api/Object/GetMeta/GetObjectMetaCommand.cs rename to src/Api/Object/GetMeta/GetObjectMetaCommand.cs diff --git a/Api/Object/GetMeta/GetObjectMetaResult.cs b/src/Api/Object/GetMeta/GetObjectMetaResult.cs similarity index 100% rename from Api/Object/GetMeta/GetObjectMetaResult.cs rename to src/Api/Object/GetMeta/GetObjectMetaResult.cs diff --git a/Api/Object/Head/HeadObjectCommand.cs b/src/Api/Object/Head/HeadObjectCommand.cs similarity index 100% rename from Api/Object/Head/HeadObjectCommand.cs rename to src/Api/Object/Head/HeadObjectCommand.cs diff --git a/Api/Object/Head/HeadObjectParams.cs b/src/Api/Object/Head/HeadObjectParams.cs similarity index 100% rename from Api/Object/Head/HeadObjectParams.cs rename to src/Api/Object/Head/HeadObjectParams.cs diff --git a/Api/Object/Head/HeadObjectResult.cs b/src/Api/Object/Head/HeadObjectResult.cs similarity index 100% rename from Api/Object/Head/HeadObjectResult.cs rename to src/Api/Object/Head/HeadObjectResult.cs diff --git a/Api/Object/Put/PutObjectCommand.cs b/src/Api/Object/Put/PutObjectCommand.cs similarity index 100% rename from Api/Object/Put/PutObjectCommand.cs rename to src/Api/Object/Put/PutObjectCommand.cs diff --git a/Api/Object/Put/PutObjectResult.cs b/src/Api/Object/Put/PutObjectResult.cs similarity index 100% rename from Api/Object/Put/PutObjectResult.cs rename to src/Api/Object/Put/PutObjectResult.cs diff --git a/Api/Object/PutAcl/PutObjectACLCommand.cs b/src/Api/Object/PutAcl/PutObjectACLCommand.cs similarity index 100% rename from Api/Object/PutAcl/PutObjectACLCommand.cs rename to src/Api/Object/PutAcl/PutObjectACLCommand.cs diff --git a/Api/OssResult.cs b/src/Api/OssResult.cs similarity index 100% rename from Api/OssResult.cs rename to src/Api/OssResult.cs diff --git a/Cuiliang.AliyunOssSdk.csproj b/src/Cuiliang.AliyunOssSdk.csproj similarity index 100% rename from Cuiliang.AliyunOssSdk.csproj rename to src/Cuiliang.AliyunOssSdk.csproj diff --git a/Cuiliang.AliyunOssSdk.xproj b/src/Cuiliang.AliyunOssSdk.xproj similarity index 100% rename from Cuiliang.AliyunOssSdk.xproj rename to src/Cuiliang.AliyunOssSdk.xproj diff --git a/Entites/BucketInfo.cs b/src/Entites/BucketInfo.cs similarity index 100% rename from Entites/BucketInfo.cs rename to src/Entites/BucketInfo.cs diff --git a/Entites/ClientConfiguration.cs b/src/Entites/ClientConfiguration.cs similarity index 100% rename from Entites/ClientConfiguration.cs rename to src/Entites/ClientConfiguration.cs diff --git a/Entites/ObjectMetadata.cs b/src/Entites/ObjectMetadata.cs similarity index 100% rename from Entites/ObjectMetadata.cs rename to src/Entites/ObjectMetadata.cs diff --git a/Entites/OssCredential.cs b/src/Entites/OssCredential.cs similarity index 100% rename from Entites/OssCredential.cs rename to src/Entites/OssCredential.cs diff --git a/Entites/OssRegions.cs b/src/Entites/OssRegions.cs similarity index 100% rename from Entites/OssRegions.cs rename to src/Entites/OssRegions.cs diff --git a/Entites/RequestContent.cs b/src/Entites/RequestContent.cs similarity index 100% rename from Entites/RequestContent.cs rename to src/Entites/RequestContent.cs diff --git a/OssClient.cs b/src/OssClient.cs similarity index 100% rename from OssClient.cs rename to src/OssClient.cs diff --git a/Properties/AssemblyInfo.cs b/src/Properties/AssemblyInfo.cs similarity index 100% rename from Properties/AssemblyInfo.cs rename to src/Properties/AssemblyInfo.cs diff --git a/Request/MyProxy.cs b/src/Request/MyProxy.cs similarity index 100% rename from Request/MyProxy.cs rename to src/Request/MyProxy.cs diff --git a/Request/PresignedUrlCreator.cs b/src/Request/PresignedUrlCreator.cs similarity index 100% rename from Request/PresignedUrlCreator.cs rename to src/Request/PresignedUrlCreator.cs diff --git a/Request/RequestContentType.cs b/src/Request/RequestContentType.cs similarity index 100% rename from Request/RequestContentType.cs rename to src/Request/RequestContentType.cs diff --git a/Request/RequestContext.cs b/src/Request/RequestContext.cs similarity index 100% rename from Request/RequestContext.cs rename to src/Request/RequestContext.cs diff --git a/Request/ServiceCaller.cs b/src/Request/ServiceCaller.cs similarity index 100% rename from Request/ServiceCaller.cs rename to src/Request/ServiceCaller.cs diff --git a/Request/ServiceRequest.cs b/src/Request/ServiceRequest.cs similarity index 100% rename from Request/ServiceRequest.cs rename to src/Request/ServiceRequest.cs diff --git a/Request/SignatureHelper.cs b/src/Request/SignatureHelper.cs similarity index 100% rename from Request/SignatureHelper.cs rename to src/Request/SignatureHelper.cs diff --git a/Utility/DateUtils.cs b/src/Utility/DateUtils.cs similarity index 100% rename from Utility/DateUtils.cs rename to src/Utility/DateUtils.cs diff --git a/Utility/Ensure.cs b/src/Utility/Ensure.cs similarity index 100% rename from Utility/Ensure.cs rename to src/Utility/Ensure.cs diff --git a/Utility/HttpUtils.cs b/src/Utility/HttpUtils.cs similarity index 100% rename from Utility/HttpUtils.cs rename to src/Utility/HttpUtils.cs diff --git a/Utility/MimeHelper.cs b/src/Utility/MimeHelper.cs similarity index 100% rename from Utility/MimeHelper.cs rename to src/Utility/MimeHelper.cs diff --git a/Utility/OssUtils.cs b/src/Utility/OssUtils.cs similarity index 100% rename from Utility/OssUtils.cs rename to src/Utility/OssUtils.cs diff --git a/Utility/ResponseHeaderOverrides.cs b/src/Utility/ResponseHeaderOverrides.cs similarity index 100% rename from Utility/ResponseHeaderOverrides.cs rename to src/Utility/ResponseHeaderOverrides.cs diff --git a/Utility/SerializeHelper.cs b/src/Utility/SerializeHelper.cs similarity index 100% rename from Utility/SerializeHelper.cs rename to src/Utility/SerializeHelper.cs diff --git a/project.json b/src/project.json similarity index 100% rename from project.json rename to src/project.json diff --git a/tests/Sample/NewSdkTester.cs b/tests/Sample/NewSdkTester.cs new file mode 100644 index 0000000..9df4035 --- /dev/null +++ b/tests/Sample/NewSdkTester.cs @@ -0,0 +1,169 @@ +using Cuiliang.AliyunOssSdk; +using Cuiliang.AliyunOssSdk.Entites; +using System; +using System.Collections.Generic; +using System.Net; +using System.Text; +using System.Threading.Tasks; + +namespace Sample +{ + class NewSdkTester + { + public static string AccessKeyId = ""; // 设置您的AccessKeyId + + internal static string AssessSecret = ""; //设置您的AssessSecret + + internal static string EndPoint = "oss-cn-shanghai.aliyuncs.com"; //设置要操作的区域 + + + internal static string BucketName = ""; //设置要操作的BucketName + + + public static async Task RunAsync() + { + + + + var crediential = new OssCredential() + { + AccessKeyId = AccessKeyId, + AccessKeySecret = AssessSecret + }; + + var client = new OssClient(crediential); + + ////list buckets + //var listBucketResult = await client.ListBucketsAsync(OssRegions.ShangHai); + //Console.WriteLine(listBucketResult.IsSuccess + ":" + listBucketResult.ErrorMessage); + + var bucket = BucketInfo.CreateByRegion(EndPoint, BucketName, false, false); + + // put string + { + string content = "这是一个文本文件\naaaaaaaa\nbbbbbb\nccccccccc"; + var putResult = await client.PutObjectAsync(bucket, "test_put_object_string.txt", content); + Console.WriteLine($"Put string object {putResult.IsSuccess} {putResult.ErrorMessage} Etag:{putResult.SuccessResult?.ETag}"); + } + + + + //// put file + //var file = @"D:\Work\Weixin\resource\IMG_1399.png"; + //putResult = await client.PutObjectByFileNameAsync(bucket, "test_put_file.png", file); + //Console.WriteLine($"Put file object {putResult.IsSuccess} {putResult.ErrorMessage} Etag:{putResult.SuccessResult?.ETag}"); + + + //// copy file + //Console.WriteLine("\n\n===Copy Object============="); + //var copyResult = + // await + // client.CopyObjectAsync(bucket, "test_put_object_string.txt", bucket, + // "test_03_copy_object_string.txt", null); + //Console.WriteLine($"Copy object {copyResult.IsSuccess} {copyResult.ErrorMessage} Etag:{copyResult.SuccessResult?.LastModified}"); + + //// get file + //Console.WriteLine("\n\n===Get Object============="); + //var getResult = await client.GetObjectAsync(bucket, "test_put_object_string.txt"); + //Console.WriteLine($"Get Object = {getResult.IsSuccess}"); + //if (getResult.IsSuccess) + //{ + // var content = await getResult.SuccessResult.Content.ReadAsStringAsync(); + // Console.WriteLine("FileContent" + content); + //} + + //// append file + //Console.WriteLine("\n\n===append Object============="); + //{ + // var content = "This is a line 这是一行字符串."; + // var file = new OssObjectInfo() + // { + // ContentType = RequestContentType.String, + // MimeType = "text/text", + // StringContent = content + // }; + // var appendResult = await client.AppendObject(bucket, "test_append_object.txt", 0, file); + // Console.WriteLine($"1st append:{appendResult.IsSuccess} nextPos={appendResult.SuccessResult?.NextAppendPosition}"); + // if (appendResult.IsSuccess) + // { + // appendResult = await client.AppendObject(bucket, "test_append_object.txt", appendResult.SuccessResult.NextAppendPosition, file); + // Console.WriteLine($"2st append:{appendResult.IsSuccess} nextPos={appendResult.SuccessResult?.NextAppendPosition}"); + + // } + //} + + //// delete object + //Console.WriteLine("\n\n===append Object============="); + //{ + // var content = "This is a line 这是一行字符串."; + // var key = "test_delete_object.txt"; + // var putResult = await client.PutObjectAsync(bucket, key, content); + // if (putResult.IsSuccess) + // { + // var deleteResult = await client.DeleteObjectAsync(bucket, key); + // Console.WriteLine($"Delete reuslt:{deleteResult.IsSuccess} {deleteResult.ErrorMessage}"); + // } + // else + // { + // Console.WriteLine($" Put object failed.{putResult.ErrorMessage}"); + // } + //} + + //// delete multiple + //Console.WriteLine("\n\n===delete multiple============="); + //{ + // var content = "This is a line 这是一行字符串."; + + // IList fielKeys = new List(); + + // for (int i = 1; i < 10; i++) + // { + // var key = $"test_delete_multi_object_{i}.txt"; + // var putResult = await client.PutObjectAsync(bucket, key, content); + // if (putResult.IsSuccess == false) + // { + // Console.WriteLine($" Put object {i} failed.{putResult.ErrorMessage}"); + // return; + // } + // fielKeys.Add(key); + // } + + // var deleteResult = await client.DeleteMultipleObjectsAsync(bucket, fielKeys, false); + + // Console.WriteLine($"Delete multi:{deleteResult.IsSuccess} {deleteResult.ErrorMessage}"); + + //} + + + // head object + // delete multiple + Console.WriteLine("\n\n===head object============="); + { + var content = "This is a line 这是一行字符串."; + var key = "test_head_object.txt"; + //var putResult = await client.PutObjectAsync(bucket, key, content); + //if (putResult.IsSuccess) + { + var headResult = await client.HeadObjectAsync(bucket, key, null); + Console.WriteLine($"Head object: {headResult.IsSuccess} {headResult.ErrorMessage}"); + } + + } + + + Console.WriteLine("\n\n===Get object meta============="); + { + //var content = "This is a line 这是一行字符串."; + var key = "test_get_meta_object.txt"; + //var putResult = await client.PutObjectAsync(bucket, key, content); + //if (putResult.IsSuccess) + { + var headResult = await client.GetObjectMetaAsync(bucket, key); + Console.WriteLine($"Head object: {headResult.IsSuccess} {headResult.ErrorMessage}"); + } + + } + + } + } +} diff --git a/tests/Sample/Program.cs b/tests/Sample/Program.cs new file mode 100644 index 0000000..c339ba5 --- /dev/null +++ b/tests/Sample/Program.cs @@ -0,0 +1,28 @@ +using System; +using System.Threading.Tasks; +using Sample; + +class Program +{ + public static void Main(string[] args) + { + MainAsync(args).GetAwaiter().GetResult(); + + Console.ReadKey(); + } + + public static async Task MainAsync(string[] args) + { + try + { + await NewSdkTester.RunAsync(); + } + catch (Exception ex) + { + Console.WriteLine("Ex:" + ex.Message); + throw; + } + + + } +} \ No newline at end of file diff --git a/tests/Sample/Sample.csproj b/tests/Sample/Sample.csproj new file mode 100644 index 0000000..de40afa --- /dev/null +++ b/tests/Sample/Sample.csproj @@ -0,0 +1,16 @@ + + + Exe + netcoreapp1.0 + + + + + + + + + + + + \ No newline at end of file