Bringing up to date.

Brought everything up to date with 0.437.0.406875 and made some improvements.
This commit is contained in:
CloneTrooper1019 2020-06-21 20:02:36 -05:00
parent e5f6852e7a
commit 5f4d3e16d2
16 changed files with 12822 additions and 257 deletions

3
.gitignore vendored
View File

@ -328,3 +328,6 @@ ASALocalRun/
# MFractors (Xamarin productivity tool) working folder # MFractors (Xamarin productivity tool) working folder
.mfractor/ .mfractor/
# Library Test
RobloxFileFormat.exe

View File

@ -11,6 +11,10 @@ namespace RobloxFiles.DataTypes
return string.Join<ColorSequenceKeypoint>(" ", Keypoints); return string.Join<ColorSequenceKeypoint>(" ", Keypoints);
} }
public ColorSequence(float r, float g, float b) : this(new Color3(r, g, b))
{
}
public ColorSequence(Color3 c) : this(c, c) public ColorSequence(Color3 c) : this(c, c)
{ {
} }

View File

@ -1,5 +1,5 @@
// Auto-generated list of creatable Roblox classes. // Auto-generated list of creatable Roblox classes.
// Updated as of 0.415.0.373700 // Updated as of 0.437.0.406875
using System; using System;
@ -7,6 +7,8 @@ using RobloxFiles.DataTypes;
using RobloxFiles.Enums; using RobloxFiles.Enums;
using RobloxFiles.Utility; using RobloxFiles.Utility;
#pragma warning disable IDE1006 // Suppress warnings about camelCase.
namespace RobloxFiles namespace RobloxFiles
{ {
public class ABTestService : Instance public class ABTestService : Instance
@ -65,6 +67,14 @@ namespace RobloxFiles
{ {
} }
public class AssetManagerService : Instance
{
public AssetManagerService()
{
IsService = true;
}
}
public class AssetService : Instance public class AssetService : Instance
{ {
public AssetService() public AssetService()
@ -73,12 +83,26 @@ namespace RobloxFiles
} }
} }
public class Atmosphere : Instance
{
public Color3 Color = Color3.FromRGB(199, 170, 107);
public Color3 Decay = Color3.FromRGB(92, 60, 13);
public float Density = 0.395f;
public float Glare = 0;
public float Haze = 0;
public float Offset = 0;
}
public class Attachment : Instance public class Attachment : Instance
{ {
public CFrame CFrame = new CFrame(); public CFrame CFrame = new CFrame();
public bool Visible = false; public bool Visible = false;
} }
public class Bone : Attachment
{
}
public class Backpack : Instance public class Backpack : Instance
{ {
} }
@ -149,7 +173,7 @@ namespace RobloxFiles
{ {
public Attachment Attachment0 = null; public Attachment Attachment0 = null;
public Attachment Attachment1 = null; public Attachment Attachment1 = null;
public ColorSequence Color = new ColorSequence(new Color3(1, 1, 1)); public ColorSequence Color = new ColorSequence(1, 1, 1);
public float CurveSize0 = 0; public float CurveSize0 = 0;
public float CurveSize1 = 0; public float CurveSize1 = 0;
public bool Enabled = true; public bool Enabled = true;
@ -320,6 +344,14 @@ namespace RobloxFiles
} }
} }
public class BulkImportService : Instance
{
public BulkImportService()
{
IsService = true;
}
}
public abstract class CacheableContentProvider : Instance public abstract class CacheableContentProvider : Instance
{ {
public CacheableContentProvider() public CacheableContentProvider()
@ -530,12 +562,21 @@ namespace RobloxFiles
{ {
public Vector3 AngularVelocity_ = new Vector3(); public Vector3 AngularVelocity_ = new Vector3();
public float MaxTorque = 0; public float MaxTorque = 0;
public bool ReactionTorqueEnabled = false;
public ActuatorRelativeTo RelativeTo = ActuatorRelativeTo.World; public ActuatorRelativeTo RelativeTo = ActuatorRelativeTo.World;
} }
public class BallSocketConstraint : Constraint public class BallSocketConstraint : Constraint
{ {
public bool LimitsEnabled = false; public bool LimitsEnabled = false;
public float MaxFrictionTorque
{
get { return MaxFrictionTorqueXml; }
set { MaxFrictionTorqueXml = value; }
}
public float MaxFrictionTorqueXml = 0;
public float Radius = 0.15f; public float Radius = 0.15f;
public float Restitution = 0; public float Restitution = 0;
public bool TwistLimitsEnabled = false; public bool TwistLimitsEnabled = false;
@ -712,6 +753,7 @@ namespace RobloxFiles
public class CustomEvent : Instance public class CustomEvent : Instance
{ {
public float PersistedCurrentValue = 0;
} }
public class CustomEventReceiver : Instance public class CustomEventReceiver : Instance
@ -816,6 +858,14 @@ namespace RobloxFiles
{ {
} }
public class EventIngestService : Instance
{
public EventIngestService()
{
IsService = true;
}
}
public class Explosion : Instance public class Explosion : Instance
{ {
public float BlastPressure = 500000; public float BlastPressure = 500000;
@ -944,6 +994,7 @@ namespace RobloxFiles
public class FunctionalTest : Instance public class FunctionalTest : Instance
{ {
public string Description = "?"; public string Description = "?";
public bool HasMigratedSettingsToTestService = false;
} }
public class GamePassService : Instance public class GamePassService : Instance
@ -1115,6 +1166,17 @@ namespace RobloxFiles
public bool TextWrapped = false; public bool TextWrapped = false;
public TextXAlignment TextXAlignment = TextXAlignment.Center; public TextXAlignment TextXAlignment = TextXAlignment.Center;
public TextYAlignment TextYAlignment = TextYAlignment.Center; public TextYAlignment TextYAlignment = TextYAlignment.Center;
public new float Transparency
{
get { return base.Transparency; }
set
{
base.Transparency = value;
TextTransparency = value;
}
}
} }
public abstract class GuiLabel : GuiObject public abstract class GuiLabel : GuiObject
@ -1173,6 +1235,17 @@ namespace RobloxFiles
public bool TextWrapped = false; public bool TextWrapped = false;
public TextXAlignment TextXAlignment = TextXAlignment.Center; public TextXAlignment TextXAlignment = TextXAlignment.Center;
public TextYAlignment TextYAlignment = TextYAlignment.Center; public TextYAlignment TextYAlignment = TextYAlignment.Center;
public new float Transparency
{
get { return base.Transparency; }
set
{
base.Transparency = value;
TextTransparency = value;
}
}
} }
public class ScrollingFrame : GuiObject public class ScrollingFrame : GuiObject
@ -1196,7 +1269,6 @@ namespace RobloxFiles
public class TextBox : GuiObject public class TextBox : GuiObject
{ {
public bool ClearTextOnFocus = true; public bool ClearTextOnFocus = true;
public bool EnableRealtimeFilteringHints = false; // [Load-only]
public Font Font = Font.Legacy; public Font Font = Font.Legacy;
[Obsolete] [Obsolete]
@ -1207,12 +1279,9 @@ namespace RobloxFiles
} }
public float LineHeight = 1; public float LineHeight = 1;
public bool ManualFocusRelease = false; // [Load-only]
public bool MultiLine = false; public bool MultiLine = false;
public bool OverlayNativeInput = false; // [Load-only]
public Color3 PlaceholderColor3 = Color3.FromRGB(178, 178, 178); public Color3 PlaceholderColor3 = Color3.FromRGB(178, 178, 178);
public string PlaceholderText = ""; public string PlaceholderText = "";
public ReturnKeyType ReturnKeyType = ReturnKeyType.Default; // [Load-only]
public bool ShowNativeInput = true; public bool ShowNativeInput = true;
public string Text = "TextBox"; public string Text = "TextBox";
@ -1225,7 +1294,6 @@ namespace RobloxFiles
public Color3 TextColor3 = Color3.FromRGB(27, 42, 53); public Color3 TextColor3 = Color3.FromRGB(27, 42, 53);
public bool TextEditable = true; public bool TextEditable = true;
public TextInputType TextInputType = TextInputType.Default; // [Load-only]
public bool TextScaled = false; public bool TextScaled = false;
public float TextSize = 8; public float TextSize = 8;
public Color3 TextStrokeColor3 = new Color3(); public Color3 TextStrokeColor3 = new Color3();
@ -1243,6 +1311,17 @@ namespace RobloxFiles
public bool TextWrapped = false; public bool TextWrapped = false;
public TextXAlignment TextXAlignment = TextXAlignment.Center; public TextXAlignment TextXAlignment = TextXAlignment.Center;
public TextYAlignment TextYAlignment = TextYAlignment.Center; public TextYAlignment TextYAlignment = TextYAlignment.Center;
public new float Transparency
{
get { return base.Transparency; }
set
{
base.Transparency = value;
TextTransparency = value;
}
}
} }
public class VideoFrame : GuiObject public class VideoFrame : GuiObject
@ -1343,6 +1422,26 @@ namespace RobloxFiles
public float WireRadius = 0.0625f; public float WireRadius = 0.0625f;
} }
public abstract class InstanceAdornment : GuiBase3d
{
public Instance Adornee = null;
}
public class SelectionBox : InstanceAdornment
{
public float LineThickness = 0.15f;
[Obsolete]
public BrickColor SurfaceColor
{
get { return BrickColor.FromColor3(SurfaceColor3); }
set { SurfaceColor3 = value.Color; }
}
public Color3 SurfaceColor3 = Color3.FromRGB(13, 105, 172);
public float SurfaceTransparency = 1;
}
public abstract class PVAdornment : GuiBase3d public abstract class PVAdornment : GuiBase3d
{ {
public PVInstance Adornee = null; public PVInstance Adornee = null;
@ -1394,21 +1493,6 @@ namespace RobloxFiles
{ {
} }
public class SelectionBox : PVAdornment
{
public float LineThickness = 0.15f;
[Obsolete]
public BrickColor SurfaceColor
{
get { return BrickColor.FromColor3(SurfaceColor3); }
set { SurfaceColor3 = value.Color; }
}
public Color3 SurfaceColor3 = Color3.FromRGB(13, 105, 172);
public float SurfaceTransparency = 1;
}
public class SelectionSphere : PVAdornment public class SelectionSphere : PVAdornment
{ {
[Obsolete] [Obsolete]
@ -1472,7 +1556,6 @@ namespace RobloxFiles
public bool AutoSelectGuiEnabled = true; public bool AutoSelectGuiEnabled = true;
public bool CoreGuiNavigationEnabled = true; public bool CoreGuiNavigationEnabled = true;
public bool GuiNavigationEnabled = true; public bool GuiNavigationEnabled = true;
public GuiObject SelectedCoreObject = null;
public GuiObject SelectedObject = null; public GuiObject SelectedObject = null;
} }
@ -1510,6 +1593,7 @@ namespace RobloxFiles
public bool BreakJointsOnDeath = true; public bool BreakJointsOnDeath = true;
public HumanoidCollisionType CollisionType = HumanoidCollisionType.OuterBox; public HumanoidCollisionType CollisionType = HumanoidCollisionType.OuterBox;
public HumanoidDisplayDistanceType DisplayDistanceType = HumanoidDisplayDistanceType.Viewer; public HumanoidDisplayDistanceType DisplayDistanceType = HumanoidDisplayDistanceType.Viewer;
public string DisplayName = "";
public float Health public float Health
{ {
@ -1529,6 +1613,7 @@ namespace RobloxFiles
public float MaxSlopeAngle = 89; public float MaxSlopeAngle = 89;
public float NameDisplayDistance = 100; public float NameDisplayDistance = 100;
public NameOcclusion NameOcclusion = NameOcclusion.OccludeAll; public NameOcclusion NameOcclusion = NameOcclusion.OccludeAll;
public bool RequiresNeck = true;
public HumanoidRigType RigType = HumanoidRigType.R6; public HumanoidRigType RigType = HumanoidRigType.R6;
public bool UseJumpPower = true; public bool UseJumpPower = true;
public float WalkSpeed = 16; public float WalkSpeed = 16;
@ -1644,7 +1729,6 @@ namespace RobloxFiles
public class Motor : JointInstance public class Motor : JointInstance
{ {
public float CurrentAngle = 0; // [Load-only]
public float DesiredAngle = 0; public float DesiredAngle = 0;
public float MaxVelocity = 0; public float MaxVelocity = 0;
} }
@ -1714,6 +1798,14 @@ namespace RobloxFiles
} }
} }
public class LanguageService : Instance
{
public LanguageService()
{
IsService = true;
}
}
public abstract class Light : Instance public abstract class Light : Instance
{ {
public float Brightness = 1; public float Brightness = 1;
@ -1760,15 +1852,10 @@ namespace RobloxFiles
public float FogStart = 0; public float FogStart = 0;
public float GeographicLatitude = 41.7333f; public float GeographicLatitude = 41.7333f;
public bool GlobalShadows = true; public bool GlobalShadows = true;
public bool LegacyOutlines = false;
public Color3 OutdoorAmbient = Color3.FromRGB(128, 128, 128); public Color3 OutdoorAmbient = Color3.FromRGB(128, 128, 128);
[Obsolete] [Obsolete]
public bool Outlines public bool Outlines = false;
{
get { return LegacyOutlines; }
set { LegacyOutlines = value; }
}
[Obsolete] [Obsolete]
public Color3 ShadowColor = Color3.FromRGB(178, 178, 183); public Color3 ShadowColor = Color3.FromRGB(178, 178, 183);
@ -1786,6 +1873,14 @@ namespace RobloxFiles
} }
} }
public class AppStorageService : LocalStorageService
{
public AppStorageService()
{
IsService = true;
}
}
public class LocalizationService : Instance public class LocalizationService : Instance
{ {
public LocalizationService() public LocalizationService()
@ -1826,7 +1921,6 @@ namespace RobloxFiles
public abstract class BaseScript : LuaSourceContainer public abstract class BaseScript : LuaSourceContainer
{ {
public bool Disabled = false; public bool Disabled = false;
public Content LinkedSource = "";
} }
public class Script : BaseScript public class Script : BaseScript
@ -2082,7 +2176,6 @@ namespace RobloxFiles
public abstract class TriangleMeshPart : BasePart public abstract class TriangleMeshPart : BasePart
{ {
public CollisionFidelity CollisionFidelity = CollisionFidelity.Default; // [Load-only]
public Vector3 InitialSize = new Vector3(1, 1, 1); public Vector3 InitialSize = new Vector3(1, 1, 1);
public byte[] LODData = new byte[0]; public byte[] LODData = new byte[0];
public SharedString PhysicalConfigData = SharedString.FromBase64("1B2M2Y8AsgTpgAmY7PhCfg=="); public SharedString PhysicalConfigData = SharedString.FromBase64("1B2M2Y8AsgTpgAmY7PhCfg==");
@ -2091,6 +2184,8 @@ namespace RobloxFiles
public class MeshPart : TriangleMeshPart public class MeshPart : TriangleMeshPart
{ {
public bool HasSkinnedMesh = false;
[Obsolete] [Obsolete]
public Content MeshID public Content MeshID
{ {
@ -2110,6 +2205,7 @@ namespace RobloxFiles
public FormFactor FormFactor = FormFactor.Custom; public FormFactor FormFactor = FormFactor.Custom;
public byte[] MeshData = new byte[0]; public byte[] MeshData = new byte[0];
public RenderFidelity RenderFidelity = RenderFidelity.Precise; public RenderFidelity RenderFidelity = RenderFidelity.Precise;
public float SmoothingAngle = 0;
public bool UsePartColor = false; public bool UsePartColor = false;
} }
@ -2174,6 +2270,7 @@ namespace RobloxFiles
public int StreamingMinRadius = 64; public int StreamingMinRadius = 64;
public StreamingPauseMode StreamingPauseMode = StreamingPauseMode.Default; public StreamingPauseMode StreamingPauseMode = StreamingPauseMode.Default;
public int StreamingTargetRadius = 1024; public int StreamingTargetRadius = 1024;
public bool TemporaryLegacyPhysicsSolverOverrideStreaming = false;
public bool TerrainWeldsFixed = true; public bool TerrainWeldsFixed = true;
} }
@ -2184,16 +2281,8 @@ namespace RobloxFiles
public class PackageLink : Instance public class PackageLink : Instance
{ {
public bool AutoUpdate = false; public bool AutoUpdate = false;
public long OriginalHash = 0;
public Content PackageIdSerialize = ""; public Content PackageIdSerialize = "";
public string SymbolicLink = "";
public long VersionIdSerialize = 0; public long VersionIdSerialize = 0;
public long VersionNumber
{
get { return VersionIdSerialize; }
set { VersionIdSerialize = value; }
}
} }
public class PackageService : Instance public class PackageService : Instance
@ -2213,7 +2302,7 @@ namespace RobloxFiles
public class ParticleEmitter : Instance public class ParticleEmitter : Instance
{ {
public Vector3 Acceleration = new Vector3(); public Vector3 Acceleration = new Vector3();
public ColorSequence Color = new ColorSequence(new Color3(1, 1, 1)); public ColorSequence Color = new ColorSequence(1, 1, 1);
public float Drag = 0; public float Drag = 0;
public NormalId EmissionDirection = NormalId.Top; public NormalId EmissionDirection = NormalId.Top;
public bool Enabled = true; public bool Enabled = true;
@ -2252,6 +2341,14 @@ namespace RobloxFiles
public float EmptyCutoff = 0; public float EmptyCutoff = 0;
} }
public class PermissionsService : Instance
{
public PermissionsService()
{
IsService = true;
}
}
public class PhysicsService : Instance public class PhysicsService : Instance
{ {
public PhysicsService() public PhysicsService()
@ -2266,9 +2363,6 @@ namespace RobloxFiles
{ {
IsService = true; IsService = true;
} }
public bool PlayerEmulationEnabled = false; // [Load-only]
public string StudioEmulatedCountryRegionCode = ""; // [Load-only]
} }
public class Players : Instance public class Players : Instance
@ -2286,9 +2380,6 @@ namespace RobloxFiles
public class PluginAction : Instance public class PluginAction : Instance
{ {
public bool Checked = true; // [Load-only]
public string DefaultShortcut = ""; // [Load-only]
public bool Enabled = true; // [Load-only]
} }
public class PluginGuiService : Instance public class PluginGuiService : Instance
@ -2352,6 +2443,14 @@ namespace RobloxFiles
public Color3 TintColor = new Color3(1, 1, 1); public Color3 TintColor = new Color3(1, 1, 1);
} }
public class DepthOfFieldEffect : PostEffect
{
public float FarIntensity = 0.75f;
public float FocusDistance = 0.05f;
public float InFocusRadius = 10;
public float NearIntensity = 0.75f;
}
public class SunRaysEffect : PostEffect public class SunRaysEffect : PostEffect
{ {
public float Intensity = 0.25f; public float Intensity = 0.25f;
@ -2410,7 +2509,7 @@ namespace RobloxFiles
public class ReflectionMetadataClass : ReflectionMetadataItem public class ReflectionMetadataClass : ReflectionMetadataItem
{ {
public int ExplorerImageIndex = 0; public int ExplorerImageIndex = 0;
public int ExplorerOrder = 2147483647; public int ExplorerOrder = int.MaxValue;
public bool Insertable = true; public bool Insertable = true;
public string PreferredParent = ""; public string PreferredParent = "";
} }
@ -2464,6 +2563,14 @@ namespace RobloxFiles
} }
} }
public class ReplicatedScriptService : Instance
{
public ReplicatedScriptService()
{
IsService = true;
}
}
public class ReplicatedStorage : Instance public class ReplicatedStorage : Instance
{ {
public ReplicatedStorage() public ReplicatedStorage()
@ -2496,14 +2603,6 @@ namespace RobloxFiles
} }
} }
public class RuntimeScriptService : Instance
{
public RuntimeScriptService()
{
IsService = true;
}
}
public class ScriptContext : Instance public class ScriptContext : Instance
{ {
public ScriptContext() public ScriptContext()
@ -2546,6 +2645,14 @@ namespace RobloxFiles
} }
} }
public class SessionService : Instance
{
public SessionService()
{
IsService = true;
}
}
public class Sky : Instance public class Sky : Instance
{ {
public bool CelestialBodiesShown = true; public bool CelestialBodiesShown = true;
@ -2600,12 +2707,7 @@ namespace RobloxFiles
public class Sound : Instance public class Sound : Instance
{ {
public float EmitterSize public float EmitterSize = 10;
{
get { return xmlRead_MinDistance_3; }
set { xmlRead_MinDistance_3 = value; }
}
public bool Looped = false; public bool Looped = false;
public float MaxDistance public float MaxDistance
@ -2637,7 +2739,12 @@ namespace RobloxFiles
public double TimePosition = 0; public double TimePosition = 0;
public float Volume = 0.5f; public float Volume = 0.5f;
public float xmlRead_MaxDistance_3 = 10000; public float xmlRead_MaxDistance_3 = 10000;
public float xmlRead_MinDistance_3 = 10;
public float xmlRead_MinDistance_3
{
get { return EmitterSize; }
set { EmitterSize = value; }
}
} }
public abstract class SoundEffect : Instance public abstract class SoundEffect : Instance
@ -2827,7 +2934,12 @@ namespace RobloxFiles
IsService = true; IsService = true;
} }
public long CommitInflightAuthorId = 0;
public string CommitInflightGuid = "";
public int CommitInflightPlaceVersion = 0;
public bool EnableScriptCollabByDefaultOnLoad = false;
public bool EnableScriptCollabOnLoad = false; public bool EnableScriptCollabOnLoad = false;
public bool EnableScriptCollabVersionHistoryOnLoad = false;
public long SrcPlaceId = 0; public long SrcPlaceId = 0;
public long SrcUniverseId = 0; public long SrcUniverseId = 0;
} }
@ -2838,8 +2950,16 @@ namespace RobloxFiles
{ {
IsService = true; IsService = true;
} }
}
public bool UseLocalSpace = true; // [Load-only] public class SurfaceAppearance : Instance
{
public AlphaMode AlphaMode = AlphaMode.Overlay;
public Content ColorMap = "";
public Content MetalnessMap = "";
public Content NormalMap = "";
public Content RoughnessMap = "";
public Content TexturePack = "";
} }
public class Team : Instance public class Team : Instance
@ -2928,7 +3048,7 @@ namespace RobloxFiles
{ {
public Attachment Attachment0 = null; public Attachment Attachment0 = null;
public Attachment Attachment1 = null; public Attachment Attachment1 = null;
public ColorSequence Color = new ColorSequence(new Color3(1, 1, 1)); public ColorSequence Color = new ColorSequence(1, 1, 1);
public bool Enabled = true; public bool Enabled = true;
public bool FaceCamera = false; public bool FaceCamera = false;
public float Lifetime = 2; public float Lifetime = 2;
@ -2998,9 +3118,15 @@ namespace RobloxFiles
public int MinTextSize = 1; public int MinTextSize = 1;
} }
public class UICorner : UIComponent
{
public UDim CornerRadius = new UDim(0, 8);
}
public class UIGradient : UIComponent public class UIGradient : UIComponent
{ {
public ColorSequence Color = new ColorSequence(new Color3(1, 1, 1)); public ColorSequence Color = new ColorSequence(1, 1, 1);
public bool Enabled = true;
public Vector2 Offset = new Vector2(); public Vector2 Offset = new Vector2();
public float Rotation = 0; public float Rotation = 0;
public NumberSequence Transparency = new NumberSequence(0); public NumberSequence Transparency = new NumberSequence(0);
@ -3080,10 +3206,17 @@ namespace RobloxFiles
public bool LegacyInputEventsEnabled = true; public bool LegacyInputEventsEnabled = true;
public MouseBehavior MouseBehavior = MouseBehavior.Default; public MouseBehavior MouseBehavior = MouseBehavior.Default;
public float MouseDeltaSensitivity = 1; // [Load-only]
public bool MouseIconEnabled = true; public bool MouseIconEnabled = true;
} }
public class UserService : Instance
{
public UserService()
{
IsService = true;
}
}
public class VRService : Instance public class VRService : Instance
{ {
public VRService() public VRService()
@ -3125,26 +3258,40 @@ namespace RobloxFiles
{ {
public double ConstrainedValue public double ConstrainedValue
{ {
get { return Value; } get { return value; }
set { Value = value; } set { this.value = value; }
} }
public double MaxValue = 1; public double MaxValue = 1;
public double MinValue = 0; public double MinValue = 0;
public double Value = 0; // [Load-only]
public double Value
{
get { return value; }
set { this.value = value; }
}
public double value = 0;
} }
public class IntConstrainedValue : ValueBase public class IntConstrainedValue : ValueBase
{ {
public long ConstrainedValue public long ConstrainedValue
{ {
get { return Value; } get { return value; }
set { Value = value; } set { this.value = value; }
} }
public long MaxValue = 10; public long MaxValue = 10;
public long MinValue = 0; public long MinValue = 0;
public long Value = 0; // [Load-only]
public long Value
{
get { return value; }
set { this.value = value; }
}
public long value = 0;
} }
public class IntValue : ValueBase public class IntValue : ValueBase
@ -3191,8 +3338,6 @@ namespace RobloxFiles
{ {
IsService = true; IsService = true;
} }
public string AdditionalLuaState = ""; // [Load-only]
} }
public class VirtualUser : Instance public class VirtualUser : Instance

