private void AddModuleToGrid(ModuleWrapper module, GridEXRow row)
        {
            AssignNumberValueToCell <uint>(row.Cells[0], module.GetToken());
            AssignNumberValueToCell <ulong>(row.Cells[1], module.GetBaseAddress());
            AssignNumberValueToCell <uint>(row.Cells[2], module.GetSize());

            row.Cells[3].Value = module.IsDynamic();
            row.Cells[4].Value = module.IsInMemory();

            string moduleName = module.GetName();

            try
            {
                row.Cells[5].Value = Path.GetFileName(moduleName);
            }
            catch
            {
            }

            row.Cells[6].Value = moduleName;

            AssemblyWrapper assembly = module.GetAssembly();

            row.Cells[7].Value = assembly.GetName();

            AppDomainWrapper appDomain = assembly.GetAppDomain();

            row.Cells[8].Value = appDomain.GetName();
        }
        private void ShowThreads()
        {
            threadsGrid.BeginGridUpdate();
            threadsGrid.ClearItems();
            List <ThreadWrapper> threads = NuGenDebugEventHandler.Instance.EventObjects.Controller.EnumerateThreads();

            foreach (ThreadWrapper thread in threads)
            {
                EvaluatedThreadName = "<no name>";
                ValueWrapper threadObject       = null;
                ValueWrapper dereferencedObject = null;

                if (!HasSearchedForNameMethod)
                {
                    threadObject = thread.GetObject();

                    if (threadObject != null && !threadObject.IsNull())
                    {
                        dereferencedObject = threadObject.DereferenceValue();

                        if (dereferencedObject != null)
                        {
                            ClassWrapper  threadClass     = dereferencedObject.GetClassInformation();
                            uint          threadTypeToken = threadClass.GetToken();
                            ModuleWrapper module          = threadClass.GetModule();

                            FindGetThreadNameMethod(threadTypeToken, module);
                        }
                    }
                }

                if (HasSearchedForNameMethod)
                {
                    if (GetThreadNameMethod == null)
                    {
                        EvaluatedThreadName = "<definition of the Thread class is not loaded>";
                    }
                    else
                    {
                        if (threadObject == null)
                        {
                            threadObject = thread.GetObject();

                            if (threadObject != null && !threadObject.IsNull())
                            {
                                dereferencedObject = threadObject.DereferenceValue();
                            }
                        }

                        if (dereferencedObject != null)
                        {
                            FrameWrapper threadActiveFrame = thread.GetActiveFrame();

                            if (threadActiveFrame != null)
                            {
                                NuGenFrameRefresher threadActiveFrameRefresher = new NuGenFrameRefresher(thread, threadActiveFrame.ChainIndex, threadActiveFrame.FrameIndex, threadActiveFrame.IsActiveFrame);

                                GetThreadName(thread, threadObject, threadActiveFrameRefresher);
                            }
                        }
                    }
                }

                GridEXRow row = threadsGrid.AddItem();

                uint       threadID = thread.GetID();
                GridEXCell idCell   = row.Cells[0];
                NuGenHelperFunctions.TaggedObjects.Add((int)idCell.Value, threadID);
                idCell.Value       = NuGenHelperFunctions.FormatNumber(threadID);
                row.Cells[1].Value = EvaluatedThreadName;

                AppDomainWrapper appDomain = thread.GetAppDomain();

                if (appDomain != null)
                {
                    row.Cells[2].Value = appDomain.GetName();
                }

                NuGenHelperFunctions.TaggedObjects.Add((String)row.Cells[1].Value + (String)row.Cells[2].Value, thread);
            }

            threadsGrid.EndGridUpdate();
        }