0.462.0.416719

This commit is contained in:
CloneTrooper1019
2021-01-20 14:45:58 -06:00
parent 1a34e9c849
commit 1acb895eaf
17 changed files with 63 additions and 70 deletions

View File

@ -57,9 +57,9 @@ namespace RobloxFiles
// internal BinaryWriter writer;
internal int ReadInt() => reader.ReadInt32();
internal byte readByte() => reader.ReadByte();
internal bool readBool() => reader.ReadBoolean();
internal short readShort() => reader.ReadInt16();
internal byte ReadByte() => reader.ReadByte();
internal bool ReadBool() => reader.ReadBoolean();
internal short ReadShort() => reader.ReadInt16();
internal float ReadFloat() => reader.ReadSingle();
internal double ReadDouble() => reader.ReadDouble();
internal string ReadString() => reader.ReadString(true);
@ -103,14 +103,13 @@ namespace RobloxFiles
switch (DataType)
{
//////////////////////////
case AttributeType.Null:
break;
case AttributeType.String:
Value = ReadString();
break;
case AttributeType.Bool:
Value = readBool();
Value = ReadBool();
break;
case AttributeType.Int:
Value = ReadInt();
@ -185,7 +184,7 @@ namespace RobloxFiles
Value = new Rect(this);
break;
case AttributeType.PhysicalProperties:
bool custom = readBool();
bool custom = ReadBool();
if (custom)
Value = new PhysicalProperties(this);
@ -197,9 +196,7 @@ namespace RobloxFiles
case AttributeType.Region3int16:
Value = new Region3int16(this);
break;
default:
throw new InvalidDataException($"Cannot handle AttributeType {DataType}!");
//////////////////////////
default: throw new InvalidDataException($"Cannot handle AttributeType {DataType}!");
}
reader = null;

View File

@ -18,6 +18,7 @@ namespace RobloxFiles
public Instance()
{
Name = ClassName;
RefreshProperties();
}
/// <summary>The ClassName of this Instance.</summary>
@ -506,12 +507,11 @@ namespace RobloxFiles
/// <param name="prop">A reference to the property that will be added.</param>
internal void AddProperty(ref Property prop)
{
string name = prop.Name;
RemoveProperty(name);
prop.Instance = this;
if (props.ContainsKey(prop.Name))
props.Remove(prop.Name);
props.Add(prop.Name, prop);
props.Add(name, prop);
}
/// <summary>

View File

@ -211,10 +211,7 @@ namespace RobloxFiles
}
else
{
if (!RobloxFile.LogErrors)
return false;
Console.Error.WriteLine($"RobloxFiles.Property - Property {Instance.ClassName}.{Name} does not exist!");
RobloxFile.LogError($"RobloxFiles.Property - Property {Instance.ClassName}.{Name} does not exist!");
}
}
}
@ -248,10 +245,7 @@ namespace RobloxFiles
}
catch
{
if (!RobloxFile.LogErrors)
return;
Console.Error.WriteLine($"RobloxFiles.Property - Failed to cast value {value} into property {Instance.ClassName}.{Name}");
RobloxFile.LogError($"RobloxFiles.Property - Failed to cast value {value} into property {Instance.ClassName}.{Name}");
}
}
else if (valueType != null)
@ -267,10 +261,7 @@ namespace RobloxFiles
}
catch
{
if (!RobloxFile.LogErrors)
return;
Console.Error.WriteLine($"RobloxFiles.Property - Failed to implicitly cast value {value} into property {Instance.ClassName}.{Name}");
RobloxFile.LogError($"RobloxFiles.Property - Failed to implicitly cast value {value} into property {Instance.ClassName}.{Name}");
}
}
}