System.IO.Stream.Flush()

Here are the examples of the csharp api System.IO.Stream.Flush() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

836 Examples 7

19 Source : DisposeActionStream.cs
with MIT License
from 0x0ade

public override void Flush() => Inner.Flush();

19 Source : PositionAwareStream.cs
with MIT License
from 0x0ade

public override void Flush() {
            Inner.Flush();
        }

19 Source : RedisIO.cs
with MIT License
from 2881099

public void Write(byte[] data)
        {
            lock (_streamLock)
            {
                Stream.Write(data, 0, data.Length);
                Stream.Flush();
            }
        }

19 Source : RedisIO.cs
with MIT License
from 2881099

public void Write(Stream stream)
        {
            lock (_streamLock)
            {
                stream.CopyTo(Stream);
                Stream.Flush();
            }
        }

19 Source : RangeCoder.cs
with MIT License
from 91Act

public void FlushStream()
		{
			Stream.Flush();
		}

19 Source : OutBuffer.cs
with MIT License
from 91Act

public void FlushStream() { m_Stream.Flush(); }

19 Source : DateAndSizeRollingFileAppender.cs
with MIT License
from Abc-Arbitrage

public override void Flush()
            => _stream?.Flush();

19 Source : Host.cs
with MIT License
from acandylevey

public void SendMessage(JObject data)
        {
            Log.LogMessage("Sending Message:" + JsonConvert.SerializeObject(data));

            byte[] bytes = System.Text.Encoding.UTF8.GetBytes(data.ToString(Formatting.None));
            Stream stdout = Console.OpenStandardOutput();
            stdout.WriteByte((byte)((bytes.Length >> 0) & 0xFF));
            stdout.WriteByte((byte)((bytes.Length >> 8) & 0xFF));
            stdout.WriteByte((byte)((bytes.Length >> 16) & 0xFF));
            stdout.WriteByte((byte)((bytes.Length >> 24) & 0xFF));
            stdout.Write(bytes, 0, bytes.Length);
            stdout.Flush();
        }

19 Source : FileLoggerProcessor.cs
with MIT License
from adams85

internal void Flush()
            {
                // FlushAsync is extremely slow currently
                // https://github.com/dotnet/corefx/issues/32837
                _appendStream.Flush();
            }

19 Source : IOHelper.cs
with Mozilla Public License 2.0
from agebullhu

public static bool XMLSerializer<T>(Stream ms, T args)
        {
            if (Equals(args, default(T)))
                return false;
            ms.SetLength(1);
            var ds = new DataContractSerializer(typeof(T));
            ds.WriteObject(ms, args);
            ms.Flush();
            return true;
        }

19 Source : Stream.cs
with Mozilla Public License 2.0
from ahyahy

public virtual void Flush()
        {
            M_Stream.Flush();
        }

19 Source : HttpResponse.cs
with GNU General Public License v3.0
from aiportal

public void SendStaticFile(string fpath, byte[] bsFile)
		{
			Debug.replacedert(!string.IsNullOrEmpty(fpath));
			Debug.replacedert(bsFile != null && bsFile.Length > 0);
			
			SetExpires(0);
			Response.ContentType = ApacheMimeTypes.Get(Path.GetExtension(fpath));
			Response.ContentEncoding = Encoding.UTF8;
			
			SetDebugHeaders();
			if (Response.OutputStream.CanWrite)
			{
				Response.OutputStream.Write(bsFile, 0, bsFile.Length);
				Response.OutputStream.Flush();
			}
			//Response.Close();
		}

19 Source : HttpResponse.cs
with GNU General Public License v3.0
from aiportal

public void SendErrorPage(int errCode, string errMsg)
		{
			Debug.replacedert(errCode > 0);

			byte[] bsMsg = Encoding.UTF8.GetBytes(errMsg);
			Response.StatusCode = errCode;
			Response.StatusDescription = errMsg;

			SetExpires(0);
			Response.ContentType = "text/plain";
			Response.ContentEncoding = Encoding.UTF8;

			SetDebugHeaders();
			Response.OutputStream.Write(bsMsg, 0, bsMsg.Length);
			Response.OutputStream.Flush();
			Response.Close();
		}

