public override void Flush() { _s.Flush(); }
/// <summary> /// Transfers a source stream to a target and flushes the target /// </summary> /// <param name="source"> /// The stream to read /// </param> /// <param name="target"> /// The stream to write /// </param> /// <returns> /// The total number of bytes transferred /// </returns> public Int32 CopyAndFlush(Stream source, Stream target) { var copied = Copy(source, target); target.Flush(); return copied; }
internal void FlushStream() { Stream.Flush(); }
/// <summary> /// Start processing post back data from the request. /// </summary> /// <param name="request">The http request context.</param> /// <param name="uploadDirectory">The upload directory path where files are placed; else uploaded files are ingored.</param> public void ProcessPostBack(System.Net.HttpListenerRequest request, string uploadDirectory = null) { System.IO.Stream input = null; System.IO.FileStream localDestination = null; System.IO.MemoryStream memoryFormData = null; try { // If no directory path then only get the form post back data. if (String.IsNullOrEmpty(uploadDirectory)) { // Create a new memory stream that will contain the form data using (memoryFormData = new System.IO.MemoryStream()) { input = request.InputStream; // Copy the request stream data to the file stream. Nequeo.Net.Http.Utility.TransferData(input, memoryFormData); // Flush the streams. input.Flush(); memoryFormData.Flush(); // Close the local file. memoryFormData.Close(); input.Close(); } // Get the form data uploaded from the request stream // within the memory stream byte[] formByteData = memoryFormData.ToArray(); string formStringData = Encoding.ASCII.GetString(formByteData); // Get the enumerable collection of for data lines. IEnumerable <string> formLines = formStringData.Split(new string[] { "\r\n" }, StringSplitOptions.None).AsEnumerable(); // Get the form post back data. _form = Nequeo.Net.Http.Utility.FormParser(formLines); _uploadFiles = new string[0]; } else { string directory = uploadDirectory.TrimEnd('\\') + "\\"; // The request is a file uploader. Nequeo.Net.Http.Utility.CreateDirectory(directory); string localFileName = directory + Guid.NewGuid().ToString() + ".txt"; // Create the new file and start the transfer process. using (localDestination = new System.IO.FileStream(localFileName, System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.ReadWrite)) { input = request.InputStream; // Copy the request stream data to the file stream. Nequeo.Net.Http.Utility.TransferData(input, localDestination); // Flush the streams. input.Flush(); localDestination.Flush(); // Close the local file. localDestination.Close(); input.Close(); } // Get the form post back data. _form = Nequeo.Net.Http.Utility.FormParser(System.IO.File.ReadLines(localFileName)); // Get the upload file collection. _uploadFiles = Nequeo.Net.Http.Utility.ParseUploadedFileEx(localFileName); } } catch (Exception ex) { // Log the error. LogHandler.WriteTypeMessage( ex.Message, MethodInfo.GetCurrentMethod(), Nequeo.Net.Common.Helper.EventApplicationName); throw; } finally { try { if (input != null) { input.Close(); } } catch { } try { if (memoryFormData != null) { memoryFormData.Close(); } } catch { } try { if (localDestination != null) { localDestination.Close(); } } catch { } } }
public void FlushStream() { Stream.Flush(); }
public override void Flush() { out_Renamed.Flush(); }
public void RebootMachine() { //try //{ // Permission permissionCheck = ContextCompat.CheckSelfPermission(Forms.Context, Manifest.Permission.Reboot); // if (permissionCheck != Permission.Granted) // { // // Android.Support.V4.App.ActivityCompat.RequestPermissions(Xamarin.Forms.Platform.Android.FormsApplicationActivity, new string[] { Manifest.Permission.Reboot }, 0); // Android.Support.V4.App.ActivityCompat.RequestPermissions(globalVariables.activity, // new string[] { Manifest.Permission.Reboot }, // 1); // } // else // { // //TODO // } // try // { // Runtime.GetRuntime().Exec(new string[] { "su", "-c", "am force-stop com.android.launcher" }); // } // catch (System.Exception e) // { // e = e; // //do something // } // PowerManager pm = (PowerManager)Forms.Context.GetSystemService(Context.PowerService); // pm.Reboot(null); //} //catch (System.Exception ex) //{ // ex = ex; //} //try //{ // Runtime.GetRuntime().Exec(new string[] { "/system/bin/su", "-c", "reboot now" }); //} //catch (System.Exception ex) //{ // ex = ex; //} //try //{ // Runtime.GetRuntime().Exec(new string[] { "su", "-c", "reboot now" }); //} //catch (System.Exception ex) //{ // ex = ex; //} // Android.OS.Process.KillProcess(Android.OS.Process.MyPid()); string command = "adb reboot"; try { Java.Lang.Process sh = Runtime.GetRuntime().Exec("su", null, null); System.IO.Stream os = sh.OutputStream; byte[] mScreenBuffer = Encoding.Unicode.GetBytes(command); os.Write(mScreenBuffer); os.Flush(); os.Close(); sh.WaitFor(); Log.Verbose("PPX", "comple"); } catch (Java.Lang.Exception e) { e.PrintStackTrace(); } }
public void Flush() { iStream.Flush(); }
public override void Flush() { try { m_stream.Flush(); } catch { } }
public virtual void commit() { output.Flush(); isWritingTerm = false; variableTable = null; }
/// <summary> /// Converts a URL from mtgvault.com into a ConverterDeck which is populated with all cards and deck name. /// </summary> /// <param name="url">The URL of the Deck</param> /// <param name="deckSectionNames">List of the name of each section for the deck being converted.</param> /// <param name="convertGenericFileFunc"> /// Function to convert a collection of lines from a deck file into a ConverterDeck. /// Used when downloading a Deck File from a webpage instead of scraping. /// </param> /// <returns>A ConverterDeck which is populated with all cards and deck name</returns> public override ConverterDeck Convert( string url, IEnumerable <string> deckSectionNames, Func <IEnumerable <string>, IEnumerable <string>, ConverterDeck> convertGenericFileFunc) { object htmlWebInstance = HtmlAgilityPackWrapper.HtmlWeb_CreateInstance(); object htmlDocumentInstance = HtmlAgilityPackWrapper.HtmlWeb_InvokeMethod_Load(htmlWebInstance, url); object htmlDocument_DocumentNode = HtmlAgilityPackWrapper.HtmlDocument_GetProperty_DocumentNode(htmlDocumentInstance); // Extract the '__VIEWSTATE' and '__EVENTVALIDATION' input values string viewstateValue = null; string eventValidationValue = null; // Get a collection of all the input nodes IEnumerable <object> aspnetFormInputNodes = HtmlAgilityPackWrapper.HtmlNode_InvokeMethod_SelectNodes(htmlDocument_DocumentNode, "//input"); foreach (object inputNode in aspnetFormInputNodes) { // get the name of the input IEnumerable <object> attributes = HtmlAgilityPackWrapper.HtmlNode_GetProperty_Attributes(inputNode); string name = string.Empty; foreach (object attribute in attributes) { if (HtmlAgilityPackWrapper.HtmlAttribute_GetProperty_Name(attribute).Equals("name", StringComparison.InvariantCultureIgnoreCase)) { name = HtmlAgilityPackWrapper.HtmlAttribute_GetProperty_Value(attribute); break; } } if (name.Equals(@"__VIEWSTATE", StringComparison.InvariantCultureIgnoreCase)) { foreach (object attribute in attributes) { if (HtmlAgilityPackWrapper.HtmlAttribute_GetProperty_Name(attribute).Equals("value", StringComparison.InvariantCultureIgnoreCase)) { viewstateValue = HtmlAgilityPackWrapper.HtmlAttribute_GetProperty_Value(attribute); break; } } } else if (name.Equals(@"__EVENTVALIDATION", StringComparison.InvariantCultureIgnoreCase)) { foreach (object attribute in attributes) { if (HtmlAgilityPackWrapper.HtmlAttribute_GetProperty_Name(attribute).Equals("value", StringComparison.InvariantCultureIgnoreCase)) { eventValidationValue = HtmlAgilityPackWrapper.HtmlAttribute_GetProperty_Value(attribute); break; } } } } System.Collections.Specialized.NameValueCollection outgoingQueryString = System.Web.HttpUtility.ParseQueryString(String.Empty); outgoingQueryString.Add(@"__EVENTTARGET", @"ctl00$ContentPlaceHolder1$LinkButton1"); outgoingQueryString.Add(@"__EVENTARGUMENT", string.Empty); outgoingQueryString.Add(@"__VIEWSTATE", viewstateValue); outgoingQueryString.Add(@"__EVENTVALIDATION", eventValidationValue); outgoingQueryString.Add(@"ctl00$ContentPlaceHolder1$TextBox_AutoCompleteSideBoard", string.Empty); outgoingQueryString.Add(@"ctl00$ContentPlaceHolder1$TextBox_QuantitySideBoard", string.Empty); outgoingQueryString.Add(@"ctl00$ContentPlaceHolder1$TextBox_BulkImportSideBoard", string.Empty); outgoingQueryString.Add(@"ctl00$Login1$TextBox_Username", string.Empty); outgoingQueryString.Add(@"ctl00$Login1$TextBox_Password", string.Empty); string postData = outgoingQueryString.ToString(); ASCIIEncoding ascii = new ASCIIEncoding(); byte[] postBytes = ascii.GetBytes(postData.ToString()); System.Net.HttpWebRequest request = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(url); request.Method = "POST"; request.Accept = "text/html,application/xhtml+xml,application/xml"; request.ContentType = "application/x-www-form-urlencoded"; request.ContentLength = postBytes.Length; request.Host = "www.mtgvault.com"; request.Referer = url; request.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Firefox/31.0"; // add post data to request System.IO.Stream postStream = request.GetRequestStream(); postStream.Write(postBytes, 0, postBytes.Length); postStream.Flush(); postStream.Close(); System.Net.WebResponse response = request.GetResponse(); string filename = response.Headers["content-disposition"]; System.IO.Stream dataStream = response.GetResponseStream(); System.IO.StreamReader reader = new System.IO.StreamReader(dataStream); string responseFromServer = System.Web.HttpUtility.HtmlDecode(reader.ReadToEnd()); reader.Close(); response.Close(); filename = filename.Replace(@"attachment;", string.Empty); filename = filename.Replace(@".txt", string.Empty); ConverterDeck converterDeck = convertGenericFileFunc(TextConverter.SplitLines(responseFromServer), deckSectionNames); converterDeck.DeckName = filename; return(converterDeck); }
public void SendNotification(INotification notification, SendNotificationCallbackDelegate callback) { lock (sentLock) { Interlocked.Increment(ref trackedNotificationCount); var appleNotification = notification as AppleNotification; bool isOkToSend = true; byte[] notificationData = new byte[] {}; try { notificationData = appleNotification.ToBytes(); } catch (NotificationFailureException nfex) { //Bad notification format already isOkToSend = false; Interlocked.Decrement(ref trackedNotificationCount); if (callback != null) { callback(this, new SendNotificationResult(notification, false, nfex)); } } if (isOkToSend) { try { lock (connectLock) Connect(); lock (streamWriteLock) { bool stillConnected = client.Connected && client.Client.Poll(0, SelectMode.SelectWrite) && networkStream.CanWrite; if (!stillConnected) { throw new ObjectDisposedException("Connection to APNS is not Writable"); } lock (sentLock) { if (notificationData.Length > 45) { networkStream.Write(notificationData, 0, 45); networkStream.Write(notificationData, 45, notificationData.Length - 45); } else { networkStream.Write(notificationData, 0, notificationData.Length); } networkStream.Flush(); sentNotifications.Add(new SentNotification(appleNotification) { Callback = callback }); } } } catch (ConnectionFailureException cex) { connected = false; //If this failed, we probably had a networking error, so let's requeue the notification Interlocked.Decrement(ref trackedNotificationCount); if (callback != null) { callback(this, new SendNotificationResult(notification, false, cex)); } } catch (Exception ex) { connected = false; //If this failed, we probably had a networking error, so let's requeue the notification Interlocked.Decrement(ref trackedNotificationCount); if (callback != null) { callback(this, new SendNotificationResult(notification, true, ex)); } } } } }
public static void MultipleLargeDataSets() { System.Net.Http.HttpMethod meth = System.Net.Http.HttpMethod.Post; string fn = "lobster.json.txt"; using (System.IO.Stream strm = new System.IO.FileStream(fn, System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.None)) { MultipleLargeDataSets(strm, GetMultipleDataSetsSQL()); } // End Using strm string endpointUrl = "http://localhost:53417/ajax/dataReceiver.ashx"; using (System.Net.WebClient client = new System.Net.WebClient()) { client.Headers.Add("Content-Type", "application/json"); // client.OpenWriteCompleted += (sender, e) => client.OpenWriteCompleted += delegate(object sender, System.Net.OpenWriteCompletedEventArgs e) { // System.Net.WebClient that = (System.Net.WebClient) sender; if (e.Error != null) { throw e.Error; } using (System.IO.Stream postStream = e.Result) { MultipleLargeDataSets(postStream, GetMultipleDataSetsSQL()); postStream.Flush(); postStream.Close(); } }; client.OpenWriteAsync(new System.Uri(endpointUrl)); using (System.IO.Stream postStream = client.OpenWrite(endpointUrl, meth.Method)) { // postStream.Write(fileContent, 0, fileContent.Length); MultipleLargeDataSets(postStream, GetMultipleDataSetsSQL()); } // End Using postStream using (System.IO.Stream postStream = client.OpenRead(endpointUrl)) { using (System.IO.StreamReader sr = new System.IO.StreamReader(postStream)) { string output = sr.ReadToEnd(); System.Console.WriteLine(output); } // End Using sr } // End Using postStream // client.ResponseHeaders } // End Using client DataSetSerialization thisDataSet = EasyJSON.JsonHelper.DeserializeFromFile <DataSetSerialization>(fn); System.Console.WriteLine(thisDataSet); } // End Sub MultipleLargeDataSets
/* * <xml><appid><![CDATA[wxb4f8f3d799d22f03]]></appid> * <attach><![CDATA[测试数据]]></attach> * <bank_type><![CDATA[CFT]]></bank_type> * <cash_fee><![CDATA[1]]></cash_fee> * <fee_type><![CDATA[CNY]]></fee_type> * <is_subscribe><![CDATA[Y]]></is_subscribe> * <mch_id><![CDATA[1264926201]]></mch_id> * <nonce_str><![CDATA[rdwbEb2FXXmV7LBF]]></nonce_str> * <openid><![CDATA[oY-Cqs7wZ6p_Cq_0AAP2QHLhANRc]]></openid> * <out_trade_no><![CDATA[126492620120160426005955291]]></out_trade_no> * <result_code><![CDATA[SUCCESS]]></result_code> * <return_code><![CDATA[SUCCESS]]></return_code> * <sign><![CDATA[C251718418AFA3FDEB764E258F220340]]></sign> * <time_end><![CDATA[20160426010056]]></time_end> * <total_fee>1</total_fee> * <trade_type><![CDATA[NATIVE]]></trade_type> * <transaction_id><![CDATA[4008492001201604265225452570]]></transaction_id> * </xml> */ #endregion public void ProcessRequest(HttpContext context) { WxPayData res = new WxPayData(); try { context.Response.ContentType = "text/plain"; System.IO.Stream s = context.Request.InputStream; int count = 0; byte[] buffer = new byte[1024]; StringBuilder builder = new StringBuilder(); while ((count = s.Read(buffer, 0, 1024)) > 0) { builder.Append(Encoding.UTF8.GetString(buffer, 0, count)); } s.Flush(); s.Close(); s.Dispose(); Loggers.Debug(new DebugLogInfo() { Message = string.Format("Receive data from WeChat : {0}", builder.ToString()) }); string rspStr = builder.ToString(). Replace("<![CDATA[", "").Replace("]]>", ""); XmlDocument doc = new XmlDocument(); doc.LoadXml(rspStr); string orderId = doc.GetElementsByTagName("out_trade_no")[0].InnerText; string resultcode = doc.GetElementsByTagName("result_code")[0].InnerText; string openId = doc.GetElementsByTagName("openid")[0].InnerText; AppOrderBLL bll = new AppOrderBLL(new Utility.BasicUserInfo()); AppOrderEntity appOrder = bll.QueryByEntity(new AppOrderEntity() { AppOrderID = orderId, }, null).FirstOrDefault(); if (appOrder != null && resultcode == "SUCCESS" && appOrder.Status != 2) { appOrder.Status = 2; new RechargeBLL().RechargeTonysCardAct2(appOrder); } if (appOrder != null && !(appOrder.IsNotified ?? false)) { try { string msg; if (NotifyHandler.Notify(appOrder, out msg, true)) { appOrder.IsNotified = true; } else { appOrder.NextNotifyTime = DateTime.Now.AddMinutes(1); } //通知完成,通知次数+1 appOrder.NotifyCount = (appOrder.NotifyCount ?? 0) + 1; bll.Update(appOrder); } catch (Exception ex) { Loggers.Exception(new ExceptionLogInfo(ex)); res.SetValue("return_code", "FAIL"); res.SetValue("return_msg", "FAIL"); } } NotifyHandler.NotifyTFSaveWxVipInfo(appOrder.AppOrderID, appOrder.AppClientID, openId); if ((appOrder.IsNotified ?? false) && appOrder.Status == 2) { res.SetValue("return_code", "SUCCESS"); res.SetValue("return_msg", "OK"); } } catch (Exception ex) { res.SetValue("return_code", "FAIL"); res.SetValue("return_msg", ex.Message); } context.Response.Write(res.ToXml()); context.Response.End(); }
/// <summary> /// 支付回调 /// </summary> /// <returns></returns> public ContentResult WxNotify() { //接收从微信后台POST过来的数据 System.IO.Stream s = Request.InputStream; int count = 0; byte[] buffer = new byte[1024]; StringBuilder builder = new StringBuilder(); while ((count = s.Read(buffer, 0, 1024)) > 0) { builder.Append(Encoding.UTF8.GetString(buffer, 0, count)); } s.Flush(); s.Close(); s.Dispose(); //转换数据格式并验证签名 WxPayData notifyData = new WxPayData(); WxPayData res = new WxPayData(); try { notifyData.FromXml(builder.ToString()); } catch (WxPayException ex) { //若签名错误,则立即返回结果给微信支付后台 res.SetValue("return_code", "FAIL"); res.SetValue("return_msg", ex.Message); return(Content(res.ToXml())); } //检查支付结果中transaction_id是否存在 if (!notifyData.IsSet("transaction_id")) { //若transaction_id不存在,则立即返回结果给微信支付后台 res.SetValue("return_code", "FAIL"); res.SetValue("return_msg", "支付结果中微信订单号不存在"); return(Content(res.ToXml())); } string transaction_id = notifyData.GetValue("transaction_id").ToString(); string out_trade_no = notifyData.GetValue("out_trade_no").ToString(); //查询订单,判断订单真实性 if (!QueryOrder(transaction_id)) { //若订单查询失败,则立即返回结果给微信支付后台 res.SetValue("return_code", "FAIL"); res.SetValue("return_msg", "订单查询失败"); } //查询订单成功 else { var orderService = new OrderService(); var result = orderService.Complete(out_trade_no); if (result.Code == ResultCode.Error) { res.SetValue("return_code", "FAIL"); res.SetValue("return_msg", "订单查询失败"); } else { res.SetValue("return_code", "SUCCESS"); res.SetValue("return_msg", "OK"); } } return(Content(res.ToXml())); }
//UPGRADE_TODO: The following method was automatically generated and it must be implemented in order to preserve the class logic. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1232'" public override void Flush() { mIn.Flush(); }
/// <summary> /// Flash. /// </summary> public override void Flush() { _stream.Flush(); }
/// <inheritdoc/> public override void Flush() { _underlyingStream.Flush(); }
public static void ssh_test2() { SshUserData data1 = new SshUserData(); data1.user = "******"; data1.host = "tkynt2.phys.s.u-tokyo.ac.jp"; data1.port = 22; data1.pass = ""; System.Collections.Hashtable config = new System.Collections.Hashtable(); config["StrictHostKeyChecking"] = "no"; SshfsMessage mess1 = new SshfsMessage("[]"); jsch::JSch jsch = new Tamir.SharpSsh.jsch.JSch(); jsch::Session sess1 = jsch.getSession(data1.user, data1.host, data1.port); sess1.setConfig(config); //sess1.setUserInfo(new DokanSSHFS.DokanUserInfo(data1.pass,null)); sess1.setUserInfo(new SshLoginInfo(mess1, data1)); sess1.setPassword(data1.pass); sess1.connect(); //MyProx proxy=new MyProx(sess1); //SshUserData data2=new SshUserData(); //data2.user="******"; //data2.host="127.0.0.1"; //data2.port=50022; //data2.pass=""; //jsch::Session sess2=jsch.getSession(data2.user,data2.host,data2.port); //sess2.setConfig(config); //sess2.setUserInfo(new mwg.Sshfs.SshLoginInfo(mess1,data2)); //sess2.setPassword(data2.pass); //sess2.setProxy(proxy); //sess2.connect(); System.Console.WriteLine("cat"); jsch::ChannelExec ch_e = (jsch::ChannelExec)sess1.openChannel("exec"); ch_e.setCommand("cat"); ch_e.setOutputStream(System.Console.OpenStandardOutput(), true); System.IO.Stream ins = ch_e.getOutputStream(); ch_e.connect(); System.Threading.Thread.Sleep(2000); System.Console.WriteLine("hello"); ins.WriteByte((byte)'h'); ins.WriteByte((byte)'e'); ins.WriteByte((byte)'l'); ins.WriteByte((byte)'l'); ins.WriteByte((byte)'o'); ins.WriteByte((byte)'\n'); ins.Flush(); //System.Threading.Thread.Sleep(2000); System.Threading.Thread.Sleep(2000); System.IO.StreamWriter sw = new System.IO.StreamWriter(ins); System.Console.WriteLine("test"); sw.WriteLine("test"); sw.Flush(); System.Threading.Thread.Sleep(2000); System.Console.WriteLine("world"); sw.WriteLine("world"); sw.Flush(); System.Threading.Thread.Sleep(2000); for (int i = 0; i < 5; i++) { System.Console.WriteLine("count={0}", i); sw.WriteLine("count={0}", i); sw.Flush(); System.Threading.Thread.Sleep(2000); } for (int i = 5; i < 20; i++) { System.Console.WriteLine("count={0}", i); sw.WriteLine("count={0}", i); sw.Flush(); } System.Threading.Thread.Sleep(2000); sw.Close(); ins.Close(); System.Console.WriteLine("comp."); ch_e.disconnect(); //sess2.disconnect(); sess1.disconnect(); }
/// <summary> /// Flush the stream. /// </summary> public override void Flush() { _innerStream.Flush(); }
public void NotifyByWeixin(HttpRequest request, out bool isPaied, out string responseXml) { isPaied = false; var config = ConfigInfo; WxPayConfig.APPID = config.WeixinAppId; WxPayConfig.MCHID = config.WeixinMchId; WxPayConfig.KEY = config.WeixinKey; WxPayConfig.APPSECRET = config.WeixinAppSecret; //=======【商户系统后台机器IP】===================================== /* 此参数可手动配置也可在程序中自动获取 */ WxPayConfig.IP = "8.8.8.8"; //=======【代理服务器设置】=================================== /* 默认IP和端口号分别为0.0.0.0和0,此时不开启代理(如有需要才设置) */ WxPayConfig.PROXY_URL = "http://10.152.18.220:8080"; //=======【上报信息配置】=================================== /* 测速上报等级,0.关闭上报; 1.仅错误时上报; 2.全量上报 */ WxPayConfig.REPORT_LEVENL = 1; //=======【日志级别】=================================== /* 日志等级,0.不输出日志;1.只输出错误信息; 2.输出错误和正常信息; 3.输出错误信息、正常信息和调试信息 */ WxPayConfig.LOG_LEVENL = 0; //接收从微信后台POST过来的数据 System.IO.Stream s = request.InputStream; int count; byte[] buffer = new byte[1024]; StringBuilder builder = new StringBuilder(); while ((count = s.Read(buffer, 0, 1024)) > 0) { builder.Append(Encoding.UTF8.GetString(buffer, 0, count)); } s.Flush(); s.Close(); s.Dispose(); Log.Info(GetType().ToString(), "NotifyByWeixin : " + builder); //转换数据格式并验证签名 WxPayData notifyData = new WxPayData(); try { notifyData.FromXml(builder.ToString()); } catch (WxPayException ex) { //若签名错误,则立即返回结果给微信支付后台 WxPayData res = new WxPayData(); res.SetValue("return_code", "FAIL"); res.SetValue("return_msg", ex.Message); Log.Error(GetType().ToString(), "Sign check error : " + res.ToXml()); responseXml = res.ToXml(); return; } if (!notifyData.IsSet("return_code") || notifyData.GetValue("return_code").ToString() != "SUCCESS") { WxPayData res = new WxPayData(); res.SetValue("return_code", "FAIL"); res.SetValue("return_msg", "回调数据异常"); Log.Info(GetType().ToString(), "The data WeChat post is error : " + res.ToXml()); responseXml = res.ToXml(); return; } //统一下单成功,则返回成功结果给微信支付后台 WxPayData data = new WxPayData(); data.SetValue("return_code", "SUCCESS"); data.SetValue("return_msg", "OK"); Log.Info(GetType().ToString(), "UnifiedOrder success , send data to WeChat : " + data.ToXml()); isPaied = true; responseXml = data.ToXml(); }
public void Save(Stream stream) { if (GraphSaving != null) GraphSaving(this, EventArgs.Empty); foreach (DrawingNode n in Graph.Nodes) n.GeometryObject.UserData = n.Id; Graph.WriteToStream(stream); stream.Flush(); if (GraphSaved != null) GraphSaved(this, EventArgs.Empty); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: private void sendToUser(User user, pspsharp.network.proonline.PacketFactory.SceNetAdhocctlPacketBaseS2C packet) throws java.io.IOException private void sendToUser(User user, SceNetAdhocctlPacketBaseS2C packet) { System.IO.Stream os = user.socket.OutputStream; os.Write(packet.Bytes, 0, packet.Bytes.Length); os.Flush(); }