public ASMethod(ABCFile abc, FlashReader reader) : this(abc) { Parameters.Capacity = reader.Read7BitEncodedInt(); ReturnTypeIndex = reader.Read7BitEncodedInt(); for (int i = 0; i < Parameters.Capacity; i++) { int parameterTypeIndex = reader.Read7BitEncodedInt(); var parameter = new ASParameter(abc, parameterTypeIndex); Parameters.Add(parameter); parameter.Rank = Parameters.Count; } NameIndex = reader.Read7BitEncodedInt(); MethodInfo = (MethodFlags)reader.ReadByte(); if (MethodInfo.HasFlag(MethodFlags.HasOptional)) { int optionalParamCount = reader.Read7BitEncodedInt(); while (optionalParamCount > 0) { int paramIndex = ((Parameters.Count - 1) - (--optionalParamCount)); ASParameter optionalParameter = Parameters[paramIndex]; optionalParameter.IsOptional = true; optionalParameter.ValueIndex = reader.Read7BitEncodedInt(); optionalParameter.ValueType = (ConstantType)reader.ReadByte(); } } if (MethodInfo.HasFlag(MethodFlags.HasParamNames)) { foreach (ASParameter parameter in Parameters) { parameter.ObjNameIndex = reader.Read7BitEncodedInt(); } } }
public ASMethod(ABCFile abc, FlashReader reader) : this(abc) { Parameters.Capacity = reader.Read7BitEncodedInt(); ReturnTypeIndex = reader.Read7BitEncodedInt(); for (int i = 0; i < Parameters.Capacity; i++) { int parameterTypeIndex = reader.Read7BitEncodedInt(); var parameter = new ASParameter(abc, parameterTypeIndex); Parameters.Add(parameter); parameter.Rank = Parameters.Count; } NameIndex = reader.Read7BitEncodedInt(); MethodInfo = (MethodFlags)reader.ReadByte(); if (MethodInfo.HasFlag(MethodFlags.HasOptional)) { int optionalParamCount = reader.Read7BitEncodedInt(); while (optionalParamCount > 0) { int paramIndex = ((Parameters.Count - 1) - (--optionalParamCount)); ASParameter optionalParameter = Parameters[paramIndex]; optionalParameter.IsOptional = true; optionalParameter.ValueIndex = reader.Read7BitEncodedInt(); optionalParameter.ValueType = (ConstantType)reader.ReadByte(); } } if (MethodInfo.HasFlag(MethodFlags.HasParamNames)) { foreach (ASParameter parameter in Parameters) parameter.ObjNameIndex = reader.Read7BitEncodedInt(); } }