19 Source : HttpResponse.cs
with GNU General Public License v3.0
from aiportal

public void SendException(Exception ex)
		{
			byte[] bsException = Encoding.UTF8.GetBytes(ex.ToString());

			SetExpires(0);
			Response.ContentType = "text/plain";
			Response.ContentEncoding = Encoding.UTF8;

			SetDebugHeaders();
			Response.OutputStream.Write(bsException, 0, bsException.Length);
			Response.OutputStream.Flush();
		}

19 Source : HttpResponse.cs
with GNU General Public License v3.0
from aiportal

public void SendJsonObject(object result, bool compress = true)
		{
			// json serialize
			byte[] bsJson = Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(result));
			if (compress)
			{
				Response.Headers[HttpResponseHeader.ContentEncoding] = "gzip";
				bsJson = bfbd.Common.Compress.GZip(bsJson, true);
			}

			SetExpires(0);
			Response.ContentType = "text/json";
			Response.ContentEncoding = Encoding.UTF8;

			SetDebugHeaders();
			Response.OutputStream.Write(bsJson, 0, bsJson.Length);
			Response.OutputStream.Flush();
			Response.Close();
		}

19 Source : HttpResponse.cs
with GNU General Public License v3.0
from aiportal

public void SendJsonError(int errCode, string errMsg)
		{
			byte[] bsMsg = Encoding.UTF8.GetBytes(errMsg);

			SetExpires(0);
			Response.ContentType = "text/plain";
			Response.ContentEncoding = Encoding.UTF8;

			SetDebugHeaders();
			Response.OutputStream.Write(bsMsg, 0, bsMsg.Length);
			Response.OutputStream.Flush();
			Response.Close();
		}

19 Source : HttpResponse.cs
with GNU General Public License v3.0
from aiportal

public void SendJsonScript(string script, bool compress = true, bool expires = false)
		{
			byte[] bsJson = Encoding.UTF8.GetBytes(script);
			if (compress)
			{
				Response.Headers[HttpResponseHeader.ContentEncoding] = "gzip";
				bsJson = bfbd.Common.Compress.GZip(bsJson, true);
			}

			SetExpires(expires ? 0 : 600);
			Response.ContentType = "text/plain";
			Response.ContentEncoding = Encoding.UTF8;
			
			SetDebugHeaders();
			Response.OutputStream.Write(bsJson, 0, bsJson.Length);
			Response.OutputStream.Flush();
			Response.Close();
		}

19 Source : HttpResponse.cs
with GNU General Public License v3.0
from aiportal

public void SendImage(byte[] bsImage, string fileExtension)
		{
			SetExpires(600);
			Response.ContentType = ApacheMimeTypes.Get(fileExtension);
			Response.ContentEncoding = Encoding.UTF8;
			
			SetDebugHeaders();
			Response.OutputStream.Write(bsImage, 0, bsImage.Length);
			Response.OutputStream.Flush();
			Response.Close();
		}

19 Source : ResponseExtension.cs
with GNU General Public License v3.0
from aiportal

private static void WriteFileContent(HttpListenerResponse resp, byte[] data, string mime, bool compress)
		{
			if (compress)
			{
				resp.Headers[HttpResponseHeader.ContentEncoding] = "gzip";
				data = Compress.GZip(data, true);
			}

			resp.ContentType = mime;
			resp.ContentEncoding = Encoding.UTF8;

			SetDebugMode(resp);
			resp.OutputStream.Write(data, 0, data.Length);
			resp.OutputStream.Flush();
			resp.Close();
		}

19 Source : TweakableStream.cs
with MIT License
from airbreather

public override void Flush() => _inner.Flush();

19 Source : ArduinoInfo.cs
with GNU General Public License v3.0
from AlexandreDoucet

public void WriteToArduino(string message)
    {
        if (arduinoPort.IsOpen)
        {
            message = message + "\r\n";
            arduinoPort.Write(message);
            arduinoPort.BaseStream.Flush();
        }
    }

