public void ReadMarshalInformation(NuGenIMetaDataImport2 import, Dictionary <uint, NuGenTokenBase> allTokens, int parameterCount)
 {
     if ((AttributeFlags & CorParamAttr.pdHasFieldMarshal) == CorParamAttr.pdHasFieldMarshal)
     {
         MarshalAsTypeString = string.Format("marshal({0})", NuGenHelperFunctions.ReadMarshalDescriptor(import, allTokens, Token, parameterCount));
     }
 }
        protected override void ReadMetadataInformation()
        {
            base.ReadMetadataInformation();
            NuGenAssembly assembly = BaseTypeDefinition.ModuleScope.Assembly;

            try
            {
                assembly.OpenMetadataInterfaces();

                if ((Flags & CorFieldAttr.fdHasDefault) == CorFieldAttr.fdHasDefault)
                {
                    object defaultValueNumber;
                    DefaultValueAsString = NuGenHelperFunctions.ReadDefaultValue(DefaultValueType, DefaultValue, DefaultValueLength, out defaultValueNumber);
                    DefaultValueNumber   = defaultValueNumber;
                }

                if ((Flags & CorFieldAttr.fdHasFieldMarshal) == CorFieldAttr.fdHasFieldMarshal)
                {
                    MarshalAsTypeString = string.Format("marshal({0})", NuGenHelperFunctions.ReadMarshalDescriptor(assembly.Import, BaseTypeDefinition.ModuleScope.Assembly.AllTokens, Token, 0));
                }

                if ((Flags & CorFieldAttr.fdPinvokeImpl) == CorFieldAttr.fdPinvokeImpl)
                {
                    PinvokeMap = NuGenHelperFunctions.ReadPinvokeMap(assembly.Import, BaseTypeDefinition.ModuleScope.Assembly, Token);
                }

                CustomAttributes = NuGenHelperFunctions.EnumCustomAttributes(assembly.Import, BaseTypeDefinition.ModuleScope.Assembly, this);
            }
            finally
            {
                assembly.CloseMetadataInterfaces();
            }
        }
        private void GetThreadName(ThreadWrapper threadWrapper, ValueWrapper threadObject, NuGenFrameRefresher threadActiveFrameRefresher)
        {
            List <ModuleWrapper> modules = threadWrapper.FindModulesByName(GetThreadNameMethod.BaseTypeDefinition.ModuleScope.Assembly.FileName);

            if (modules.Count == 1)
            {
                ModuleWrapper       module = modules[0];
                FunctionWrapper     getThreadNameFunction = module.GetFunction(GetThreadNameMethod.Token);
                List <ValueWrapper> arguments             = new List <ValueWrapper>(1);
                arguments.Add(threadObject);

                NuGenEvaluationHandler    methodCaller     = new NuGenEvaluationHandler(threadActiveFrameRefresher);
                NuGenBaseEvaluationResult evaluationResult = methodCaller.CallFunction(getThreadNameFunction, arguments);

                if (evaluationResult.IsSuccessful)
                {
                    if (evaluationResult.Result != null && (CorElementType)evaluationResult.Result.ElementType == CorElementType.ELEMENT_TYPE_STRING)
                    {
                        ValueWrapper dereferencedResult = evaluationResult.Result.DereferenceValue();

                        if (dereferencedResult != null)
                        {
                            EvaluatedThreadName = NuGenHelperFunctions.ShowEscapeCharacters(dereferencedResult.GetStringValue(), true);
                        }
                    }
                }
            }
        }
        private void InnerLazyInitialize(bool openMetadata)
        {
            NuGenAssembly assembly = Method.BaseTypeDefinition.ModuleScope.Assembly;

            try
            {
                if (openMetadata)
                {
                    assembly.OpenMetadataInterfaces();
                }

                CustomAttributes = NuGenHelperFunctions.EnumCustomAttributes(assembly.Import, assembly, this);
            }
            finally
            {
                if (openMetadata)
                {
                    assembly.CloseMetadataInterfaces();
                }
            }

            if (CustomAttributes != null && CustomAttributes.Count > 0)
            {
                foreach (NuGenCustomAttribute customAttribute in CustomAttributes)
                {
                    customAttribute.SetText(assembly.AllTokens);
                }
            }
        }
        protected override void CreateText(Dictionary <uint, NuGenTokenBase> allTokens)
        {
            base.CreateText(allTokens);
            ReadSignature();
            NuGenBaseSignatureItem signatureItem = signatureReader.Type;

            NuGenHelperFunctions.SetSignatureItemToken(allTokens, signatureItem);

            if (((Flags & CorFieldAttr.fdReservedMask) & CorFieldAttr.fdHasFieldRVA) == CorFieldAttr.fdHasFieldRVA)
            {
                NuGenAssembly assembly = BaseTypeDefinition.ModuleScope.Assembly;

                try
                {
                    assembly.OpenMetadataInterfaces();
                    uint rva;
                    uint implFlags;

                    assembly.Import.GetRVA(Token, out rva, out implFlags);

                    Rva = rva;
                    ImplementationFlags = (CorMethodImpl)implFlags;
                }
                finally
                {
                    assembly.CloseMetadataInterfaces();
                }
            }
        }
        private string ContractAttributesAsString()
        {
            string result = string.Empty;

            result  = NuGenHelperFunctions.EnumAsString(Flags, CorFieldAttr.fdStatic, "static ");
            result += NuGenHelperFunctions.EnumAsString(Flags, CorFieldAttr.fdInitOnly, "initonly ");
            result += NuGenHelperFunctions.EnumAsString(Flags, CorFieldAttr.fdLiteral, "literal ");
            result += NuGenHelperFunctions.EnumAsString(Flags, CorFieldAttr.fdNotSerialized, "notserialized ");
            result += NuGenHelperFunctions.EnumAsString(Flags, CorFieldAttr.fdSpecialName, "specialname ");

            if ((Flags & CorFieldAttr.fdPinvokeImpl) == CorFieldAttr.fdPinvokeImpl)
            {
                result += "pinvokeimpl(";

                if (PinvokeMap == null)
                {
                    result += "/* No map */";
                }
                else
                {
                    result += PinvokeMap;
                }

                result += ") ";
            }

            return(result);
        }
        protected override void CreateText(Dictionary <uint, NuGenTokenBase> allTokens)
        {
            base.CreateText(allTokens);
            ReadSignature();
            NuGenHelperFunctions.SetSignatureItemToken(allTokens, signatureReader.Type);
            Name = signatureReader.Type.ToString();

            if (signatureReader.GenericParameters != null)
            {
                StringBuilder nameBuilder = new StringBuilder(Name);
                nameBuilder.Append("<");

                for (int index = 0; index < signatureReader.GenericParameters.Count; index++)
                {
                    NuGenBaseSignatureItem genericParameter = signatureReader.GenericParameters[index];

                    NuGenHelperFunctions.SetSignatureItemToken(allTokens, genericParameter);
                    nameBuilder.Append(genericParameter);

                    if (index < signatureReader.GenericParameters.Count - 1)
                    {
                        nameBuilder.Append(", ");
                    }
                }

                nameBuilder.Append(">");
                Name = nameBuilder.ToString();
            }
        }
 public override void SetGenericParametersOfMethod(List <NuGenGenericParameter> genericParameters)
 {
     if (HasGenericMethodParameter)
     {
         NuGenHelperFunctions.SetSignatureItemToken(AllTokens, MarshalAsType, genericParameters);
     }
 }