View File

@ -1,8 +1,18 @@
// Auto-generated list of Roblox enums. // Auto-generated list of Roblox enums.
// Updated as of 0.415.0.373700 // Updated as of 0.437.0.406875
namespace RobloxFiles.Enums namespace RobloxFiles.Enums
{ {
public enum ABTestLoadingStatus
{
None,
Pending,
Initialized,
Error,
TimedOut,
ShutOff
}
public enum ActionType public enum ActionType
{ {
Nothing, Nothing,
@ -32,6 +42,12 @@ namespace RobloxFiles.Enums
Perpendicular Perpendicular
} }
public enum AlphaMode
{
Overlay,
Transparency
}
public enum AnimationPriority public enum AnimationPriority
{ {
Idle, Idle,
@ -112,7 +128,15 @@ namespace RobloxFiles.Enums
PoseAnimation, PoseAnimation,
EarAccessory, EarAccessory,
EyeAccessory, EyeAccessory,
EmoteAnimation = 61 EmoteAnimation = 61,
Video
}
public enum AutoIndentRule
{
Off,
Absolute,
Relative
} }
public enum AvatarContextMenuOption public enum AvatarContextMenuOption
@ -191,6 +215,12 @@ namespace RobloxFiles.Enums
UserBreakpoint UserBreakpoint
} }
public enum BulkMoveMode
{
FireAllEvents,
FireCFrameChanged
}
public enum Button public enum Button
{ {
Dismount = 8, Dismount = 8,
@ -318,7 +348,8 @@ namespace RobloxFiles.Enums
{ {
Default, Default,
Hull, Hull,
Box Box,
PreciseConvexDecomposition
} }
public enum ComputerCameraMovementMode public enum ComputerCameraMovementMode
@ -458,12 +489,6 @@ namespace RobloxFiles.Enums
OnUpdate OnUpdate
} }
public enum DateTimeKind
{
Utc,
Local
}
public enum DevCameraOcclusionMode public enum DevCameraOcclusionMode
{ {
Zoom, Zoom,
@ -570,7 +595,8 @@ namespace RobloxFiles.Enums
{ {
OK, OK,
DraftOutdated, DraftOutdated,
ScriptRemoved ScriptRemoved,
DraftCommitted
} }
public enum EasingDirection public enum EasingDirection
@ -833,6 +859,7 @@ namespace RobloxFiles.Enums
NetFail, NetFail,
Aborted, Aborted,
SslConnectFail, SslConnectFail,
SslVerificationFail,
Unknown Unknown
} }
@ -894,6 +921,13 @@ namespace RobloxFiles.Enums
None = 18 None = 18
} }
public enum IKCollisionsMode
{
NoCollisions,
OtherMechanismsAnchored,
IncludeContactedMechanisms
}
public enum InOut public enum InOut
{ {
Edge, Edge,
@ -1213,7 +1247,8 @@ namespace RobloxFiles.Enums
{ {
SystemDefault, SystemDefault,
English, English,
SimplifiedChinese SimplifiedChinese,
Korean
} }
public enum LeftRight public enum LeftRight
@ -1430,6 +1465,13 @@ namespace RobloxFiles.Enums
Roblox Roblox
} }
public enum PhysicsSimulationRate
{
Fixed240Hz,
Fixed120Hz,
Fixed60Hz
}
public enum Platform public enum Platform
{ {
Windows, Windows,
@ -1543,6 +1585,12 @@ namespace RobloxFiles.Enums
InnerBox InnerBox
} }
public enum RaycastFilterType
{
Blacklist,
Whitelist
}
public enum RenderFidelity public enum RenderFidelity
{ {
Automatic, Automatic,
@ -1830,6 +1878,8 @@ namespace RobloxFiles.Enums
ScriptBuiltInFunction, ScriptBuiltInFunction,
ScriptWarning, ScriptWarning,
ScriptError, ScriptError,
ScriptWhitespace,
ScriptRuler,
DebuggerCurrentLine, DebuggerCurrentLine,
DebuggerErrorLine, DebuggerErrorLine,
DiffFilePathText, DiffFilePathText,
@ -1862,10 +1912,7 @@ namespace RobloxFiles.Enums
DialogButtonText, DialogButtonText,
DialogButtonBorder, DialogButtonBorder,
DialogMainButton, DialogMainButton,
DialogMainButtonText, DialogMainButtonText
Merge3HighlightOriginal,
Merge3HighlightMine,
Merge3HighlightTheirs
} }
public enum StudioStyleGuideModifier public enum StudioStyleGuideModifier
@ -1932,7 +1979,8 @@ namespace RobloxFiles.Enums
Legacy, Legacy,
Voxel, Voxel,
Compatibility, Compatibility,
ShadowMap ShadowMap,
Future
} }
public enum TeleportResult public enum TeleportResult