19 Source : ArduinoInfo.cs
with GNU General Public License v3.0
from AlexandreDoucet

public void ArduinoAgentCleanup()
    {
        try
        {
            if (arduinoPort.IsOpen)
            {
                WriteToArduino("DONE");
                arduinoPort.BaseStream.Flush();
                arduinoPort.Dispose();
            }
        }
        catch/* (System.NullReferenceException e)*/
        {
            //    Debug.LogWarning("Handled Error -> " + e.GetType() + " : " + e.Message);
        }


    }

19 Source : ArduinoReceive_ Section 6.cs
with GNU General Public License v3.0
from AlexandreDoucet

private void WriteToArduino(string message)
	{
		if (arduinoPort.IsOpen) 
		{	
			message = message + "\r\n";
			arduinoPort.Write (message);
			arduinoPort.BaseStream.Flush ();
		}	 
		else 
		{	
			Debug.Log ("PortNotOpen");
		}	
	}

19 Source : ArduinoReveive_Section 5.cs
with GNU General Public License v3.0
from AlexandreDoucet

private void WriteToArduino(string message)
    {
        if (arduinoPort.IsOpen)
        {
            message = message + "\r\n";
            arduinoPort.Write(message);
            arduinoPort.BaseStream.Flush();
        }
        else
        {
            Debug.Log("PortNotOpen");
        }
    }

19 Source : HttpServer.cs
with MIT License
from AlexGyver

private void ServeResourceFile(HttpListenerResponse response, string name, 
      string ext) 
    {
      // resource names do not support the hyphen
      name = "OpenHardwareMonitor.Resources." + 
        name.Replace("custom-theme", "custom_theme");

      string[] names =
        replacedembly.GetExecutingreplacedembly().GetManifestResourceNames();
      for (int i = 0; i < names.Length; i++) {
        if (names[i].Replace('\\', '.') == name) {
          using (Stream stream = replacedembly.GetExecutingreplacedembly().
            GetManifestResourceStream(names[i])) {
            response.ContentType = GetcontentType("." + ext);
            response.ContentLength64 = stream.Length;
            byte[] buffer = new byte[512 * 1024];
            int len;
            try {
              Stream output = response.OutputStream;
              while ((len = stream.Read(buffer, 0, buffer.Length)) > 0) {
                output.Write(buffer, 0, len);
              }
              output.Flush();
              output.Close();              
              response.Close();
            } catch (HttpListenerException) { 
            } catch (InvalidOperationException) { 
            }
            return;
          }          
        }
      }

      response.StatusCode = 404;
      response.Close();
    }

19 Source : PngEncoder.cs
with MIT License
from AlexGyver

public byte[] ToArray()
            {
                this.BaseStream.Flush();
                return ((MemoryStream)this.BaseStream).ToArray();
            }

19 Source : ProgressStream.cs
with MIT License
from alexis-

public override void Flush()
    {
      innerStream.Flush();
    }

19 Source : ProgressStreamContent.cs
with MIT License
from alexrainman

public override void Flush()
            {
                ParentStream.Flush();
            }

19 Source : AlipayMobilePublicMultiMediaClient.cs
with Apache License 2.0
from alipay

public void GetResponsereplacedtream(Stream outStream, HttpWebResponse rsp)
        {
            StringBuilder result = new StringBuilder();
            Stream stream = null;
            StreamReader reader = null;
            BinaryWriter writer = null;

            try
            {
                // 以字符流的方式读取HTTP响应
                stream = rsp.GetResponseStream();
                reader = new StreamReader(stream);

                writer = new BinaryWriter(outStream);

                //stream.CopyTo(outStream);
                int length = Convert.ToInt32(rsp.ContentLength);
                byte[] buffer = new byte[length];
                int rc = 0;
                while ((rc = stream.Read(buffer, 0, length)) > 0)
                {
                    outStream.Write(buffer, 0, rc);
                }
                outStream.Flush();
                outStream.Close();

            }
            finally
            {
                // 释放资源
                if (reader != null) reader.Close();
                if (stream != null) stream.Close();
                if (rsp != null) rsp.Close();
            }
        }

