Skip to content

Feature/pfop #40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Feb 18, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
*.swp
*.suo

TestResult.xml
test-results
csharp-sdk.userprefs
Qiniu.LocalTest
*.userprefs

bin
obj
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
## CHANGE LOG

### v6.0.3

2014-01-06 #issue[40](https://github.com/qiniu/csharp-sdk/pull/40)

- 添加pfop请求(DO)及状态查询接口(QueryPfopStatus)
- 添加NET2.0、NET3.5、NET4.0支持

### v6.0.2

2013-11-18 #issue[38](https://github.com/qiniu/csharp-sdk/pull/38)
Expand Down
2 changes: 1 addition & 1 deletion Docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ title: C# SDK 使用指南

# C# SDK 使用指南

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

- [安装](#install)
- [初始化](#setup)
Expand Down
19 changes: 12 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
# for travis ci
all:

xbuild csharp-sdk.sln;
cp Qiniu.Test/bin/Debug/Qiniu.Test.dll bin
cp Qiniu/bin/Debug/Qiniu.dll bin

test:

cp tools/Newtonsoft.Json.dll tools/nunit.framework.dll bin
#for OS X
#export MON_PATH="/Library/Frameworks/Mono.framework/Libraries/mono/4.0/"
#mono --debug /Library/Frameworks/Mono.framework/Versions/3.2.0/lib/mono/4.5/nunit-console.exe bin/Qiniu.Test.dll

#for Linux
nunit-console -framework="4.0" bin/Qiniu.Test.dll
#2.0||3.5
xbuild csharp-sdk.2.0.sln;
cp Qiniu/bin/Debug/2.0/Qiniu.2.0.dll bin/
cp Qiniu.Test/bin/Debug/2.0/Qiniu.Test.dll bin/Qiniu.2.0.Test.dll
nunit-console bin/Qiniu.2.0.Test.dll

#4.0
xbuild csharp-sdk.4.0.sln;
cp Qiniu/bin/Debug/4.0/Qiniu.4.0.dll bin/
cp Qiniu.Test/bin/Debug/4.0/Qiniu.Test.dll bin/Qiniu.4.0.Test.dll
nunit-console bin/Qiniu.4.0.Test.dll
2 changes: 1 addition & 1 deletion Qiniu.Test/Auth/PutPolicy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class GetPolicyTest:QiniuTestBase
public void MakeRequestTest()
{
string actual;
FileOpUrl = "http://icattlecoder-private.qiniudn.com/img.jpg?download/avialkjdf" + "橛苛要工苛".ToUrlEncode() ;
FileOpUrl = "http://icattlecoder-private.qiniudn.com/img.jpg?download/avialkjdf" + StringEx.ToUrlEncode("橛苛要工苛") ;

actual = GetPolicy.MakeRequest(FileOpUrl);
//System.Diagnostics.Process.Start(actual);
Expand Down
50 changes: 26 additions & 24 deletions Qiniu.Test/IO/IOClientTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,30 +119,32 @@ public void PutFileWithoutKeyTest()
//target.PutFile("error", "error", "error", null);
Assert.IsTrue (ret.OK, "PutFileTest Failure");

}
[Test]
public void PutTest()
{
IOClient target = new IOClient();
string key = NewKey;
PrintLn(key);
PutExtra extra = new PutExtra(); // TODO: 初始化为适当的值
extra.MimeType = "text/plain";
extra.Crc32 = 123;
extra.CheckCrc = CheckCrcType.CHECK;
extra.Params = new System.Collections.Generic.Dictionary<string, string>();
PutPolicy put = new PutPolicy(Bucket);
target.PutFinished += new EventHandler<PutRet> ((o,e) => {
if (e.OK) {
RSHelper.RSDel (Bucket, key);
}
});
string token = put.Token ();
PutRet ret = target.Put(put.Token(), key, "Hello, Qiniu Cloud!".ToStream(), extra);

Assert.IsTrue(ret.OK, "PutFileTest Failure");

}
}
[Test]
public void PutTest()
{
IOClient target = new IOClient();
string key = NewKey;
PrintLn(key);
PutExtra extra = new PutExtra(); // TODO: 初始化为适当的值
extra.MimeType = "text/plain";
extra.Crc32 = 123;
extra.CheckCrc = CheckCrcType.CHECK;
extra.Params = new System.Collections.Generic.Dictionary<string, string>();
PutPolicy put = new PutPolicy(Bucket);
target.PutFinished += new EventHandler<PutRet>((o, e) =>
{
if (e.OK)
{
RSHelper.RSDel(Bucket, key);
}
});
string token = put.Token();
PutRet ret = target.Put(put.Token(), key, StreamEx.ToStream("Hello, Qiniu Cloud!"), extra);

Assert.IsTrue(ret.OK, "PutFileTest Failure");

}
[Test]
public void PutWithoutKeyTest()
{
Expand Down
64 changes: 64 additions & 0 deletions Qiniu.Test/Qiniu.2.0.Test.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>10.0.0</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{95DC2A77-2344-4315-9F6F-334CC928459C}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>Qiniu.Test</RootNamespace>
<AssemblyName>Qiniu.Test</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\2.0\</OutputPath>
<DefineConstants>DEBUG;NET20</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\4.0\</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="nunit.framework">
<HintPath>..\tools\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System.Configuration" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="QiniuTestBase.cs" />
<Compile Include="IO\IOClientTest.cs" />
<Compile Include="RS\RSClientTest.cs" />
<Compile Include="RSF\RSFClientTest.cs" />
<Compile Include="FileOp\ExifTest.cs" />
<Compile Include="FileOp\ImageInfoTest.cs" />
<Compile Include="FileOp\ImageMogrifyTest.cs" />
<Compile Include="FileOp\ImageViewTest.cs" />
<Compile Include="FileOp\ImageWaterMarkerTest.cs" />
<Compile Include="FileOp\TextWaterMarkerTest.cs" />
<Compile Include="Auth\PutPolicy.cs" />
<Compile Include="IO\Resumable\ResumablePutTest.cs" />
<Compile Include="TestHelper\IOHelper.cs" />
<Compile Include="TestHelper\RSHelper.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<ProjectReference Include="..\Qiniu\Qiniu.2.0.csproj">
<Project>{AD4EA9D1-11C2-4BF6-8A06-72A966BC1B80}</Project>
<Name>Qiniu.2.0</Name>
</ProjectReference>
</ItemGroup>
</Project>
135 changes: 63 additions & 72 deletions Qiniu.Test/Qiniu.Test.csproj → Qiniu.Test/Qiniu.4.0.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,72 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>10.0.0</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{95DC2A77-2344-4315-9F6F-334CC928459C}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>Qiniu.Test</RootNamespace>
<AssemblyName>Qiniu.Test</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="nunit.framework">
<HintPath>..\tools\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System.Configuration" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="QiniuTestBase.cs" />
<Compile Include="IO\IOClientTest.cs" />
<Compile Include="RS\RSClientTest.cs" />
<Compile Include="RSF\RSFClientTest.cs" />
<Compile Include="FileOp\ExifTest.cs" />
<Compile Include="FileOp\ImageInfoTest.cs" />
<Compile Include="FileOp\ImageMogrifyTest.cs" />
<Compile Include="FileOp\ImageViewTest.cs" />
<Compile Include="FileOp\ImageWaterMarkerTest.cs" />
<Compile Include="FileOp\TextWaterMarkerTest.cs" />
<Compile Include="Auth\PutPolicy.cs" />
<Compile Include="IO\Resumable\ResumablePutTest.cs" />
<Compile Include="TestHelper\IOHelper.cs" />
<Compile Include="TestHelper\RSHelper.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<ProjectReference Include="..\Qiniu\Qiniu.csproj">
<Project>{AD4EA9D1-11C2-4BF6-8A06-72A966BC1B80}</Project>
<Name>Qiniu</Name>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="IO\" />
<Folder Include="RS\" />
<Folder Include="RSF\" />
<Folder Include="FileOp\" />
<Folder Include="Auth\" />
<Folder Include="IO\Resumable\" />
<Folder Include="TestHelper\" />
</ItemGroup>
</Project>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>10.0.0</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{95DC2A77-2344-4315-9F6F-334CC928459C}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>Qiniu.Test</RootNamespace>
<AssemblyName>Qiniu.Test</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\4.0\</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\4.0\</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="nunit.framework">
<HintPath>..\tools\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System.Configuration" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="QiniuTestBase.cs" />
<Compile Include="IO\IOClientTest.cs" />
<Compile Include="RS\RSClientTest.cs" />
<Compile Include="RSF\RSFClientTest.cs" />
<Compile Include="FileOp\ExifTest.cs" />
<Compile Include="FileOp\ImageInfoTest.cs" />
<Compile Include="FileOp\ImageMogrifyTest.cs" />
<Compile Include="FileOp\ImageViewTest.cs" />
<Compile Include="FileOp\ImageWaterMarkerTest.cs" />
<Compile Include="FileOp\TextWaterMarkerTest.cs" />
<Compile Include="Auth\PutPolicy.cs" />
<Compile Include="IO\Resumable\ResumablePutTest.cs" />
<Compile Include="TestHelper\IOHelper.cs" />
<Compile Include="TestHelper\RSHelper.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<ProjectReference Include="..\Qiniu\Qiniu.4.0.csproj">
<Project>{AD4EA9D1-11C2-4BF6-8A06-72A966BC1B80}</Project>
<Name>Qiniu.4.0</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup />
</Project>
2 changes: 1 addition & 1 deletion Qiniu.Test/TestHelper/RSHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static List<string> RSPut(string bucket,int num)
List<string> newKeys=new List<string>();
for (int i=0; i<num; i++) {
key = "csharp" + Guid.NewGuid ().ToString ();
PutRet ret = target.Put (put.Token (), key, "Hello, Qiniu Cloud!".ToStream (), extra);
PutRet ret = target.Put (put.Token (), key,StreamEx.ToStream("Hello, Qiniu Cloud!"), extra);
if (ret.OK) {
newKeys.Add (key);
}
Expand Down
Loading