using ConsoleApplication2;
//using QCloud.CosApi.Common;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace WebSocketService
{
public class TXupfile
{
//var Bucket = “temp-1256392453”;
//var Region = “ap-chengdu”; //根据区域需要变更
//var protocol = “http:”;
//var prefix = protocol + “//” + Bucket + “.cos.” + Region + “.myqcloud.com”;
// 上传文件
// NewUpload(prefix, “/dir/demo/web.rar”, “C:\web.rar”);
//删除文件
// NEWDeleteFile(prefix, “/dir/demo/web.rar”);
//下载文件
//FileDownload(prefix, “/dir/demo/0379aeb8-4a31-ec76-e79c-9cde8b021c98.jpg”, “C:\temp\0379aeb8-4a31-ec76-e79c-9cde8b021c98.jpg”); //ok
public string SecretId = “”;//写自己的id
public string SecretKey = “”;//写自己的密钥
#region 获取签名处理
/// <summary>
///
/// </summary>
/// <param name="strModel"></param>
/// <param name="pathname"></param>
/// <param name="qheaderlist"></param>
/// <param name="qurlparamlist"></param>
/// <returns></returns>
public string gettxkey(string strModel, string pathname, string qheaderlist, string qurlparamlist)
{
strModel = strModel.ToLower();
if (pathname.IndexOf("/") != 0)
{
pathname = "/" + pathname;
}
var singtime = "";
//1525180877;1525181777
var now = Extension.ToUnixTime(DateTime.Now) / 1000; //1536307831;
var exp = Extension.ToUnixTime(DateTime.Now.AddMinutes(15)) / 1000; //1536309631;
singtime = now + ";" + exp;
//http://zzc123-125508