Skip to content

Commit

Permalink
format code2
Browse files Browse the repository at this point in the history
  • Loading branch information
konakonall committed Nov 19, 2020
1 parent dbdf023 commit 097257f
Show file tree
Hide file tree
Showing 40 changed files with 285 additions and 284 deletions.
19 changes: 10 additions & 9 deletions COSXMLDemo/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ public static void Main(string[] args)
{
// 创建存储痛
Console.WriteLine(" ======= Put Bucket ======");
putBucket(cosXml);
PutBucket(cosXml);

// 上传对象
Console.WriteLine(" ======= Put Object ======");
string cosKey = putObject(cosXml);
string cosKey = PutObject(cosXml);

// 删除对象
Console.WriteLine(" ======= Delete Object ======");
deleteObject(cosXml, cosKey);
DeleteObject(cosXml, cosKey);
}
catch (COSXML.CosException.CosClientException clientEx)
{
Expand All @@ -70,17 +70,18 @@ public static void Main(string[] args)
catch (COSXML.CosException.CosServerException serverEx)
{
Console.WriteLine("CosServerException: " + serverEx.GetInfo());
} finally
}
finally
{
// 删除存储桶
Console.WriteLine(" ======= Delete Bucket ======");
deleteBucket(cosXml);
DeleteBucket(cosXml);
}

Console.WriteLine(" ======= Program End. ======");
}

internal static void putBucket(CosXmlServer cosXml)
internal static void PutBucket(CosXmlServer cosXml)
{
try
{
Expand All @@ -104,7 +105,7 @@ internal static void putBucket(CosXmlServer cosXml)
}
}

internal static void deleteBucket(CosXmlServer cosXml)
internal static void DeleteBucket(CosXmlServer cosXml)
{
DeleteBucketRequest request = new DeleteBucketRequest(bucket);

Expand All @@ -113,7 +114,7 @@ internal static void deleteBucket(CosXmlServer cosXml)
Console.WriteLine(result.GetResultInfo());
}

internal static string putObject(CosXmlServer cosXml)
internal static string PutObject(CosXmlServer cosXml)
{
string cosKey = "cosKey";
byte[] tmpData = new byte[1024];
Expand All @@ -127,7 +128,7 @@ internal static string putObject(CosXmlServer cosXml)
return cosKey;
}

