Esempio n. 1
0
        public static IEnumerable <ClrDynamic> EnumerateDynamicObjects(this ClrHeap heap, IEnumerable <ClrType> types)
        {
            if (types == null)
            {
                return(heap.EnumerateDynamicObjects());
            }

            IList <ClrType> castedTypes = types as IList <ClrType> ?? types.ToList();

            if (castedTypes.Count == 0)
            {
                return(heap.EnumerateDynamicObjects());
            }

            if (castedTypes.Count == 1)
            {
                return(heap.EnumerateDynamicObjects(castedTypes[0]));
            }

            HashSet <ClrType> set = new HashSet <ClrType>(castedTypes);

            return(from address in heap.EnumerateObjectAddresses()
                   let type = heap.GetSafeObjectType(address)
                              where set.Contains(type)
                              select new ClrDynamic(address, type));
        }
Esempio n. 2
0
 public static IEnumerable <ClrDynamic> EnumerateDynamicObjects(this ClrHeap heap, ClrType type)
 {
     return(from address in heap.EnumerateObjectAddresses()
            let objectType = heap.GetSafeObjectType(address)
                             where objectType == type
                             select new ClrDynamic(address, type));
 }
Esempio n. 3
0
        public static IEnumerable <ClrObject> EnumerateClrObjects(this ClrHeap heap, IEnumerable <string> typeNames)
        {
            if (typeNames == null)
            {
                return(heap.EnumerateClrObjects());
            }

            IList <string> castedTypes = typeNames as IList <string> ?? typeNames.ToList();

            if (castedTypes.Count == 0)
            {
                return(heap.EnumerateClrObjects());
            }

            if (castedTypes.Count == 1)
            {
                return(heap.EnumerateClrObjects(castedTypes[0]));
            }

            HashSet <string> set = new HashSet <string>(castedTypes, StringComparer.OrdinalIgnoreCase);

            return(from address in heap.EnumerateObjects()
                   let type = heap.GetSafeObjectType(address)
                              where type != null && set.Contains(type.Name)
                              select new ClrObject(address, type));
        }
Esempio n. 4
0
        public static IEnumerable <ClrObject> EnumerateClrObjects(this ClrHeap heap, string typeName)
        {
            if (typeName.Contains("*"))
            {
                string typeNameRegex = "^" + Regex.Escape(typeName).Replace("\\*", ".*") + "$";
                Regex  regex         = new Regex(typeNameRegex, RegexOptions.Compiled | RegexOptions.IgnoreCase);

                return(from address in heap.EnumerateObjects()
                       let type = heap.GetSafeObjectType(address)
                                  where type != null && regex.IsMatch(type.Name)
                                  select new ClrObject(address, type));
            }

            return(from address in heap.EnumerateObjects()
                   let type = heap.GetSafeObjectType(address)
                              where type != null && type.Name.Equals(typeName, StringComparison.OrdinalIgnoreCase)
                              select new ClrObject(address, type));
        }
Esempio n. 5
0
 public static ClrDynamic GetDynamicObject(this ClrHeap heap, ulong address)
 {
     return(new ClrDynamic(address, heap.GetSafeObjectType(address)));
 }
Esempio n. 6
0
 public static ClrObject GetClrObject(this ClrHeap heap, ulong address)
 {
     return(new ClrObject(address, heap.GetSafeObjectType(address)));
 }