Skip to content

Commit c6caed3

Browse files
committed
Merge pull request #40 from icattlecoder/feature/pfop
Feature/pfop
2 parents 5edbe5a + 6d60199 commit c6caed3

33 files changed

+1202
-735
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
*.swp
33
*.suo
44

5+
TestResult.xml
56
test-results
6-
csharp-sdk.userprefs
7+
Qiniu.LocalTest
8+
*.userprefs
79

810
bin
911
obj

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
## CHANGE LOG
22

3+
### v6.0.3
4+
5+
2014-01-06 #issue[40](https://github.com/qiniu/csharp-sdk/pull/40)
6+
7+
- 添加pfop请求(DO)及状态查询接口(QueryPfopStatus)
8+
- 添加NET2.0、NET3.5、NET4.0支持
9+
310
### v6.0.2
411

512
2013-11-18 #issue[38](https://github.com/qiniu/csharp-sdk/pull/38)

Docs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ title: C# SDK 使用指南
55

66
# C# SDK 使用指南
77

8-
此 C# SDK 适用于.net framework>4.0版本,基于 [七牛云存储官方API](http://docs.qiniu.com/) 构建。使用此 SDK 构建您的网络应用程序,能让您以非常便捷地方式将数据安全地存储到七牛云存储上。无论您的网络应用是一个网站程序,还是包括从云端(服务端程序)到终端(手持设备应用)的架构的服务或应用,通过七牛云存储及其 SDK,都能让您应用程序的终端用户高速上传和下载,同时也让您的服务端更加轻盈。
8+
此 C# SDK 适用于.net framework>2.0版本,基于 [七牛云存储官方API](http://docs.qiniu.com/) 构建。使用此 SDK 构建您的网络应用程序,能让您以非常便捷地方式将数据安全地存储到七牛云存储上。无论您的网络应用是一个网站程序,还是包括从云端(服务端程序)到终端(手持设备应用)的架构的服务或应用,通过七牛云存储及其 SDK,都能让您应用程序的终端用户高速上传和下载,同时也让您的服务端更加轻盈。
99

