代码修改后的版本,全部提交
This commit is contained in:
33
COSXML/Common/CosACL.cs
Normal file
33
COSXML/Common/CosACL.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
using COSXML.Utils;
|
||||
/**
|
||||
* Copyright (c) 2018 Tencent Cloud. All rights reserved.
|
||||
* 11/2/2018 1:53:35 PM
|
||||
* bradyxiao
|
||||
*/
|
||||
namespace COSXML.Common
|
||||
{
|
||||
public enum CosACL
|
||||
{
|
||||
/// <summary>
|
||||
/// 私有读写
|
||||
/// </summary>
|
||||
[CosValue("private")]
|
||||
PRIVATE = 0,
|
||||
|
||||
/// <summary>
|
||||
/// 私有写公有读
|
||||
/// </summary>
|
||||
[CosValue("public-read")]
|
||||
PUBLIC_READ,
|
||||
|
||||
/// <summary>
|
||||
/// 公有读写
|
||||
/// </summary>
|
||||
[CosValue("public-read-write")]
|
||||
PUBLIC_READ_WRITE,
|
||||
}
|
||||
}
|
||||
46
COSXML/Common/CosClientError.cs
Normal file
46
COSXML/Common/CosClientError.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
using COSXML.Common;
|
||||
using COSXML.Utils;
|
||||
/**
|
||||
* Copyright (c) 2018 Tencent Cloud. All rights reserved.
|
||||
* 11/2/2018 8:19:06 PM
|
||||
* bradyxiao
|
||||
*/
|
||||
namespace COSXML.Common
|
||||
{
|
||||
public enum CosClientError
|
||||
{
|
||||
[CosValue("InvalidArgument")]
|
||||
INVALID_ARGUMENT = 10000,
|
||||
|
||||
[CosValue("InvalidCredentials")]
|
||||
INVALID_CREDENTIALS = 10001,
|
||||
|
||||
[CosValue("BadRequest")]
|
||||
BAD_REQUEST = 10002,
|
||||
|
||||
[CosValue("SinkSourceNotFound")]
|
||||
SINK_SOURCE_NOT_FOUND = 10003,
|
||||
|
||||
[CosValue("InternalError")]
|
||||
INTERNA_LERROR = 20000,
|
||||
|
||||
[CosValue("ServerError")]
|
||||
SERVER_ERROR = 20001,
|
||||
|
||||
[CosValue("IOError")]
|
||||
IO_ERROR = 20002,
|
||||
|
||||
[CosValue("PoorNetwork")]
|
||||
POOR_NETWORK = 20003,
|
||||
|
||||
[CosValue("UserCancelled")]
|
||||
USER_CANCELLED = 30000,
|
||||
|
||||
[CosValue("AlreadyFinished")]
|
||||
ALREADY_FINISHED = 30001,
|
||||
}
|
||||
}
|
||||
34
COSXML/Common/CosGrantPermission.cs
Normal file
34
COSXML/Common/CosGrantPermission.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
using COSXML.Common;
|
||||
using COSXML.Utils;
|
||||
/**
|
||||
* Copyright (c) 2018 Tencent Cloud. All rights reserved.
|
||||
* 11/2/2018 2:30:52 PM
|
||||
* bradyxiao
|
||||
*/
|
||||
namespace COSXML.Common
|
||||
{
|
||||
public enum CosGrantPermission
|
||||
{
|
||||
/// <summary>
|
||||
/// 只读权限
|
||||
/// </summary>
|
||||
[CosValue("READ")]
|
||||
READ = 0,
|
||||
|
||||
/// <summary>
|
||||
/// 只写权限
|
||||
/// </summary>
|
||||
[CosValue("WRITE")]
|
||||
WRITE,
|
||||
|
||||
/// <summary>
|
||||
/// 读写权限
|
||||
/// </summary>
|
||||
[CosValue("FULL_CONTROL")]
|
||||
FULL_CONTROL
|
||||
}
|
||||
}
|
||||
22
COSXML/Common/CosMetaDataDirective.cs
Normal file
22
COSXML/Common/CosMetaDataDirective.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
using COSXML.Common;
|
||||
using COSXML.Utils;
|
||||
/**
|
||||
* Copyright (c) 2018 Tencent Cloud. All rights reserved.
|
||||
* 11/2/2018 2:49:33 PM
|
||||
* bradyxiao
|
||||
*/
|
||||
namespace COSXML.Common
|
||||
{
|
||||
public enum CosMetaDataDirective
|
||||
{
|
||||
[CosValue("Copy")]
|
||||
COPY = 0,
|
||||
|
||||
[CosValue("Replaced")]
|
||||
REPLACED
|
||||
}
|
||||
}
|
||||
120
COSXML/Common/CosRegion.cs
Normal file
120
COSXML/Common/CosRegion.cs
Normal file
@@ -0,0 +1,120 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
using COSXML.Utils;
|
||||
/**
|
||||
* Copyright (c) 2018 Tencent Cloud. All rights reserved.
|
||||
* 11/1/2018 9:48:15 PM
|
||||
* bradyxiao
|
||||
*/
|
||||
namespace COSXML.Common
|
||||
{
|
||||
public enum CosRegion
|
||||
{
|
||||
/// <summary>
|
||||
/// 北京一区(华北)
|
||||
/// </summary>
|
||||
[CosValue("ap-beijing-1")]
|
||||
AP_Beijing_1 = 0,
|
||||
|
||||
/// <summary>
|
||||
/// 北京
|
||||
/// </summary>
|
||||
[CosValue("ap-beijing")]
|
||||
AP_Beijing,
|
||||
|
||||
/// <summary>
|
||||
/// 上海(华东)
|
||||
/// </summary>
|
||||
[CosValue("ap-shanghai")]
|
||||
AP_Shanghai,
|
||||
|
||||
/// <summary>
|
||||
/// 广州(华南)
|
||||
/// </summary>
|
||||
[CosValue("ap-guangzhou")]
|
||||
AP_Guangzhou,
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[CosValue("ap-guangzhou-2")]
|
||||
AP_Guangzhou_2,
|
||||
|
||||
/// <summary>
|
||||
/// 成都(西南)
|
||||
/// </summary>
|
||||
[CosValue("ap-chengdu")]
|
||||
AP_Chengdu,
|
||||
|
||||
/// <summary>
|
||||
/// 新加坡
|
||||
/// </summary>
|
||||
[CosValue("ap-singapore")]
|
||||
AP_Singapore,
|
||||
|
||||
/// <summary>
|
||||
/// 香港
|
||||
/// </summary>
|
||||
[CosValue("ap-hongkong")]
|
||||
AP_Hongkong,
|
||||
|
||||
/// <summary>
|
||||
/// 多伦多
|
||||
/// </summary>
|
||||
[CosValue("na-toronto")]
|
||||
NA_Toronto,
|
||||
|
||||
/// <summary>
|
||||
/// 法兰克福
|
||||
/// </summary>
|
||||
[CosValue("eu-frankfurt")]
|
||||
EU_Frankfurt,
|
||||
|
||||
[CosValue("ap-chongqing")]
|
||||
AP_Chongqing,
|
||||
|
||||
/// <summary>
|
||||
/// 孟买
|
||||
/// </summary>
|
||||
[CosValue("ap-mumbai")]
|
||||
AP_Mumbai,
|
||||
|
||||
/// <summary>
|
||||
/// 首尔
|
||||
/// </summary>
|
||||
[CosValue("ap-seoul")]
|
||||
AP_Seoul,
|
||||
|
||||
/// <summary>
|
||||
/// 硅谷
|
||||
/// </summary>
|
||||
[CosValue("na-siliconvalley")]
|
||||
NA_Siliconvalley,
|
||||
|
||||
/// <summary>
|
||||
/// 弗吉尼亚
|
||||
/// </summary>
|
||||
[CosValue("na-ashburn")]
|
||||
NA_Ashburn,
|
||||
|
||||
/// <summary>
|
||||
/// 曼谷
|
||||
/// </summary>
|
||||
[CosValue("ap-bangkok")]
|
||||
AP_Bangkok,
|
||||
|
||||
/// <summary>
|
||||
/// 莫斯科
|
||||
/// </summary>
|
||||
[CosValue("eu-moscow")]
|
||||
EU_Moscow,
|
||||
|
||||
/// <summary>
|
||||
/// 东京
|
||||
/// </summary>
|
||||
[CosValue("ap-tokyo")]
|
||||
AO_Tokyo,
|
||||
}
|
||||
}
|
||||
53
COSXML/Common/CosRequestHeaderKey.cs
Normal file
53
COSXML/Common/CosRequestHeaderKey.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
|
||||
namespace COSXML.Common
|
||||
{
|
||||
public sealed class CosRequestHeaderKey
|
||||
{
|
||||
public const string COS_SESSION_TOKEN = "x-cos-security-token";
|
||||
public const string AUTHORIZAIION = "Authorization";
|
||||
public const string CONTENT_TYPE = "Content-Type";
|
||||
public const string X_COS_ACL = "x-cos-acl";
|
||||
public const string X_COS_GRANT_READ = "x-cos-grant-read";
|
||||
public const string X_COS_GRANT_WRITE = "x-cos-grant-write";
|
||||
public const string X_COS_GRANT_FULL_CONTROL = "x-cos-grant-full-control";
|
||||
public const string CACHE_CONTROL = "Cache-Control";
|
||||
public const string CONTENT_DISPOSITION = "Content-Disposition";
|
||||
public const string CONTENT_ENCODING = "Content-Encoding";
|
||||
public const string EXPIRES = "Expires";
|
||||
public const string X_COS_COPY_SOURCE = "x-cos-copy-source";
|
||||
public const string X_COS_METADATA_DIRECTIVE = "x-cos-metadata-directive";
|
||||
public const string X_COS_COPY_SOURCE_IF_MODIFIED_SINCE= "x-cos-copy-source-If-Modified-Since";
|
||||
public const string X_COS_COPY_SOURCE_IF_UNMODIFIED_SINCE = "x-cos-copy-source-If-Unmodified-Since";
|
||||
public const string X_COS_COPY_SOURCE_IF_MATCH = "x-cos-copy-source-If-Match";
|
||||
public const string X_COS_COPY_SOURCE_IF_NONE_MATCH = "x-cos-copy-source-If-None-Match";
|
||||
public const string X_COS_STORAGE_CLASS_ = "x-cos-storage-class";
|
||||
public const string X_COS_COPY_SOURCE_RANGE = "x-cos-copy-source-range";
|
||||
public const string X_COS_TRAFFIC_LIMIT = "x-cos-traffic-limit"; // 限速
|
||||
public const string ORIGIN = "Origin";
|
||||
public const string ACCESS_CONTROL_REQUEST_METHOD = "Access-Control-Request-Method";
|
||||
public const string ACCESS_CONTROL_REQUEST_HEADERS = "Access-Control-Request-Headers";
|
||||
public const string IF_MODIFIED_SINCE = "If-Modified-Since";
|
||||
public const string IF_UNMODIFIED_SINCE = "If-Unmodified-Since";
|
||||
public const string IF_MATCH = "If-Match";
|
||||
public const string IF_NONE_MATCH = "If-None-Match";
|
||||
public const string APPLICATION_XML = "application/xml";
|
||||
public const string TEXT_PLAIN = "text/plain";
|
||||
public const string APPLICATION_OCTET_STREAM = "application/octet-stream";
|
||||
public const string RANGE = "Range";
|
||||
public const string VERSION_ID = "versionId";
|
||||
public const string ENCODING_TYPE = "Encoding-type";
|
||||
public const string PART_NUMBER_MARKER = "part-number-marker";
|
||||
public const string MAX_PARTS = "max-parts";
|
||||
public const string CONTENT_MD5 = "Content-MD5";
|
||||
public const string RESPONSE_CONTENT_TYPE = "response-content-type";
|
||||
public const string RESPONSE_CONTENT_LANGUAGE = "response-content-language";
|
||||
public const string RESPONSE_CACHE_CONTROL = "response-cache-control";
|
||||
public const string RESPONSE_CONTENT_DISPOSITION = "response-content-disposition";
|
||||
public const string RESPONSE_CONTENT_ENCODING = "response-content-encoding";
|
||||
public const string RESPONSE_EXPIRES = "response-expires";
|
||||
}
|
||||
}
|
||||
21
COSXML/Common/CosRequestMethod.cs
Normal file
21
COSXML/Common/CosRequestMethod.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
/**
|
||||
* Copyright (c) 2018 Tencent Cloud. All rights reserved.
|
||||
* 11/2/2018 2:42:24 PM
|
||||
* bradyxiao
|
||||
*/
|
||||
namespace COSXML.Common
|
||||
{
|
||||
public sealed class CosRequestMethod
|
||||
{
|
||||
public const string GET = "GET";
|
||||
public const string POST = "POST";
|
||||
public const string PUT = "PUT";
|
||||
public const string DELETE = "DELETE";
|
||||
public const string HEAD = "HEAD";
|
||||
public const string OPTIONS = "OPTIONS";
|
||||
}
|
||||
}
|
||||
34
COSXML/Common/CosStorageClass.cs
Normal file
34
COSXML/Common/CosStorageClass.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
using COSXML.Common;
|
||||
using COSXML.Utils;
|
||||
/**
|
||||
* Copyright (c) 2018 Tencent Cloud. All rights reserved.
|
||||
* 11/2/2018 1:58:05 PM
|
||||
* bradyxiao
|
||||
*/
|
||||
namespace COSXML.Common
|
||||
{
|
||||
public enum CosStorageClass
|
||||
{
|
||||
/// <summary>
|
||||
/// 标准储存
|
||||
/// </summary>
|
||||
[CosValue("Standard")]
|
||||
STANDARD = 0,
|
||||
|
||||
/// <summary>
|
||||
/// 低频存储
|
||||
/// </summary>
|
||||
[CosValue("Standard_IA")]
|
||||
STANDARD_IA = 1,
|
||||
|
||||
/// <summary>
|
||||
/// 归档储存
|
||||
/// </summary>
|
||||
[CosValue("ARCHIVE")]
|
||||
ARCHIVE
|
||||
}
|
||||
}
|
||||
44
COSXML/Common/CosVersion.cs
Normal file
44
COSXML/Common/CosVersion.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Diagnostics;
|
||||
|
||||
using System.Text;
|
||||
/**
|
||||
* Copyright (c) 2018 Tencent Cloud. All rights reserved.
|
||||
* 11/2/2018 2:34:04 PM
|
||||
* bradyxiao
|
||||
*/
|
||||
namespace COSXML.Common
|
||||
{
|
||||
public sealed class CosVersion
|
||||
{
|
||||
private static string SDKVersion = "5.4.11.0";
|
||||
|
||||
public static string GetUserAgent()
|
||||
{
|
||||
StringBuilder userAgent = new StringBuilder();
|
||||
userAgent.Append("cos-net-sdk").Append('.')
|
||||
.Append(SDKVersion);
|
||||
return userAgent.ToString();
|
||||
}
|
||||
|
||||
//public static string GetOsVersion()
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// var os = Environment.OSVersion;
|
||||
// return "windows " + os.Version.Major + "." + os.Version.Minor;
|
||||
// }
|
||||
// catch (InvalidOperationException)
|
||||
// {
|
||||
// return "Unknown OSVersion";
|
||||
// }
|
||||
//}
|
||||
|
||||
//public static string GetOsArchitecture()
|
||||
//{
|
||||
// return (IntPtr.Size == 8) ? "x86_64" : "x86";
|
||||
//}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user