BIN
LibTest/Binary.rbxl Normal file

Binary file not shown.

18
LibTest/Program.cs Normal file
View File

@ -0,0 +1,18 @@
using System;
using System.Diagnostics;
namespace RobloxFiles
{
internal static class Program
{
[STAThread]
static void Main(string[] args)
{
RobloxFile bin = RobloxFile.Open(@"LibTest\Binary.rbxl");
Debugger.Break();
RobloxFile xml = RobloxFile.Open(@"LibTest\Xml.rbxlx");
Debugger.Break();
}
}
}

12249
LibTest/Xml.rbxlx Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -18,8 +18,14 @@ function Format.String(value)
end end
function Format.Int(value) function Format.Int(value)
if value == 2147483647 then
return "int.MaxValue"
elseif value == -2147483648 then
return "int.MinValue"
else
return string.format("%i", value) return string.format("%i", value)
end end
end
function Format.Number(value) function Format.Number(value)
local int = math.floor(value) local int = math.floor(value)
@ -238,7 +244,7 @@ function Format.ColorSequence(cs)
local csKey = cs.Keypoints[1] local csKey = cs.Keypoints[1]
local fmt = "new ColorSequence(%s)" local fmt = "new ColorSequence(%s)"
local value = Format.Color3(csKey.Value) local value = tostring(csKey.Value)
return fmt:format(value) return fmt:format(value)
end end

