private bool SaveToALiYunOSSOTSEx() { ALiYunOSSOTSAPI MyALiYunOSSOTSAPI; MyALiYunOSSOTSAPI = new ALiYunOSSOTSAPI(); int StartIndex = 39; MemoryStream MyMemoryStreamContent = new MemoryStream(MyReadBuffers, StartIndex, MyRecieveCount - StartIndex); string MySaveToOSSFileName = MyLockIDStr + "/" + MyAutoFileNameStr + ".jpg"; MyCompleteFileName = "http://" + "hnlylgj.oss-cn-hangzhou.aliyuncs.com/" + MySaveToOSSFileName; try { MyALiYunOSSOTSAPI.MyALiYunOSSOTSLogin.PrefixStr = this.MyLockIDStr + "/"; MyALiYunOSSOTSAPI.MyALiYunOSSOTSLogin.FileKeyName = MyAutoFileNameStr + ".jpg"; MyALiYunOSSOTSAPI.PrivateUploadFile3(ref MyMemoryStreamContent); MyMemoryStreamContent.Close(); this.MyAsynchLockServerSocketService.DisplayResultInfor(1, "保存数据到OSS:" + MyALiYunOSSOTSAPI.ResultMessageStr); return(true); } catch (Exception AnyException) { MyMemoryStreamContent.Close(); this.MyAsynchLockServerSocketService.DisplayResultInfor(1, "保存数据到OSS:" + MyALiYunOSSOTSAPI.ResultMessageStr); return(false); } }
private bool SaveToALiYunOSSOTSEx() { ALiYunOSSOTSAPI MyALiYunOSSOTSAPI; MyALiYunOSSOTSAPI = new ALiYunOSSOTSAPI(); int StartIndex = 22; MemoryStream MyMemoryStreamContent = new MemoryStream(MyReadBuffers, StartIndex, MyRecieveCount - StartIndex); string MySaveToOSSFileName = this.MyLoginUser.LockID + "/" + MyAutoFileNameStr + ".jpg"; MyCompleteFileName = "http://" + "hnlylgj.oss-cn-hangzhou.aliyuncs.com/" + MySaveToOSSFileName; bool SaveFlag = false; string MyTimeMarker = DateTime.Now.ToString() + ":" + DateTime.Now.Millisecond.ToString(); // + "[" + DateTime.Now.Ticks.ToString() + "]"; try { MyALiYunOSSOTSAPI.MyALiYunOSSOTSLogin.PrefixStr = this.MyLoginUser.LockID + "/"; MyALiYunOSSOTSAPI.MyALiYunOSSOTSLogin.FileKeyName = MyAutoFileNameStr + ".jpg"; MyALiYunOSSOTSAPI.PrivateUploadFile3(ref MyMemoryStreamContent); //MyMemoryStreamContent.Close(); //this.MyAsynchLockServerSocketService.DisplayResultInfor(1, "保存数据到OSS:" + MyALiYunOSSOTSAPI.ResultMessageStr); //string MyTimeMarker = DateTime.Now.ToString() + ":" + DateTime.Now.Millisecond.ToString();// + "[" + DateTime.Now.Ticks.ToString() + "]"; this.MyAsynchLockServerSocketService.DisplayResultInfor(1, string.Format(MyTimeMarker + "锁端[{0}][{1}]标准保存数据到OSS:[{2}][{3}]", this.MyLoginUser.LockID, MyReadWriteChannel.MyTCPClient.Client.RemoteEndPoint, MyALiYunOSSOTSAPI.ResultMessageStr, MyRecieveCount - StartIndex)); SaveFlag = true; } catch (Exception AnyException) { //MyMemoryStreamContent.Close(); //this.MyAsynchLockServerSocketService.DisplayResultInfor(1, "保存数据到OSS:" + MyALiYunOSSOTSAPI.ResultMessageStr); //string MyTimeMarker = DateTime.Now.ToString() + ":" + DateTime.Now.Millisecond.ToString();// + "[" + DateTime.Now.Ticks.ToString() + "]"; //this.MyAsynchLockServerSocketService.DisplayResultInfor(1, string.Format(MyTimeMarker + "锁端[{0}]标准保存数据到OSS:[{1}]", MyLockIDStr, MyALiYunOSSOTSAPI.ResultMessageStr)); this.MyAsynchLockServerSocketService.DisplayResultInfor(1, string.Format(MyTimeMarker + "锁端[{0}][{1}]标准保存数据到OSS:[{2}][{3}]", this.MyLoginUser.LockID, MyReadWriteChannel.MyTCPClient.Client.RemoteEndPoint, MyALiYunOSSOTSAPI.ResultMessageStr, MyRecieveCount - StartIndex)); SaveFlag = false; } finally { MyMemoryStreamContent.Close(); } return(SaveFlag); }