scripts
This commit is contained in:
@@ -0,0 +1,123 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace System.Resources
|
||||
{
|
||||
// Token: 0x0200028A RID: 650
|
||||
internal class Win32ResFileReader
|
||||
{
|
||||
// Token: 0x060020D1 RID: 8401 RVA: 0x00078724 File Offset: 0x00076924
|
||||
public Win32ResFileReader(Stream s)
|
||||
{
|
||||
this.res_file = s;
|
||||
}
|
||||
|
||||
// Token: 0x060020D2 RID: 8402 RVA: 0x00078734 File Offset: 0x00076934
|
||||
private int read_int16()
|
||||
{
|
||||
int num = this.res_file.ReadByte();
|
||||
if (num == -1)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
int num2 = this.res_file.ReadByte();
|
||||
if (num2 == -1)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return num | (num2 << 8);
|
||||
}
|
||||
|
||||
// Token: 0x060020D3 RID: 8403 RVA: 0x00078770 File Offset: 0x00076970
|
||||
private int read_int32()
|
||||
{
|
||||
int num = this.read_int16();
|
||||
if (num == -1)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
int num2 = this.read_int16();
|
||||
if (num2 == -1)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return num | (num2 << 16);
|
||||
}
|
||||
|
||||
// Token: 0x060020D4 RID: 8404 RVA: 0x000787A4 File Offset: 0x000769A4
|
||||
private void read_padding()
|
||||
{
|
||||
while (this.res_file.Position % 4L != 0L)
|
||||
{
|
||||
this.read_int16();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060020D5 RID: 8405 RVA: 0x000787C8 File Offset: 0x000769C8
|
||||
private NameOrId read_ordinal()
|
||||
{
|
||||
int num = this.read_int16();
|
||||
if ((num & 65535) != 0)
|
||||
{
|
||||
int num2 = this.read_int16();
|
||||
return new NameOrId(num2);
|
||||
}
|
||||
byte[] array = new byte[16];
|
||||
int num3 = 0;
|
||||
for (;;)
|
||||
{
|
||||
int num4 = this.read_int16();
|
||||
if (num4 == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (num3 == array.Length)
|
||||
{
|
||||
byte[] array2 = new byte[array.Length * 2];
|
||||
Array.Copy(array, array2, array.Length);
|
||||
array = array2;
|
||||
}
|
||||
array[num3] = (byte)(num4 >> 8);
|
||||
array[num3 + 1] = (byte)(num4 & 255);
|
||||
num3 += 2;
|
||||
}
|
||||
return new NameOrId(new string(Encoding.Unicode.GetChars(array, 0, num3)));
|
||||
}
|
||||
|
||||
// Token: 0x060020D6 RID: 8406 RVA: 0x00078870 File Offset: 0x00076A70
|
||||
public ICollection ReadResources()
|
||||
{
|
||||
ArrayList arrayList = new ArrayList();
|
||||
for (;;)
|
||||
{
|
||||
this.read_padding();
|
||||
int num = this.read_int32();
|
||||
if (num == -1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
this.read_int32();
|
||||
NameOrId nameOrId = this.read_ordinal();
|
||||
NameOrId nameOrId2 = this.read_ordinal();
|
||||
this.read_padding();
|
||||
this.read_int32();
|
||||
this.read_int16();
|
||||
int num2 = this.read_int16();
|
||||
this.read_int32();
|
||||
this.read_int32();
|
||||
if (num != 0)
|
||||
{
|
||||
byte[] array = new byte[num];
|
||||
this.res_file.Read(array, 0, num);
|
||||
arrayList.Add(new Win32EncodedResource(nameOrId, nameOrId2, num2, array));
|
||||
}
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
// Token: 0x04000BB6 RID: 2998
|
||||
private Stream res_file;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user