Пример #1
0
 internal static uint Write(object argument, IDefinitionWriter writer)
 {
     var(enumeration, enumeral) = (EnumConst)argument;
     writer.WriteReference(enumeration);
     writer.WriteReference(enumeral);
     return(16);
 }
Пример #2
0
        internal override void Serialize(IDefinitionWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException(nameof(writer));
            }

            writer.WriteValueU8((byte)this.Visibility);
            writer.WriteValueU32((uint)this.Flags);

            if ((this.Flags & FunctionFlags.IsNative) == 0)
            {
                writer.WriteReference(this.SourceFile);
                writer.WriteValueU32(this.SourceLine);
            }

            if ((this.Flags & FunctionFlags.HasReturnValue) != 0)
            {
                writer.WriteReference(this.ReturnType);
                writer.WriteValueB8(this.Unknown50);
            }

            if ((this.Flags & FunctionFlags.Unknown8) != 0)
            {
                writer.WriteReference(this.Unknown58);
            }

            if ((this.Flags & FunctionFlags.HasParameters) != 0)
            {
                writer.WriteReferences(this.Parameters);
            }
            if ((this.Flags & FunctionFlags.HasLocals) != 0)
            {
                writer.WriteReferences(this.Locals);
            }
            if ((this.Flags & FunctionFlags.Unknown6) != 0)
            {
                writer.WriteValueU32(this.Unknown98);
            }
            if ((this.Flags & FunctionFlags.Unknown12) != 0)
            {
                writer.WriteValueU8(this.UnknownA0);
            }
            if ((this.Flags & FunctionFlags.HasBody) != 0)
            {
                var bodySizePosition = writer.Position;
                writer.WriteValueU32(uint.MaxValue);
                var bodySize    = Instructions.Write(writer, this.Body);
                var endPosition = writer.Position;
                writer.Position = bodySizePosition;
                writer.WriteValueU32(bodySize);
                writer.Position = endPosition;
            }
        }
Пример #3
0
 internal static uint Write(object argument, IDefinitionWriter writer)
 {
     var (type, unknown) = (DynamicCast)argument;
     writer.WriteReference(type);
     writer.WriteValueU8(unknown);
     return 9;
 }
Пример #4
0
 internal static uint Write(object argument, IDefinitionWriter writer)
 {
     var(type, size) = (EnumCast)argument;
     writer.WriteReference(type);
     writer.WriteValueU8(size);
     return(9);
 }
Пример #5
0
        public static uint Write(object argument, IDefinitionWriter writer)
        {
            var definition = (T)argument;

            writer.WriteReference(definition);
            return(8);
        }
Пример #6
0
 internal static uint Write(object argument, IDefinitionWriter writer)
 {
     var(parameterCount, type) = (Constructor)argument;
     writer.WriteValueU8(parameterCount);
     writer.WriteReference(type);
     return(9);
 }
Пример #7
0
        public static uint Write(object argument, IDefinitionWriter writer)
        {
            var native = (NativeDefinition)argument;

            writer.WriteReference(native);
            return(8);
        }
Пример #8
0
        public static uint Write(object argument, IDefinitionWriter writer)
        {
            var parameter = (ParameterDefinition)argument;

            writer.WriteReference(parameter);
            return(8);
        }
Пример #9
0
        public static uint Write(object argument, IDefinitionWriter writer)
        {
            var property = (PropertyDefinition)argument;

            writer.WriteReference(property);
            return(8);
        }
Пример #10
0
        public static uint Write(object argument, IDefinitionWriter writer)
        {
            var local = (LocalDefinition)argument;

            writer.WriteReference(local);
            return(8);
        }
Пример #11
0
 internal static uint Write(object argument, IDefinitionWriter writer)
 {
     var(type, firstCaseOffset) = (Switch)argument;
     firstCaseOffset           -= 1 + 8 + 2; // make relative to the jump offset
     writer.WriteReference(type);
     writer.WriteValueS16(firstCaseOffset);
     return(10);
 }
Пример #12
0
 internal static uint Write(object argument, IDefinitionWriter writer)
 {
     var(jnextOffset, sourceLine, function) = (FinalFunc_Offset)argument;
     jnextOffset -= 1 + 2; // make relative to the jump offset;
     writer.WriteValueS16(jnextOffset);
     writer.WriteValueU16(sourceLine);
     writer.WriteReference(function);
     return(12);
 }
Пример #13
0
        internal override void Serialize(IDefinitionWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException(nameof(writer));
            }

            writer.WriteReference(this.Type);
            writer.WriteValueU8(this.Unknown28);
        }
Пример #14
0
        internal override void Serialize(IDefinitionWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException(nameof(writer));
            }

            writer.WriteValueU8((byte)this.NativeType);

            if (HasBaseType(this.NativeType) == true)
            {
                writer.WriteReference(this.BaseType);
            }

            if (this.NativeType == NativeType.StaticArray)
            {
                writer.WriteValueU32(this.ArraySize);
            }
        }
Пример #15
0
        internal override void Serialize(IDefinitionWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException(nameof(writer));
            }

            writer.WriteValueU8((byte)this.Visibility);
            writer.WriteValueU16((ushort)this.Flags);
            writer.WriteReference(this.BaseClass);
            if ((this.Flags & ClassFlags.HasFunctions) != 0)
            {
                writer.WriteReferences(this.Functions);
            }
            if ((this.Flags & ClassFlags.Unknown5) != 0)
            {
                writer.WriteReferences(this.Unknown20s);
            }
            if ((this.Flags & ClassFlags.Unknown8) != 0)
            {
                writer.WriteReferences(this.Unknown30s);
            }
        }