added EnumType

This commit is contained in:
iAmAsval 2020-10-31 13:32:36 +01:00
parent 1073daeede
commit 5e6b949ddc
6 changed files with 13 additions and 7 deletions

View File

@ -17,8 +17,7 @@ namespace FModel.Creator
{
if (ioStore.Chunks.TryGetValue(id.Id, out string path))
{
if (ioStore.Files.TryGetValue(ioStore.MountPoint + path.Substring(0, path.LastIndexOf(".")), out FIoStoreEntry value))
return ioStore.MountPoint + value.Name;
return ioStore.MountPoint + path;
}
}

View File

@ -19,7 +19,7 @@ namespace FModel.PakReader.IO
public FIoOffsetAndLength OffsetLength => ioStore.Toc[ChunkId];
public override long Offset => (long) OffsetLength.Offset;
public long Length => (long) OffsetLength.Length;
public string CompressionMethodString => ioStore.TocResource.CompressionMethods[CompressionMethodIndex > 0 ? CompressionMethodIndex - 1 : CompressionMethodIndex];
public string CompressionMethodString => CompressionMethodIndex > 0 ? ("COMPRESS_" + ioStore.TocResource.CompressionMethods[CompressionMethodIndex - 1]) : "COMPRESS_None";
public FIoStoreEntry(FFileIoStoreReader ioStore, uint userData, string name, bool caseSensitive)
{

View File

@ -13,17 +13,20 @@ namespace FModel.PakReader.IO
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string EnumName;
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string EnumType;
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string InnerType;
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string ValueType;
public PropertyInfo(string name, string type, string structType = null, bool? b = null, string enumName = null, string innerType = null, string valueType = null)
public PropertyInfo(string name, string type, string structType = null, bool? b = null, string enumName = null, string enumType = null, string innerType = null, string valueType = null)
{
Name = name;
Type = type;
StructType = structType;
Bool = b;
EnumName = enumName;
EnumType = enumType;
InnerType = innerType;
ValueType = valueType;
}

View File

@ -65,6 +65,7 @@ namespace FModel.PakReader.Parsers.Class
}
else
{
Dict[val.ToString()] = null;
if (!isNonZero)
{
// We are lucky: We don't know this property but it also has no content

View File

@ -8,6 +8,7 @@ namespace FModel.PakReader.Parsers.Objects
public readonly long Position;
public readonly byte BoolVal;
public readonly FName EnumName;
public readonly FName EnumType;
public readonly byte HasPropertyGuid;
public readonly FName InnerType;
public readonly FName Name;
@ -27,6 +28,7 @@ namespace FModel.PakReader.Parsers.Objects
StructName = new FName(info.StructType);
BoolVal = (byte) ((info.Bool ?? false) ? 1 : 0);
EnumName = new FName(info.EnumName);
EnumType = new FName(info.EnumType);
InnerType = new FName(info.InnerType);
ValueType = new FName(info.ValueType);
ArrayIndex = 0;
@ -43,6 +45,7 @@ namespace FModel.PakReader.Parsers.Objects
Position = 0; // default
BoolVal = 0;
EnumName = default;
EnumType = default;
HasPropertyGuid = 0;
InnerType = default;
Name = default;

View File

@ -14,7 +14,7 @@ namespace FModel.PakReader.Parsers.PropertyTagData
if (reader is IoPackageReader)
{
var byteValue = reader.ReadByte();
object byteValue = tag.EnumType.String == "IntProperty" ? reader.ReadInt32() : reader.ReadByte();
Value = new FName(ByteToEnum(tag.EnumName.String, byteValue));
}
else
@ -23,7 +23,7 @@ namespace FModel.PakReader.Parsers.PropertyTagData
}
}
private static string ByteToEnum(string enumName, byte value)
private static string ByteToEnum(string enumName, object value)
{
string result;
@ -32,7 +32,7 @@ namespace FModel.PakReader.Parsers.PropertyTagData
if (Globals.EnumMappings.TryGetValue(enumName, out var values))
{
result = values.TryGetValue(value, out var member) ? string.Concat(enumName, "::", member) : string.Concat(enumName, "::", value);
result = values.TryGetValue((int)value, out var member) ? string.Concat(enumName, "::", member) : string.Concat(enumName, "::", value);
}
else
{