Exemple #9
0
        public override void  ReadSignature()
        {
            uint data;
            int  dataLength = Convert.ToInt32(NuGenSignatureCompression.CorSigUncompressData(signatureBlob, out data));

            CallingConvention = (CorCallingConvention)data;
            NuGenHelperFunctions.StepIntPtr(ref signatureBlob, dataLength);
            uint paramCount = 0;

            NuGenHelperFunctions.StepIntPtr(ref signatureBlob, NuGenSignatureCompression.CorSigUncompressData(signatureBlob, out paramCount));

            ReturnType = ReadSignatureItem(ref signatureBlob);

            if (paramCount > 0)
            {
                Parameters = new List <NuGenBaseSignatureItem>();
            }

            int paramIndex = 0;

            while (paramIndex < paramCount && signatureBlob.ToInt32() < SignatureEnd)
            {
                Parameters.Add(ReadSignatureItem(ref signatureBlob));
                paramIndex++;
            }
        }
Exemple #10
0
        public void ShowText(string text)
        {
            try
            {
                if (!text.StartsWith("\"") && !text.StartsWith("'"))
                {
                    textBox.Text = string.Empty;
                    escapeCharactersCheckBox.Checked = false;
                    textBox.Text = text;
                }
                else if (escapeCharactersCheckBox.Checked)
                {
                    textBox.Text = text;
                }
                else
                {
                    textBox.Text = NuGenHelperFunctions.ConvertEscapedCharacters(text, true);
                }
            }
            catch (Exception exception)
            {
                MessageBox.Show("An exception occurred while trying to display the text:\n\n" + exception.ToString());
            }

            textBox.SelectionStart  = 0;
            textBox.SelectionLength = 0;

            textTab.SelectedTab = textEditorTabPage;
            ShowDialog();
        }
