Example #1
0
        static StreamHelperType FindStreamHelperType(TypeDef type)
        {
            foreach (var field in type.Fields)
            {
                var nested = field.FieldSig.GetFieldType().TryGetTypeDef();
                if (nested == null)
                {
                    continue;
                }
                if (nested.DeclaringType != type)
                {
                    continue;
                }
                if (!new FieldTypes(nested).Exactly(streamHelperTypeFields))
                {
                    continue;
                }
                var streamHelperType = new StreamHelperType(nested);
                if (!streamHelperType.Detected)
                {
                    continue;
                }

                return(streamHelperType);
            }
            return(null);
        }
Example #2
0
 bool CheckType(TypeDef type)
 {
     if (!new FieldTypes(type).All(requiredFieldTypes))
     {
         return(false);
     }
     if (type.NestedTypes.Count == 0)
     {
         return(DotNetUtils.FindFieldType(type, "System.IO.BinaryReader", true) != null &&
                DotNetUtils.FindFieldType(type, "System.Collections.Generic.Dictionary`2<System.Int32,System.String>", true) != null);
     }
     else if (type.NestedTypes.Count == 3)
     {
         streamHelperType = FindStreamHelperType(type);
         return(streamHelperType != null);
     }
     else if (type.NestedTypes.Count == 1)
     {
         return(type.NestedTypes[0].IsEnum);
     }
     else
     {
         return(false);
     }
 }
Example #3
0
        static StreamHelperType findStreamHelperType(TypeDefinition type)
        {
            foreach (var field in type.Fields)
            {
                var nested = field.FieldType as TypeDefinition;
                if (nested == null)
                {
                    continue;
                }
                if (nested.DeclaringType != type)
                {
                    continue;
                }
                if (!new FieldTypes(nested).exactly(streamHelperTypeFields))
                {
                    continue;
                }
                var streamHelperType = new StreamHelperType(nested);
                if (!streamHelperType.Detected)
                {
                    continue;
                }

                return(streamHelperType);
            }
            return(null);
        }
Example #4
0
		static StreamHelperType FindStreamHelperType(TypeDef type) {
			foreach (var field in type.Fields) {
				var nested = field.FieldSig.GetFieldType().TryGetTypeDef();
				if (nested == null)
					continue;
				if (nested.DeclaringType != type)
					continue;
				if (!new FieldTypes(nested).Exactly(streamHelperTypeFields))
					continue;
				var streamHelperType = new StreamHelperType(nested);
				if (!streamHelperType.Detected)
					continue;

				return streamHelperType;
			}
			return null;
		}
Example #5
0
		bool CheckType(TypeDef type) {
			if (!new FieldTypes(type).All(requiredFieldTypes))
				return false;
			if (type.NestedTypes.Count == 0) {
				return DotNetUtils.FindFieldType(type, "System.IO.BinaryReader", true) != null &&
					DotNetUtils.FindFieldType(type, "System.Collections.Generic.Dictionary`2<System.Int32,System.String>", true) != null;
			}
			else if (type.NestedTypes.Count == 3) {
				streamHelperType = FindStreamHelperType(type);
				return streamHelperType != null;
			}
			else if (type.NestedTypes.Count == 1) {
				return type.NestedTypes[0].IsEnum;
			}
			else
				return false;
		}
Example #6
0
        static StreamHelperType findStreamHelperType(TypeDefinition type)
        {
            foreach (var field in type.Fields) {
                var nested = field.FieldType as TypeDefinition;
                if (nested == null)
                    continue;
                if (nested.DeclaringType != type)
                    continue;
                if (!new FieldTypes(nested).exactly(streamHelperTypeFields))
                    continue;
                var streamHelperType = new StreamHelperType(nested);
                if (!streamHelperType.Detected)
                    continue;

                return streamHelperType;
            }
            return null;
        }