mirror of
https://github.com/4sval/FModel.git
synced 2026-06-21 07:20:05 -05:00
added EnumType
This commit is contained in:
parent
1073daeede
commit
5e6b949ddc
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user