MalwareSourceCode/MSIL/Trojan-Ransom/Win32/G/Trojan-Ransom.Win32.Gimemo.ayt-7cb020d260d835f80919399a58563918f73757689e39ba851e89cc00a05535da/Buffer/OutBuffer.cs
2022-08-18 06:28:56 -05:00

59 lines
1.5 KiB
C#

// Decompiled with JetBrains decompiler
// Type: SevenZip.Buffer.OutBuffer
// Assembly: crypted, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: 316F25AB-9DC5-41B1-B1CB-0BB9D97AEA6A
// Assembly location: C:\Users\Administrateur\Downloads\Virusshare-00000-msil\Trojan-Ransom.Win32.Gimemo.ayt-7cb020d260d835f80919399a58563918f73757689e39ba851e89cc00a05535da.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;
}
}