Skip to content

Commit 7b5a028

Browse files
committed
condition complie
1 parent b8d8122 commit 7b5a028

File tree

10 files changed

+778
-516
lines changed

10 files changed

+778
-516
lines changed

Makefile

Lines changed: 11 additions & 6 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
10+
#3.5
11+
xbuild csharp-sdk-3.5.sln;
12+
cp Qiniu/bin/Debug/3.5/Qiniu.dll bin
13+
cp Qiniu.Test/bin/Debug/Qiniu.Test.dll bin
14+
nunit-console -framework="3.5" bin/Qiniu.Test.dll
15+
16+
#4.0
17+
xbuild csharp-sdk-4.0.sln;
18+
cp Qiniu/bin/Debug/4.0/Qiniu.dll bin
19+
cp Qiniu.Test/bin/Debug/Qiniu.Test.dll bin
1520
nunit-console -framework="4.0" bin/Qiniu.Test.dll

Qiniu/FileOp/ImageInfoRet.cs

Lines changed: 76 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,77 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using Qiniu.RPC;
4-
using Newtonsoft.Json;
5-
6-
namespace Qiniu.FileOp
7-
{
8-
public class ImageInfoRet : CallRet
9-
{
10-
public int Width { get; private set; }
11-
12-
public int Height { get; private set; }
13-
14-
public string Format { get; private set; }
15-
16-
public string ColorModel { get; private set; }
17-
18-
public ImageInfoRet (CallRet ret)
19-
: base(ret)
20-
{
21-
if (!String.IsNullOrEmpty (Response)) {
22-
try {
23-
Unmarshal (Response);
24-
} catch (Exception e) {
25-
Console.WriteLine (e.ToString ());
26-
this.Exception = e;
27-
}
28-
}
29-
}
30-
31-
private void Unmarshal (string json)
32-
{
33-
var dics = JsonConvert.DeserializeObject<Dictionary<string,dynamic>> (json);
34-
dynamic tmp;
35-
if (dics.TryGetValue ("format", out tmp)) {
36-
Format = (string)tmp;
37-
}
38-
if (dics.TryGetValue ("width", out tmp)) {
39-
Width = (int)tmp;
40-
}
41-
if (dics.TryGetValue ("height", out tmp)) {
42-
Height = (int)tmp;
43-
}
44-
if (dics.TryGetValue ("colorModel", out tmp)) {
45-
ColorModel = (string)tmp;
46-
}
47-
}
48-
}
1+
using System;
2+
using System.Collections.Generic;
3+
using Qiniu.RPC;
4+
using Newtonsoft.Json;
5+
6+
namespace Qiniu.FileOp
7+
{
8+
/// <summary>
9+
/// Image Info
10+
/// </summary>
11+
public class ImageInfoRet : CallRet
12+
{
13+
/// <summary>
14+
/// Width
15+
/// </summary>
16+
public int Width { get; private set; }
17+
18+
/// <summary>
19+
/// Height
20+
/// </summary>
21+
public int Height { get; private set; }
22+
23+
/// <summary>
24+
/// Format
25+
/// </summary>
26+
public string Format { get; private set; }
27+
28+
/// <summary>
29+
/// Color Model
30+
/// </summary>
31+
public string ColorModel { get; private set; }
32+
33+
/// <summary>
34+
/// construct
35+
/// </summary>
36+
/// <param name="ret"></param>
37+
public ImageInfoRet(CallRet ret)
38+
: base(ret)
39+
{
40+
if (!String.IsNullOrEmpty(Response))
41+
{
42+
try
43+
{
44+
Unmarshal(Response);
45+
}
46+
catch (Exception e)
47+
{
48+
Console.WriteLine(e.ToString());
49+
this.Exception = e;
50+
}
51+
}
52+
}
53+
54+
private void Unmarshal(string json)
55+
{
56+
Dictionary<string, object> dics = JsonConvert.DeserializeObject<Dictionary<string, object>>(json);
57+
object tmp;
58+
if (dics.TryGetValue("format", out tmp))
59+
{
60+
this.Format = (string)tmp;
61+
}
62+
if (dics.TryGetValue("colorModel", out tmp))
63+
{
64+
this.ColorModel = (string)tmp;
65+
}
66+
if (dics.TryGetValue("width", out tmp))
67+
{
68+
this.Width = Convert.ToInt32(tmp);
69+
}
70+
if (dics.TryGetValue("height", out tmp))
71+
{
72+
this.Height = Convert.ToInt32(tmp);
73+
}
74+
75+
}
76+
}
4977
}

Qiniu/IO/PutRet.cs

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,23 @@ public PutRet (CallRet ret)
2828
this.Exception = e;
2929
}
3030
}
31-
}
32-
33-
private void Unmarshal (string json)
34-
{
35-
try {
36-
var dict = JsonConvert.DeserializeObject<Dictionary<string,dynamic>> (json);
37-
object tmp;
38-
if (dict.TryGetValue ("hash", out tmp))
39-
Hash = (string)dict ["hash"];
40-
if (dict.TryGetValue ("key", out tmp))
41-
key = (string)dict ["key"];
42-
} catch (Exception e) {
43-
throw e;
44-
}
45-
}
31+
}
32+
33+
private void Unmarshal(string json)
34+
{
35+
try
36+
{
37+
Dictionary<string, object> dict = JsonConvert.DeserializeObject<Dictionary<string, object>>(json);
38+
object tmp;
39+
if (dict.TryGetValue("hash", out tmp))
40+
Hash = (string)tmp;
41+
if (dict.TryGetValue("key", out tmp))
42+
key = (string)tmp;
43+
}
44+
catch (Exception e)
45+
{
46+
throw e;
47+
}
48+
}
4649
}
4750
}

0 commit comments

Comments
 (0)