Kaynağa Gözat

erere

master
fyf 2 yıl önce
ebeveyn
işleme
708734b76b
1 değiştirilmiş dosya ile 33 ekleme ve 3 silme
  1. +33
    -3
      DataVAPI/UpAndDown/Sample.cs

+ 33
- 3
DataVAPI/UpAndDown/Sample.cs Dosyayı Görüntüle

@@ -43,8 +43,7 @@ namespace DataVAPI.UpAndDown
};
AlibabaCloud.TeaUtil.Models.RuntimeOptions runtime = new AlibabaCloud.TeaUtil.Models.RuntimeOptions();
AlibabaCloud.SDK.Iot20180120.Models.QueryDeviceFileListResponse resp = client.QueryDeviceFileListWithOptions(queryDeviceFileListRequest, runtime);
//AlibabaCloud.TeaConsole.Client.Log();
//;

AlibabaCloudRes cloudRes= Tools.JsonToObjectTools<AlibabaCloudRes>(AlibabaCloud.TeaUtil.Common.ToJSONString(resp.ToMap()));
cloudRes?.body?.Data?.FileSummary?.ForEach(fileSummary =>
{
@@ -52,12 +51,43 @@ namespace DataVAPI.UpAndDown
if (_data != null)
{
_data.UtcCreatedOn = DateTime.Parse(_data.UtcCreatedOn).AddHours(8).ToString("yyyy-MM-dd HH:mm:ss");
_data.DownloadUrl = CutStarStr(_data.DownloadUrl,"http://","https://");
retdata.Add(_data);
}
});
return retdata;
}

/// <summary>
/// 替换字符串起始位置(开头)中指定的字符串
/// </summary>
/// <param name="s">源串</param>
/// <param name="searchStr">查找的串</param>
/// <param name="replaceStr">替换的目标串</param>
/// <returns></returns>
public static string CutStarStr(string s, string searchStr, string replaceStr)
{
var result = s;
try
{
if (string.IsNullOrEmpty(result))
{
return result;
}
if (s.Length < searchStr.Length)
{
return result;
}
if (s.IndexOf(searchStr, 0, searchStr.Length, StringComparison.Ordinal) > -1)
{
result = s.Substring(searchStr.Length);
}
return result;
}
catch (Exception e)
{
return result;
}
}
public static QueryDeviceFileResponseBodyData FileQuery(string DeviceName,string FileId)
{
AlibabaCloud.SDK.Iot20180120.Client client = CreateClient("LTAI5tDbUDuCvqU5hP8ZpHHV", "SvNIRQuz3BQFEaC3PFSJdgpeOKWFRi");


Yükleniyor…
İptal
Kaydet