Example #1
0
 void GetSetProperty(ExtendedStringBuilder sb, int offset, string type, string readType, string name)
 {
     sb.SetPropertyIndent();
     sb.AppendLine($"public {type} {Name}");
     sb.AppendLine("{");
     sb.SetGetSetIndet();
     sb.AppendLine("get");
     sb.AppendLine("{");
     sb.SetInsideGetSet();
     sb.AppendLine($"return Read{readType}(0x{offset:X2});");
     sb.SetGetSetIndet();
     sb.AppendLine("}");
     sb.AppendLine("set");
     sb.AppendLine("{");
     sb.SetInsideGetSet();
     sb.AppendLine($"Write{readType}(0x{offset:X2},value);");
     sb.SetGetSetIndet();
     sb.AppendLine("}");
     sb.SetPropertyIndent();
     sb.AppendLine("}");
 }
Example #2
0
 public void BuildClass(ExtendedStringBuilder sb)
 {
     sb.SetClassIndent();
     WriteSummary(sb);
     if (string.IsNullOrEmpty(SuperClass))
         SuperClass = "MemoryObject";
     sb.AppendLine($"public class {ClassName}:{SuperClass}");
     sb.AppendLine("{");
     sb.SetPropertyIndent();
     sb.AppendLine($"public override int ObjectSize => {ClassSize};");
     foreach (var p in Properties.Values.ToArray())
     {
         p.BuildProperty(sb);
         sb.AppendLine("");
     }
     sb.SetClassIndent();
     sb.AppendLine("}");
     sb.SetNamespaceIndent();
     sb.AppendLine("");
     sb.AppendLine("");
 }
Example #3
0
        public void BuildProperty(ExtendedStringBuilder sb)
        {
            sb.SetPropertyIndent();
            WritePropertSummary(sb);
            switch (Type)
            {
            case "BoolProperty":
            {
                if (BoolFieldMask == 0xFF)
                {
                    GetSetProperty(sb, (int)(Offset + BoolOffset), "bool", "Bool", Name);
                }
                else
                {
                    sb.AppendLine($"public bool {Name} => (ReadByte(0x{Offset + BoolOffset:X4}) & 0x{BoolByteMask:X2}) == 0x{BoolByteMask:X2};");
                }
                break;
            }

            case "StrProperty":
            {
                sb.AppendLine($"public FString {Name} => new FString(BaseAddress+0x{Offset:X2});");
                break;
            }

            case "StructProperty":
            {
                sb.AppendLine($"public {SubType} {Name} => ReadStruct<{SubType}>(0x{Offset:X2});");
                break;
            }

            case "ObjectProperty":
            {
                sb.AppendLine($"public {SubType} {Name} => ReadUObject<{SubType}>(0x{Offset:X2});");
                break;
            }

            case "ArrayProperty":
            {
                if (!string.IsNullOrEmpty(ArraySubType))
                {
                    sb.AppendLine($"public TArray<{ArraySubType}> {Name} => new TArray<{ArraySubType}>(BaseAddress+0x{Offset:X2});");
                }
                break;
            }

            case "DoubleProperty":
            {
                GetSetProperty(sb, Offset, "double", "Double", Name);
                break;
            }

            case "FloatProperty":
            {
                GetSetProperty(sb, Offset, "float", "Single", Name);
                break;
            }

            case "IntProperty":
            {
                GetSetProperty(sb, Offset, "int", "Int32", Name);
                break;
            }

            case "UIntProperty":
            {
                GetSetProperty(sb, Offset, "uint", "UInt32", Name);
                break;
            }

            case "Int16Property":
            {
                GetSetProperty(sb, Offset, "short", "Int16", Name);
                break;
            }

            case "UInt16Property":
            {
                GetSetProperty(sb, Offset, "ushort", "UInt16", Name);
                break;
            }

            case "UInt64Property":
            {
                GetSetProperty(sb, Offset, "ulong", "UInt64", Name);
                break;
            }

            case "Int64Property":
            {
                GetSetProperty(sb, Offset, "long", "Int64", Name);
                break;
            }

            case "ByteProperty":
            {
                GetSetProperty(sb, Offset, "byte", "Byte", Name);
                break;
            }
            }
        }