Exemple #11
0
        public override void ReadSignature()
        {
            uint data;
            int  dataLength = Convert.ToInt32(NuGenSignatureCompression.CorSigUncompressData(signatureBlob, out data));

            CorCallingConvention callingConvention = (CorCallingConvention)data;

            NuGenHelperFunctions.StepIntPtr(ref signatureBlob, dataLength);
            Type = ReadSignatureItem(ref signatureBlob);

            if (signatureBlob.ToInt32() < SignatureEnd)
            {
                uint genericParamCount;
                NuGenHelperFunctions.StepIntPtr(ref signatureBlob, NuGenSignatureCompression.CorSigUncompressData(signatureBlob, out genericParamCount));

                if (genericParamCount > 0)
                {
                    GenericParameters = new List <NuGenBaseSignatureItem>();

                    for (int genericParamIndex = 0; genericParamIndex < genericParamCount; genericParamIndex++)
                    {
                        GenericParameters.Add(ReadSignatureItem(ref signatureBlob));
                    }
                }
            }
        }
Exemple #12
0
        protected override void CreateText(Dictionary <uint, NuGenTokenBase> allTokens)
        {
            base.CreateText(allTokens);
            StringBuilder nameBuilder = null;

            if (Name == null || Name.Length == 0)
            {
                nameBuilder = new StringBuilder();
                nameBuilder.Append("<");
                ReadSignature();

                if (signatureReader.Arguments != null)
                {
                    for (int index = 0; index < signatureReader.Arguments.Count; index++)
                    {
                        NuGenBaseSignatureItem argument = signatureReader.Arguments[index];
                        NuGenHelperFunctions.SetSignatureItemToken(allTokens, argument);
                        nameBuilder.Append(argument);

                        if (index < signatureReader.Arguments.Count - 1)
                        {
                            nameBuilder.Append(", ");
                        }
                    }
                }

                nameBuilder.Append(">(");

                string parentAsString = Parent.ToString();

                Name = parentAsString.Replace("(", nameBuilder.ToString());
            }
        }
Exemple #13
0
        public override void ReadSignature()
        {
            uint data;
            uint dataLength = NuGenSignatureCompression.CorSigUncompressData(signatureBlob, out data);

            CallingConvention = (CorCallingConvention)data;
            NuGenHelperFunctions.StepIntPtr(ref signatureBlob, dataLength);
            uint paramCount = 0;

            if (CallingConvention != CorCallingConvention.IMAGE_CEE_CS_CALLCONV_FIELD)
            {
                dataLength = NuGenSignatureCompression.CorSigUncompressData(signatureBlob, out paramCount);
                NuGenHelperFunctions.StepIntPtr(ref signatureBlob, dataLength);

                if ((CallingConvention & CorCallingConvention.IMAGE_CEE_CS_CALLCONV_GENERIC) == CorCallingConvention.IMAGE_CEE_CS_CALLCONV_GENERIC)
                {
                    dataLength = NuGenSignatureCompression.CorSigUncompressData(signatureBlob, out paramCount);
                    NuGenHelperFunctions.StepIntPtr(ref signatureBlob, dataLength);
                }
            }

            ReturnType = ReadSignatureItem(ref signatureBlob);

            if (paramCount > 0)
            {
                Parameters = new List <NuGenBaseSignatureItem>();
            }

            int paramIndex = 0;

            while (paramIndex < paramCount)
            {
                dataLength = NuGenSignatureCompression.CorSigUncompressData(signatureBlob, out data);
                CorElementType elementType = (CorElementType)data;

                if (elementType == CorElementType.ELEMENT_TYPE_SENTINEL)
                {
                    SentinelFound = true;
                    NuGenHelperFunctions.StepIntPtr(ref signatureBlob, dataLength);
                }

                if (SentinelFound)
                {
                    if (VarargParameters == null)
                    {
                        VarargParameters = new List <NuGenBaseSignatureItem>();
                    }

                    NuGenBaseSignatureItem signatureItem = ReadSignatureItem(ref signatureBlob);
                    VarargParameters.Add(signatureItem);
                }
                else
                {
                    NuGenBaseSignatureItem signatureItem = ReadSignatureItem(ref signatureBlob);
                    Parameters.Add(signatureItem);
                }

                paramIndex++;
            }
        }
 public NuGenModuleReference(NuGenAssembly assembly, uint token, string name)
 {
     Token    = token;
     Assembly = assembly;
     Name     = name;
     NuGenHelperFunctions.GetMemberReferences(Assembly, Token);
 }
