Add Stream resource type
This commit is contained in:
parent
8521f7baac
commit
b7eb39203a
|
@ -109,6 +109,7 @@ namespace de4dot.code.resources {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ResourceTypeCode.ByteArray:
|
case ResourceTypeCode.ByteArray:
|
||||||
|
case ResourceTypeCode.Stream:
|
||||||
var ary = (byte[])data;
|
var ary = (byte[])data;
|
||||||
writer.Write(ary.Length);
|
writer.Write(ary.Length);
|
||||||
writer.Write(ary);
|
writer.Write(ary);
|
||||||
|
@ -143,6 +144,7 @@ namespace de4dot.code.resources {
|
||||||
return string.Format("{0}: '{1}'", code, data);
|
return string.Format("{0}: '{1}'", code, data);
|
||||||
|
|
||||||
case ResourceTypeCode.ByteArray:
|
case ResourceTypeCode.ByteArray:
|
||||||
|
case ResourceTypeCode.Stream:
|
||||||
var ary = data as byte[];
|
var ary = data as byte[];
|
||||||
if (ary != null)
|
if (ary != null)
|
||||||
return string.Format("{0}: Length: {1}", code, ary.Length);
|
return string.Format("{0}: Length: {1}", code, ary.Length);
|
||||||
|
|
|
@ -112,6 +112,10 @@ namespace de4dot.code.resources {
|
||||||
return new BuiltInResourceData(ResourceTypeCode.ByteArray, value);
|
return new BuiltInResourceData(ResourceTypeCode.ByteArray, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BuiltInResourceData CreateStream(byte[] value) {
|
||||||
|
return new BuiltInResourceData(ResourceTypeCode.Stream, value);
|
||||||
|
}
|
||||||
|
|
||||||
public CharArrayResourceData Create(char[] value) {
|
public CharArrayResourceData Create(char[] value) {
|
||||||
return new CharArrayResourceData(CreateUserResourceType(CharArrayResourceData.typeName), value);
|
return new CharArrayResourceData(CreateUserResourceType(CharArrayResourceData.typeName), value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,6 +139,7 @@ namespace de4dot.code.resources {
|
||||||
case ResourceTypeCode.DateTime: return resourceDataCreator.Create(new DateTime(reader.ReadInt64()));
|
case ResourceTypeCode.DateTime: return resourceDataCreator.Create(new DateTime(reader.ReadInt64()));
|
||||||
case ResourceTypeCode.TimeSpan: return resourceDataCreator.Create(new TimeSpan(reader.ReadInt64()));
|
case ResourceTypeCode.TimeSpan: return resourceDataCreator.Create(new TimeSpan(reader.ReadInt64()));
|
||||||
case ResourceTypeCode.ByteArray: return resourceDataCreator.Create(reader.ReadBytes(reader.ReadInt32()));
|
case ResourceTypeCode.ByteArray: return resourceDataCreator.Create(reader.ReadBytes(reader.ReadInt32()));
|
||||||
|
case ResourceTypeCode.Stream: return resourceDataCreator.CreateStream(reader.ReadBytes(reader.ReadInt32()));
|
||||||
default:
|
default:
|
||||||
int userTypeIndex = (int)(code - (uint)ResourceTypeCode.UserTypes);
|
int userTypeIndex = (int)(code - (uint)ResourceTypeCode.UserTypes);
|
||||||
if (userTypeIndex < 0 || userTypeIndex >= userTypes.Count)
|
if (userTypeIndex < 0 || userTypeIndex >= userTypes.Count)
|
||||||
|
|
|
@ -37,6 +37,7 @@ namespace de4dot.code.resources {
|
||||||
DateTime,
|
DateTime,
|
||||||
TimeSpan,
|
TimeSpan,
|
||||||
ByteArray = 0x20,
|
ByteArray = 0x20,
|
||||||
|
Stream = 0x21,
|
||||||
UserTypes = 0x40,
|
UserTypes = 0x40,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user