Exemplo n.º 1
0
        public override string GenerateDescription(NktParam aParameter, string functionName)
        {
            if (aParameter.PointerVal == IntPtr.Zero) return "0x0";
            var pointedParameter = aParameter.Evaluate();

            return pointedParameter.FieldsCount == 0 ? DescriptionForNonStructurePointee(aParameter) : DescriptionForStructurePointee(pointedParameter, functionName);
        }
Exemplo n.º 2
0
        private bool Inspect(NktParam parameter)
        {
            if (IsMaxAllowedDepthReached) return false;
            
            parameter.Accept(this);

            return true;
        }
        public override string GenerateDescription(NktParam aParameter, string functionName)
        {
            var nonStructureFields = NonStructureFieldsFrom(aParameter);
            if (nonStructureFields.Length == 0) return EmptyStructureDescription;

            var stringDescriptor = new StringDescriptor();

            if (!nonStructureFields.Any(parameter => stringDescriptor.CanHandle(parameter, functionName)))
                return FormatAsStructure(Describe(nonStructureFields.First(), functionName));


            var aField = nonStructureFields.First(aParameter1 => stringDescriptor.CanHandle(aParameter1, functionName));
            var fieldDescription = stringDescriptor.GenerateDescription(aField, functionName);
            return FormatAsStructure(fieldDescription);
        }
Exemplo n.º 4
0
        private static ParameterDescriptor For(NktParam aParameter, string functionName)
        {
            var generators = new ParameterDescriptor[]
                                 {
                                     new NullPointerDescriptor(),
                                     new MessageDescriptor(),
                                     new ResourceStringDescriptor(),
                                     new GuidDescriptor(),
                                     new StringDescriptor(),
                                     new StructureDescriptor(),
                                     new PointerDescriptor(),
                                     new BasicTypeDescriptor()
                                 };

            return generators.First(generator => generator.CanHandle(aParameter, functionName));
        }
Exemplo n.º 5
0
 public void VisitSignedDoubleWordParameter(NktParam aParameter)
 {
     RegisterInspectorFor(aParameter);
 }
Exemplo n.º 6
0
 public void VisitFloatParameter(NktParam aParameter)
 {
     RegisterInspectorFor(aParameter);
 }
Exemplo n.º 7
0
 public void VisitResourceStringParameter(NktParam aParameter)
 {
     RegisterInspectorFor(aParameter);
 }
Exemplo n.º 8
0
 private string ByteDescription(NktParam aParameter)
 {
     return(FormatAsHex(aParameter.ByteVal));
 }
 private static NktParam[] NonStructureFieldsFrom(NktParam aParameter)
 {
     return FieldsFrom(aParameter).Where(param => param.FieldsCount == 0).ToArray();
 }
Exemplo n.º 10
0
 public override bool CanHandle(NktParam aParameter, string functionName)
 {
     return IsMessageFunction(functionName) && IsMessageParameter(aParameter.Name);
 }
Exemplo n.º 11
0
        private InspectedParameter RegisterInspectorFor(NktParam aParameter)
        {
            var inspectedParameter = InspectedParameter.From(aParameter, _functionName);

            InspectedParameters.Add(inspectedParameter);

            return inspectedParameter;
        }
Exemplo n.º 12
0
 private string DescriptionForNonStructurePointee(NktParam aParameter)
 {
     return(FormatAsPointer(aParameter.PointerVal));
 }
Exemplo n.º 13
0
 private string DescriptionForStructurePointee(NktParam pointedParameter, string functionName)
 {
     return(Describe(pointedParameter, functionName));
 }
Exemplo n.º 14
0
        public static InspectedParameter From(NktParam aParameter, string functionName)
        {
            var description = ParameterDescriptor.Describe(aParameter, functionName);

            return(From(description, aParameter.Name, aParameter.Type()));
        }
Exemplo n.º 15
0
 public override string GenerateDescription(NktParam aParameter, string functionName)
 {
     return(aParameter.ReadString());
 }
Exemplo n.º 16
0
 public override bool CanHandle(NktParam aParameter, string functionName)
 {
     return(aParameter.IsWideString || aParameter.IsAnsiString);
 }
Exemplo n.º 17
0
 public override string GenerateDescription(NktParam aParameter, string functionName)
 {
     return("NULL");
 }
Exemplo n.º 18
0
 public void VisitNullPointerParameter(NktParam aParameter)
 {
     RegisterInspectorFor(aParameter);
 }
Exemplo n.º 19
0
        public void VisitStructureParameter(NktParam aParameter)
        {
            var inspectedStructure = RegisterInspectorFor(aParameter);
            
            foreach (var field in aParameter.Fields().CollectAllInspectables())
            {
                IncreaseInspectingDepth();

                if (Inspect(field))
                    RemoveLastCreatedParameterAndAddItAsChildOf(inspectedStructure);

                DecreaseInspectingDepth();
            }
        }
Exemplo n.º 20
0
 public override bool CanHandle(NktParam aParameter, string functionName)
 {
     return(aParameter.IsPointer);
 }
Exemplo n.º 21
0
        public override bool CanHandle(NktParam aParameter, string functionName)
        {
            var handledBasicTypes = _basicTypesHandlers.Keys;

            return(handledBasicTypes.Contains(aParameter.BasicType));
        }
Exemplo n.º 22
0
 public static string Describe(NktParam aParameter, string functionName)
 {
     return(For(aParameter, functionName).GenerateDescription(aParameter, functionName));
 }
Exemplo n.º 23
0
 public override bool CanHandle(NktParam aParameter, string functionName)
 {
     return aParameter.FieldsCount > 0;
 }