Exemple #15
0
        public override void ReadSignature()
        {
            uint data;
            int  dataLength = Convert.ToInt32(NuGenSignatureCompression.CorSigUncompressData(signatureBlob, out data));

            CallingConvention = (CorCallingConvention)data;
            NuGenHelperFunctions.StepIntPtr(ref signatureBlob, dataLength);
            uint argumentCount = 0;

            dataLength = Convert.ToInt32(NuGenSignatureCompression.CorSigUncompressData(signatureBlob, out argumentCount));
            NuGenHelperFunctions.StepIntPtr(ref signatureBlob, dataLength);

            if (argumentCount > 0)
            {
                Arguments = new List <NuGenBaseSignatureItem>();
            }

            int argumentIndex = 0;

            while (argumentIndex < argumentCount && signatureBlob.ToInt32() < SignatureEnd)
            {
                Arguments.Add(ReadSignatureItem(ref signatureBlob));
                argumentIndex++;
            }
        }
Exemple #16
0
        public void Initialize()
        {
            CodeLines = new List <NuGenCodeLine>();

            CodeLines.Add(new NuGenCodeLine(0, ".module " + Name));
            CodeLines.Add(new NuGenCodeLine(0, "// MVID: {" + Mvid.ToString() + "}"));
            CodeLines.Add(new NuGenCodeLine(0, ".imagebase 0x" + NuGenHelperFunctions.FormatAsHexNumber(Assembly.ImageBase, 8)));
            CodeLines.Add(new NuGenCodeLine(0, ".file alignment 0x" + NuGenHelperFunctions.FormatAsHexNumber(Assembly.FileAlignment, 8)));

            if (Assembly.IsPe32)
            {
                CodeLines.Add(new NuGenCodeLine(0, ".stackreserve 0x" + NuGenHelperFunctions.FormatAsHexNumber(Assembly.StackReserve, 8)));
            }
            else
            {
                CodeLines.Add(new NuGenCodeLine(0, ".stackreserve 0x" + NuGenHelperFunctions.FormatAsHexNumber(Assembly.StackReserve, 16)));
            }

            CodeLines.Add(new NuGenCodeLine(0, string.Format(".subsystem 0x{0} //{1}", NuGenHelperFunctions.FormatAsHexNumber(Assembly.Subsystem, 4), (Assembly.Subsystem == 2 ? "WINDOWS_CE" : "WINDOWS_GUI"))));
            CodeLines.Add(new NuGenCodeLine(0, ".corflags 0x" + NuGenHelperFunctions.FormatAsHexNumber(Assembly.CorFlags, 8)));

            string peFormat = "//PE Format: ";

            if (Assembly.IsPe32)
            {
                peFormat += "PE32 (32 bit assembly)";
            }
            else
            {
                peFormat += "PE32+ (64 bit assembly)";
            }
            CodeLines.Add(new NuGenCodeLine(0, peFormat));
        }