View File

@ -8,6 +8,8 @@ end
local GuiTextMixIn = local GuiTextMixIn =
{ {
Add = { Transparency = "float" };
Redirect = Redirect =
{ {
FontSize = FontSize =
@ -18,41 +20,44 @@ local GuiTextMixIn =
TextColor = UseColor3("TextColor3"); TextColor = UseColor3("TextColor3");
TextWrap = "TextWrapped"; TextWrap = "TextWrapped";
Transparency =
{
Get = "base.Transparency";
Set = "base.Transparency = value;\n" ..
"TextTransparency = value;";
Flag = "new";
}
}; };
} }
return return
{ {
Accoutrement =
{
Remove =
{
"AttachmentUp";
"AttachmentPos";
"AttachmentRight";
"AttachmentForward";
};
};
AnalyticsService = AnalyticsService =
{ {
Defaults = { ApiKey = "" } Defaults = { ApiKey = "" }
}; };
Attachment = BallSocketConstraint =
{ {
Remove = -- Why does this even exist?
Add =
{ {
"Axis"; MaxFrictionTorque = "float";
"Orientation"; MaxFrictionTorqueXml = "float";
"Position";
"SecondaryAxis";
"WorldAxis";
"WorldCFrame";
"WorldOrientation";
"WorldPosition";
"WorldSecondaryAxis";
}; };
Defaults =
{
MaxFrictionTorqueXml = 0;
};
Redirect =
{
MaxFrictionTorque = "MaxFrictionTorqueXml";
}
}; };
BasePart = BasePart =
@ -84,6 +89,11 @@ return
} }
}; };
BaseScript =
{
Remove = {"LinkedSource"};
};
BevelMesh = BevelMesh =
{ {
Add = Add =
@ -137,11 +147,22 @@ return
Redirect = { cframe = "CFrame" }; Redirect = { cframe = "CFrame" };
}; };
Bone =
{
Remove = {"Transform"}
};
Camera = Camera =
{ {
Redirect = { CoordinateFrame = "CFrame" } Redirect = { CoordinateFrame = "CFrame" }
}; };
CustomEvent =
{
Add = { PersistedCurrentValue = "float"; };
Defaults = { PersistedCurrentValue = 0; };
};
DataModelMesh = DataModelMesh =
{ {
Add = Add =
@ -173,7 +194,14 @@ return
DoubleConstrainedValue = DoubleConstrainedValue =
{ {
Redirect = { ConstrainedValue = "Value" } Add = { value = "double" };
Defaults = { value = 0.0 };
Redirect =
{
Value = "value";
ConstrainedValue = "value";
}
}; };
Fire = Fire =
@ -215,6 +243,12 @@ return
}; };
}; };
FunctionalTest =
{
Add = { HasMigratedSettingsToTestService = "bool"; };
Defaults = { HasMigratedSettingsToTestService = false; };
};
GuiBase2d = GuiBase2d =
{ {
Redirect = { Localize = "AutoLocalize" } Redirect = { Localize = "AutoLocalize" }
@ -293,7 +327,14 @@ return
IntConstrainedValue = IntConstrainedValue =
{ {
Redirect = { ConstrainedValue = "Value" } Add = { value = "int64" };
Defaults = { value = 0; };
Redirect =
{
Value = "value";
ConstrainedValue = "value";
}
}; };
JointInstance = JointInstance =
@ -311,30 +352,8 @@ return
Defaults = Defaults =
{ {
LegacyOutlines = false;
Technology = Enum.Technology.Compatibility; Technology = Enum.Technology.Compatibility;
}; };
Redirect =
{
Outlines = "LegacyOutlines";
};
Remove =
{
"ClockTime";
};
};
LocalizationService =
{
Remove =
{
"ForcePlayModeGameLocaleId";
"ForcePlayModeRobloxLocaleId";
"RobloxForcePlayModeGameLocaleId";
"RobloxForcePlayModeRobloxLocaleId";
}
}; };
LocalizationTable = LocalizationTable =
@ -409,18 +428,10 @@ return
} }
}; };
NotificationService =
{
Remove = {"SelectedTheme"}
};
PackageLink = PackageLink =
{ {
Add = Add =
{ {
OriginalHash = "int64";
SymbolicLink = "string";
VersionIdSerialize = "int64"; VersionIdSerialize = "int64";
PackageIdSerialize = "Content"; PackageIdSerialize = "Content";
}; };
@ -429,17 +440,9 @@ return
{ {
AutoUpdate = false; AutoUpdate = false;
OriginalHash = 0;
SymbolicLink = "";
VersionIdSerialize = 0; VersionIdSerialize = 0;
PackageIdSerialize = ""; PackageIdSerialize = "";
}; };
Redirect =
{
VersionNumber = "VersionIdSerialize";
};
}; };
Part = Part =
@ -503,20 +506,6 @@ return
} }
}; };
RenderingTest =
{
Remove =
{
"Position";
"Orientation";
};
};
ScriptContext =
{
Remove = { "ScriptsDisabled" }
};
SelectionBox = SelectionBox =
{ {
Redirect = { SurfaceColor = UseColor3("SurfaceColor3") } Redirect = { SurfaceColor = UseColor3("SurfaceColor3") }
@ -583,8 +572,8 @@ return
Redirect = Redirect =
{ {
EmitterSize = "xmlRead_MinDistance_3";
MaxDistance = "xmlRead_MaxDistance_3"; MaxDistance = "xmlRead_MaxDistance_3";
xmlRead_MinDistance_3 = "EmitterSize";
MinDistance = "EmitterSize"; MinDistance = "EmitterSize";
Pitch = "PlaybackSpeed"; Pitch = "PlaybackSpeed";
@ -598,13 +587,29 @@ return
StudioData = StudioData =
{ {
Add =
{
CommitInflightAuthorId = "int64";
CommitInflightGuid = "string";
CommitInflightPlaceVersion = "int";
};
Defaults = Defaults =
{ {
CommitInflightAuthorId = 0;
CommitInflightGuid = "";
CommitInflightPlaceVersion = 0;
SrcPlaceId = 0; SrcPlaceId = 0;
SrcUniverseId = 0; SrcUniverseId = 0;
}; };
}; };
SurfaceAppearance =
{
Defaults = { AlphaMode = Enum.AlphaMode.Overlay }
};
TextBox = GuiTextMixIn; TextBox = GuiTextMixIn;
TextLabel = GuiTextMixIn; TextLabel = GuiTextMixIn;
TextButton = GuiTextMixIn; TextButton = GuiTextMixIn;
@ -656,17 +661,6 @@ return
}; };
}; };
Tool =
{
Remove =
{
"GripForward";
"GripPos";
"GripRight";
"GripUp";
};
};
TriangleMeshPart = TriangleMeshPart =
{ {
Add = Add =
@ -705,8 +699,6 @@ return
CameraCFrame = CFrame.new(); CameraCFrame = CFrame.new();
CameraFieldOfView = 70; CameraFieldOfView = 70;
}; };
Remove = {"CurrentCamera"};
}; };
WeldConstraint = WeldConstraint =
@ -748,6 +740,7 @@ return
StreamingPauseMode = "Enum:StreamingPauseMode"; StreamingPauseMode = "Enum:StreamingPauseMode";
TerrainWeldsFixed = "bool"; TerrainWeldsFixed = "bool";
TemporaryLegacyPhysicsSolverOverrideStreaming = "bool";
}; };
Defaults = Defaults =
@ -760,6 +753,7 @@ return
StreamingPauseMode = Enum.StreamingPauseMode.Default; StreamingPauseMode = Enum.StreamingPauseMode.Default;
TerrainWeldsFixed = true; TerrainWeldsFixed = true;
TemporaryLegacyPhysicsSolverOverrideStreaming = false;
} }
} }
} }

