├── Bimface.SDK.sln ├── Bimface.SDK.sln.DotSettings.user ├── Bimface.SDK.v11.suo ├── Bimface.SDK ├── Bean │ ├── GeneralResponse.cs │ ├── Request │ │ ├── FileTransferRequest.cs │ │ └── FileUploadRequest.cs │ └── Response │ │ ├── AccessTokenBean.cs │ │ ├── FileBean.cs │ │ ├── ShareLinkBean.cs │ │ ├── SupportFileBean.cs │ │ └── TransferBean.cs ├── Bimface.SDK.csproj ├── Bimface.SDK.csproj.user ├── BimfaceClient.cs ├── Configuration │ ├── Authorization │ │ ├── AccessTokenStorage.cs │ │ ├── Credential.cs │ │ └── DefaultAccessTokenStorage.cs │ ├── Config.cs │ └── Endpoint.cs ├── Constants │ ├── BimfaceConstants.cs │ ├── CallbackStatus.cs │ └── TransferStatus.cs ├── Exceptions │ └── BimfaceException.cs ├── Http │ ├── HttpFormEncoding.cs │ ├── HttpFormEncodingBuilder.cs │ ├── HttpHeaders.cs │ ├── HttpUtils.cs │ └── ServiceClient.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ └── Resources.resx ├── Service │ ├── AbstractAccessTokenService.cs │ ├── AbstractService.cs │ ├── AccessTokenService.cs │ ├── ShareLinkService.cs │ ├── SignatureService.cs │ ├── SupportFileService.cs │ ├── TransferService.cs │ ├── UploadService.cs │ └── ViewTokenService.cs ├── Utils │ ├── AssertUtils.cs │ ├── Base64.cs │ ├── FileNameUtils.cs │ ├── JsonUtils.cs │ ├── MD5Util.cs │ ├── RequestRecord.cs │ ├── StringUtils.cs │ └── VersionInfoUtils.cs ├── bin │ ├── Debug │ │ ├── Bimface.SDK.dll │ │ ├── Bimface.SDK.pdb │ │ └── Newtonsoft.Json.dll │ └── Release │ │ ├── Bimface.SDK.dll │ │ ├── Bimface.SDK.pdb │ │ └── Newtonsoft.Json.dll └── obj │ ├── Debug │ ├── Bimface.SDK.Properties.Resources.resources │ ├── Bimface.SDK.csproj.FileListAbsolute.txt │ ├── Bimface.SDK.csproj.GenerateResource.Cache │ ├── Bimface.SDK.csprojResolveAssemblyReference.cache │ ├── Bimface.SDK.dll │ ├── Bimface.SDK.pdb │ ├── DesignTimeResolveAssemblyReferencesInput.cache │ ├── TempPE │ │ └── Properties.Resources.Designer.cs.dll │ ├── TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs │ ├── TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs │ └── TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs │ └── Release │ ├── Bimface.SDK.Properties.Resources.resources │ ├── Bimface.SDK.csproj.FileListAbsolute.txt │ ├── Bimface.SDK.csproj.GenerateResource.Cache │ ├── Bimface.SDK.dll │ ├── Bimface.SDK.pdb │ ├── DesignTimeResolveAssemblyReferencesInput.cache │ ├── TempPE │ └── Properties.Resources.Designer.cs.dll │ ├── TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs │ ├── TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs │ └── TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs └── packages ├── Newtonsoft.Json.9.0.1 ├── Newtonsoft.Json.9.0.1.nupkg ├── lib │ ├── net20 │ │ ├── Newtonsoft.Json.dll │ │ └── Newtonsoft.Json.xml │ ├── net35 │ │ ├── Newtonsoft.Json.dll │ │ └── Newtonsoft.Json.xml │ ├── net40 │ │ ├── Newtonsoft.Json.dll │ │ └── Newtonsoft.Json.xml │ ├── net45 │ │ ├── Newtonsoft.Json.dll │ │ └── Newtonsoft.Json.xml │ ├── netstandard1.0 │ │ ├── Newtonsoft.Json.dll │ │ └── Newtonsoft.Json.xml │ ├── portable-net40+sl5+wp80+win8+wpa81 │ │ ├── Newtonsoft.Json.dll │ │ └── Newtonsoft.Json.xml │ └── portable-net45+wp80+win8+wpa81 │ │ ├── Newtonsoft.Json.dll │ │ └── Newtonsoft.Json.xml └── tools │ └── install.ps1 └── repositories.config /Bimface.SDK.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bimface.SDK", "Bimface.SDK\Bimface.SDK.csproj", "{5C222F51-DF07-4974-8AF3-79E5ACE67684}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Any CPU = Debug|Any CPU 9 | Release|Any CPU = Release|Any CPU 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {5C222F51-DF07-4974-8AF3-79E5ACE67684}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 13 | {5C222F51-DF07-4974-8AF3-79E5ACE67684}.Debug|Any CPU.Build.0 = Debug|Any CPU 14 | {5C222F51-DF07-4974-8AF3-79E5ACE67684}.Release|Any CPU.ActiveCfg = Release|Any CPU 15 | {5C222F51-DF07-4974-8AF3-79E5ACE67684}.Release|Any CPU.Build.0 = Release|Any CPU 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /Bimface.SDK.sln.DotSettings.user: -------------------------------------------------------------------------------- 1 |  2 | <AssemblyExplorer> 3 | <Assembly Path="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.dll" /> 4 | <Assembly Path="C:\Users\Kennan\documents\visual studio 2012\Projects\BIMFace.SDK\libs\Newtonsoft.Json.dll" /> 5 | </AssemblyExplorer> -------------------------------------------------------------------------------- /Bimface.SDK.v11.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/Bimface.SDK.v11.suo -------------------------------------------------------------------------------- /Bimface.SDK/Bean/GeneralResponse.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/Bimface.SDK/Bean/GeneralResponse.cs -------------------------------------------------------------------------------- /Bimface.SDK/Bean/Request/FileTransferRequest.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/Bimface.SDK/Bean/Request/FileTransferRequest.cs -------------------------------------------------------------------------------- /Bimface.SDK/Bean/Request/FileUploadRequest.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/Bimface.SDK/Bean/Request/FileUploadRequest.cs -------------------------------------------------------------------------------- /Bimface.SDK/Bean/Response/AccessTokenBean.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/Bimface.SDK/Bean/Response/AccessTokenBean.cs -------------------------------------------------------------------------------- /Bimface.SDK/Bean/Response/FileBean.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/Bimface.SDK/Bean/Response/FileBean.cs -------------------------------------------------------------------------------- /Bimface.SDK/Bean/Response/ShareLinkBean.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/Bimface.SDK/Bean/Response/ShareLinkBean.cs -------------------------------------------------------------------------------- /Bimface.SDK/Bean/Response/SupportFileBean.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | /// 5 | /// 支持文件格式和文件大小 6 | /// @author bimface, 2016-09-01. 7 | /// 8 | namespace Bimface.SDK.Bean.Response 9 | { 10 | public class SupportFileBean 11 | { 12 | private long? length; // 支持的最大文件长度,单位Byte 13 | private IList types; //支持的文件格式 14 | 15 | public virtual long? Length 16 | { 17 | get { return length; } 18 | set { length = value; } 19 | } 20 | 21 | public virtual IList Types 22 | { 23 | get { return types; } 24 | set { types = value; } 25 | } 26 | 27 | 28 | public override string ToString() 29 | { 30 | return string.Format("FileBean [length={0}, types={1}]", length, types.ToString()); 31 | } 32 | 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Bimface.SDK/Bean/Response/TransferBean.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/Bimface.SDK/Bean/Response/TransferBean.cs -------------------------------------------------------------------------------- /Bimface.SDK/Bimface.SDK.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {5C222F51-DF07-4974-8AF3-79E5ACE67684} 8 | Library 9 | Properties 10 | Bimface.SDK 11 | Bimface.SDK 12 | v4.5 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | bin\Release\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | ..\libs\Newtonsoft.Json.dll 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | True 73 | True 74 | Resources.resx 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | ResXFileCodeGenerator 97 | Resources.Designer.cs 98 | 99 | 100 | 101 | 108 | -------------------------------------------------------------------------------- /Bimface.SDK/Bimface.SDK.csproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | ProjectFiles 5 | 6 | -------------------------------------------------------------------------------- /Bimface.SDK/BimfaceClient.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/Bimface.SDK/BimfaceClient.cs -------------------------------------------------------------------------------- /Bimface.SDK/Configuration/Authorization/AccessTokenStorage.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/Bimface.SDK/Configuration/Authorization/AccessTokenStorage.cs -------------------------------------------------------------------------------- /Bimface.SDK/Configuration/Authorization/Credential.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Bimface.SDK.Configuation.Authorization 4 | { 5 | /// 6 | /// APP证书 7 | /// @author bimface, 2016-06-01. 8 | /// 9 | public sealed class Credential 10 | { 11 | public Credential(string appKey, string appSecret) 12 | { 13 | Check(appKey, appSecret); 14 | AppKey = appKey; 15 | AppSecret = appSecret; 16 | } 17 | 18 | public string AppKey { get; set; } 19 | public string AppSecret { get; set; } 20 | 21 | private void Check(string appKey, string appSecret) 22 | { 23 | if (appKey == null || appKey.Equals("")) 24 | { 25 | throw new ArgumentException("appKey should not be null or empty."); 26 | } 27 | if (appSecret == null || appSecret.Equals("")) 28 | { 29 | throw new ArgumentException("appSecret should not be null or empty."); 30 | } 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /Bimface.SDK/Configuration/Authorization/DefaultAccessTokenStorage.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/Bimface.SDK/Configuration/Authorization/DefaultAccessTokenStorage.cs -------------------------------------------------------------------------------- /Bimface.SDK/Configuration/Config.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/Bimface.SDK/Configuration/Config.cs -------------------------------------------------------------------------------- /Bimface.SDK/Configuration/Endpoint.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Bimface.SDK.Constants; 3 | 4 | namespace Bimface.SDK.Configuation 5 | { 6 | /// 7 | /// API调用地址入口 8 | /// @author bimface, 2016-06-01. 9 | /// 10 | public sealed class Endpoint 11 | { 12 | private string apiHost = BimfaceConstants.API_HOST; // API地址 13 | private string fileHost = BimfaceConstants.FILE_HOST; // 文件API地址 14 | 15 | public Endpoint() 16 | { 17 | } 18 | 19 | public Endpoint(string apiHost, string fileHost) 20 | { 21 | Check(apiHost, fileHost); 22 | this.apiHost = apiHost; 23 | this.fileHost = fileHost; 24 | } 25 | 26 | public string ApiHost 27 | { 28 | get { return apiHost; } 29 | set { apiHost = value; } 30 | } 31 | 32 | public string FileHost 33 | { 34 | get { return fileHost; } 35 | set { fileHost = value; } 36 | } 37 | 38 | private void Check(string apiHost, string fileHost) 39 | { 40 | if (string.IsNullOrEmpty(apiHost)) 41 | { 42 | throw new ArgumentException("apiHost should not be null or empty."); 43 | } 44 | if (string.IsNullOrEmpty(fileHost)) 45 | { 46 | throw new ArgumentException("fileHost should not be null or empty."); 47 | } 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /Bimface.SDK/Constants/BimfaceConstants.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/Bimface.SDK/Constants/BimfaceConstants.cs -------------------------------------------------------------------------------- /Bimface.SDK/Constants/CallbackStatus.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/Bimface.SDK/Constants/CallbackStatus.cs -------------------------------------------------------------------------------- /Bimface.SDK/Constants/TransferStatus.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/Bimface.SDK/Constants/TransferStatus.cs -------------------------------------------------------------------------------- /Bimface.SDK/Exceptions/BimfaceException.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/Bimface.SDK/Exceptions/BimfaceException.cs -------------------------------------------------------------------------------- /Bimface.SDK/Http/HttpFormEncoding.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/Bimface.SDK/Http/HttpFormEncoding.cs -------------------------------------------------------------------------------- /Bimface.SDK/Http/HttpFormEncodingBuilder.cs: -------------------------------------------------------------------------------- 1 | using System.Text; 2 | using Bimface.SDK.Utils; 3 | 4 | namespace Bimface.SDK.Http 5 | { 6 | internal sealed class HttpFormEncodingBuilder 7 | { 8 | private readonly StringBuilder builder = new StringBuilder(); 9 | private readonly string contentType = "application/x-www-form-urlencoded"; 10 | 11 | internal HttpFormEncodingBuilder() 12 | { 13 | } 14 | 15 | internal HttpFormEncodingBuilder(string contentType) 16 | { 17 | this.contentType = contentType; 18 | } 19 | 20 | internal HttpFormEncodingBuilder Add(string name, string value) 21 | { 22 | if (builder.Length > 0) 23 | builder.Append('&'); 24 | builder.Append(string.Format("{0}={1}", name, value)); 25 | return this; 26 | } 27 | 28 | internal byte[] Build() 29 | { 30 | return StringUtils.UTF8Bytes(builder.ToString()); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /Bimface.SDK/Http/HttpHeaders.cs: -------------------------------------------------------------------------------- 1 | using System.Net; 2 | using Bimface.SDK.Utils; 3 | 4 | namespace Bimface.SDK.Http 5 | { 6 | /// 7 | /// HTTP headers 工具 8 | /// @author bimface, 2016-06-01. 9 | /// 10 | public class HttpHeaders : WebHeaderCollection 11 | { 12 | public const string AUTHORIZATION = "Authorization"; 13 | public const string CACHE_CONTROL = "Cache-Control"; 14 | public const string CONTENT_DISPOSITION = "Content-Disposition"; 15 | public const string CONTENT_ENCODING = "Content-Encoding"; 16 | public const string CONTENT_LENGTH = "Content-Length"; 17 | public const string CONTENT_MD5 = "Content-MD5"; 18 | public const string CONTENT_TYPE = "Content-Type"; 19 | public const string TRANSFER_ENCODING = "Transfer-Encoding"; 20 | public const string DATE = "Date"; 21 | public const string ETAG = "ETag"; 22 | public const string EXPIRES = "Expires"; 23 | public const string HOST = "Host"; 24 | public const string LAST_MODIFIED = "Last-Modified"; 25 | public const string RANGE = "Range"; 26 | public const string LOCATION = "Location"; 27 | public const string CONNECTION = "Connection"; 28 | 29 | /// 30 | /// header里添加授权Authorization的Basic认证 31 | /// 32 | /// bimface颁发授权的应用key 33 | /// bimface颁发授权的应用secret 34 | public virtual void AddBasicAuthHeader(string appKey, string appSecret) 35 | { 36 | var bytes = StringUtils.UTF8Bytes(appKey + ":" + appSecret); 37 | var credential = "Basic " + Base64.Encode(bytes); 38 | Add(AUTHORIZATION, credential.Replace("\n", "").Replace("\r", "")); 39 | } 40 | 41 | /// 42 | /// header里添加授权Authorization的Bearer认证 43 | /// 44 | /// 由bimface颁发的appKey和appSecret通过Basic认证获取的token 45 | public virtual void AddOAuth2Header(string token) 46 | { 47 | Add(AUTHORIZATION, "Bearer " + token); 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /Bimface.SDK/Http/HttpUtils.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/Bimface.SDK/Http/HttpUtils.cs -------------------------------------------------------------------------------- /Bimface.SDK/Http/ServiceClient.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.IO; 5 | using System.Net; 6 | using System.Text; 7 | using Bimface.SDK.Configuation; 8 | using Bimface.SDK.Constants; 9 | using Bimface.SDK.Exceptions; 10 | using Bimface.SDK.Utils; 11 | 12 | namespace Bimface.SDK.Http 13 | { 14 | /// 15 | /// API请求的Client 16 | /// \n 17 | /// @author bimface, 2016-06-01. 18 | /// 19 | public class ServiceClient 20 | { 21 | private readonly Config httpConfig; 22 | 23 | public ServiceClient() 24 | { 25 | httpConfig = new Config(); 26 | } 27 | 28 | public ServiceClient(Config config) 29 | { 30 | httpConfig = config; 31 | } 32 | 33 | /// 34 | /// 空内容 35 | /// 36 | public string EmptyRequestBody 37 | { 38 | get { return string.Empty; } 39 | } 40 | 41 | public virtual HttpWebResponse Get(string url) 42 | { 43 | return Get(url, new HttpHeaders()); 44 | } 45 | 46 | public virtual HttpWebResponse Get(string url, HttpHeaders headers) 47 | { 48 | var request = WebRequest.Create(new Uri(url)) as HttpWebRequest; 49 | if (headers != null) 50 | request.Headers = headers; 51 | request.Method = WebRequestMethods.Http.Get; 52 | return Send(request, new byte[0]); 53 | } 54 | 55 | public virtual HttpWebResponse Post(string url, byte[] body, HttpHeaders headers) 56 | { 57 | return Post(url, body, headers, BimfaceConstants.STREAM_MIME); 58 | } 59 | 60 | public virtual HttpWebResponse Post(string url, string body, HttpHeaders headers) 61 | { 62 | return Post(url, body, headers, BimfaceConstants.STREAM_MIME); 63 | } 64 | 65 | public virtual HttpWebResponse Post(string url, HttpFormEncoding @params, HttpHeaders headers) 66 | { 67 | var builder = new HttpFormEncodingBuilder(); 68 | foreach (var key in @params.Params.Keys) 69 | builder.Add(key, @params.Params[key]); 70 | return Post(url, builder.Build(), headers); 71 | } 72 | 73 | public virtual HttpWebResponse Post(string url, string body, HttpHeaders headers, string contentType) 74 | { 75 | var bodyContent = new byte[0]; 76 | if (!string.IsNullOrEmpty(body)) 77 | bodyContent = Encoding.UTF8.GetBytes(body); 78 | return Post(url, bodyContent, headers, contentType); 79 | } 80 | 81 | public virtual HttpWebResponse Post(string url, byte[] body, int offset, int size, HttpHeaders headers, 82 | string contentType) 83 | { 84 | var bodyContent = new byte[0]; 85 | if (body != null && body.Length > 0) 86 | { 87 | bodyContent = new byte[size]; 88 | body.CopyTo(bodyContent, offset); 89 | } 90 | return Post(url, bodyContent, headers, contentType); 91 | } 92 | 93 | public virtual HttpWebResponse Post(string url, Stream inputStream, long contentLength, HttpHeaders headers) 94 | { 95 | if (contentLength > BimfaceConstants.PUT_THRESHOLD) 96 | { 97 | var request = WebRequest.Create(new Uri(url)) as HttpWebRequest; 98 | if (headers != null) 99 | request.Headers = headers; 100 | request.MediaType = BimfaceConstants.JSON_MIME; 101 | request.ContentType = BimfaceConstants.JSON_MIME; 102 | request.Method = WebRequestMethods.Http.Post; 103 | return Send(request, inputStream, contentLength); 104 | } 105 | var buffer = new byte[contentLength]; 106 | inputStream.Read(buffer, 0, (int) contentLength); 107 | return Post(url, buffer, headers); 108 | } 109 | 110 | private HttpWebResponse Post(string url, byte[] body, HttpHeaders headers, string contentType) 111 | { 112 | var request = WebRequest.Create(new Uri(url)) as HttpWebRequest; 113 | if (headers != null) 114 | request.Headers = headers; 115 | request.MediaType = contentType; 116 | request.ContentType = contentType; 117 | request.Method = WebRequestMethods.Http.Post; 118 | return Send(request, body); 119 | } 120 | 121 | public HttpWebResponse Put(string url, HttpHeaders headers) 122 | { 123 | return Put(url, string.Empty, headers); 124 | } 125 | 126 | public virtual HttpWebResponse Put(string url, object body, HttpHeaders headers) 127 | { 128 | return Put(url, JsonUtils.SerializeObject(body), headers); 129 | } 130 | 131 | public virtual HttpWebResponse Put(string url, string body, HttpHeaders headers) 132 | { 133 | var bodyContent = new byte[0]; 134 | if (!string.IsNullOrEmpty(body)) 135 | bodyContent = Encoding.UTF8.GetBytes(body); 136 | return Put(url, bodyContent, headers); 137 | } 138 | 139 | public virtual HttpWebResponse Put(string url, Stream inputStream, long contentLength, HttpHeaders headers) 140 | { 141 | if (contentLength > BimfaceConstants.PUT_THRESHOLD) 142 | { 143 | var request = WebRequest.Create(new Uri(url)) as HttpWebRequest; 144 | if (headers != null) 145 | request.Headers = headers; 146 | request.MediaType = BimfaceConstants.JSON_MIME; 147 | request.ContentType = BimfaceConstants.JSON_MIME; 148 | request.Method = WebRequestMethods.Http.Put; 149 | return Send(request, inputStream, contentLength); 150 | } 151 | var buffer = new byte[contentLength]; 152 | inputStream.Read(buffer, 0, (int) contentLength); 153 | return Put(url, buffer, headers); 154 | } 155 | 156 | private HttpWebResponse Put(string url, byte[] body, HttpHeaders headers) 157 | { 158 | var request = WebRequest.Create(new Uri(url)) as HttpWebRequest; 159 | if (headers != null) 160 | request.Headers = headers; 161 | request.MediaType = BimfaceConstants.MEDIA_TYPE_JSON; 162 | request.ContentType = BimfaceConstants.JSON_MIME; 163 | request.Method = WebRequestMethods.Http.Put; 164 | return Send(request, body); 165 | } 166 | 167 | public virtual HttpWebResponse Delete(string url) 168 | { 169 | return Delete(url, new HttpHeaders()); 170 | } 171 | 172 | public virtual HttpWebResponse Delete(string url, HttpHeaders headers) 173 | { 174 | var request = WebRequest.Create(new Uri(url)) as HttpWebRequest; 175 | if (headers != null) 176 | request.Headers = headers; 177 | request.Method = "DELETE"; 178 | return Send(request, new byte[0]); 179 | } 180 | 181 | public virtual HttpWebResponse Send(HttpWebRequest request, byte[] body) 182 | { 183 | request.ContentLength = body.Length; 184 | try 185 | { 186 | SetRequestConfig(request); 187 | request.UserAgent = VersionInfoUtils.DefaultUserAgent; 188 | if (body != null && body.Length > 0) 189 | { 190 | var requestStream = request.GetRequestStream(); 191 | requestStream.Write(body, 0, body.Length); 192 | requestStream.Close(); 193 | } 194 | var response = request.GetResponse() as HttpWebResponse; 195 | if (response.StatusCode >= (HttpStatusCode) 300) 196 | throw new BimfaceException(response.StatusDescription, 197 | Enum.GetName(typeof (HttpStatusCode), response.StatusCode)); 198 | return response; 199 | } 200 | catch (IOException e) 201 | { 202 | throw new BimfaceException(e); 203 | } 204 | } 205 | 206 | public virtual HttpWebResponse Send(HttpWebRequest request, Stream body, long contentLength) 207 | { 208 | request.ContentLength = contentLength; 209 | try 210 | { 211 | SetRequestConfig(request); 212 | request.UserAgent = VersionInfoUtils.DefaultUserAgent; 213 | request.AllowWriteStreamBuffering = false; 214 | var contentLeft = contentLength; 215 | var requestStream = request.GetRequestStream(); 216 | var content = new StringBuilder(); 217 | while (contentLeft > 0) 218 | { 219 | var length = contentLeft > BimfaceConstants.PUT_THRESHOLD 220 | ? BimfaceConstants.PUT_THRESHOLD 221 | : (int) contentLeft; 222 | var buffer = new byte[length]; 223 | body.Read(buffer, 0, length); 224 | requestStream.Write(buffer, 0, length); 225 | contentLeft -= length; 226 | content.Append(Encoding.Unicode.GetString(buffer)); 227 | } 228 | requestStream.Close(); 229 | var response = request.GetResponse() as HttpWebResponse; 230 | if (response.StatusCode >= (HttpStatusCode) 300) 231 | throw new BimfaceException(response.StatusDescription, 232 | Enum.GetName(typeof (HttpStatusCode), response.StatusCode)); 233 | return response; 234 | } 235 | catch (IOException e) 236 | { 237 | throw new BimfaceException(e); 238 | } 239 | } 240 | 241 | private void SetRequestConfig(HttpWebRequest request) 242 | { 243 | request.Timeout = httpConfig.ResponseTimeout; 244 | request.ReadWriteTimeout = httpConfig.ReadWriteTimeout; 245 | } 246 | } 247 | } -------------------------------------------------------------------------------- /Bimface.SDK/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | 8 | [assembly: AssemblyTitle("BimFace.SDK")] 9 | [assembly: AssemblyDescription("Software Development Kit for BimFace")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Glodon")] 12 | [assembly: AssemblyProduct("BimFace.SDK")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | 21 | [assembly: ComVisible(false)] 22 | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM 24 | 25 | [assembly: Guid("526f1253-4861-4ac7-be35-bd3f89e360bc")] 26 | 27 | // Version information for an assembly consists of the following four values: 28 | // 29 | // Major Version 30 | // Minor Version 31 | // Build Number 32 | // Revision 33 | // 34 | // You can specify all the values or you can default the Build and Revision Numbers 35 | // by using the '*' as shown below: 36 | // [assembly: AssemblyVersion("1.0.*")] 37 | 38 | [assembly: AssemblyVersion("1.0.0.0")] 39 | [assembly: AssemblyFileVersion("1.0.0.0")] -------------------------------------------------------------------------------- /Bimface.SDK/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Bimface.SDK.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Bimface.SDK.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Looks up a localized string similar to 1.0.0. 65 | /// 66 | internal static string Version { 67 | get { 68 | return ResourceManager.GetString("Version", resourceCulture); 69 | } 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /Bimface.SDK/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 1.0.0 122 | 123 | -------------------------------------------------------------------------------- /Bimface.SDK/Service/AbstractAccessTokenService.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/Bimface.SDK/Service/AbstractAccessTokenService.cs -------------------------------------------------------------------------------- /Bimface.SDK/Service/AbstractService.cs: -------------------------------------------------------------------------------- 1 | using Bimface.SDK.Configuation; 2 | using Bimface.SDK.Http; 3 | 4 | namespace Bimface.SDK.Service 5 | { 6 | /// 7 | /// 业务处理的抽象类 8 | /// @author bimface, 2016-06-01. 9 | /// 10 | public abstract class AbstractService 11 | { 12 | private readonly Endpoint endpoint; 13 | private readonly ServiceClient serviceClient; 14 | 15 | public AbstractService() 16 | { 17 | } 18 | 19 | public AbstractService(ServiceClient serviceClient, Endpoint endpoint) 20 | { 21 | this.serviceClient = serviceClient; 22 | this.endpoint = endpoint; 23 | } 24 | 25 | public virtual ServiceClient ServiceClient 26 | { 27 | get { return serviceClient; } 28 | } 29 | 30 | public virtual string ApiHost 31 | { 32 | get { return endpoint.ApiHost; } 33 | } 34 | 35 | public virtual string FileHost 36 | { 37 | get { return endpoint.FileHost; } 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /Bimface.SDK/Service/AccessTokenService.cs: -------------------------------------------------------------------------------- 1 | using Bimface.SDK.Bean.Response; 2 | using Bimface.SDK.Configuation; 3 | using Bimface.SDK.Configuation.Authorization; 4 | using Bimface.SDK.Http; 5 | 6 | namespace Bimface.SDK.Service 7 | { 8 | /// 9 | /// 获取AccessToken 10 | /// @author bimface, 2016-06-01. 11 | /// 12 | public sealed class AccessTokenService : AbstractService 13 | { 14 | private readonly AccessTokenStorage accessTokenStorage; 15 | private readonly Credential credential; 16 | private readonly bool InstanceFieldsInitialized; 17 | private string ACCESS_TOKEN_URL; 18 | 19 | public AccessTokenService(ServiceClient serviceClient, Endpoint endpoint, Credential credential, 20 | AccessTokenStorage accessTokenStorage) : base(serviceClient, endpoint) 21 | { 22 | if (!InstanceFieldsInitialized) 23 | { 24 | InitializeInstanceFields(); 25 | InstanceFieldsInitialized = true; 26 | } 27 | this.credential = credential; 28 | this.accessTokenStorage = accessTokenStorage; 29 | } 30 | 31 | private void InitializeInstanceFields() 32 | { 33 | ACCESS_TOKEN_URL = ApiHost + "/oauth2/token"; 34 | } 35 | 36 | public AccessTokenBean Get() 37 | { 38 | var accessTokenBean = accessTokenStorage.Get(); 39 | if (accessTokenBean == null) 40 | { 41 | accessTokenBean = Grant(); 42 | accessTokenStorage.Put(accessTokenBean); 43 | } 44 | return accessTokenBean; 45 | } 46 | 47 | private AccessTokenBean Grant() 48 | { 49 | var headers = new HttpHeaders(); 50 | headers.AddBasicAuthHeader(credential.AppKey, credential.AppSecret); 51 | var response = ServiceClient.Post(ACCESS_TOKEN_URL, ServiceClient.EmptyRequestBody, headers); 52 | return HttpUtils.Response(response); 53 | } 54 | } 55 | } -------------------------------------------------------------------------------- /Bimface.SDK/Service/ShareLinkService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Bimface.SDK.Bean.Response; 3 | using Bimface.SDK.Configuation; 4 | using Bimface.SDK.Http; 5 | using Bimface.SDK.Utils; 6 | 7 | namespace Bimface.SDK.Service 8 | { 9 | /// 10 | /// 分享链接 11 | /// @author bimface, 2016-06-01. 12 | /// 13 | public class ShareLinkService : AbstractAccessTokenService 14 | { 15 | private readonly bool InstanceFieldsInitialized; 16 | private string CREATE_SHARE_URL; 17 | private string CREATE_SHARE_URL_FOREVER; 18 | private string DELETE_SHARE_URL; 19 | private string GET_SHARE_URL; 20 | 21 | public ShareLinkService(ServiceClient serviceClient, Endpoint endpoint, AccessTokenService accessTokenService) 22 | : base(serviceClient, endpoint, accessTokenService) 23 | { 24 | if (!InstanceFieldsInitialized) 25 | { 26 | InitializeInstanceFields(); 27 | InstanceFieldsInitialized = true; 28 | } 29 | } 30 | 31 | private void InitializeInstanceFields() 32 | { 33 | CREATE_SHARE_URL = ApiHost + "/share?transferId={0}&activeHours={1}"; 34 | CREATE_SHARE_URL_FOREVER = ApiHost + "/share?transferId={0}"; 35 | GET_SHARE_URL = ApiHost + "/share?transferId={0}"; 36 | DELETE_SHARE_URL = ApiHost + "/share?transferId={0}"; 37 | } 38 | 39 | public virtual ShareLinkBean Create(string transferId, int? activeHours) 40 | { 41 | // 参数校验 42 | AssertUtils.AssertStringNotNullOrEmpty(transferId, "transferId"); 43 | if (activeHours != null && activeHours <= 0) 44 | { 45 | throw new ArgumentException("activeHours must not less than zero."); 46 | } 47 | 48 | var headers = new HttpHeaders(); 49 | headers.AddOAuth2Header(AccessToken); 50 | var response = ServiceClient.Post(string.Format(CREATE_SHARE_URL, transferId, activeHours), "", headers); 51 | return HttpUtils.Response(response); 52 | } 53 | 54 | public virtual ShareLinkBean Create(string transferId) 55 | { 56 | // 参数校验 57 | AssertUtils.AssertStringNotNullOrEmpty(transferId, "transferId"); 58 | 59 | var headers = new HttpHeaders(); 60 | headers.AddOAuth2Header(AccessToken); 61 | var response = ServiceClient.Post(string.Format(CREATE_SHARE_URL_FOREVER, transferId), "", headers); 62 | return HttpUtils.Response(response); 63 | } 64 | 65 | public virtual string Delete(string transferId) 66 | { 67 | // 参数校验 68 | AssertUtils.AssertStringNotNullOrEmpty(transferId, "transferId"); 69 | 70 | var headers = new HttpHeaders(); 71 | headers.AddOAuth2Header(AccessToken); 72 | var response = ServiceClient.Delete(string.Format(DELETE_SHARE_URL, transferId), headers); 73 | return HttpUtils.Response(response); 74 | } 75 | } 76 | } -------------------------------------------------------------------------------- /Bimface.SDK/Service/SignatureService.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/Bimface.SDK/Service/SignatureService.cs -------------------------------------------------------------------------------- /Bimface.SDK/Service/SupportFileService.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Bimface.SDK.Configuation; 3 | using Bimface.SDK.Http; 4 | using Bimface.SDK.Bean.Response; 5 | 6 | namespace Bimface.SDK.Service 7 | { 8 | /// 9 | /// 支持的文件格式 10 | /// @author bimface, 2016-09-01. 11 | /// 12 | public class SupportFileService : AbstractAccessTokenService 13 | { 14 | private readonly bool InstanceFieldsInitialized; 15 | private string SUPPORT_FILE_URL; 16 | private SupportFileBean supportFileBean; 17 | 18 | public SupportFileService(ServiceClient serviceClient, Endpoint endpoint, AccessTokenService accessTokenService) 19 | : base(serviceClient, endpoint, accessTokenService) 20 | { 21 | if (!InstanceFieldsInitialized) 22 | { 23 | InitializeInstanceFields(); 24 | InstanceFieldsInitialized = true; 25 | } 26 | } 27 | 28 | public virtual SupportFileBean GetSupport 29 | { 30 | get 31 | { 32 | // 在缓存中获取 33 | if (supportFileBean != null) 34 | { 35 | return supportFileBean; 36 | } 37 | 38 | var headers = new HttpHeaders(); 39 | headers.AddOAuth2Header(AccessToken); 40 | var response = ServiceClient.Get(SUPPORT_FILE_URL, headers); 41 | supportFileBean = HttpUtils.Response(response); 42 | return supportFileBean; 43 | } 44 | } 45 | 46 | private void InitializeInstanceFields() 47 | { 48 | SUPPORT_FILE_URL = string.Format("{0}/support", FileHost); 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /Bimface.SDK/Service/TransferService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Bimface.SDK.Bean.Request; 3 | using Bimface.SDK.Bean.Response; 4 | using Bimface.SDK.Configuation; 5 | using Bimface.SDK.Http; 6 | using Bimface.SDK.Utils; 7 | 8 | namespace Bimface.SDK.Service 9 | { 10 | /// 11 | /// 文件转换 12 | /// @author bimface, 2016-06-01. 13 | /// 14 | public class TransferService : AbstractAccessTokenService 15 | { 16 | private readonly bool InstanceFieldsInitialized; 17 | private string GET_TRANSFER_URL; 18 | private string TRANSFER_URL; 19 | 20 | public TransferService(ServiceClient serviceClient, Endpoint endpoint, AccessTokenService accessTokenService) 21 | : base(serviceClient, endpoint, accessTokenService) 22 | { 23 | if (!InstanceFieldsInitialized) 24 | { 25 | InitializeInstanceFields(); 26 | InstanceFieldsInitialized = true; 27 | } 28 | } 29 | 30 | private void InitializeInstanceFields() 31 | { 32 | TRANSFER_URL = ApiHost + "/transfer"; 33 | GET_TRANSFER_URL = ApiHost + "/transfer?transferId={0}"; 34 | } 35 | 36 | public virtual TransferBean Transfer(FileTransferRequest fileTransferRequest) 37 | { 38 | // 参数校验 39 | Check(fileTransferRequest); 40 | 41 | var headers = new HttpHeaders(); 42 | headers.AddOAuth2Header(AccessToken); 43 | var response = ServiceClient.Put(TRANSFER_URL, fileTransferRequest, headers); 44 | return HttpUtils.Response(response); 45 | } 46 | 47 | public virtual TransferBean GetTransfer(string transferId) 48 | { 49 | // 参数校验 50 | AssertUtils.AssertStringNotNullOrEmpty(transferId, "transferId"); 51 | 52 | var headers = new HttpHeaders(); 53 | headers.AddOAuth2Header(AccessToken); 54 | var response = ServiceClient.Get(string.Format(GET_TRANSFER_URL, transferId), headers); 55 | return HttpUtils.Response(response); 56 | } 57 | 58 | private void Check(FileTransferRequest fileTransferRequest) 59 | { 60 | AssertUtils.AssertParameterNotNull(fileTransferRequest, "fileTransferRequest"); 61 | if (fileTransferRequest.FileId == null && fileTransferRequest.FileId < 0) 62 | { 63 | throw new ArgumentException("ParameterLongIsEmpty FileId"); 64 | } 65 | } 66 | } 67 | } -------------------------------------------------------------------------------- /Bimface.SDK/Service/UploadService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net; 3 | using Bimface.SDK.Bean.Request; 4 | using Bimface.SDK.Bean.Response; 5 | using Bimface.SDK.Configuation; 6 | using Bimface.SDK.Http; 7 | using Bimface.SDK.Utils; 8 | 9 | namespace Bimface.SDK.Service 10 | { 11 | /// 12 | /// 文件上传 13 | /// @author bimface, 2016-06-01. 14 | /// 15 | public class UploadService : AbstractAccessTokenService 16 | { 17 | private readonly bool InstanceFieldsInitialized; 18 | private string UPLOAD_BY_URL_URL; 19 | private string UPLOAD_URL; 20 | 21 | public UploadService(ServiceClient serviceClient, Endpoint endpoint, AccessTokenService accessTokenService) 22 | : base(serviceClient, endpoint, accessTokenService) 23 | { 24 | if (!InstanceFieldsInitialized) 25 | { 26 | InitializeInstanceFields(); 27 | InstanceFieldsInitialized = true; 28 | } 29 | } 30 | 31 | public virtual SupportFileService SupportFileService { set; get; } 32 | 33 | private void InitializeInstanceFields() 34 | { 35 | UPLOAD_URL = FileHost + "/upload?name={0}"; 36 | UPLOAD_BY_URL_URL = FileHost + "/upload?name={0}&url={2}"; 37 | } 38 | 39 | public virtual FileBean Upload(FileUploadRequest fileUploadRequest) 40 | { 41 | // 参数校验 42 | Check(fileUploadRequest); 43 | 44 | var headers = new HttpHeaders(); 45 | headers.AddOAuth2Header(AccessToken); 46 | HttpWebResponse response = null; 47 | string requestUrl = null; 48 | if (fileUploadRequest.ByUrl) 49 | { 50 | requestUrl = string.Format(UPLOAD_BY_URL_URL, fileUploadRequest.Name, 51 | fileUploadRequest.Url); 52 | response = ServiceClient.Put(requestUrl, headers); 53 | } 54 | else 55 | { 56 | requestUrl = string.Format(UPLOAD_URL, fileUploadRequest.Name); 57 | //headers.Add(HttpHeaders.CONTENT_LENGTH, fileUploadRequest.ContentLength.ToString()); 58 | response = ServiceClient.Put(requestUrl, fileUploadRequest.InputStream, fileUploadRequest.ContentLength, 59 | headers); 60 | } 61 | return HttpUtils.Response(response); 62 | } 63 | 64 | private void Check(FileUploadRequest fileUploadRequest) 65 | { 66 | AssertUtils.AssertParameterNotNull(fileUploadRequest, "fileUploadRequest"); 67 | if (fileUploadRequest.Url == null) 68 | { 69 | if (fileUploadRequest.ContentLength <= 0) 70 | { 71 | throw new ArgumentException("ParameterLongIsEmpty ContentLength"); 72 | } 73 | AssertUtils.AssertParameterNotNull(fileUploadRequest.InputStream, "inputStream"); 74 | } 75 | FileNameUtils.CheckFileName(fileUploadRequest.Name); 76 | SupportFileBean supportFile = SupportFileService.GetSupport; 77 | FileNameUtils.CheckFileType(supportFile.Types, fileUploadRequest.Name); 78 | } 79 | } 80 | } -------------------------------------------------------------------------------- /Bimface.SDK/Service/ViewTokenService.cs: -------------------------------------------------------------------------------- 1 | using Bimface.SDK.Configuation; 2 | using Bimface.SDK.Http; 3 | using Bimface.SDK.Utils; 4 | 5 | namespace Bimface.SDK.Service 6 | { 7 | /// 8 | /// 获取viewToken 9 | /// @author bimface, 2016-06-01. 10 | /// 11 | public class ViewTokenService : AbstractAccessTokenService 12 | { 13 | private readonly bool InstanceFieldsInitialized; 14 | private string VIEW_TOKEN_URL; 15 | 16 | public ViewTokenService(ServiceClient serviceClient, Endpoint endpoint, AccessTokenService accessTokenService) 17 | : base(serviceClient, endpoint, accessTokenService) 18 | { 19 | if (!InstanceFieldsInitialized) 20 | { 21 | InitializeInstanceFields(); 22 | InstanceFieldsInitialized = true; 23 | } 24 | } 25 | 26 | private void InitializeInstanceFields() 27 | { 28 | VIEW_TOKEN_URL = ApiHost + "/view/token?transferId={0}"; 29 | } 30 | 31 | public virtual string GrantViewToken(string transferId) 32 | { 33 | AssertUtils.AssertStringNotNullOrEmpty(transferId, "transferId"); 34 | var headers = new HttpHeaders(); 35 | headers.AddOAuth2Header(AccessToken); 36 | var response = ServiceClient.Get(string.Format(VIEW_TOKEN_URL, transferId), headers); 37 | return HttpUtils.Response(response); 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /Bimface.SDK/Utils/AssertUtils.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/Bimface.SDK/Utils/AssertUtils.cs -------------------------------------------------------------------------------- /Bimface.SDK/Utils/Base64.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | 4 | namespace Bimface.SDK.Utils 5 | { 6 | /// 7 | /// Base64工具 8 | /// @author bimface, 2016-06-01. 9 | /// 10 | public class Base64 11 | { 12 | public static string Encode(byte[] buff) 13 | { 14 | lock (typeof (Base64)) 15 | { 16 | if (null == buff) 17 | { 18 | return null; 19 | } 20 | return Convert.ToBase64String(buff); 21 | } 22 | } 23 | 24 | public static string Encode(string @string, string encoding) 25 | { 26 | lock (typeof (Base64)) 27 | { 28 | if (null == @string || null == encoding) 29 | { 30 | return null; 31 | } 32 | var stringArray = Encoding.GetEncoding(encoding).GetBytes(@string); 33 | return Encode(stringArray); 34 | } 35 | } 36 | 37 | public static string Decode(string @string, string encoding) 38 | { 39 | lock (typeof (Base64)) 40 | { 41 | if (null == @string || null == encoding) 42 | { 43 | return null; 44 | } 45 | var buffer = Convert.FromBase64String(@string); 46 | return Encoding.GetEncoding(encoding).GetString(buffer); 47 | } 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /Bimface.SDK/Utils/FileNameUtils.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Bimface.SDK.Utils 5 | { 6 | class FileNameUtils 7 | { 8 | 9 | private static string[] ILLEGAL_CHAR = new string[] { "/", "\n", "*", "\\", "<", ">", "|", "\"", ":", "?" }; 10 | 11 | public static void CheckFileName(string name) 12 | { 13 | if (name == null || name.Length <= 0) 14 | { 15 | throw new ArgumentException("File name must not be empty."); 16 | } 17 | if (name.Length > 256) 18 | { 19 | throw new ArgumentException("File name too long, no more than 256 characters."); 20 | } 21 | string suffix = GetSuffix(name); 22 | if (suffix == null || suffix.Length <= 0) 23 | { 24 | throw new ArgumentException("File name has no suffix."); 25 | } 26 | if (ContainsIllegalChar(name)) 27 | { 28 | throw new ArgumentException("File name contains illegal character."); 29 | } 30 | } 31 | 32 | public static void CheckFileType(IList allSupportedType, string name) 33 | { 34 | string suffix = GetSuffix(name); 35 | foreach (string s in allSupportedType) { 36 | if (s.ToLower().Equals(suffix.ToLower())) { 37 | return; 38 | } 39 | } 40 | throw new ArgumentException("File type not supported."); 41 | } 42 | 43 | 44 | private static bool ContainsIllegalChar(string value) { 45 | 46 | foreach (string x in ILLEGAL_CHAR) { 47 | if (value.Contains(x)) { 48 | return true; 49 | } 50 | } 51 | 52 | return false; 53 | } 54 | 55 | private static string GetSuffix(string name) 56 | { 57 | if (name.IndexOf(".") == -1) 58 | { 59 | return null; 60 | } 61 | string suffix = null; 62 | if (name != null && name.Length > 0) 63 | { 64 | suffix = name.Substring(name.LastIndexOf(".") + 1); 65 | } 66 | return suffix; 67 | } 68 | 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /Bimface.SDK/Utils/JsonUtils.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.IO; 3 | using Newtonsoft.Json; 4 | using Newtonsoft.Json.Linq; 5 | 6 | namespace Bimface.SDK.Utils 7 | { 8 | public class JsonUtils 9 | { 10 | /// 11 | /// 将对象序列化为JSON格式 12 | /// 13 | /// 对象 14 | /// json字符串 15 | public static string SerializeObject(object o) 16 | { 17 | //string json = JsonConvert.SerializeObject(o); 18 | var obj = JObject.FromObject(o, new JsonSerializer()); 19 | return obj.ToString(); 20 | } 21 | 22 | /// 23 | /// 解析JSON字符串生成对象实体 24 | /// 25 | /// 对象类型 26 | /// json字符串(eg.{"ID":"112","Name":"石子儿"}) 27 | /// 对象实体 28 | public static T DeserializeJsonToObject(string json) where T : class 29 | { 30 | var serializer = new JsonSerializer(); 31 | var sr = new StringReader(json); 32 | var o = serializer.Deserialize(new JsonTextReader(sr), typeof (T)); 33 | var t = o as T; 34 | return t; 35 | } 36 | 37 | /// 38 | /// 解析JSON数组生成对象实体集合 39 | /// 40 | /// 对象类型 41 | /// json数组字符串(eg.[{"ID":"112","Name":"石子儿"}]) 42 | /// 对象实体集合 43 | public static List DeserializeJsonToList(string json) where T : class 44 | { 45 | var serializer = new JsonSerializer(); 46 | var sr = new StringReader(json); 47 | var o = serializer.Deserialize(new JsonTextReader(sr), typeof (List)); 48 | var list = o as List; 49 | return list; 50 | } 51 | 52 | /// 53 | /// 反序列化JSON到给定的匿名对象. 54 | /// 55 | /// 匿名对象类型 56 | /// json字符串 57 | /// 匿名对象 58 | /// 匿名对象 59 | public static T DeserializeAnonymousType(string json, T anonymousTypeObject) 60 | { 61 | var t = JsonConvert.DeserializeAnonymousType(json, anonymousTypeObject); 62 | return t; 63 | } 64 | } 65 | } -------------------------------------------------------------------------------- /Bimface.SDK/Utils/MD5Util.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/Bimface.SDK/Utils/MD5Util.cs -------------------------------------------------------------------------------- /Bimface.SDK/Utils/RequestRecord.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Net; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Bimface.SDK.Utils 9 | { 10 | public class RequestRecord : Stack> 11 | { 12 | private RequestRecord() : base() 13 | { 14 | 15 | } 16 | 17 | public static readonly RequestRecord Instance = new RequestRecord(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Bimface.SDK/Utils/StringUtils.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/Bimface.SDK/Utils/StringUtils.cs -------------------------------------------------------------------------------- /Bimface.SDK/Utils/VersionInfoUtils.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Bimface.SDK.Properties; 3 | 4 | namespace Bimface.SDK.Utils 5 | { 6 | /// 7 | /// 版本工具 8 | /// @author bimface, 2016-06-01. 9 | /// 10 | public class VersionInfoUtils 11 | { 12 | private const string USER_AGENT_PREFIX = "Bimface-SDK-NET"; 13 | private static string version; 14 | private static string defaultUserAgent; 15 | 16 | public static string Version 17 | { 18 | get 19 | { 20 | if (string.IsNullOrEmpty(version)) 21 | { 22 | InitializeVersion(); 23 | } 24 | return version; 25 | } 26 | } 27 | 28 | public static string DefaultUserAgent 29 | { 30 | get 31 | { 32 | if (defaultUserAgent == null) 33 | { 34 | var operatingSystem = Environment.OSVersion; 35 | defaultUserAgent = string.Format("{0}/{1}(OS:{2};.NET:{3})", USER_AGENT_PREFIX, Version, 36 | Environment.OSVersion, Environment.Version); 37 | } 38 | return defaultUserAgent; 39 | } 40 | } 41 | 42 | private static void InitializeVersion() 43 | { 44 | try 45 | { 46 | version = Resources.Version; 47 | } 48 | catch (Exception) 49 | { 50 | version = "unknown-version"; 51 | } 52 | } 53 | } 54 | } -------------------------------------------------------------------------------- /Bimface.SDK/bin/Debug/Bimface.SDK.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/Bimface.SDK/bin/Debug/Bimface.SDK.dll -------------------------------------------------------------------------------- /Bimface.SDK/bin/Debug/Bimface.SDK.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/Bimface.SDK/bin/Debug/Bimface.SDK.pdb -------------------------------------------------------------------------------- /Bimface.SDK/bin/Debug/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/Bimface.SDK/bin/Debug/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /Bimface.SDK/bin/Release/Bimface.SDK.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/Bimface.SDK/bin/Release/Bimface.SDK.dll -------------------------------------------------------------------------------- /Bimface.SDK/bin/Release/Bimface.SDK.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/Bimface.SDK/bin/Release/Bimface.SDK.pdb -------------------------------------------------------------------------------- /Bimface.SDK/bin/Release/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/Bimface.SDK/bin/Release/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /Bimface.SDK/obj/Debug/Bimface.SDK.Properties.Resources.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/Bimface.SDK/obj/Debug/Bimface.SDK.Properties.Resources.resources -------------------------------------------------------------------------------- /Bimface.SDK/obj/Debug/Bimface.SDK.csproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | F:\newBimface\sdk\Bimface.CSharp.SDK\Bimface.SDK\bin\Debug\Bimface.SDK.dll 2 | F:\newBimface\sdk\Bimface.CSharp.SDK\Bimface.SDK\bin\Debug\Bimface.SDK.pdb 3 | F:\newBimface\sdk\Bimface.CSharp.SDK\Bimface.SDK\bin\Debug\Newtonsoft.Json.dll 4 | F:\newBimface\sdk\Bimface.CSharp.SDK\Bimface.SDK\obj\Debug\Bimface.SDK.csprojResolveAssemblyReference.cache 5 | F:\newBimface\sdk\Bimface.CSharp.SDK\Bimface.SDK\obj\Debug\Bimface.SDK.Properties.Resources.resources 6 | F:\newBimface\sdk\Bimface.CSharp.SDK\Bimface.SDK\obj\Debug\Bimface.SDK.csproj.GenerateResource.Cache 7 | F:\newBimface\sdk\Bimface.CSharp.SDK\Bimface.SDK\obj\Debug\Bimface.SDK.dll 8 | F:\newBimface\sdk\Bimface.CSharp.SDK\Bimface.SDK\obj\Debug\Bimface.SDK.pdb 9 | D:\Git\sdk\Bimface.CSharp.SDK\Bimface.SDK\bin\Debug\Bimface.SDK.dll 10 | D:\Git\sdk\Bimface.CSharp.SDK\Bimface.SDK\bin\Debug\Bimface.SDK.pdb 11 | D:\Git\sdk\Bimface.CSharp.SDK\Bimface.SDK\bin\Debug\Newtonsoft.Json.dll 12 | D:\Git\sdk\Bimface.CSharp.SDK\Bimface.SDK\obj\Debug\Bimface.SDK.csprojResolveAssemblyReference.cache 13 | D:\Git\sdk\Bimface.CSharp.SDK\Bimface.SDK\obj\Debug\Bimface.SDK.Properties.Resources.resources 14 | D:\Git\sdk\Bimface.CSharp.SDK\Bimface.SDK\obj\Debug\Bimface.SDK.csproj.GenerateResource.Cache 15 | D:\Git\sdk\Bimface.CSharp.SDK\Bimface.SDK\obj\Debug\Bimface.SDK.dll 16 | D:\Git\sdk\Bimface.CSharp.SDK\Bimface.SDK\obj\Debug\Bimface.SDK.pdb 17 | -------------------------------------------------------------------------------- /Bimface.SDK/obj/Debug/Bimface.SDK.csproj.GenerateResource.Cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/Bimface.SDK/obj/Debug/Bimface.SDK.csproj.GenerateResource.Cache -------------------------------------------------------------------------------- /Bimface.SDK/obj/Debug/Bimface.SDK.csprojResolveAssemblyReference.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/Bimface.SDK/obj/Debug/Bimface.SDK.csprojResolveAssemblyReference.cache -------------------------------------------------------------------------------- /Bimface.SDK/obj/Debug/Bimface.SDK.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/Bimface.SDK/obj/Debug/Bimface.SDK.dll -------------------------------------------------------------------------------- /Bimface.SDK/obj/Debug/Bimface.SDK.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/Bimface.SDK/obj/Debug/Bimface.SDK.pdb -------------------------------------------------------------------------------- /Bimface.SDK/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/Bimface.SDK/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache -------------------------------------------------------------------------------- /Bimface.SDK/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/Bimface.SDK/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll -------------------------------------------------------------------------------- /Bimface.SDK/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/Bimface.SDK/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs -------------------------------------------------------------------------------- /Bimface.SDK/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/Bimface.SDK/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs -------------------------------------------------------------------------------- /Bimface.SDK/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/Bimface.SDK/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs -------------------------------------------------------------------------------- /Bimface.SDK/obj/Release/Bimface.SDK.Properties.Resources.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/Bimface.SDK/obj/Release/Bimface.SDK.Properties.Resources.resources -------------------------------------------------------------------------------- /Bimface.SDK/obj/Release/Bimface.SDK.csproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | D:\Git\sdk\Bimface.CSharp.SDK\Bimface.SDK\bin\Release\Bimface.SDK.dll 2 | D:\Git\sdk\Bimface.CSharp.SDK\Bimface.SDK\bin\Release\Bimface.SDK.pdb 3 | D:\Git\sdk\Bimface.CSharp.SDK\Bimface.SDK\bin\Release\Newtonsoft.Json.dll 4 | D:\Git\sdk\Bimface.CSharp.SDK\Bimface.SDK\obj\Release\Bimface.SDK.csprojResolveAssemblyReference.cache 5 | D:\Git\sdk\Bimface.CSharp.SDK\Bimface.SDK\obj\Release\Bimface.SDK.Properties.Resources.resources 6 | D:\Git\sdk\Bimface.CSharp.SDK\Bimface.SDK\obj\Release\Bimface.SDK.csproj.GenerateResource.Cache 7 | D:\Git\sdk\Bimface.CSharp.SDK\Bimface.SDK\obj\Release\Bimface.SDK.dll 8 | D:\Git\sdk\Bimface.CSharp.SDK\Bimface.SDK\obj\Release\Bimface.SDK.pdb 9 | F:\newBimface\sdk\Bimface.CSharp.SDK\Bimface.SDK\obj\Release\Bimface.SDK.Properties.Resources.resources 10 | F:\newBimface\sdk\Bimface.CSharp.SDK\Bimface.SDK\obj\Release\Bimface.SDK.csproj.GenerateResource.Cache 11 | F:\newBimface\sdk\Bimface.CSharp.SDK\Bimface.SDK\obj\Release\Bimface.SDK.dll 12 | F:\newBimface\sdk\Bimface.CSharp.SDK\Bimface.SDK\obj\Release\Bimface.SDK.pdb 13 | F:\newBimface\sdk\Bimface.CSharp.SDK\Bimface.SDK\bin\Release\Bimface.SDK.dll 14 | F:\newBimface\sdk\Bimface.CSharp.SDK\Bimface.SDK\bin\Release\Bimface.SDK.pdb 15 | F:\newBimface\sdk\Bimface.CSharp.SDK\Bimface.SDK\bin\Release\Newtonsoft.Json.dll 16 | -------------------------------------------------------------------------------- /Bimface.SDK/obj/Release/Bimface.SDK.csproj.GenerateResource.Cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/Bimface.SDK/obj/Release/Bimface.SDK.csproj.GenerateResource.Cache -------------------------------------------------------------------------------- /Bimface.SDK/obj/Release/Bimface.SDK.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/Bimface.SDK/obj/Release/Bimface.SDK.dll -------------------------------------------------------------------------------- /Bimface.SDK/obj/Release/Bimface.SDK.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/Bimface.SDK/obj/Release/Bimface.SDK.pdb -------------------------------------------------------------------------------- /Bimface.SDK/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/Bimface.SDK/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache -------------------------------------------------------------------------------- /Bimface.SDK/obj/Release/TempPE/Properties.Resources.Designer.cs.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/Bimface.SDK/obj/Release/TempPE/Properties.Resources.Designer.cs.dll -------------------------------------------------------------------------------- /Bimface.SDK/obj/Release/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/Bimface.SDK/obj/Release/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs -------------------------------------------------------------------------------- /Bimface.SDK/obj/Release/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/Bimface.SDK/obj/Release/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs -------------------------------------------------------------------------------- /Bimface.SDK/obj/Release/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/Bimface.SDK/obj/Release/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs -------------------------------------------------------------------------------- /packages/Newtonsoft.Json.9.0.1/Newtonsoft.Json.9.0.1.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/packages/Newtonsoft.Json.9.0.1/Newtonsoft.Json.9.0.1.nupkg -------------------------------------------------------------------------------- /packages/Newtonsoft.Json.9.0.1/lib/net20/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/packages/Newtonsoft.Json.9.0.1/lib/net20/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /packages/Newtonsoft.Json.9.0.1/lib/net35/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/packages/Newtonsoft.Json.9.0.1/lib/net35/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /packages/Newtonsoft.Json.9.0.1/lib/net40/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/packages/Newtonsoft.Json.9.0.1/lib/net40/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /packages/Newtonsoft.Json.9.0.1/lib/net45/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/packages/Newtonsoft.Json.9.0.1/lib/net45/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /packages/Newtonsoft.Json.9.0.1/lib/netstandard1.0/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/packages/Newtonsoft.Json.9.0.1/lib/netstandard1.0/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /packages/Newtonsoft.Json.9.0.1/lib/portable-net40+sl5+wp80+win8+wpa81/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/packages/Newtonsoft.Json.9.0.1/lib/portable-net40+sl5+wp80+win8+wpa81/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /packages/Newtonsoft.Json.9.0.1/lib/portable-net45+wp80+win8+wpa81/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bimface/bimface-csharp-sdk/edffe9fb399c493d2769c225a8ab41634ec21094/packages/Newtonsoft.Json.9.0.1/lib/portable-net45+wp80+win8+wpa81/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /packages/Newtonsoft.Json.9.0.1/tools/install.ps1: -------------------------------------------------------------------------------- 1 | param($installPath, $toolsPath, $package, $project) 2 | 3 | # open json.net splash page on package install 4 | # don't open if json.net is installed as a dependency 5 | 6 | try 7 | { 8 | $url = "http://www.newtonsoft.com/json/install?version=" + $package.Version 9 | $dte2 = Get-Interface $dte ([EnvDTE80.DTE2]) 10 | 11 | if ($dte2.ActiveWindow.Caption -eq "Package Manager Console") 12 | { 13 | # user is installing from VS NuGet console 14 | # get reference to the window, the console host and the input history 15 | # show webpage if "install-package newtonsoft.json" was last input 16 | 17 | $consoleWindow = $(Get-VSComponentModel).GetService([NuGetConsole.IPowerConsoleWindow]) 18 | 19 | $props = $consoleWindow.GetType().GetProperties([System.Reflection.BindingFlags]::Instance -bor ` 20 | [System.Reflection.BindingFlags]::NonPublic) 21 | 22 | $prop = $props | ? { $_.Name -eq "ActiveHostInfo" } | select -first 1 23 | if ($prop -eq $null) { return } 24 | 25 | $hostInfo = $prop.GetValue($consoleWindow) 26 | if ($hostInfo -eq $null) { return } 27 | 28 | $history = $hostInfo.WpfConsole.InputHistory.History 29 | 30 | $lastCommand = $history | select -last 1 31 | 32 | if ($lastCommand) 33 | { 34 | $lastCommand = $lastCommand.Trim().ToLower() 35 | if ($lastCommand.StartsWith("install-package") -and $lastCommand.Contains("newtonsoft.json")) 36 | { 37 | $dte2.ItemOperations.Navigate($url) | Out-Null 38 | } 39 | } 40 | } 41 | else 42 | { 43 | # user is installing from VS NuGet dialog 44 | # get reference to the window, then smart output console provider 45 | # show webpage if messages in buffered console contains "installing...newtonsoft.json" in last operation 46 | 47 | $instanceField = [NuGet.Dialog.PackageManagerWindow].GetField("CurrentInstance", [System.Reflection.BindingFlags]::Static -bor ` 48 | [System.Reflection.BindingFlags]::NonPublic) 49 | 50 | $consoleField = [NuGet.Dialog.PackageManagerWindow].GetField("_smartOutputConsoleProvider", [System.Reflection.BindingFlags]::Instance -bor ` 51 | [System.Reflection.BindingFlags]::NonPublic) 52 | 53 | if ($instanceField -eq $null -or $consoleField -eq $null) { return } 54 | 55 | $instance = $instanceField.GetValue($null) 56 | 57 | if ($instance -eq $null) { return } 58 | 59 | $consoleProvider = $consoleField.GetValue($instance) 60 | if ($consoleProvider -eq $null) { return } 61 | 62 | $console = $consoleProvider.CreateOutputConsole($false) 63 | 64 | $messagesField = $console.GetType().GetField("_messages", [System.Reflection.BindingFlags]::Instance -bor ` 65 | [System.Reflection.BindingFlags]::NonPublic) 66 | if ($messagesField -eq $null) { return } 67 | 68 | $messages = $messagesField.GetValue($console) 69 | if ($messages -eq $null) { return } 70 | 71 | $operations = $messages -split "==============================" 72 | 73 | $lastOperation = $operations | select -last 1 74 | 75 | if ($lastOperation) 76 | { 77 | $lastOperation = $lastOperation.ToLower() 78 | 79 | $lines = $lastOperation -split "`r`n" 80 | 81 | $installMatch = $lines | ? { $_.StartsWith("------- installing...newtonsoft.json ") } | select -first 1 82 | 83 | if ($installMatch) 84 | { 85 | $dte2.ItemOperations.Navigate($url) | Out-Null 86 | } 87 | } 88 | } 89 | } 90 | catch 91 | { 92 | try 93 | { 94 | $pmPane = $dte2.ToolWindows.OutputWindow.OutputWindowPanes.Item("Package Manager") 95 | 96 | $selection = $pmPane.TextDocument.Selection 97 | $selection.StartOfDocument($false) 98 | $selection.EndOfDocument($true) 99 | 100 | if ($selection.Text.StartsWith("Attempting to gather dependencies information for package 'Newtonsoft.Json." + $package.Version + "'")) 101 | { 102 | # don't show on upgrade 103 | if (!$selection.Text.Contains("Removed package")) 104 | { 105 | $dte2.ItemOperations.Navigate($url) | Out-Null 106 | } 107 | } 108 | } 109 | catch 110 | { 111 | # stop potential errors from bubbling up 112 | # worst case the splash page won't open 113 | } 114 | } 115 | 116 | # still yolo -------------------------------------------------------------------------------- /packages/repositories.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | --------------------------------------------------------------------------------