public VerificationTypeInfo(ref ReadOnlySpan <byte> data, CPInfo[] constants) { Tag = data.ReadOne(); Type = (VerificationType)Tag; ObjectType = null; Offset = 0; switch (Type) { case VerificationType.TopVariable: case VerificationType.IntegerVariable: case VerificationType.FloatVariable: case VerificationType.LongVariable: case VerificationType.DoubleVariable: case VerificationType.NullVariable: case VerificationType.UninitializedThisVariable: break; case VerificationType.ObjectVariable: ushort cPoolIndex = data.ReadTwo(); ObjectType = ((CClassInfo)constants[cPoolIndex]); break; case VerificationType.UninitializedVariable: Offset = data.ReadTwo(); break; } }
public EnclosingMethodAttribute(ref ReadOnlySpan <byte> data, CPInfo[] constants) : base(ref data, constants) { ReadOnlySpan <byte> infoAsSpan = info.AsSpan(); ClassIndex = infoAsSpan.ReadTwo(); MethodIndex = infoAsSpan.ReadTwo(); Class = (CClassInfo)constants[ClassIndex]; Method = (CNameAndTypeInfo)constants[MethodIndex]; }
public ExceptionHandlerInfo(ref ReadOnlySpan <byte> data, CPInfo[] constants) { StartPc = data.ReadTwo(); EndPc = data.ReadTwo(); HandlerPc = data.ReadTwo(); CatchType = data.ReadTwo(); if (CatchType != 0) { CatchClassType = (CClassInfo)constants[CatchType]; } else { CatchClassType = null; } }
public ElementValue(ref ReadOnlySpan <byte> data, CPInfo[] Constants) { Tag = data.ReadOne(); switch ((char)Tag) { case 'B': case 'C': case 'D': case 'F': case 'I': case 'J': case 'S': case 'Z': case 's': ConstValueIndex = data.ReadTwo(); ConstantValue = Constants[ConstValueIndex]; break; case 'e': TypeNameIndex = data.ReadTwo(); ConstNameIndex = data.ReadTwo(); TypeName = ((CUtf8Info)Constants[TypeNameIndex]).String; ConstName = ((CUtf8Info)Constants[ConstNameIndex]).String; break; case 'c': ClassInfoIndex = data.ReadTwo(); ClassInfo = (CClassInfo)Constants[ClassInfoIndex]; break; case '@': AnnotationValue = new Annotation(ref data, Constants); break; case '[': NumValues = data.ReadTwo(); Values = new ElementValue[NumValues]; for (int i = 0; i < NumValues; i++) { Values[i] = new ElementValue(ref data, Constants); } break; default: throw new InvalidOperationException(); } }
public ClassTableEntry(ref ReadOnlySpan <byte> data, CPInfo[] constants) { InnerClassInfoIndex = data.ReadTwo(); OuterClassInfoIndex = data.ReadTwo(); InnerNameIndex = data.ReadTwo(); InnerClassAccessFlags = data.ReadTwo(); InnerClassInfo = (CClassInfo)constants[InnerClassInfoIndex]; OuterClassInfo = (CClassInfo)constants[OuterClassInfoIndex]; if (InnerNameIndex != 0) { InnerClassName = ((CUtf8Info)constants[InnerNameIndex]).String; } else { InnerClassName = null; } }
private void UpdateMetaClasses(int dllHandle, string getCountMetho, string getInfoMetho) { Tuple <Delegate, Delegate> delegates = GetDelegate <Win32.GetMetaClassCountDelegate, Win32.GetMetaClassesDelegate>(dllHandle, getCountMetho, getInfoMetho); int count = (delegates.Item1 as Win32.GetMetaClassCountDelegate)(); CClassInfo[] metaDatas = new CClassInfo[count]; _metaClasses.Clear(); int size = Marshal.SizeOf(typeof(CClassInfo)) * count; IntPtr buffer = Marshal.AllocHGlobal(size); (delegates.Item2 as Win32.GetMetaClassesDelegate)(buffer, count); for (int i = 0; i < count; ++i) { IntPtr p = new IntPtr(buffer.ToInt64() + Marshal.SizeOf(typeof(CClassInfo)) * i); metaDatas[i] = (CClassInfo)Marshal.PtrToStructure(p, typeof(CClassInfo)); var classDescriptor = new MetaClassDescriptor(metaDatas[i].TypeName, metaDatas[i].Category, metaDatas[i].DisplayName, metaDatas[i].Description, MetaClassDescriptor.GetIcon(metaDatas[i].TypeName)); var properties = new List <MetaPropertyDescriptor>(); foreach (var pd in metaDatas[i].PropertyData) { //如果ID为0表示这个属性信息为空 if (pd.TypeID != 0) { var enumSource = pd.EnumSource.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries); var x = MetaPropertyDescriptor.GetTupleInfo(pd.ValueTypeName, enumSource); if (x == null) { ViewModel.LogData.Add(LogLevel.Warn, "元件{0}的属性{1}使用了不支持的C++属性类型{2}", classDescriptor.TypeName, pd.DisplayName, pd.ValueTypeName); continue; } properties.Add(new MetaPropertyDescriptor(pd.ValueTypeName, pd.TypeID, pd.Category, pd.DisplayName, pd.Order, pd.Description, enumSource, x.Item1, x.Item2, x.Item3)); } } _metaClasses.Add(new MetaClass(classDescriptor, properties)); } Marshal.FreeHGlobal(buffer); }
public static int GetClassObjectAddr(CClassInfo classInfo) { return(GetClassObjectAddr(classInfo.Name)); }