Exemple #17
0
        private void ReadStandAloneMethodSignature(ref IntPtr signatureBlob)
        {
            uint paramCount = 0;

            if (CallingConvention == CorCallingConvention.IMAGE_CEE_CS_CALLCONV_HASTHIS)
            {
                uint data;
                NuGenHelperFunctions.StepIntPtr(ref signatureBlob, NuGenSignatureCompression.CorSigUncompressData(signatureBlob, out data));
                CorCallingConvention explicitThis = (CorCallingConvention)data;

                if (explicitThis == CorCallingConvention.IMAGE_CEE_CS_CALLCONV_EXPLICITTHIS)
                {
                    CallingConvention |= CorCallingConvention.IMAGE_CEE_CS_CALLCONV_EXPLICITTHIS;
                }
                else
                {
                    paramCount = data;
                }
            }
            else
            {
                NuGenHelperFunctions.StepIntPtr(ref signatureBlob, NuGenSignatureCompression.CorSigUncompressData(signatureBlob, out paramCount));
            }

            ReturnType = ReadSignatureItem(ref signatureBlob);

            if (paramCount > 0)
            {
                Parameters = new List <NuGenBaseSignatureItem>();

                int paramIndex = 0;
                while (paramIndex < paramCount)
                {
                    uint data;
                    NuGenSignatureCompression.CorSigUncompressData(signatureBlob, out data);
                    CorElementType elementType = (CorElementType)data;

                    if (elementType == CorElementType.ELEMENT_TYPE_SENTINEL)
                    {
                        throw new NotImplementedException("Sentinel found.");
                    }

                    if (SentinelFound)
                    {
                        if (VarargParameters == null)
                        {
                            VarargParameters = new List <NuGenBaseSignatureItem>();
                        }

                        VarargParameters.Add(ReadSignatureItem(ref signatureBlob));
                    }
                    else
                    {
                        Parameters.Add(ReadSignatureItem(ref signatureBlob));
                    }
                    paramIndex++;
                }
            }
        }
 protected virtual void DisplayCreatedControls(TableLayoutPanel panel)
 {
     panel.RowCount    = RowCount;
     panel.ColumnCount = ColumnCount;
     NuGenHelperFunctions.CopyListElements(CreatedControls, panel.Controls);
     NuGenHelperFunctions.CopyListElements(ColumnStyles, panel.ColumnStyles);
     NuGenHelperFunctions.CopyListElements(RowStyles, panel.RowStyles);
 }
Exemple #19
0
 public void MoveAssemblyToFirst(string assemblyFilePath)
 {
     if (NuGenHelperFunctions.MoveItemInList <string>(RecentAssemblies, assemblyFilePath, 0))
     {
         SaveConfiguration();
         OnRecentAssembliesChanged();
     }
 }
