Skip to content

Commit 742f5a2

Browse files
authored
Merge pull request #2 from cuiliang/develop
更新vs2017项目文件。 修改实例代码。
2 parents c488c46 + 4c3b190 commit 742f5a2

File tree

7 files changed

+77
-23
lines changed

7 files changed

+77
-23
lines changed

.vscode/launch.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": ".NET Core Launch (console)",
6+
"type": "coreclr",
7+
"request": "launch",
8+
"preLaunchTask": "build",
9+
"program": "${workspaceRoot}\\tests\\Sample\\bin\\Debug\\netcoreapp1.0\\Sample.dll",
10+
"args": [],
11+
"cwd": "${workspaceRoot}",
12+
"externalConsole": false,
13+
"stopAtEntry": false,
14+
"internalConsoleOptions": "openOnSessionStart"
15+
},
16+
{
17+
"name": ".NET Core Attach",
18+
"type": "coreclr",
19+
"request": "attach",
20+
"processId": "${command.pickProcess}"
21+
}
22+
]
23+
}

.vscode/tasks.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"version": "0.1.0",
3+
"command": "dotnet",
4+
"isShellCommand": true,
5+
"args": [],
6+
"tasks": [
7+
{
8+
"taskName": "build",
9+
"args": [
10+
"${workspaceRoot}\\tests\\Sample\\Sample.csproj"
11+
],
12+
"isBuildCommand": true,
13+
"problemMatcher": "$msCompile"
14+
}
15+
]
16+
}

src/Cuiliang.AliyunOssSdk.csproj

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,6 @@
1414
<RepositoryUrl>https://github.com/cuiliang/Cuiliang.AliyunOssSdk</RepositoryUrl>
1515
</PropertyGroup>
1616
<ItemGroup>
17-
<Compile Include="**\*.cs" />
18-
<EmbeddedResource Include="**\*.resx" />
19-
<EmbeddedResource Include="compiler\resources\**\*" />
20-
</ItemGroup>
21-
<ItemGroup>
22-
<PackageReference Include="NETStandard.Library">
23-
<Version>1.6.1</Version>
24-
</PackageReference>
2517
<PackageReference Include="System.Collections.NonGeneric">
2618
<Version>4.3.0</Version>
2719
</PackageReference>

src/Entites/OssRegions.cs

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,44 @@
55
/// </summary>
66
public class OssRegions
77
{
8+
// 华东 1
89
public const string HangZhou = "oss-cn-hangzhou";
10+
11+
// 华东 2
912
public const string ShangHai = "oss-cn-shanghai";
13+
14+
// 华北 1
1015
public const string QingDao = "oss-cn-qingdao";
16+
17+
// 华北 2
1118
public const string BeiJing = "oss-cn-beijing";
19+
20+
// 华南 1
1221
public const string ShenZhen = "oss-cn-shenzhen";
22+
23+
// 香港
1324
public const string HongKong = "oss-cn-hongkong";
25+
26+
// 美国西部 1 (硅谷)
1427
public const string UsWest1 = "oss-us-west-1";
28+
29+
// 美国东部 1 (弗吉尼亚)
1530
public const string UsEast1 = "oss-us-east-1";
16-
public const string AsiaPacific = "oss-ap-southeast-1";
31+
32+
// 亚太东南 1 (新加坡)
33+
public const string ApSoutheast1 = "oss-ap-southeast-1";
34+
35+
// 亚太东南 2 (悉尼)
36+
public const string ApSoutheast2 = "oss-ap-southeast-2";
37+
38+
// 亚太东北1 日本
39+
public const string ApNorthEast1 = "oss-ap-northeast-1";
40+
41+
// 欧洲中部 1 (法兰克福)
42+
public const string EuCentral1 = "oss-eu-central-1";
43+
44+
// 中东东部 1 (迪拜)
45+
public const string MeEast1 = "oss-me-east-1";
46+
1747
}
1848
}

src/Request/SignatureHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public static string HmacSha1Sign(
5959
var strToSign =
6060
$"{httpMethod.ToUpper()}\n{contentMd5}\n{contentType}\n{date}\n{canonicalizedOSSHeaders}{canonicalizedResource}";
6161

62-
Console.WriteLine("String to sign:" + strToSign);
62+
//Console.WriteLine("String to sign:" + strToSign);
6363

6464
return HmacSha1Sign(accessKeySecret, strToSign);
6565
}

tests/Sample/NewSdkTester.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ namespace Sample
1010
{
1111
class NewSdkTester
1212
{
13-
public static string AccessKeyId = ""; // 设置您的AccessKeyId
13+
public static string AccessKeyId = "******"; // 设置您的AccessKeyId
14+
internal static string AssessSecret = "******"; //设置您的AssessSecret
15+
internal static string BucketName = "testbucket"; //设置要操作的BucketName
1416

15-
internal static string AssessSecret = ""; //设置您的AssessSecret
17+
internal static string Region = OssRegions.ShangHai; //设置要操作的区域
1618

17-
internal static string EndPoint = "oss-cn-shanghai.aliyuncs.com"; //设置要操作的区域
1819

19-
20-
internal static string BucketName = ""; //设置要操作的BucketName
20+
2121

2222

2323
public static async Task RunAsync()
@@ -37,7 +37,7 @@ public static async Task RunAsync()
3737
//var listBucketResult = await client.ListBucketsAsync(OssRegions.ShangHai);
3838
//Console.WriteLine(listBucketResult.IsSuccess + ":" + listBucketResult.ErrorMessage);
3939

40-
var bucket = BucketInfo.CreateByRegion(EndPoint, BucketName, false, false);
40+
var bucket = BucketInfo.CreateByRegion(Region, BucketName, false, false);
4141

4242
// put string
4343
{

tests/Sample/Sample.csproj

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,6 @@
33
<OutputType>Exe</OutputType>
44
<TargetFramework>netcoreapp1.0</TargetFramework>
55
</PropertyGroup>
6-
<ItemGroup>
7-
<Compile Include="**\*.cs" />
8-
<EmbeddedResource Include="**\*.resx" />
9-
</ItemGroup>
10-
<ItemGroup>
11-
<PackageReference Include="Microsoft.NETCore.App" Version="1.0.1" />
12-
</ItemGroup>
136
<ItemGroup>
147
<ProjectReference Include="..\..\src\Cuiliang.AliyunOssSdk.csproj" />
158
</ItemGroup>

0 commit comments

Comments
 (0)