View File

@ -324,6 +324,9 @@ local function generateClasses()
writeLine("using RobloxFiles.Utility;") writeLine("using RobloxFiles.Utility;")
writeLine() writeLine()
writeLine("#pragma warning disable IDE1006 // Suppress warnings about camelCase.")
writeLine()
writeLine("namespace RobloxFiles") writeLine("namespace RobloxFiles")
openStack() openStack()
@ -401,28 +404,23 @@ local function generateClasses()
writeLine("IsService = true;") writeLine("IsService = true;")
closeStack() closeStack()
for i, propName in ipairs(propNames) do
local prop = propMap[propName]
local serial = prop.Serialization
if serial.CanLoad then
writeLine()
break
end
end
end end
for i, propName in ipairs(propNames) do for i, propName in ipairs(propNames) do
local prop = propMap[propName] local prop = propMap[propName]
local propTags = getTags(prop)
local serial = prop.Serialization local serial = prop.Serialization
local valueType = prop.ValueType.Name local valueType = prop.ValueType.Name
if serial.CanLoad then
local propTags = getTags(prop)
local redirect = redirectProps[propName] local redirect = redirectProps[propName]
local couldSave = (serial.CanSave or propTags.Deprecated or redirect)
if serial.CanLoad and couldSave then
if firstLine and classTags.Service then
writeLine()
end
local name = propName local name = propName
local default = "" local default = ""
@ -446,14 +444,19 @@ local function generateClasses()
end end
if redirect then if redirect then
local get, set local get, set, flag
if typeof(redirect) == "string" then if typeof(redirect) == "string" then
get = redirect get = redirect
set = redirect .. " = value" set = redirect .. " = value"
if redirect == "value" then
set = "this." .. set
end
else else
get = redirect.Get get = redirect.Get
set = redirect.Set set = redirect.Set
flag = redirect.Flag
end end
if not firstLine and set then if not firstLine and set then
@ -465,11 +468,30 @@ local function generateClasses()
end end
if set then if set then
if flag then
writeLine("public %s %s %s", flag, valueType, name)
else
writeLine("public %s %s", valueType, name) writeLine("public %s %s", valueType, name)
end
openStack() openStack()
writeLine("get { return %s; }", get) writeLine("get { return %s; }", get)
if set:find('\n') then
writeLine()
writeLine("set")
openStack()
for line in set:gmatch("[^\r\n]+") do
writeLine(line)
end
closeStack()
else
writeLine("set { %s; }", set) writeLine("set { %s; }", set)
end
closeStack() closeStack()
else else
writeLine("public %s %s => %s;", valueType, name, get) writeLine("public %s %s => %s;", valueType, name, get)
@ -512,13 +534,8 @@ local function generateClasses()
result = formatFunc(value) result = formatFunc(value)
end end
if not serial.CanSave and not propTags.Deprecated then
comment = " // [Load-only]"
else
comment = ""
end
default = " = " .. result default = " = " .. result
comment = ""
end end
if propTags.Deprecated then if propTags.Deprecated then