Exemple #20
0
 public void MoveProjectToFirst(string projectFilePath)
 {
     if (NuGenHelperFunctions.MoveItemInList <string>(RecentProjects, projectFilePath, 0))
     {
         SaveConfiguration();
         OnRecentProjectsChanged();
     }
 }
 public NuGenTypeReference(NuGenIMetaDataImport2 import, NuGenAssembly assembly, string name, uint token, uint resolutionScope)
 {
     Assembly        = assembly;
     Name            = name;
     Token           = token;
     ResolutionScope = resolutionScope;
     NuGenHelperFunctions.GetMemberReferences(Assembly, Token);
 }
        public NuGenTypeSpecification(NuGenAssembly assembly, uint token, IntPtr signatureBlob, uint signatureBlobLength)
        {
            Token               = token;
            SignatureBlob       = signatureBlob;
            SignatureBlobLength = signatureBlobLength;
            Assembly            = assembly;

            NuGenHelperFunctions.GetMemberReferences(Assembly, Token);
        }
        private NuGenMashallingDescriptorItem ReadNativeType()
        {
            NuGenMashallingDescriptorItem result = new NuGenMashallingDescriptorItem();

            uint data;

            NuGenHelperFunctions.StepIntPtr(ref signatureBlob, NuGenSignatureCompression.CorSigUncompressData(SignatureBlob, out data));

            result.NativeType   = (CorNativeType)data;
            result.IsNativeType = true;

            switch (result.NativeType)
            {
            case CorNativeType.NATIVE_TYPE_SAFEARRAY:
                result.NextItem = ReadVariantType();
                break;

            case CorNativeType.NATIVE_TYPE_CUSTOMMARSHALER:
                result.Guid          = ReadString();
                result.UnmanagedType = ReadString();
                result.ManagedType   = ReadString();
                result.Cookie        = ReadString();
                break;

            case CorNativeType.NATIVE_TYPE_ARRAY:
                result.NextItem = ReadNativeType();

                NuGenHelperFunctions.StepIntPtr(ref signatureBlob, NuGenSignatureCompression.CorSigUncompressData(SignatureBlob, out data));
                result.ParamNumber = (int)data;

                if (result.ParamNumber > ParameterCount)
                {
                    result.ParamNumber = -1;
                }

                NuGenHelperFunctions.StepIntPtr(ref signatureBlob, NuGenSignatureCompression.CorSigUncompressData(SignatureBlob, out data));
                result.ElemMultiply = (int)data;

                NuGenHelperFunctions.StepIntPtr(ref signatureBlob, NuGenSignatureCompression.CorSigUncompressData(SignatureBlob, out data));
                result.NumberElem = (int)data;
                break;

            case CorNativeType.NATIVE_TYPE_FIXEDSYSSTRING:
                NuGenHelperFunctions.StepIntPtr(ref signatureBlob, NuGenSignatureCompression.CorSigUncompressData(SignatureBlob, out data));
                result.NumberElem = (int)data;
                break;

            case CorNativeType.NATIVE_TYPE_FIXEDARRAY:
                NuGenHelperFunctions.StepIntPtr(ref signatureBlob, NuGenSignatureCompression.CorSigUncompressData(SignatureBlob, out data));
                result.NumberElem = (int)data;

                result.NextItem = ReadNativeType();
                break;
            }

            return(result);
        }
Exemple #24
0
        public void Initialize()
        {
            CodeLines = new List <NuGenCodeLine>();

            NuGenCodeLine definition = new NuGenCodeLine(0, "file " + Name);

            CodeLines.Add(definition);

            CodeLines.Add(new NuGenCodeLine(0, string.Format(".hash = {0}", NuGenHelperFunctions.ReadBlobAsString(Hash, HashLength))));
        }
Exemple #25
0
 public override void SetGenericParametersOfMethod(List <NuGenGenericParameter> genericParameters)
 {
     if (Arguments != null && HasGenericMethodParameter)
     {
         foreach (NuGenBaseSignatureItem signatureItem in Arguments)
         {
             NuGenHelperFunctions.SetSignatureItemToken(AllTokens, signatureItem, genericParameters);
         }
     }
 }
        private void projectPropertiesMenuItem_Click(object sender, EventArgs e)
        {
            NuGenProjectProperties properties = new NuGenProjectProperties();

            if (properties.DisplaySettings() == DialogResult.OK)
            {
                projectElements.Nodes[0].Text = NuGenHelperFunctions.TruncateText(NuGenProject.Instance.Name);
                NuGenUIHandler.Instance.ShowDebuggerState(DebuggerState.DebuggeeStopped);
            }
        }
        private string ReservedFlagsAsString()
        {
            string       result        = string.Empty;
            CorFieldAttr reservedFlags = Flags & CorFieldAttr.fdReservedMask;

            result = NuGenHelperFunctions.EnumAsString(Flags, CorFieldAttr.fdRTSpecialName, "rtsspecialname ");

            result += NuGenHelperFunctions.EnumAsString(Flags, CorFieldAttr.fdHasFieldMarshal, "marshal ");

            return(result);
        }
