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);
        }
        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);
        }
Esempio 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));
        }
 public void VisitSignedDoubleWordParameter(NktParam aParameter)
 {
     RegisterInspectorFor(aParameter);
 }
 public void VisitFloatParameter(NktParam aParameter)
 {
     RegisterInspectorFor(aParameter);
 }
 public void VisitResourceStringParameter(NktParam aParameter)
 {
     RegisterInspectorFor(aParameter);
 }
Esempio 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();
 }
Esempio n. 10
0
 public override bool CanHandle(NktParam aParameter, string functionName)
 {
     return IsMessageFunction(functionName) && IsMessageParameter(aParameter.Name);
 }
Esempio n. 11
0
        private InspectedParameter RegisterInspectorFor(NktParam aParameter)
        {
            var inspectedParameter = InspectedParameter.From(aParameter, _functionName);

            InspectedParameters.Add(inspectedParameter);

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

            return(From(description, aParameter.Name, aParameter.Type()));
        }
 public override string GenerateDescription(NktParam aParameter, string functionName)
 {
     return(aParameter.ReadString());
 }
 public override bool CanHandle(NktParam aParameter, string functionName)
 {
     return(aParameter.IsWideString || aParameter.IsAnsiString);
 }
Esempio n. 17
0
 public override string GenerateDescription(NktParam aParameter, string functionName)
 {
     return("NULL");
 }
Esempio n. 18
0
 public void VisitNullPointerParameter(NktParam aParameter)
 {
     RegisterInspectorFor(aParameter);
 }
Esempio 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();
            }
        }
 public override bool CanHandle(NktParam aParameter, string functionName)
 {
     return(aParameter.IsPointer);
 }
Esempio n. 21
0
        public override bool CanHandle(NktParam aParameter, string functionName)
        {
            var handledBasicTypes = _basicTypesHandlers.Keys;

            return(handledBasicTypes.Contains(aParameter.BasicType));
        }
Esempio n. 22
0
 public static string Describe(NktParam aParameter, string functionName)
 {
     return(For(aParameter, functionName).GenerateDescription(aParameter, functionName));
 }
 public override bool CanHandle(NktParam aParameter, string functionName)
 {
     return aParameter.FieldsCount > 0;
 }
Esempio n. 24
0
 public abstract bool CanHandle(NktParam aParameter, string functionName);
Esempio n. 25
0
 public override bool CanHandle(NktParam aParameter, string functionName)
 {
     return aParameter.IsPointer && aParameter.IsNullPointer;
 }
Esempio n. 26
0
 public abstract string GenerateDescription(NktParam aParameter, string functionName);
 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);
 }
Esempio 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());
 }
Esempio n. 31
0
 public void VisitUnsignedByteParameter(NktParam aParameter)
 {
     RegisterInspectorFor(aParameter);
 }
 private static NktParam[] FieldsFrom(NktParam aParameter)
 {
     return(aParameter.Fields().CollectAll());
 }
Esempio n. 33
0
 public void VisitUnsignedQuadWordParameter(NktParam aParameter)
 {
     RegisterInspectorFor(aParameter);
 }
Esempio n. 34
0
 private string WordDescription(NktParam aParameter)
 {
     return(FormatAsHex(aParameter.ShortVal));
 }
Esempio 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());
        }
Esempio n. 36
0
 public override bool CanHandle(NktParam aParameter, string functionName)
 {
     return !string.IsNullOrEmpty(aParameter.GuidString);
 }
Esempio n. 37
0
 public void VisitGuidStringParameter(NktParam aParameter)
 {
     RegisterInspectorFor(aParameter);
 }
Esempio 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);
        }
 public void VisitWideCharParameter(NktParam aParameter)
 {
     RegisterInspectorFor(aParameter);
 }
Esempio n. 40
0
 private string QuadWordDescription(NktParam aParameter)
 {
     return(FormatAsHex(aParameter.LongLongVal));
 }
Esempio n. 41
0
 public override string GenerateDescription(NktParam aParameter, string functionName)
 {
     return aParameter.GuidString;
 }
 public void VisitStringParameter(NktParam aParameter)
 {
     RegisterInspectorFor(aParameter);
 }
Esempio 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);
        }
 public void VisitFloatParameter(NktParam aParameter)
 {
     RegisterInspectorFor(aParameter);
 }
Esempio n. 45
0
 public static InspectedParameter From(NktParam aParameter, string functionName)
 {
     var description = ParameterDescriptor.Describe(aParameter, functionName);
     return From(description, aParameter.Name, aParameter.Type());
 }
 public void VisitSignedByteParameter(NktParam aParameter)
 {
     RegisterInspectorFor(aParameter);
 }
 private string ByteDescription(NktParam aParameter)
 {
     return FormatAsHex(aParameter.ByteVal);
 }
 private string WordDescription(NktParam aParameter)
 {
     return FormatAsHex(aParameter.ShortVal);
 }
 private static NktParam[] FieldsFrom(NktParam aParameter)
 {
     return aParameter.Fields().CollectAll();
 }
 private string QuadWordDescription(NktParam aParameter)
 {
     return FormatAsHex(aParameter.LongLongVal);
 }
Esempio n. 51
0
 public override string GenerateDescription(NktParam aParameter, string functionName)
 {
     return "NULL";
 }
Esempio n. 52
0
        public override string GenerateDescription(NktParam aParameter, string functionName)
        {
            var generateDescriptionFor = _basicTypesHandlers[aParameter.BasicType];

            return(generateDescriptionFor(aParameter));
        }