View File

@ -87,6 +87,7 @@
<Compile Include="Interfaces\IBinaryFileChunk.cs" /> <Compile Include="Interfaces\IBinaryFileChunk.cs" />
<Compile Include="Generated\Classes.cs" /> <Compile Include="Generated\Classes.cs" />
<Compile Include="Generated\Enums.cs" /> <Compile Include="Generated\Enums.cs" />
<Compile Include="LibTest\Program.cs" />
<Compile Include="Tree\Attributes.cs" /> <Compile Include="Tree\Attributes.cs" />
<Compile Include="Tree\Property.cs" /> <Compile Include="Tree\Property.cs" />
<Compile Include="Tree\Instance.cs" /> <Compile Include="Tree\Instance.cs" />
@ -114,6 +115,7 @@
<Compile Include="DataTypes\Vector3.cs" /> <Compile Include="DataTypes\Vector3.cs" />
<Compile Include="Utility\Formatting.cs" /> <Compile Include="Utility\Formatting.cs" />
<Compile Include="Utility\FontUtility.cs" /> <Compile Include="Utility\FontUtility.cs" />
<Compile Include="Utility\ImplicitMember.cs" />
<Compile Include="Utility\MaterialInfo.cs" /> <Compile Include="Utility\MaterialInfo.cs" />
<Compile Include="DataTypes\Quaternion.cs" /> <Compile Include="DataTypes\Quaternion.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
@ -164,6 +166,12 @@
</BootstrapperPackage> </BootstrapperPackage>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="LibTest\Binary.rbxl">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="LibTest\Xml.rbxlx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