Exemple #28
0
        private void ReadLocalVarSignature(ref IntPtr signatureBlob)
        {
            uint count;

            NuGenHelperFunctions.StepIntPtr(ref signatureBlob, NuGenSignatureCompression.CorSigUncompressData(signatureBlob, out count));

            if (count > 0)
            {
                Parameters = new List <NuGenBaseSignatureItem>();
            }

            int index = 0;

            while (index < count)
            {
                index++;
                uint data;
                uint dataLength = NuGenSignatureCompression.CorSigUncompressData(signatureBlob, out data);
                bool pinned     = ((CorElementType)data == CorElementType.ELEMENT_TYPE_PINNED);

                if (pinned)
                {
                    NuGenHelperFunctions.StepIntPtr(ref signatureBlob, dataLength);
                    dataLength = NuGenSignatureCompression.CorSigUncompressData(signatureBlob, out data);
                }

                bool byRef = ((CorElementType)data == CorElementType.ELEMENT_TYPE_BYREF);

                if (byRef)
                {
                    NuGenHelperFunctions.StepIntPtr(ref signatureBlob, dataLength);
                }

                NuGenBaseSignatureItem signatureItem     = ReadSignatureItem(ref signatureBlob);
                NuGenTypeSignatureItem typeSignatureItem = null;

                if (signatureItem is NuGenArraySignatureItem)
                {
                    typeSignatureItem = ((NuGenArraySignatureItem)signatureItem).Type;
                }
                else if (signatureItem is NuGenTypeSignatureItem)
                {
                    typeSignatureItem = (NuGenTypeSignatureItem)signatureItem;
                }

                if (typeSignatureItem != null)
                {
                    typeSignatureItem.ByRef  = byRef;
                    typeSignatureItem.Pinned = pinned;
                }

                Parameters.Add(signatureItem);
            }
        }
Exemple #29
0
        private void DisplayValue(NuGenBaseValueRefresher valueRefresher, TreeNode parentNode)
        {
            fieldList.Items.Clear();
            evaluationLogListBox.Items.Clear();

            try
            {
                NuGenDebugExpressionResult debugValue = new NuGenDebugExpressionResult(EvaluationContext, valueRefresher.GetRefreshedValue());

                if (NuGenHelperFunctions.HasValueClass(debugValue.ResultValue))
                {
                    EnableControlsForEvaluation(false);
                    CancelValueFormattersDisplaying = false;
                    MissingModules     = new List <NuGenIValueFormatter>();
                    IsTypeOfValueFound = false;
                    ValueDisplayer.CreateComplexFormatter(debugValue, valueRefresher, FrameRefresher, parentNode);
                }
                else
                {
                    NuGenIValueFormatter valueFormatter = ValueDisplayer.CreateSimpleFormatter(debugValue);
                    valueFormatter.Name           = valueRefresher.Name;
                    valueFormatter.ValueRefresher = valueRefresher;
                    DisplayValueFormatter(valueFormatter);

                    if (valueFormatter is NuGenISimpleTypeValueFormatter)
                    {
                        NuGenStringValueFormatter valueTypeFormatter = new NuGenStringValueFormatter(((NuGenISimpleTypeValueFormatter)valueFormatter).GetNumberTypeName());
                        valueTypeFormatter.FieldGroup = ValueFieldGroup.ObjectInformation;
                        valueTypeFormatter.Name       = "Type of value";
                        DisplayValueFormatter(valueTypeFormatter);
                    }
                }
            }
            catch (NuGenEvaluationException evaluationException)
            {
                DisplayValueFormatter(new NuGenErrorValueFormatter("Evaluation exception", evaluationException.Message));
            }
            catch (NuGenEvaluationHandlerException evaluationHandlerException)
            {
                DisplayValueFormatter(new NuGenErrorValueFormatter("Evaluation running exception", evaluationHandlerException.Message));
            }
            catch (NugenMissingModuleException missingModuleException)
            {
                DisplayValueFormatter(new NuGenMissingModuleFormatter(missingModuleException.MissingModule));
            }
            catch (InvalidOperationException invalidOperationException)
            {
                DisplayValueFormatter(new NuGenErrorValueFormatter("Evaluation exception", invalidOperationException.Message));
            }
            catch (Exception exception)
            {
                DisplayValueFormatter(new NuGenErrorValueFormatter("Unexpected exception", exception.Message));
            }
        }
 private void Instance_DisplayHexaNumbersChanged()
 {
     if (threadsGrid.RowCount != 0)
     {
         for (int i = 0; i < threadsGrid.RowCount; i++)
         {
             GridEXCell idCell = threadsGrid.GetRow(i).Cells[0];
             idCell.Value = NuGenHelperFunctions.FormatNumber(NuGenHelperFunctions.TaggedObjects[(int)idCell.Value]);
         }
     }
 }