Exemplo n.º 24
0
 public abstract bool CanHandle(NktParam aParameter, string functionName);
Exemplo n.º 25
0
 public override bool CanHandle(NktParam aParameter, string functionName)
 {
     return aParameter.IsPointer && aParameter.IsNullPointer;
 }
Exemplo n.º 26
0
 public abstract string GenerateDescription(NktParam aParameter, string functionName);
Exemplo n.º 27
0
 public override bool CanHandle(NktParam aParameter, string functionName)
 {
     var handledBasicTypes = _basicTypesHandlers.Keys;
     return handledBasicTypes.Contains(aParameter.BasicType);
 }
 public override bool CanHandle(NktParam aParameter, string functionName)
 {
     return(aParameter.FieldsCount > 0);
 }
Exemplo n.º 29
0
 public void VisitWideCharParameter(NktParam aParameter)
 {
     RegisterInspectorFor(aParameter);
 }
 private static NktParam[] NonStructureFieldsFrom(NktParam aParameter)
 {
     return(FieldsFrom(aParameter).Where(param => param.FieldsCount == 0).ToArray());
 }
Exemplo n.º 31
0
 public void VisitUnsignedByteParameter(NktParam aParameter)
 {
     RegisterInspectorFor(aParameter);
 }
 private static NktParam[] FieldsFrom(NktParam aParameter)
 {
     return(aParameter.Fields().CollectAll());
 }
Exemplo n.º 33
0
 public void VisitUnsignedQuadWordParameter(NktParam aParameter)
 {
     RegisterInspectorFor(aParameter);
 }
Exemplo n.º 34
0
 private string WordDescription(NktParam aParameter)
 {
     return(FormatAsHex(aParameter.ShortVal));
 }
Exemplo n.º 35
0
        public void VisitNonNullPointerParameter(NktParam aParameter)
        {
            var pointee = aParameter.Evaluate();
            
            Inspect(pointee);

            // Parameter Name and Type information is provided by the pointer parameter, and not by the pointee
            UpdateLastAddedParameterInfo(aParameter.Name, aParameter.Type());
        }
Exemplo n.º 36
0
 public override bool CanHandle(NktParam aParameter, string functionName)
 {
     return !string.IsNullOrEmpty(aParameter.GuidString);
 }
Exemplo n.º 37
0
 public void VisitGuidStringParameter(NktParam aParameter)
 {
     RegisterInspectorFor(aParameter);
 }
Exemplo n.º 38
0
        public override string GenerateDescription(NktParam aParameter, string functionName)
        {
            var description = DescriptionFor(aParameter);
            var formattedDescription = string.IsNullOrEmpty(description) ? string.Empty : " " + description;

            return string.Format("0x{0:X}{1}", (uint)aParameter.Value, formattedDescription);
        }
Exemplo n.º 39
0
 public void VisitWideCharParameter(NktParam aParameter)
 {
     RegisterInspectorFor(aParameter);
 }
Exemplo n.º 40
0
 private string QuadWordDescription(NktParam aParameter)
 {
     return(FormatAsHex(aParameter.LongLongVal));
 }
Exemplo n.º 41
0
 public override string GenerateDescription(NktParam aParameter, string functionName)
 {
     return aParameter.GuidString;
 }
Exemplo n.º 42
0
 public void VisitStringParameter(NktParam aParameter)
 {
     RegisterInspectorFor(aParameter);
 }
Exemplo n.º 43
0
        private static string DescriptionFor(NktParam aParameter)
        {
            var messageCode = (uint)aParameter.Value;
            var descriptionNode = _knownParameterDescriptions.SelectSingleNode(DescriptionQueryFor(messageCode));

            if (descriptionNode == null) return string.Empty;

            if (string.IsNullOrEmpty(descriptionNode.InnerText))
            {
                return IsUserMessageCode(messageCode) ? DescriptionForUserMessage(messageCode) : string.Empty;
            }

            return DescriptionForMessage(descriptionNode);
        }
Exemplo n.º 44
0
 public void VisitFloatParameter(NktParam aParameter)
 {
     RegisterInspectorFor(aParameter);
 }
Exemplo n.º 45
0
 public static InspectedParameter From(NktParam aParameter, string functionName)
 {
     var description = ParameterDescriptor.Describe(aParameter, functionName);
     return From(description, aParameter.Name, aParameter.Type());
 }
Exemplo n.º 46
0
 public void VisitSignedByteParameter(NktParam aParameter)
 {
     RegisterInspectorFor(aParameter);
 }
Exemplo n.º 47
0
 private string ByteDescription(NktParam aParameter)
 {
     return FormatAsHex(aParameter.ByteVal);
 }
Exemplo n.º 48
0
 private string WordDescription(NktParam aParameter)
 {
     return FormatAsHex(aParameter.ShortVal);
 }
Exemplo n.º 49
0
 private static NktParam[] FieldsFrom(NktParam aParameter)
 {
     return aParameter.Fields().CollectAll();
 }
Exemplo n.º 50
0
 private string QuadWordDescription(NktParam aParameter)
 {
     return FormatAsHex(aParameter.LongLongVal);
 }
Exemplo n.º 51
0
 public override string GenerateDescription(NktParam aParameter, string functionName)
 {
     return "NULL";
 }
Exemplo n.º 52
0
        public override string GenerateDescription(NktParam aParameter, string functionName)
        {
            var generateDescriptionFor = _basicTypesHandlers[aParameter.BasicType];

            return(generateDescriptionFor(aParameter));
        }