mirror of
https://github.com/vxunderground/MalwareSourceCode.git
synced 2024-12-23 03:46:10 +00:00
64 lines
1.8 KiB
C#
64 lines
1.8 KiB
C#
|
// Decompiled with JetBrains decompiler
|
|||
|
// Type: SevenZip.Buffer.InBuffer
|
|||
|
// 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 InBuffer
|
|||
|
{
|
|||
|
private byte[] m_Buffer;
|
|||
|
private uint m_Pos;
|
|||
|
private uint m_Limit;
|
|||
|
private uint m_BufferSize;
|
|||
|
private Stream m_Stream;
|
|||
|
private bool m_StreamWasExhausted;
|
|||
|
private ulong m_ProcessedSize;
|
|||
|
|
|||
|
public InBuffer(uint bufferSize)
|
|||
|
{
|
|||
|
this.m_Buffer = new byte[(IntPtr) bufferSize];
|
|||
|
this.m_BufferSize = bufferSize;
|
|||
|
}
|
|||
|
|
|||
|
public void Init(Stream stream)
|
|||
|
{
|
|||
|
this.m_Stream = stream;
|
|||
|
this.m_ProcessedSize = 0UL;
|
|||
|
this.m_Limit = 0U;
|
|||
|
this.m_Pos = 0U;
|
|||
|
this.m_StreamWasExhausted = false;
|
|||
|
}
|
|||
|
|
|||
|
public bool ReadBlock()
|
|||
|
{
|
|||
|
if (this.m_StreamWasExhausted)
|
|||
|
return false;
|
|||
|
this.m_ProcessedSize += (ulong) this.m_Pos;
|
|||
|
int num = this.m_Stream.Read(this.m_Buffer, 0, (int) this.m_BufferSize);
|
|||
|
this.m_Pos = 0U;
|
|||
|
this.m_Limit = (uint) num;
|
|||
|
this.m_StreamWasExhausted = num == 0;
|
|||
|
return !this.m_StreamWasExhausted;
|
|||
|
}
|
|||
|
|
|||
|
public void ReleaseStream() => this.m_Stream = (Stream) null;
|
|||
|
|
|||
|
public bool ReadByte(byte b)
|
|||
|
{
|
|||
|
if (this.m_Pos >= this.m_Limit && !this.ReadBlock())
|
|||
|
return false;
|
|||
|
b = this.m_Buffer[(IntPtr) this.m_Pos++];
|
|||
|
return true;
|
|||
|
}
|
|||
|
|
|||
|
public byte ReadByte() => this.m_Pos >= this.m_Limit && !this.ReadBlock() ? byte.MaxValue : this.m_Buffer[(IntPtr) this.m_Pos++];
|
|||
|
|
|||
|
public ulong GetProcessedSize() => this.m_ProcessedSize + (ulong) this.m_Pos;
|
|||
|
}
|
|||
|
}
|