19 Source : TStreamTransport.cs
with MIT License
from aloneguid

public override void Flush()
        {
            if (outputStream == null)
            {
                throw new TTransportException(TTransportException.ExceptionType.NotOpen, "Cannot flush null outputstream");
            }

            outputStream.Flush();
        }

19 Source : GzipDataReader.cs
with MIT License
from aloneguid

private static void Decompress(Stream source, Stream destination)
      {
         if (source == null) throw new ArgumentNullException(nameof(source));
         if (destination == null) throw new ArgumentNullException(nameof(destination));

         using (var decompressor = new GZipStream(source, CompressionMode.Decompress, true))
         {
            decompressor.CopyTo(destination);
            destination.Flush();
         }
      }

19 Source : GapStream.cs
with MIT License
from aloneguid

public override void Flush()
      {
         _parent.Flush();
      }

19 Source : ThriftStream.cs
with MIT License
from aloneguid

public int Write<T>(T obj, bool rewind = false) where T : TBase, new()
      {
         _s.Flush();
         long startPos = _s.Position;
         obj.Write(_protocol);
         _s.Flush();
         long size = _s.Position - startPos;
         if (rewind) _s.Seek(startPos, SeekOrigin.Begin);
         return (int)size;
      }

19 Source : ParquetWriter.cs
with MIT License
from aloneguid

public void Dispose()
#pragma warning restore CA1063 // Implement IDisposable Correctly
      {
         if (_dataWritten)
         {
            //update row count (on append add row count to existing metadata)
            _footer.Add(_openedWriters.Sum(w => w.RowCount ?? 0));
         }

         //finalize file
         long size = _footer.Write(ThriftStream);

         //metadata size
         Writer.Write((int)size);  //4 bytes

         //end magic
         WriteMagic();              //4 bytes

         Writer.Flush();
         Stream.Flush();
      }

19 Source : HTTPChallengeWebServerValidator.cs
with GNU General Public License v3.0
from aloopkin

private void Process(HttpListenerContext context)
        {
            logger.Debug($"Processing the serving of content: {_tokenContents}");
            byte[] buf = Encoding.UTF8.GetBytes(_tokenContents);
            // First the headers
            context.Response.ContentType = "application/octet-stream";
            context.Response.ContentLength64 = buf.Length;
            context.Response.AddHeader("Date", DateTime.Now.ToString("r"));
            context.Response.StatusCode = 200;

            // Then the contents...erm, always the same !
            context.Response.OutputStream.Write(buf, 0, buf.Length);

            // We flush and close
            context.Response.OutputStream.Flush();
            context.Response.OutputStream.Close();
        }

19 Source : DataMockSI.cs
with BSD 3-Clause "New" or "Revised" License
from Altinn

