|
| 1 | +#Qiniu (Cloud) C# SDK |
| 2 | + |
| 3 | +##About |
| 4 | + |
| 5 | +This C# SDK is built based on Qiniu Cloud API (see below), and it can be used on .NET Framework 2.0+, .NET Core and UWP (Windows 10 Universal Platforms). It will help you to build an application easily and quickly. |
| 6 | + |
| 7 | +##Documentation |
| 8 | + |
| 9 | +You can have a better view of this SDK by checking the documnets given below: |
| 10 | + |
| 11 | +* [SDK-reference HTML Online](http://oiy037d6a.bkt.clouddn.com/csharp-sdk-ref-v7.2.7/index.html) |
| 12 | + |
| 13 | +* [SDK-reference CHM Offline](http://oiy037d6a.bkt.clouddn.com/QiniuCSharpSDK-Ref-v7.2.7.chm) |
| 14 | + |
| 15 | +Want to know more about how to using this SDK? Are you trying to find some code examples based on this SDK? These documents or links below will be helpful: |
| 16 | + |
| 17 | +* [github/csharp-sdk-shared-examples](https://github.com/fengyhack/csharp-sdk-shared-examples) |
| 18 | + |
| 19 | +* [SDK manual | examples](http://oiy037d6a.bkt.clouddn.com/csharp-sdk-man-v7.2.7/index.html) |
| 20 | + |
| 21 | +##How-to-install |
| 22 | + |
| 23 | +Releases can be found [here](https://github.com/fengyhack/csharp-sdk-shared/releases), choose the one you need and unzipped it, then add reference to the *.dll file in your project. |
| 24 | + |
| 25 | +The latest update will always be available in the `master` branch. |
| 26 | + |
| 27 | +Or you can install using NuGet, take Visual Studio 2013/2015 as an example, navigate to the NuGet package manager, and search `Qiniu.Shared`, or just type the scriptin the package manager console as follow: |
| 28 | + |
| 29 | +``` |
| 30 | +Install-Package Qiniu.Shared |
| 31 | +``` |
| 32 | + |
| 33 | +And of course, you can build totally from source. |
| 34 | + |
| 35 | +##How-to-build |
| 36 | + |
| 37 | +Suppose you are using Visual Studio(VS2013 and higher versions are strongly recommended) to build this SDK. |
| 38 | + |
| 39 | +| Target | Solution file | |
| 40 | +|--------|--------| |
| 41 | +| .NET Framework 2.0 | Qiniu.Net20.sln | |
| 42 | +| .NET Framework 3.5 | Qiniu.Net35.sln | |
| 43 | +| .NET Framework 4.0 | Qiniu.Net40.sln | |
| 44 | +| .NET Framework 4.5 | Qiniu.Net45.sln | |
| 45 | +| .NET Framework 4.6 | Qiniu.Net46.sln | |
| 46 | +| .NET Core | Qiniu.NetCore.sln | |
| 47 | +| Windows10 UWP | Qiniu.UWP.sln | |
| 48 | +| All the above | Qiniu.ALL_VER.sln | |
| 49 | + |
| 50 | +**Some details about building NetCore/UWP projects** |
| 51 | + |
| 52 | +If you want to build `Qiniu.NetCore` or `Qiniu.UWP`, please copy `project.json` and `project.lock.json` (from `Qiniu.Core` or `Qiniu.UWP` folder) into `Qiniu` folder firstly, or you can just copy `project.json` and then execute `dotnet restore` command (a better way)。 |
| 53 | + |
| 54 | +For the other platforms, please delete `project.json` and `project.lock.json` in `Qiniu` folder. |
| 55 | + |
| 56 | +##Notes on .NET Framework |
| 57 | + |
| 58 | +**Higher version targets support async but lower ones doesn't**. |
| 59 | + |
| 60 | +For lower version targets (.NET framework 2.0/3.0/3.5/4.0), HTTP operations is performed with `HttpWebRequest`/`HttpWebResponse` and does not support `async` operations. It should be clear that file/stream read/write functions in these targets do not support async as well. |
| 61 | + |
| 62 | +For higher version targets (.NET Framework 4.5+, .NET Core, and UWP), HTTP operations is performed with `HttpClient` which supports `async` originally. In this case, file/stream read/write operations are implemented with async support. |
| 63 | + |
| 64 | +##API reference |
| 65 | + |
| 66 | +* [Storage API documentation](http://developer.qiniu.com/article/index.html#kodo-api-handbook) |
| 67 | + |
| 68 | +* [Processing API documentation](http://developer.qiniu.com/article/index.html#dora-api-handbook) |
| 69 | + |
| 70 | +* [Fusion CDN API documentation](http://developer.qiniu.com/article/index.html#fusion-api-handbook) |
| 71 | + |
| 72 | +##Related resources |
| 73 | + |
| 74 | +Good ideas and suggestions about our documentation or products are well appreciated. Welcome to visit the websites below and you may leave your words if you like. |
| 75 | + |
| 76 | +* [Forum](http://segmentfault.com/qiniu) - You can share your ideas with each other here, talking abouthow to use Qiniu product or other related topics. |
| 77 | + |
| 78 | +* [Request](http://support.qiniu.com/hc/request/guest/) - If the problems you post on the forum are still unsolved, you can submit it here, tech-support will give you a response as soon as posible. |
| 79 | + |
| 80 | +* [Blog](http://blog.qiniu.com/) - Latest articles about activities and technical sharing can be found here. |
| 81 | + |
| 82 | +* [Weibo](http://weibo.com/qiniutek) |
| 83 | + |
| 84 | +* [FAQs](http://developer.qiniu.com/article/faqs/) |
| 85 | + |
| 86 | +##Contribution |
| 87 | + |
| 88 | +1. Fork |
| 89 | + |
| 90 | +2. Create your own branch `git checkout -b my-new-feature` |
| 91 | + |
| 92 | +3. Commit you changes `git commit -am 'Added some feature'` |
| 93 | + |
| 94 | +4. Push your commit to the remote repo `git push origin my-new-feature` |
| 95 | + |
| 96 | +5. Visit your github page and make a new `pull request` in your branmch `my-new-feature` |
| 97 | + |
| 98 | + |
| 99 | +##License |
| 100 | + |
| 101 | +Copyright (c) 2017 [qiniu.com](www.qiniu.com) |
| 102 | + |
| 103 | +Published using on MIT license: |
| 104 | + |
| 105 | +www.opensource.org/licenses/MIT |
| 106 | + |
| 107 | +##Appendix |
| 108 | + |
| 109 | +###Quick start on .NET Coree |
| 110 | + |
| 111 | +### How-to-use |
| 112 | + |
| 113 | +Here is a step-by-step guide. |
| 114 | + |
| 115 | +To get ready, if you need `dotnet` tool, see https://github.com/dotnet/cli/ |
| 116 | + |
| 117 | +####1. Create |
| 118 | + |
| 119 | +Firstly, change to the working folder, and then create a project: |
| 120 | + |
| 121 | + dotnet new |
| 122 | + dotnet restore |
| 123 | + |
| 124 | +**NOTE** that before `dotnet restore` you may modify the generated `project.json` file as follow: |
| 125 | + |
| 126 | +```json |
| 127 | +{ |
| 128 | + "version": "1.0.0-*", |
| 129 | + "buildOptions": { |
| 130 | + "emitEntryPoint": true |
| 131 | + }, |
| 132 | + |
| 133 | + "dependencies": { |
| 134 | + "Microsoft.NETCore.App": { |
| 135 | + "version": "1.0.1" |
| 136 | + }, |
| 137 | + "Qiniu": "7.1.0.0", |
| 138 | + "Newtonsoft.Json": "9.0.1" |
| 139 | + }, |
| 140 | + |
| 141 | + "frameworks": { |
| 142 | + "netcoreapp1.0": { |
| 143 | + "imports": "dnxcore50" |
| 144 | + } |
| 145 | + }, |
| 146 | + |
| 147 | + "runtimes": { |
| 148 | + "win7-x64": {}, |
| 149 | + "win7-x86": {}, |
| 150 | + "osx.10.10-x64": {}, |
| 151 | + "osx.10.11-x64": {}, |
| 152 | + "ubuntu.14.04-x64": {}, |
| 153 | + "ubuntu.16.04-x64": {} |
| 154 | + } |
| 155 | +} |
| 156 | +``` |
| 157 | + |
| 158 | +Then write your codes. |
| 159 | + |
| 160 | +#### 2. Publish |
| 161 | + |
| 162 | +You may publish to the target os using command like one of them: |
| 163 | + |
| 164 | +```script |
| 165 | +dotnet publish -r win7-x64 |
| 166 | +dotnet publish -r ubuntu.16.04-x64 |
| 167 | +dotnet publish -r osx.10.11-x64 |
| 168 | +``` |
| 169 | + |
| 170 | +Or if you have .NET Core runtime installed, just build: |
| 171 | + |
| 172 | +```script |
| 173 | +dotnet build |
| 174 | +``` |
| 175 | + |
| 176 | +#### 3. Run |
| 177 | + |
| 178 | +**NOTE that on OSX 10.11(EI Capitan)**, openssl must be installed before running your app: |
| 179 | + |
| 180 | +```script |
| 181 | +brew update |
| 182 | +brew install openssl |
| 183 | +brew link --force openssl |
| 184 | +ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/ |
| 185 | +ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/ |
| 186 | +``` |
| 187 | + |
| 188 | +Say, if you would like to run the *built app* `Example.dll`, just type: |
| 189 | + |
| 190 | +```script |
| 191 | +dotnet Example.dll |
| 192 | +``` |
| 193 | + |
| 194 | +Or if you publish on Windows and exe file if generated, just run the exe file. |
| 195 | + |
| 196 | +In this case, you should have `dotnet` tool installed at the very begin. |
| 197 | + |
| 198 | +Or if you want to run the *published app* `Example`, just double-click it. |
| 199 | + |
| 200 | +######Quick start on .NET Coree |
| 201 | + |
| 202 | +**What is UWP** |
| 203 | + |
| 204 | +UWP means (Windows 10) Universal Windows Platform. |
| 205 | + |
| 206 | +UWP project also contains a file called `project.json`, here is an example: |
| 207 | + |
| 208 | +```json |
| 209 | +{ |
| 210 | + "dependencies": { |
| 211 | + "Microsoft.NETCore.UniversalWindowsPlatform": "5.1.0" |
| 212 | + }, |
| 213 | + "frameworks": { |
| 214 | + "uap10.0": {} |
| 215 | + }, |
| 216 | + "runtimes": { |
| 217 | + "win10-arm": {}, |
| 218 | + "win10-arm-aot": {}, |
| 219 | + "win10-x86": {}, |
| 220 | + "win10-x86-aot": {}, |
| 221 | + "win10-x64": {}, |
| 222 | + "win10-x64-aot": {} |
| 223 | + } |
| 224 | +} |
| 225 | +``` |
0 commit comments