本文整理汇总了C#中Workspace.GetStream方法的典型用法代码示例。如果您正苦于以下问题:C# Workspace.GetStream方法的具体用法?C# Workspace.GetStream怎么用?C# Workspace.GetStream使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Workspace
的用法示例。
在下文中一共展示了Workspace.GetStream方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AppendHeaders
private void AppendHeaders(Workspace workspace)
{
TablesHeap tablesHeap = workspace.GetStream<TablesHeap>();
foreach (var keypair in workspace.Members)
{
tablesHeap._binWriter.Write(keypair.Value.Length);
}
}
示例2: AppendMembers
private void AppendMembers(Workspace workspace)
{
TablesHeap tablesHeap = workspace.GetStream<TablesHeap>();
foreach (var keypair in workspace.Members)
{
foreach (MetaDataMemberInfo memberInfo in keypair.Value)
{
AppendMetaDataRow(tablesHeap, memberInfo.Instance.MetaDataRow);
}
}
}
示例3: AppendCode
private void AppendCode(Workspace workspace, MethodBody methodBody, BinaryWriter writer)
{
foreach (MSILInstruction instruction in methodBody.Instructions)
{
writer.Write(instruction.OpCode.Bytes);
// TODO: support all instructions
if (instruction.Operand is string)
{
uint offset = workspace.GetStream<UserStringsHeap>().GetStringOffset(instruction.Operand as string);
offset += 0x70000000;
instruction.OperandBytes = BitConverter.GetBytes(offset);
}
if (instruction.Operand is MetaDataMember)
{
instruction.OperandBytes = BitConverter.GetBytes((instruction.Operand as MetaDataMember).MetaDataToken);
}
if (instruction.OperandBytes != null)
writer.Write(instruction.OperandBytes);
}
}
示例4: GetStringIndex
private ValueType GetStringIndex(Workspace workspace, string str)
{
StringsHeap stringsHeap = workspace.GetStream<StringsHeap>();
return GetHeapOffset(stringsHeap, stringsHeap.GetStringOffset(str));
}
示例5: GetGuidIndex
private ValueType GetGuidIndex(Workspace workspace, Guid guid)
{
GuidHeap guidHeap = workspace.GetStream<GuidHeap>();
return GetHeapOffset(guidHeap, guidHeap.GetGuidOffset(guid));
}
示例6: UpdateMetaDataRows
private void UpdateMetaDataRows(Workspace workspace)
{
TablesHeap tablesHeap = workspace.GetStream<TablesHeap>();
foreach (var table in workspace.Members)
{
foreach (MetaDataMemberInfo member in table.Value)
{
switch (table.Key)
{
case MetaDataTableType.Assembly: UpdateAssemblyDef(workspace, member.Instance as AssemblyDefinition); break;
case MetaDataTableType.AssemblyRef: UpdateAssemblyRef(workspace, member.Instance as AssemblyReference); break;
case MetaDataTableType.ClassLayout: UpdateClassLayout(workspace, member.Instance as ClassLayout); break;
case MetaDataTableType.Constant: UpdateConstant(workspace, member.Instance as Constant); break;
case MetaDataTableType.CustomAttribute: UpdateCustomAttribute(workspace, member.Instance as CustomAttribute); break;
case MetaDataTableType.DeclSecurity: UpdateSecurityDecl(workspace, member.Instance as SecurityDeclaration); break;
case MetaDataTableType.EncLog: ; break;
case MetaDataTableType.EncMap: ; break;
case MetaDataTableType.Event: UpdateEventDef(workspace, member.Instance as EventDefinition); break;
case MetaDataTableType.EventMap: UpdateEventMap(workspace, member.Instance as EventMap); break;
case MetaDataTableType.EventPtr: ; break;
case MetaDataTableType.ExportedType: ; break;
case MetaDataTableType.Field: UpdateFieldDef(workspace, member.Instance as FieldDefinition); break;
case MetaDataTableType.FieldLayout: UpdateFieldLayout(workspace, member.Instance as FieldLayout); break;
case MetaDataTableType.FieldMarshal: UpdateFieldMarshal(workspace, member.Instance as FieldMarshal); break;
case MetaDataTableType.FieldPtr: ; break;
case MetaDataTableType.FieldRVA: UpdateFieldRva(workspace, member.Instance as FieldRVA); break;
case MetaDataTableType.File: ; break;
case MetaDataTableType.GenericParam: ; break;
case MetaDataTableType.GenericParamConstraint: ; break;
case MetaDataTableType.ImplMap: UpdatePInvokeImpl(workspace, member.Instance as PInvokeImplementation); break;
case MetaDataTableType.InterfaceImpl: UpdateInterfaceImpl(workspace, member.Instance as InterfaceImplementation); break;
case MetaDataTableType.ManifestResource: ; break;
case MetaDataTableType.MemberRef: UpdateMemberRef(workspace, member.Instance as MemberReference); break;
case MetaDataTableType.Method: UpdateMethodDef(workspace, member.Instance as MethodDefinition); break;
case MetaDataTableType.MethodImpl: UpdateMethodImpl(workspace, member.Instance as MethodImplementation); break;
case MetaDataTableType.MethodPtr: ; break;
case MetaDataTableType.MethodSemantics: UpdateMethodSemantics(workspace, member.Instance as MethodSemantics); break;
case MetaDataTableType.MethodSpec: UpdateMethodSpec(workspace, member.Instance as MethodSpecification); break;
case MetaDataTableType.Module: UpdateModule(workspace, member.Instance as ModuleDefinition); break;
case MetaDataTableType.ModuleRef: UpdateModuleRef(workspace, member.Instance as ModuleReference); break;
case MetaDataTableType.NestedClass: ; break;
case MetaDataTableType.Param: UpdateParamDef(workspace, member.Instance as ParameterDefinition); break;
case MetaDataTableType.ParamPtr: UpdateParamPtr(workspace, member.Instance as ParamPtr); break;
case MetaDataTableType.Property: UpdatePropertyDef(workspace, member.Instance as PropertyDefinition); break;
case MetaDataTableType.PropertyMap: UpdatePropertyMap(workspace, member.Instance as PropertyMap); break;
case MetaDataTableType.PropertyPtr: UpdatePropertyPtr(workspace, member.Instance as PropertyPtr); break;
case MetaDataTableType.StandAloneSig: UpdateStandAloneSig(workspace, member.Instance as StandAloneSignature); break;
case MetaDataTableType.TypeDef: UpdateTypeDef(workspace, member.Instance as TypeDefinition); break;
case MetaDataTableType.TypeRef: UpdateTypeRef(workspace, member.Instance as TypeReference); break;
case MetaDataTableType.TypeSpec: UpdateTypeSpec(workspace, member.Instance as TypeSpecification); break;
}
}
}
}