|
@@ -59,12 +59,17 @@ namespace GFGGame
|
|
|
//获取图片的临时上传地址协议
|
|
|
public static async ETTask<string[]> ReqTempPictureUrl(int pictureType)
|
|
|
{
|
|
|
+ ET.Log.Debug("zoya000");
|
|
|
S2C_GetTempPictureUrl response = null;
|
|
|
response = (S2C_GetTempPictureUrl)await MessageHelper.SendToServer(new C2S_GetTempPictureUrl() { PictureType = pictureType });
|
|
|
+ ET.Log.Debug("zoya111");
|
|
|
+
|
|
|
if (response != null)
|
|
|
{
|
|
|
if (response.Error == ErrorCode.ERR_Success)
|
|
|
{
|
|
|
+ ET.Log.Debug("zoya222");
|
|
|
+
|
|
|
return new string[] { response.TempPictureUrl, response.PictureObjectPath };
|
|
|
}
|
|
|
}
|
|
@@ -74,6 +79,8 @@ namespace GFGGame
|
|
|
//将图片上传到华为云
|
|
|
public static string PushToHWCloud(string signUrl, byte[] buffer)
|
|
|
{
|
|
|
+ ET.Log.Debug("zoya333" + buffer);
|
|
|
+
|
|
|
// 使用PUT请求上传对象
|
|
|
HttpWebRequest webRequest = WebRequest.Create(signUrl) as HttpWebRequest;
|
|
|
webRequest.Method = "PUT";
|
|
@@ -89,11 +96,15 @@ namespace GFGGame
|
|
|
HttpWebResponse webResponse = null;
|
|
|
try
|
|
|
{
|
|
|
+ ET.Log.Debug("zoya444");
|
|
|
+
|
|
|
webResponse = webRequest.GetResponse() as HttpWebResponse;
|
|
|
return webResponse.StatusCode.ToString();
|
|
|
}
|
|
|
catch (WebException ex)
|
|
|
{
|
|
|
+ ET.Log.Debug("zoya555");
|
|
|
+
|
|
|
webResponse = ex.Response as HttpWebResponse;
|
|
|
return "";
|
|
|
}
|
|
@@ -101,12 +112,18 @@ namespace GFGGame
|
|
|
//保存成功后,添加图片至相册
|
|
|
public static async ETTask<bool> ReqAddTophoto(string pictureObjectPath, int sourceType)
|
|
|
{
|
|
|
+ ET.Log.Debug("zoya666");
|
|
|
+
|
|
|
S2C_AddPicture response = null;
|
|
|
response = (S2C_AddPicture)await MessageHelper.SendToServer(new C2S_AddPicture() { PictureObjectPath = pictureObjectPath, SourceType = sourceType });
|
|
|
+ ET.Log.Debug("zoya777");
|
|
|
+
|
|
|
if (response != null)
|
|
|
{
|
|
|
if (response.Error == ErrorCode.ERR_Success)
|
|
|
{
|
|
|
+ ET.Log.Debug("zoya888");
|
|
|
+
|
|
|
PoemPhotoData photoData = new PoemPhotoData();
|
|
|
photoData.PictureId = response.PictureInfo.PictureId;
|
|
|
photoData.CreationTime = response.PictureInfo.CreationTime;
|
|
@@ -115,10 +132,16 @@ namespace GFGGame
|
|
|
photoData.LockingStatus = response.PictureInfo.LockingStatus;
|
|
|
photoData.PictureName = response.PictureInfo.PictureName;
|
|
|
photoData.PictureTempUrl = response.PictureInfo.PictureTempUrl;
|
|
|
+ ET.Log.Debug("zoya999");
|
|
|
+
|
|
|
byte[] bytes = DownloadFile(photoData.PictureTempUrl);
|
|
|
+ ET.Log.Debug("zoyafff");
|
|
|
photoData.Bytes = bytes;
|
|
|
|
|
|
PoemPhotoDataManager.Instance.Add(photoData, sourceType);
|
|
|
+ ET.Log.Debug("zoyajjj");
|
|
|
+
|
|
|
+
|
|
|
EventAgent.DispatchEvent(ConstMessage.POEM_PHOTO_INFOS_CHANGE);
|
|
|
PromptController.Instance.ShowFloatTextPrompt("已保存至相册");
|
|
|
return true;
|
|
@@ -130,30 +153,33 @@ namespace GFGGame
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
+ ET.Log.Debug("zoyaaaa");
|
|
|
+
|
|
|
HttpWebRequest webRequest = HttpWebRequest.Create(URL) as HttpWebRequest;
|
|
|
webRequest.Method = "GET";
|
|
|
HttpWebResponse webResponse = webRequest.GetResponse() as HttpWebResponse;
|
|
|
System.IO.Stream st = webResponse.GetResponseStream();
|
|
|
+ ET.Log.Debug("zoyabbb");
|
|
|
|
|
|
- //// 设置当前流的位置为流的开始
|
|
|
- //st.Seek(0, SeekOrigin.Begin);
|
|
|
-
|
|
|
- //byte[] bytes = new byte[st.Length];
|
|
|
- //st.Read(bytes, 0, bytes.Length);
|
|
|
- //st.Close();
|
|
|
byte[] bytes;
|
|
|
using (var ms = new MemoryStream())
|
|
|
{
|
|
|
st.CopyTo(ms);
|
|
|
bytes = ms.ToArray();
|
|
|
}
|
|
|
+ ET.Log.Debug("zoyaccc");
|
|
|
+
|
|
|
st.Close();
|
|
|
webResponse.Close();
|
|
|
webRequest.Abort();
|
|
|
+ ET.Log.Debug("zoyaddd");
|
|
|
+
|
|
|
return bytes;
|
|
|
}
|
|
|
catch (WebException ex)
|
|
|
{
|
|
|
+ ET.Log.Debug("zoyaeee");
|
|
|
+
|
|
|
// webResponse = ex.Response as HttpWebResponse;
|
|
|
ET.Log.Debug(ex.Response.ToString());
|
|
|
return null;
|