public async Task<DataElement> InsertBinaryData(string org, string app, int instanceOwnerId, Guid instanceGuid, string dataType, HttpRequest request)
        {
            Guid dataGuid = Guid.NewGuid();
            string dataPath = GetDataPath(org, app, instanceOwnerId, instanceGuid);
            Instance instance = GetTestInstance(app, org, instanceOwnerId, instanceGuid);
            DataElement dataElement = new DataElement() { Id = dataGuid.ToString(), DataType = dataType, ContentType = request.ContentType };

            if (!Directory.Exists(Path.GetDirectoryName(dataPath)))
            {
                Directory.CreateDirectory(Path.GetDirectoryName(dataPath));
            }

            Directory.CreateDirectory(dataPath + @"blob");

            long filesize;

            using (Stream streamToWriteTo = File.Open(dataPath + @"blob\" + dataGuid.ToString(), FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite))
            {
                await request.Body.CopyToAsync(streamToWriteTo);
                streamToWriteTo.Flush();
                filesize = streamToWriteTo.Length;
                streamToWriteTo.Close();
            }

            dataElement.Size = filesize;
            string jsonData = JsonConvert.SerializeObject(dataElement);
            using StreamWriter sw = new StreamWriter(dataPath + dataGuid.ToString() + @".json");

            sw.Write(jsonData.ToString());
            sw.Close();

            return dataElement;
        }

19 Source : DataMockSI.cs
with BSD 3-Clause "New" or "Revised" License
from Altinn

public async Task<DataElement> InsertBinaryData(string instanceId, string dataType, string contentType, string filename, Stream stream)
        {
            Application app = _applicationService.GetApplication();

            Guid dataGuid = Guid.NewGuid();
            string dataPath = GetDataPath(app.Org, app.Id.Split("/")[1], Convert.ToInt32(instanceId.Split("/")[0]), new Guid(instanceId.Split("/")[1]));

            DataElement dataElement = new DataElement() { Id = dataGuid.ToString(), DataType = dataType, ContentType = contentType, };

            if (!Directory.Exists(Path.GetDirectoryName(dataPath)))
            {
                Directory.CreateDirectory(Path.GetDirectoryName(dataPath));
            }

            Directory.CreateDirectory(dataPath + @"blob");

            long filesize;

            using (Stream streamToWriteTo = File.Open(dataPath + @"blob\" + dataGuid.ToString(), FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite))
            {
                await stream.CopyToAsync(streamToWriteTo);
                streamToWriteTo.Flush();
                filesize = streamToWriteTo.Length;
            }

            dataElement.Size = filesize;
            string jsonData = JsonConvert.SerializeObject(dataElement);
            using StreamWriter sw = new StreamWriter(dataPath + dataGuid.ToString() + @".json");

            sw.Write(jsonData.ToString());
            sw.Close();

            return dataElement;
        }

19 Source : PolicyRepositoryMock.cs
with BSD 3-Clause "New" or "Revised" License
from Altinn

private async Task<Response<BlobContentInfo>> WriteStreamToTestDataFolder(string filepath, Stream fileStream)
        {
            string dataPath = GetDataBlobPath() + filepath;

            if (!Directory.Exists(Path.GetDirectoryName(dataPath)))
            {
                Directory.CreateDirectory(Path.GetDirectoryName(dataPath));
            }

            int filesize;

            using (Stream streamToWriteTo = File.Open(dataPath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite))
            {
                await fileStream.CopyToAsync(streamToWriteTo);
                streamToWriteTo.Flush();
                filesize = (int)streamToWriteTo.Length;
            }

            BlobContentInfo mockedBlobInfo = BlobsModelFactory.BlobContentInfo(new ETag("ETagSuccess"), DateTime.Now, new byte[1], DateTime.Now.ToUniversalTime().ToString(), "encryptionKeySha256", "encryptionScope", 1);
            Mock<Response<BlobContentInfo>> mockResponse = new Mock<Response<BlobContentInfo>>();
            mockResponse.SetupGet(r => r.Value).Returns(mockedBlobInfo);

            Mock<Response> responseMock = new Mock<Response>();
            responseMock.SetupGet(r => r.Status).Returns((int)HttpStatusCode.Created);
            mockResponse.Setup(r => r.GetRawResponse()).Returns(responseMock.Object);

            return mockResponse.Object;
        }

19 Source : MeshSaver.cs
with MIT License
from anderm

public static string Save(string fileName, IEnumerable<MeshFilter> meshFilters)
        {
            if (string.IsNullOrEmpty(fileName))
            {
                throw new ArgumentException("Must specify a valid fileName.");
            }

            if (meshFilters == null)
            {
                throw new ArgumentNullException("Value of meshFilters cannot be null.");
            }

            // Create the mesh file.
            String folderName = MeshFolderName;
            Debug.Log(String.Format("Saving mesh file: {0}", Path.Combine(folderName, fileName + fileExtension)));

            using (Stream stream = OpenFileForWrite(folderName, fileName + fileExtension))
            {
                // Serialize and write the meshes to the file.
                byte[] data = SimpleMeshSerializer.Serialize(meshFilters);
                stream.Write(data, 0, data.Length);
                stream.Flush();
            }

            Debug.Log("Mesh file saved.");

            return Path.Combine(folderName, fileName + fileExtension);
        }

19 Source : MeshSaver.cs
with MIT License
from anderm

public static string Save(string fileName, IEnumerable<Mesh> meshes)
        {
            if (string.IsNullOrEmpty(fileName))
            {
                throw new ArgumentException("Must specify a valid fileName.");
            }

            if (meshes == null)
            {
                throw new ArgumentNullException("Value of meshes cannot be null.");
            }

            // Create the mesh file.
            String folderName = MeshFolderName;
            Debug.Log(String.Format("Saving mesh file: {0}", Path.Combine(folderName, fileName + fileExtension)));

            using (Stream stream = OpenFileForWrite(folderName, fileName + fileExtension))
            {
                // Serialize and write the meshes to the file.
                byte[] data = SimpleMeshSerializer.Serialize(meshes);
                stream.Write(data, 0, data.Length);
                stream.Flush();
            }

            Debug.Log("Mesh file saved.");

            return Path.Combine(folderName, fileName + fileExtension);
        }

19 Source : PayServices.cs
with Apache License 2.0
from anjoy8

public async Task<MessageModel<PayRefundReturnResultModel>> PayRefund(PayRefundNeedModel payModel)
        {
            _logger.LogInformation("退款开始");
            MessageModel<PayRefundReturnResultModel> messageModel = new MessageModel<PayRefundReturnResultModel>();
            messageModel.response = new PayRefundReturnResultModel();
            try
            {
                _logger.LogInformation($"原始GET参数->{_httpContextAccessor.HttpContext.Request.QueryString}");

                string REQUEST_SN = StringHelper.GetGuidToLongID().ToString().Substring(0, 16);//请求序列码
                string CUST_ID = StaticPayInfo.MERCHANTID;//商户号
                string USER_ID = StaticPayInfo.USER_ID;//操作员号
                string PreplacedWORD = StaticPayInfo.PreplacedWORD;//密码
                string TX_CODE = "5W1004";//交易码
                string LANGUAGE = "CN";//语言
                                       //string SIGN_INFO = "";//签名信息
                                       //string SIGNCERT = "";//签名CA信息
                                       //外联平台客户端服务部署的地址+设置的监听端口
                string sUrl = StaticPayInfo.OutAddress;

                //XML请求报文
                //string sRequestMsg = $" requestXml=<?xml version=\"1.0\" encoding=\"GB2312\" standalone=\"yes\" ?><TX><REQUEST_SN>{REQUEST_SN}</REQUEST_SN><CUST_ID>{CUST_ID}</CUST_ID><USER_ID>{USER_ID}</USER_ID><PreplacedWORD>{PreplacedWORD}</PreplacedWORD><TX_CODE>{TX_CODE}</TX_CODE><LANGUAGE>{LANGUAGE}</LANGUAGE><TX_INFO><MONEY>{payModel.MONEY}</MONEY><ORDER>{payModel.ORDER}</ORDER><REFUND_CODE>{payModel.REFUND_CODE}</REFUND_CODE></TX_INFO><SIGN_INFO></SIGN_INFO><SIGNCERT></SIGNCERT></TX> ";
                string sRequestMsg = $"<?xml version=\"1.0\" encoding=\"GB2312\" standalone=\"yes\" ?><TX><REQUEST_SN>{REQUEST_SN}</REQUEST_SN><CUST_ID>{CUST_ID}</CUST_ID><USER_ID>{USER_ID}</USER_ID><PreplacedWORD>{PreplacedWORD}</PreplacedWORD><TX_CODE>{TX_CODE}</TX_CODE><LANGUAGE>{LANGUAGE}</LANGUAGE><TX_INFO><MONEY>{payModel.MONEY}</MONEY><ORDER>{payModel.ORDER}</ORDER><REFUND_CODE>{payModel.REFUND_CODE}</REFUND_CODE></TX_INFO><SIGN_INFO></SIGN_INFO><SIGNCERT></SIGNCERT></TX> ";

                //string sRequestMsg = readRequestFile("E:/02-外联平台/06-测试/测试报文/商户网银/客户端连接-5W1001-W06.txt");


                //注意:请求报文必须放在requestXml参数送
                sRequestMsg = "requestXml=" + sRequestMsg;

                _logger.LogInformation("请求地址:" + sUrl);
                _logger.LogInformation("请求报文:" + sRequestMsg);
                HttpWebRequest request = (System.Net.HttpWebRequest)HttpWebRequest.Create(sUrl);
                request.Method = "POST";

                request.ContentType = "application/x-www-form-urlencoded";
                request.KeepAlive = false;
                request.Connection = "";

                //外联平台使用GB18030编码,这里进行转码处理 
                byte[] byteRquest = Encoding.GetEncoding("GB18030").GetBytes(sRequestMsg);
                request.ContentLength = byteRquest.Length;

                //发送请求
                Stream writerStream = request.GetRequestStream();
                await writerStream.WriteAsync(byteRquest, 0, byteRquest.Length);
                writerStream.Flush();
                writerStream.Close();

                //接收请求
                HttpWebResponse response = (HttpWebResponse)request.GetResponse();
                Stream result = response.GetResponseStream();
                StreamReader readerResult = new StreamReader(result, System.Text.Encoding.GetEncoding("GB18030"));
                string sResult = await readerResult.ReadToEndAsync();
                _logger.LogInformation("响应报文:" + sResult);
                var Xmlresult = XmlHelper.ParseFormByXml<PayRefundReturnModel>(sResult, "TX");
                if (Xmlresult.RETURN_CODE.Equals("000000"))
                {
                    messageModel.success = true;
                    messageModel.msg = "退款成功";
                }
                else
                {
                    messageModel.success = false;
                    messageModel.msg = "退款失败";
                }
                messageModel.response.RETURN_MSG = Xmlresult.RETURN_MSG;
                messageModel.response.TX_CODE = Xmlresult.TX_CODE;
                messageModel.response.REQUEST_SN = Xmlresult.REQUEST_SN;
                messageModel.response.RETURN_CODE = Xmlresult.RETURN_CODE;
                messageModel.response.CUST_ID = Xmlresult.CUST_ID;
                messageModel.response.LANGUAGE = Xmlresult.LANGUAGE;

                messageModel.response.AMOUNT = Xmlresult.TX_INFO?.AMOUNT;
                messageModel.response.PAY_AMOUNT = Xmlresult.TX_INFO?.PAY_AMOUNT;
                messageModel.response.ORDER_NUM = Xmlresult.TX_INFO?.ORDER_NUM;
            }
            catch (Exception ex)
            {
                messageModel.success = false;
                messageModel.msg = "服务错误";
                messageModel.response.RETURN_MSG = ex.Message;
                _logger.LogInformation($"异常信息:{ex.Message}");
                _logger.LogInformation($"异常堆栈:{ex.StackTrace}");
            }
            finally
            {
                _logger.LogInformation($"返回数据->{JsonHelper.GetJSON<MessageModel<PayRefundReturnResultModel>>(messageModel)}");
                _logger.LogInformation("退款结束");
            }
            return messageModel;

        }

19 Source : ClippedStream.cs
with GNU General Public License v3.0
from anotak

public override void Flush()
		{
			// Flush base stream
			basestream.Flush();
		}

19 Source : WrappingStream.cs
with BSD 3-Clause "New" or "Revised" License
from anoyetta

public override void Flush() => this.m_streamBase?.Flush();

19 Source : StreamIStream.cs
with GNU General Public License v3.0
from anydream

public void Commit(int grfCommitFlags) {
			stream.Flush();
		}

19 Source : DeflaterOutputStream.cs
with GNU General Public License v3.0
from anydream

public virtual void Finish()
		{
			deflater_.Finish();
			while (!deflater_.IsFinished) {
				int len = deflater_.Deflate(buffer_, 0, buffer_.Length);
				if (len <= 0) {
					break;
				}

				if (cryptoTransform_ != null) {
					EncryptBlock(buffer_, 0, len);
				}

				baseOutputStream_.Write(buffer_, 0, len);
			}

			if (!deflater_.IsFinished) {
				throw new SharpZipBaseException("Can't deflate all input?");
			}

			baseOutputStream_.Flush();

			if (cryptoTransform_ != null) {
				if (cryptoTransform_ is ZipAESTransform) {
					AESAuthCode = ((ZipAESTransform)cryptoTransform_).GetAuthCode();
				}
				cryptoTransform_.Dispose();
				cryptoTransform_ = null;
			}
		}

19 Source : DeflaterOutputStream.cs
with GNU General Public License v3.0
from anydream

public override void Flush()
		{
			deflater_.Flush();
			Deflate();
			baseOutputStream_.Flush();
		}

19 Source : InflaterInputStream.cs
with GNU General Public License v3.0
from anydream

public override void Flush()
		{
			baseInputStream.Flush();
		}

19 Source : StreamUtils.cs
with GNU General Public License v3.0
from anydream

static public void Copy(Stream source, Stream destination, byte[] buffer)
		{
			if (source == null) {
				throw new ArgumentNullException(nameof(source));
			}

			if (destination == null) {
				throw new ArgumentNullException(nameof(destination));
			}

			if (buffer == null) {
				throw new ArgumentNullException(nameof(buffer));
			}

			// Ensure a reasonable size of buffer is used without being prohibitive.
			if (buffer.Length < 128) {
				throw new ArgumentException("Buffer is too small", nameof(buffer));
			}

			bool copying = true;

			while (copying) {
				int bytesRead = source.Read(buffer, 0, buffer.Length);
				if (bytesRead > 0) {
					destination.Write(buffer, 0, bytesRead);
				} else {
					destination.Flush();
					copying = false;
				}
			}
		}

19 Source : StreamUtils.cs
with GNU General Public License v3.0
from anydream

static public void Copy(Stream source, Stream destination,
			byte[] buffer,
			ProgressHandler progressHandler, TimeSpan updateInterval,
			object sender, string name, long fixedTarget)
		{
			if (source == null) {
				throw new ArgumentNullException(nameof(source));
			}

			if (destination == null) {
				throw new ArgumentNullException(nameof(destination));
			}

			if (buffer == null) {
				throw new ArgumentNullException(nameof(buffer));
			}

			// Ensure a reasonable size of buffer is used without being prohibitive.
			if (buffer.Length < 128) {
				throw new ArgumentException("Buffer is too small", nameof(buffer));
			}

			if (progressHandler == null) {
				throw new ArgumentNullException(nameof(progressHandler));
			}

			bool copying = true;

			DateTime marker = DateTime.Now;
			long processed = 0;
			long target = 0;

			if (fixedTarget >= 0) {
				target = fixedTarget;
			} else if (source.CanSeek) {
				target = source.Length - source.Position;
			}

			// Always fire 0% progress..
			var args = new ProgressEventArgs(name, processed, target);
			progressHandler(sender, args);

			bool progressFired = true;

			while (copying) {
				int bytesRead = source.Read(buffer, 0, buffer.Length);
				if (bytesRead > 0) {
					processed += bytesRead;
					progressFired = false;
					destination.Write(buffer, 0, bytesRead);
				} else {
					destination.Flush();
					copying = false;
				}

				if (DateTime.Now - marker > updateInterval) {
					progressFired = true;
					marker = DateTime.Now;
					args = new ProgressEventArgs(name, processed, target);
					progressHandler(sender, args);

					copying = args.ContinueRunning;
				}
			}

			if (!progressFired) {
				args = new ProgressEventArgs(name, processed, target);
				progressHandler(sender, args);
			}
		}

19 Source : ZipHelperStream.cs
with GNU General Public License v3.0
from anydream

public override void Flush()
		{
			stream_.Flush();
		}

See More Examples