internal static void deleteObject(CosXmlServer cosXml, string cosKey)
internal static void DeleteObject(CosXmlServer cosXml, string cosKey)
{
DeleteObjectRequest request = new DeleteObjectRequest(bucket, cosKey);

Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions QCloudCSharpSDK/COSXML/CosXmlConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ public Builder SetDebugLog(bool isDebug)
/// </summary>
/// <param name="suffix"></param>
/// <returns></returns>
public Builder setEndpointSuffix(string suffix)
public Builder SetEndpointSuffix(string suffix)
{
this.endpointSuffix = suffix;

Expand All @@ -316,7 +316,7 @@ public Builder setEndpointSuffix(string suffix)
/// </summary>
/// <param name="host"></param>
/// <returns></returns>
public Builder setHost(string host)
public Builder SetHost(string host)
{
this.host = host;

Expand Down
240 changes: 120 additions & 120 deletions QCloudCSharpSDK/COSXML/CosXmlServer.cs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion QCloudCSharpSDK/COSXML/Log/Log.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace COSXML.Log
{
public interface Log
public interface ILog
{
void PrintLog(string message);
}
Expand Down
2 changes: 1 addition & 1 deletion QCloudCSharpSDK/COSXML/Log/LogImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace COSXML.Log
{
public sealed class LogImpl : Log
public sealed class LogImpl : ILog
{

public void PrintLog(string message)
Expand Down
8 changes: 4 additions & 4 deletions QCloudCSharpSDK/COSXML/Log/QLog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public sealed class QLog

private static Process currentProcess = Process.GetCurrentProcess();

private static List<Log> logImplList = new List<Log>();
private static List<ILog> logImplList = new List<ILog>();

private static Level level = Level.V;

Expand All @@ -25,7 +25,7 @@ public static void SetLogLevel(Level level)
QLog.level = level;
}

public static void AddLogAdapter(Log log)
public static void AddLogAdapter(ILog log)
{

if (log == null)
Expand All @@ -34,7 +34,7 @@ public static void AddLogAdapter(Log log)
return;
}

foreach (Log logImpl in logImplList)
foreach (ILog logImpl in logImplList)
{

if (logImpl.GetType().Name == log.GetType().Name)
Expand Down Expand Up @@ -150,7 +150,7 @@ private static void Print(Level level, string tag, string message, Exception exc

messageBuilder.Append("\r\n");

foreach (Log log in logImplList)
foreach (ILog log in logImplList)
{
log.PrintLog(messageBuilder.ToString());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void SetDestination(string format, string accountId, string bucket, strin
}
}

public void enableSSE()
public void EnableSSE()
{
inventoryConfiguration.destination.cosBucketDestination.encryption = new InventoryConfiguration.Encryption();
//默认不填
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@

namespace COSXML.Model.Bucket
{
/// <summary>
///
/// </summary>
public sealed class PutBucketReplicationRequest : BucketRequest
{
private ReplicationConfiguration replicationConfiguration;
Expand Down
1 change: 1 addition & 0 deletions QCloudCSharpSDK/COSXML/Model/CosRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public bool? IsHttps
{
return isHttps;
}

set { isHttps = value; }
}

Expand Down
15 changes: 12 additions & 3 deletions QCloudCSharpSDK/COSXML/Model/CosResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,30 @@ public string GetRawContentBodyString()
/// exchange infor between request and result
/// </summary>
/// <param name="cosRequest"></param>
internal virtual void ExternInfo(CosRequest cosRequest) { }
internal virtual void ExternInfo(CosRequest cosRequest)
{

}

/// <summary>
/// parse status line and headers
/// </summary>
/// <param name="response"> <see cref="COSXML.Network.Response"/></param>
internal virtual void InternalParseResponseHeaders() { }
internal virtual void InternalParseResponseHeaders()
{

}

/// <summary>
/// parse response body, such as download files.
/// </summary>
/// <param name="inputStream"> input stream </param>
/// <param name="contentType"> body mime type</param>
/// <param name="contentLength">body length</param>
internal virtual void ParseResponseBody(Stream inputStream, string contentType, long contentLength) { }
internal virtual void ParseResponseBody(Stream inputStream, string contentType, long contentLength)
{

}

/// <summary>
/// get result message
Expand Down
5 changes: 4 additions & 1 deletion QCloudCSharpSDK/COSXML/Model/Object/ObjectRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,10 @@ protected virtual void InternalUpdateQueryParameters()
{
}

protected virtual void InteranlUpdateHeaders() { }
protected virtual void InteranlUpdateHeaders()
{

}

public override Dictionary<string, string> GetRequestParamters()
{
Expand Down
3 changes: 0 additions & 3 deletions QCloudCSharpSDK/COSXML/Model/Object/PutObjectResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ public sealed class PutObjectResult : CosResult
/// </summary>
public string eTag;

/// <summary>
///
/// </summary>
public PicOperationUploadResult uploadResult;

internal override void InternalParseResponseHeaders()
Expand Down
2 changes: 1 addition & 1 deletion QCloudCSharpSDK/COSXML/Model/Object/SelectObjectResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ private int TryRead(System.IO.Stream inputStream, byte[] buffer, int offset, int
int remainReadCount = count;


while (remainReadCount > 0 && maxRead-- > 0 & inputStream.CanRead)
while (remainReadCount > 0 && maxRead-- > 0 && inputStream.CanRead)
{
read = inputStream.Read(buffer, count - remainReadCount, remainReadCount);
remainReadCount -= read;
Expand Down
4 changes: 3 additions & 1 deletion QCloudCSharpSDK/COSXML/Model/Object/UploadPartRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ public UploadPartRequest(string bucket, string key, int partNumber, string uploa
/// <param name="srcPath"></param>
public UploadPartRequest(string bucket, string key, int partNumber, string uploadId, string srcPath)
: this(bucket, key, partNumber, uploadId, srcPath, -1L, -1L)
{ }
{

}

/// <summary>
/// 上传data数据
Expand Down
5 changes: 4 additions & 1 deletion QCloudCSharpSDK/COSXML/Model/Tag/CopySourceStruct.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ public CopySourceStruct(string appid, string bucket, string region, string key,
/// <param name="region"></param>
/// <param name="key"></param>
public CopySourceStruct(string appid, string bucket, string region, string key)
: this(appid, bucket, region, key, null) { }
: this(appid, bucket, region, key, null)
{

}

/// <summary>
/// check parameter
Expand Down
2 changes: 1 addition & 1 deletion QCloudCSharpSDK/COSXML/Model/Tag/GrantAccount.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace COSXML.Model.Tag
/// </summary>
public sealed class GrantAccount
{
List<string> idList;
internal List<string> idList;

public GrantAccount()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public sealed class IntelligentTieringConfiguration
/// </summary>
public int RequestFrequent;

public Boolean isEnabled()
public Boolean IsEnabled()
{

return "Enabled".Equals(Status);
Expand Down
2 changes: 1 addition & 1 deletion QCloudCSharpSDK/COSXML/Model/Tag/InventoryConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public sealed class COSBucketDestination

public Encryption encryption;

public void setBucket(String region, String bucket)
public void SetBucket(String region, String bucket)
{

if (region != null && bucket != null)
Expand Down
1 change: 1 addition & 0 deletions QCloudCSharpSDK/COSXML/Model/Tag/ListAllMyBuckets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
namespace COSXML.Model.Tag
{
/// <summary>
/// 列出存储桶结果
/// <see cref="https://cloud.tencent.com/document/product/436/8291"/>
/// </summary>
public sealed class ListAllMyBuckets
Expand Down
10 changes: 5 additions & 5 deletions QCloudCSharpSDK/COSXML/Model/Tag/ObjectSelectionFormat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@ namespace COSXML.Model.Tag
public sealed class ObjectSelectionFormat
{

public readonly string CompressionType;
public readonly string compressionType;

public readonly CSVFormat csvFormat;

public readonly JSONFormat jsonFormat;

public ObjectSelectionFormat(string CompressionType, CSVFormat csv)
public ObjectSelectionFormat(string compressionType, CSVFormat csv)
{
this.CompressionType = CompressionType;
this.compressionType = compressionType;
this.csvFormat = csv;
this.jsonFormat = null;
}

public ObjectSelectionFormat(string CompressionType, JSONFormat json)
public ObjectSelectionFormat(string compressionType, JSONFormat json)
{
this.CompressionType = CompressionType;
this.compressionType = compressionType;
this.csvFormat = null;
this.jsonFormat = json;
}
Expand Down
8 changes: 3 additions & 5 deletions QCloudCSharpSDK/COSXML/Network/HttpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ public void Excute(CosRequest cosRequest, CosResult cosResult)
}


public void Schedue(CosRequest cosRequest, CosResult cosResult, COSXML.Callback.OnSuccessCallback<CosResult> successCallback,
COSXML.Callback.OnFailedCallback failCallback)
public void Schedue(CosRequest cosRequest, CosResult cosResult, COSXML.Callback.OnSuccessCallback<CosResult> successCallback, COSXML.Callback.OnFailedCallback failCallback)
{
//HttpTask httpTask = new HttpTask();
//httpTask.cosRequest = cosRequest;
Expand Down Expand Up @@ -157,7 +156,7 @@ public void InternalExcute(CosRequest cosRequest, CosResult cosResult)

}

public void excute(Request request, Response response)
public void Execute(Request request, Response response)
{

try
Expand All @@ -178,8 +177,7 @@ public void excute(Request request, Response response)
}
}

public void InternalSchedue(CosRequest cosRequest, CosResult cosResult, COSXML.Callback.OnSuccessCallback<CosResult> successCallback,
COSXML.Callback.OnFailedCallback failCallback)
public void InternalSchedue(CosRequest cosRequest, CosResult cosResult, COSXML.Callback.OnSuccessCallback<CosResult> successCallback, COSXML.Callback.OnFailedCallback failCallback)
{

try
Expand Down
5 changes: 4 additions & 1 deletion QCloudCSharpSDK/COSXML/Network/HttpClientConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,10 @@ public class Builder

internal string proxyDomain;

public Builder() { }
public Builder()
{

}

public Builder AllowAutoRedirect(bool allow)
{
Expand Down
7 changes: 0 additions & 7 deletions QCloudCSharpSDK/COSXML/Network/HttpTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,6 @@
using System.Collections.Generic;
using System.Text;


/* ==============================================================================
* Copyright 2016-2019 Tencent Cloud. All Rights Reserved.
* Auth:bradyxiao
* Date:2019/4/4 16:49:33
* ==============================================================================*/

namespace Tencent.QCloud.Cos.Sdk.Network
{
public class HttpTask
Expand Down
1 change: 1 addition & 0 deletions QCloudCSharpSDK/COSXML/Network/Request.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ public Dictionary<string, string> Headers
{
return headers;
}

private set { }
}

Expand Down
4 changes: 2 additions & 2 deletions QCloudCSharpSDK/COSXML/Network/RequestBody.cs
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ private void ComputerContentLength()

if (!String.IsNullOrEmpty(fileName))
{
parametersBuilder.Append("; filename=").Append("\"").Append(fileName).Append("\""); ;
parametersBuilder.Append("; filename=").Append("\"").Append(fileName).Append("\"");
}

parametersBuilder.Append(CRLF);
Expand Down Expand Up @@ -737,7 +737,7 @@ private void WriteFileParameters(Stream outputStream)

if (!String.IsNullOrEmpty(fileName))
{
parametersBuilder.Append("; filename=").Append("\"").Append(fileName).Append("\""); ;
parametersBuilder.Append("; filename=").Append("\"").Append(fileName).Append("\"");
}

parametersBuilder.Append(CRLF);
Expand Down
Loading

0 comments on commit 097257f

Please sign in to comment.