1010
- [安装](#install)
1111
- [初始化](#setup)

Makefile

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
# for travis ci
2-
all:
3-
4-
xbuild csharp-sdk.sln;
5-
cp Qiniu.Test/bin/Debug/Qiniu.Test.dll bin
6-
cp Qiniu/bin/Debug/Qiniu.dll bin
7-
82
test:
93

104
cp tools/Newtonsoft.Json.dll tools/nunit.framework.dll bin
115
#for OS X
126
#export MON_PATH="/Library/Frameworks/Mono.framework/Libraries/mono/4.0/"
137
#mono --debug /Library/Frameworks/Mono.framework/Versions/3.2.0/lib/mono/4.5/nunit-console.exe bin/Qiniu.Test.dll
8+
149
#for Linux
15-
nunit-console -framework="4.0" bin/Qiniu.Test.dll
10+
#2.0||3.5
11+
xbuild csharp-sdk.2.0.sln;
12+
cp Qiniu/bin/Debug/2.0/Qiniu.2.0.dll bin/
13+
cp Qiniu.Test/bin/Debug/2.0/Qiniu.Test.dll bin/Qiniu.2.0.Test.dll
14+
nunit-console bin/Qiniu.2.0.Test.dll
15+
16+
#4.0
17+
xbuild csharp-sdk.4.0.sln;
18+
cp Qiniu/bin/Debug/4.0/Qiniu.4.0.dll bin/
19+
cp Qiniu.Test/bin/Debug/4.0/Qiniu.Test.dll bin/Qiniu.4.0.Test.dll
20+
nunit-console bin/Qiniu.4.0.Test.dll

Qiniu.Test/Auth/PutPolicy.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public class GetPolicyTest:QiniuTestBase
2222
public void MakeRequestTest()
2323
{
2424
string actual;
25-
FileOpUrl = "http://icattlecoder-private.qiniudn.com/img.jpg?download/avialkjdf" + "橛苛要工苛".ToUrlEncode() ;
25+
FileOpUrl = "http://icattlecoder-private.qiniudn.com/img.jpg?download/avialkjdf" + StringEx.ToUrlEncode("橛苛要工苛") ;
2626

2727
actual = GetPolicy.MakeRequest(FileOpUrl);
2828
//System.Diagnostics.Process.Start(actual);

Qiniu.Test/IO/IOClientTest.cs

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -119,30 +119,32 @@ public void PutFileWithoutKeyTest()
119119
//target.PutFile("error", "error", "error", null);
120120
Assert.IsTrue (ret.OK, "PutFileTest Failure");
121121

122-
}
123-
[Test]
124-
public void PutTest()
125-
{
126-
IOClient target = new IOClient();
127-
string key = NewKey;
128-
PrintLn(key);
129-
PutExtra extra = new PutExtra(); // TODO: 初始化为适当的值
130-
extra.MimeType = "text/plain";
131-
extra.Crc32 = 123;
132-
extra.CheckCrc = CheckCrcType.CHECK;
133-
extra.Params = new System.Collections.Generic.Dictionary<string, string>();
134-
PutPolicy put = new PutPolicy(Bucket);
135-
target.PutFinished += new EventHandler<PutRet> ((o,e) => {
136-
if (e.OK) {
137-
RSHelper.RSDel (Bucket, key);
138-
}
139-
});
140-
string token = put.Token ();
141-
PutRet ret = target.Put(put.Token(), key, "Hello, Qiniu Cloud!".ToStream(), extra);
142-
143-
Assert.IsTrue(ret.OK, "PutFileTest Failure");
144-
145-
}
122+
}
123+
[Test]
124+
public void PutTest()
125+
{
126+
IOClient target = new IOClient();
127+
string key = NewKey;
128+
PrintLn(key);
129+
PutExtra extra = new PutExtra(); // TODO: 初始化为适当的值
130+
extra.MimeType = "text/plain";
131+
extra.Crc32 = 123;
132+
extra.CheckCrc = CheckCrcType.CHECK;
133+
extra.Params = new System.Collections.Generic.Dictionary<string, string>();
134+
PutPolicy put = new PutPolicy(Bucket);
135+
target.PutFinished += new EventHandler<PutRet>((o, e) =>
136+
{
137+
if (e.OK)
138+
{
139+
RSHelper.RSDel(Bucket, key);
140+
}
141+
});
142+
string token = put.Token();
143+
PutRet ret = target.Put(put.Token(), key, StreamEx.ToStream("Hello, Qiniu Cloud!"), extra);
144+
145+
Assert.IsTrue(ret.OK, "PutFileTest Failure");
146+
147+
}
146148
[Test]
147149
public void PutWithoutKeyTest()
148150
{

Qiniu.Test/Qiniu.2.0.Test.csproj

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6+
<ProductVersion>10.0.0</ProductVersion>
7+
<SchemaVersion>2.0</SchemaVersion>
8+
<ProjectGuid>{95DC2A77-2344-4315-9F6F-334CC928459C}</ProjectGuid>
9+
<OutputType>Library</OutputType>
10+
<RootNamespace>Qiniu.Test</RootNamespace>
11+
<AssemblyName>Qiniu.Test</AssemblyName>
12+
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
13+
<TargetFrameworkProfile />
14+
</PropertyGroup>
15+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
16+
<DebugSymbols>true</DebugSymbols>
17+
<DebugType>full</DebugType>
18+
<Optimize>false</Optimize>
19+
<OutputPath>bin\Debug\2.0\</OutputPath>
20+
<DefineConstants>DEBUG;NET20</DefineConstants>
21+
<ErrorReport>prompt</ErrorReport>
22+
<WarningLevel>4</WarningLevel>
23+
<ConsolePause>false</ConsolePause>
24+
</PropertyGroup>
25+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
26+
<DebugType>full</DebugType>
27+
<Optimize>true</Optimize>
28+
<OutputPath>bin\Release\4.0\</OutputPath>
29+
<ErrorReport>prompt</ErrorReport>
30+
<WarningLevel>4</WarningLevel>
31+
<ConsolePause>false</ConsolePause>
32+
</PropertyGroup>
33+
<ItemGroup>
34+
<Reference Include="System" />
35+
<Reference Include="nunit.framework">
36+
<HintPath>..\tools\nunit.framework.dll</HintPath>
37+
</Reference>
38+
<Reference Include="System.Configuration" />
39+
</ItemGroup>
40+
<ItemGroup>
41+
<Compile Include="Properties\AssemblyInfo.cs" />
42+
<Compile Include="QiniuTestBase.cs" />
43+
<Compile Include="IO\IOClientTest.cs" />
44+
<Compile Include="RS\RSClientTest.cs" />
45+
<Compile Include="RSF\RSFClientTest.cs" />
46+
<Compile Include="FileOp\ExifTest.cs" />
47+
<Compile Include="FileOp\ImageInfoTest.cs" />
48+
<Compile Include="FileOp\ImageMogrifyTest.cs" />
49+
<Compile Include="FileOp\ImageViewTest.cs" />
50+
<Compile Include="FileOp\ImageWaterMarkerTest.cs" />
51+
<Compile Include="FileOp\TextWaterMarkerTest.cs" />
52+
<Compile Include="Auth\PutPolicy.cs" />
53+
<Compile Include="IO\Resumable\ResumablePutTest.cs" />
54+
<Compile Include="TestHelper\IOHelper.cs" />
55+
<Compile Include="TestHelper\RSHelper.cs" />
56+
</ItemGroup>
57+
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
58+
<ItemGroup>
59+
<ProjectReference Include="..\Qiniu\Qiniu.2.0.csproj">
60+
<Project>{AD4EA9D1-11C2-4BF6-8A06-72A966BC1B80}</Project>
61+
<Name>Qiniu.2.0</Name>
62+
</ProjectReference>
63+
</ItemGroup>
64+
</Project>
Lines changed: 63 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,63 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<PropertyGroup>
4-
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5-
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6-
<ProductVersion>10.0.0</ProductVersion>
7-
<SchemaVersion>2.0</SchemaVersion>
8-
<ProjectGuid>{95DC2A77-2344-4315-9F6F-334CC928459C}</ProjectGuid>
9-
<OutputType>Library</OutputType>
10-
<RootNamespace>Qiniu.Test</RootNamespace>
11-
<AssemblyName>Qiniu.Test</AssemblyName>
12-
</PropertyGroup>
13-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
14-
<DebugSymbols>true</DebugSymbols>
15-
<DebugType>full</DebugType>
16-
<Optimize>false</Optimize>
17-
<OutputPath>bin\Debug</OutputPath>
18-
<DefineConstants>DEBUG;</DefineConstants>
19-
<ErrorReport>prompt</ErrorReport>
20-
<WarningLevel>4</WarningLevel>
21-
<ConsolePause>false</ConsolePause>
22-
</PropertyGroup>
23-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
24-
<DebugType>full</DebugType>
25-
<Optimize>true</Optimize>
26-
<OutputPath>bin\Release</OutputPath>
27-
<ErrorReport>prompt</ErrorReport>
28-
<WarningLevel>4</WarningLevel>
29-
<ConsolePause>false</ConsolePause>
30-
</PropertyGroup>
31-
<ItemGroup>
32-
<Reference Include="System" />
33-
<Reference Include="nunit.framework">
34-
<HintPath>..\tools\nunit.framework.dll</HintPath>
35-
</Reference>
36-
<Reference Include="System.Configuration" />
37-
</ItemGroup>
38-
<ItemGroup>
39-
<Compile Include="Properties\AssemblyInfo.cs" />
40-
<Compile Include="QiniuTestBase.cs" />
41-
<Compile Include="IO\IOClientTest.cs" />
42-
<Compile Include="RS\RSClientTest.cs" />
43-
<Compile Include="RSF\RSFClientTest.cs" />
44-
<Compile Include="FileOp\ExifTest.cs" />
45-
<Compile Include="FileOp\ImageInfoTest.cs" />
46-
<Compile Include="FileOp\ImageMogrifyTest.cs" />
47-
<Compile Include="FileOp\ImageViewTest.cs" />
48-
<Compile Include="FileOp\ImageWaterMarkerTest.cs" />
49-
<Compile Include="FileOp\TextWaterMarkerTest.cs" />
50-
<Compile Include="Auth\PutPolicy.cs" />
51-
<Compile Include="IO\Resumable\ResumablePutTest.cs" />
52-
<Compile Include="TestHelper\IOHelper.cs" />
53-
<Compile Include="TestHelper\RSHelper.cs" />
54-
</ItemGroup>
55-
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
56-
<ItemGroup>
57-
<ProjectReference Include="..\Qiniu\Qiniu.csproj">
58-
<Project>{AD4EA9D1-11C2-4BF6-8A06-72A966BC1B80}</Project>
59-
<Name>Qiniu</Name>
60-
<Private>False</Private>
61-
</ProjectReference>
62-
</ItemGroup>
63-
<ItemGroup>
64-
<Folder Include="IO\" />
65-
<Folder Include="RS\" />
66-
<Folder Include="RSF\" />
67-
<Folder Include="FileOp\" />
68-
<Folder Include="Auth\" />
69-
<Folder Include="IO\Resumable\" />
70-
<Folder Include="TestHelper\" />
71-
</ItemGroup>
72-
</Project>
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6+
<ProductVersion>10.0.0</ProductVersion>
7+
<SchemaVersion>2.0</SchemaVersion>
8+
<ProjectGuid>{95DC2A77-2344-4315-9F6F-334CC928459C}</ProjectGuid>
9+
<OutputType>Library</OutputType>
10+
<RootNamespace>Qiniu.Test</RootNamespace>
11+
<AssemblyName>Qiniu.Test</AssemblyName>
12+
</PropertyGroup>
13+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
14+
<DebugSymbols>true</DebugSymbols>
15+
<DebugType>full</DebugType>
16+
<Optimize>false</Optimize>
17+
<OutputPath>bin\Debug\4.0\</OutputPath>
18+
<DefineConstants>DEBUG;</DefineConstants>
19+
<ErrorReport>prompt</ErrorReport>
20+
<WarningLevel>4</WarningLevel>
21+
<ConsolePause>false</ConsolePause>
22+
</PropertyGroup>
23+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
24+
<DebugType>full</DebugType>
25+
<Optimize>true</Optimize>
26+
<OutputPath>bin\Release\4.0\</OutputPath>
27+
<ErrorReport>prompt</ErrorReport>
28+
<WarningLevel>4</WarningLevel>
29+
<ConsolePause>false</ConsolePause>
30+
</PropertyGroup>
31+
<ItemGroup>
32+
<Reference Include="System" />
33+
<Reference Include="nunit.framework">
34+
<HintPath>..\tools\nunit.framework.dll</HintPath>
35+
</Reference>
36+
<Reference Include="System.Configuration" />
37+
</ItemGroup>
38+
<ItemGroup>
39+
<Compile Include="Properties\AssemblyInfo.cs" />
40+
<Compile Include="QiniuTestBase.cs" />
41+
<Compile Include="IO\IOClientTest.cs" />
42+
<Compile Include="RS\RSClientTest.cs" />
43+
<Compile Include="RSF\RSFClientTest.cs" />
44+
<Compile Include="FileOp\ExifTest.cs" />
45+
<Compile Include="FileOp\ImageInfoTest.cs" />
46+
<Compile Include="FileOp\ImageMogrifyTest.cs" />
47+
<Compile Include="FileOp\ImageViewTest.cs" />
48+
<Compile Include="FileOp\ImageWaterMarkerTest.cs" />
49+
<Compile Include="FileOp\TextWaterMarkerTest.cs" />
50+
<Compile Include="Auth\PutPolicy.cs" />
51+
<Compile Include="IO\Resumable\ResumablePutTest.cs" />
52+
<Compile Include="TestHelper\IOHelper.cs" />
53+
<Compile Include="TestHelper\RSHelper.cs" />
54+
</ItemGroup>
55+
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
56+
<ItemGroup>
57+
<ProjectReference Include="..\Qiniu\Qiniu.4.0.csproj">
58+
<Project>{AD4EA9D1-11C2-4BF6-8A06-72A966BC1B80}</Project>
59+
<Name>Qiniu.4.0</Name>
60+
</ProjectReference>
61+
</ItemGroup>
62+
<ItemGroup />
63+
</Project>

Qiniu.Test/TestHelper/RSHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public static List<string> RSPut(string bucket,int num)
3131
List<string> newKeys=new List<string>();
3232
for (int i=0; i<num; i++) {
3333
key = "csharp" + Guid.NewGuid ().ToString ();
34-
PutRet ret = target.Put (put.Token (), key, "Hello, Qiniu Cloud!".ToStream (), extra);
34+
PutRet ret = target.Put (put.Token (), key,StreamEx.ToStream("Hello, Qiniu Cloud!"), extra);
3535
if (ret.OK) {
3636
newKeys.Add (key);
3737
}

0 commit comments

Comments
 (0)