Binary file not shown.

View File

@ -1,7 +1,7 @@
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14 # Visual Studio Version 16
VisualStudioVersion = 14.0.25420.1 VisualStudioVersion = 16.0.29920.165
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RobloxFileFormat", "RobloxFileFormat.csproj", "{CF50C0E2-23A7-4DC1-B4B2-E60CDE716253}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RobloxFileFormat", "RobloxFileFormat.csproj", "{CF50C0E2-23A7-4DC1-B4B2-E60CDE716253}"
EndProject EndProject
@ -19,4 +19,7 @@ Global
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C024FBF2-2DCC-4AFD-B6D9-68E1AD3CF00A}
EndGlobalSection
EndGlobal EndGlobal

View File

@ -1,11 +1,14 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection; using System.Reflection;
using RobloxFiles.BinaryFormat; using RobloxFiles.BinaryFormat;
using RobloxFiles.BinaryFormat.Chunks; using RobloxFiles.BinaryFormat.Chunks;
using RobloxFiles.DataTypes; using RobloxFiles.DataTypes;
using RobloxFiles.Utility;
namespace RobloxFiles namespace RobloxFiles
{ {
@ -55,8 +58,9 @@ namespace RobloxFiles
internal BinaryRobloxFileWriter CurrentWriter; internal BinaryRobloxFileWriter CurrentWriter;
internal static BindingFlags BindingFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy | BindingFlags.IgnoreCase; internal static BindingFlags BindingFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy | BindingFlags.IgnoreCase;
internal static MemberTypes FieldOrProperty = MemberTypes.Field | MemberTypes.Property;
public static IReadOnlyDictionary<Type, PropertyType> Types = new Dictionary<Type, PropertyType>() public static readonly IReadOnlyDictionary<Type, PropertyType> Types = new Dictionary<Type, PropertyType>()
{ {
{ typeof(Axes), PropertyType.Axes }, { typeof(Axes), PropertyType.Axes },
{ typeof(Faces), PropertyType.Faces }, { typeof(Faces), PropertyType.Faces },
@ -78,17 +82,17 @@ namespace RobloxFiles
{ typeof(Vector2), PropertyType.Vector2 }, { typeof(Vector2), PropertyType.Vector2 },
{ typeof(Vector3), PropertyType.Vector3 }, { typeof(Vector3), PropertyType.Vector3 },
{ typeof(BrickColor), PropertyType.BrickColor }, { typeof(BrickColor), PropertyType.BrickColor },
{ typeof(Quaternion), PropertyType.Quaternion }, { typeof(Quaternion), PropertyType.Quaternion },
{ typeof(Color3uint8), PropertyType.Color3uint8 }, { typeof(Color3uint8), PropertyType.Color3uint8 },
{ typeof(NumberRange), PropertyType.NumberRange }, { typeof(NumberRange), PropertyType.NumberRange },
{ typeof(SharedString), PropertyType.SharedString }, { typeof(SharedString), PropertyType.SharedString },
{ typeof(Vector3int16), PropertyType.Vector3int16 }, { typeof(Vector3int16), PropertyType.Vector3int16 },
{ typeof(ColorSequence), PropertyType.ColorSequence }, { typeof(ColorSequence), PropertyType.ColorSequence },
{ typeof(NumberSequence), PropertyType.NumberSequence }, { typeof(NumberSequence), PropertyType.NumberSequence },
{ typeof(ProtectedString), PropertyType.String },
{ typeof(ProtectedString), PropertyType.String },
{ typeof(PhysicalProperties), PropertyType.PhysicalProperties }, { typeof(PhysicalProperties), PropertyType.PhysicalProperties },
}; };
@ -166,24 +170,19 @@ namespace RobloxFiles
byte[] data = Instance.SerializedTags; byte[] data = Instance.SerializedTags;
RawValue = data; RawValue = data;
} }
else if (Name == "AttributesSerialize")
{
byte[] data = Instance.AttributesSerialize;
RawValue = data;
}
else else
{ {
FieldInfo field = Instance.GetType() var type = Instance.GetType();
.GetField(ImplicitName, BindingFlags); var member = ImplicitMember.Get(type, ImplicitName);
if (field != null) if (member != null)
{ {
object value = field.GetValue(Instance); object value = member.GetValue(Instance);
RawValue = value; RawValue = value;
} }
else else
{ {
Console.WriteLine($"RobloxFiles.Property - No defined field for {Instance.ClassName}.{Name}"); Console.Error.WriteLine($"RobloxFiles.Property - No defined member for {Instance.ClassName}.{Name}");
} }
} }
} }
@ -199,49 +198,41 @@ namespace RobloxFiles
byte[] data = value as byte[]; byte[] data = value as byte[];
Instance.SerializedTags = data; Instance.SerializedTags = data;
} }
else if (Name == "AttributesSerialize" && value is byte[])
{
byte[] data = value as byte[];
Instance.AttributesSerialize = data;
}
else else
{ {
FieldInfo field = Instance.GetType() var type = Instance.GetType();
.GetField(ImplicitName, BindingFlags); var member = ImplicitMember.Get(type, ImplicitName);
if (field != null) if (member != null)
{ {
Type fieldType = field.FieldType; var valueType = value?.GetType();
Type valueType = value?.GetType(); Type memberType = member.MemberType;
if (fieldType == valueType || value == null) if (memberType == valueType || value == null)
{ {
try try
{ {
field.SetValue(Instance, value); member.SetValue(Instance, value);
} }
catch catch
{ {
Console.WriteLine($"RobloxFiles.Property - Failed to cast value {value} into property {Instance.ClassName}.{Name}"); Console.Error.WriteLine($"RobloxFiles.Property - Failed to cast value {value} into property {Instance.ClassName}.{Name}");
} }
} }
else if (valueType != null) else if (valueType != null)
{ {
var typeWrapper = new Type[] { valueType }; MethodInfo implicitCast = memberType.GetMethod("op_Implicit", new Type[] { valueType });
MethodInfo implicitCast = fieldType.GetMethod("op_Implicit", typeWrapper);
if (implicitCast != null) if (implicitCast != null)
{ {
var valueWrapper = new object[] { value };
try try
{ {
object castedValue = implicitCast.Invoke(null, valueWrapper); object castedValue = implicitCast.Invoke(null, new object[] { value });
field.SetValue(Instance, castedValue); member.SetValue(Instance, castedValue);
} }
catch catch
{ {
Console.WriteLine($"RobloxFiles.Property - Failed to implicitly cast value {value} into property {Instance.ClassName}.{Name}"); Console.Error.WriteLine($"RobloxFiles.Property - Failed to implicitly cast value {value} into property {Instance.ClassName}.{Name}");
} }
} }
} }

79
Utility/ImplicitMember.cs Normal file
View File

@ -0,0 +1,79 @@
using System;
using System.Reflection;
namespace RobloxFiles.Utility
{
// This is a lazy helper class to disambiguate between FieldInfo and PropertyInfo
internal class ImplicitMember
{
private static BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy | BindingFlags.IgnoreCase;
private object member;
private ImplicitMember(FieldInfo field) { member = field; }
private ImplicitMember(PropertyInfo prop) { member = prop; }
public static ImplicitMember Get(Type type, string name)
{
var field = type.GetField(name, flags);
var prop = type.GetProperty(name, flags);
if (field != null)
return new ImplicitMember(field);
else if (prop != null)
return new ImplicitMember(prop);
return null;
}
public Type MemberType
{
get
{
Type result = null;
if (member is FieldInfo)
{
var field = member as FieldInfo;
result = field.FieldType;
}
else if (member is PropertyInfo)
{
var prop = member as PropertyInfo;
result = prop.PropertyType;
}
return result;
}
}
public object GetValue(object obj)
{
if (member is FieldInfo)
{
var field = member as FieldInfo;
return field.GetValue(obj);
}
else if (member is PropertyInfo)
{
var prop = member as PropertyInfo;
return prop.GetValue(obj);
}
return null;
}
public void SetValue(object obj, object value)
{
if (member is FieldInfo)
{
var field = member as FieldInfo;
field.SetValue(obj, value);
}
else if (member is PropertyInfo)
{
var prop = member as PropertyInfo;
prop.SetValue(obj, value);
}
}
}
}