Пример #1
0
        private void regenMovedSymbolsProperty(IProperty property, SymbolWriterClass emitter)
        {
            PropertyDefinition targtProp, targtPropOld;
            MethodDefinition   targtMetSet, targtMetOldSet, targtMetGet, targtMetOldGet;

            // Find appropriete new version of method in new assembly.
            targtProp = MetadataManager.FindProperty(ResourceManager.NewAssembly,
                                                     ResourceManager.NewAssemblyName, property);
            if (targtProp == null)
            {
                throw new TranslatingException("Property " + property.ToString() + " could not be found in debugged module");
            }

            // Find appropriete original version of method in running assembly.
            targtPropOld = MetadataManager.FindProperty(ResourceManager.OldAssembly,
                                                        ResourceManager.CurrentModule.Name, property);
            if (targtPropOld == null)
            {
                throw new TranslatingException("Property " + property.ToString() + " could not be found in emitted module");
            }

            targtMetGet    = targtProp.GetMethod;
            targtMetSet    = targtProp.SetMethod;
            targtMetOldGet = targtPropOld.GetMethod;
            targtMetOldSet = targtPropOld.SetMethod;
            try {
                if (targtMetGet != null)
                {
                    emitter.EmitMethod(targtMetOldGet.MetadataToken.ToUInt32(), targtMetGet.MetadataToken.ToUInt32());
                }
                if (targtMetSet != null)
                {
                    emitter.EmitMethod(targtMetOldSet.MetadataToken.ToUInt32(), targtMetSet.MetadataToken.ToUInt32());
                }
            } catch (COMException e) {
            }
        }
Пример #2
0
        private void regenMovedSymbolsMethod(IMethod method, SymbolWriterClass emitter)
        {
            MethodDefinition targtMet, targtMetOld;

            // Find appropriete new version of method in new assembly.
            targtMet = MetadataManager.FindMethod(ResourceManager.NewAssembly,
                                                  ResourceManager.NewAssemblyName, method);
            if (targtMet == null)
            {
                throw new TranslatingException("Method " + method.ToString() + " could not be found in debugged module");
            }

            // Find appropriete original version of method in running assembly.
            targtMetOld = MetadataManager.FindMethod(ResourceManager.OldAssembly,
                                                     ResourceManager.CurrentModule.Name, method);
            if (targtMetOld == null)
            {
                throw new TranslatingException("Method " + method.ToString() + " could not be found in emitted module");
            }

            emitter.EmitMethod(targtMetOld.MetadataToken.ToUInt32(), targtMet.MetadataToken.ToUInt32());
        }