Ejemplo n.º 1
0
        public ResourceIdContext AddDialogResourceId(int resourceId, string resourceLabel)
        {
            ResourceIdContext resourceIdContext = new ResourceIdContext(resourceId, resourceLabel);

            if (this.DialogResourceMap.ContainsKey(resourceLabel))
            {
                //this.DuplicatesIds.Add(resourceId);
            }
            else
            {
                this.DialogResourceMap.Add(resourceLabel, resourceIdContext);
            }

            return(resourceIdContext);
        }
Ejemplo n.º 2
0
        public ResourceIdContext AddResrouceId(int resourceId, string resourceLabel)
        {
            ResourceIdContext resourceIdContext = new ResourceIdContext(resourceId, resourceLabel);

            if (this.ResourceIds.ContainsKey(resourceId))
            {
                //this.DuplicatesIds.Add(resourceId);
            }
            else
            {
                this.ResourceIds.Add(resourceId, resourceIdContext);
            }

            switch (resourceLabel)
            {
            case "SSM_CLICK":
                break;
            }

            if (this.ResourceNames.ContainsKey(resourceLabel))
            {
                switch (resourceLabel)
                {
                case "CMaskedAbnormalityWnd::MSG_MASK_AB_MOVE":
                    break;
                }

                //this.DuplicatesLabels.Add(resourceLabel);
            }
            else
            {
                this.ResourceNames.Add(resourceLabel, resourceIdContext);
            }

            return(resourceIdContext);
        }
Ejemplo n.º 3
0
        public override void Init()
        {
            try
            {
                string prefix = this.SingleLineText.Length > 4 ? this.SingleLineText.Substring(0, 4) : "";

                if (prefix == "DDX_")
                {
                    this.IsDDXExpression = true;
                }

                if (this.CallExpression.InvokedExpression != null)
                {
                    string invokeText = this.CallExpression.InvokedExpression.GetText();

                    invokeText = invokeText.Replace("->", ".");

                    string[] invokeAr = invokeText.Split('.');

                    if (invokeAr.Length == 1)
                    {
                        this.Method = invokeAr[0];
                    }
                    else
                    {
                        List <string> invokeList = new List <string>(invokeAr);

                        int cnt = 1;
                        foreach (string invokeName in invokeList)
                        {
                            if (cnt++ == invokeList.Count)
                            {
                                this.Method = invokeName;
                            }
                            else
                            {
                                this.VariableChain.Add(invokeName);
                            }
                        }
                    }
                }
                else
                {
                    LogManager.Self.Log("PenWebCallExpression() InvokedExpression is null");
                }

                base.Init();

                PenWebMemberAccessExpression penWebMemberAccessExpression = this.GetChildByType <PenWebMemberAccessExpression>();

                if (penWebMemberAccessExpression != null)
                {
                    this.Class = penWebMemberAccessExpression.Class;
                }
                else
                {
                    LogManager.Self.Log("PenWebCallExpression() penWebMemberAccessExpression is null");

                    HierarchySnapshot hierarchySnapshot = new HierarchySnapshot(this);
                }

                List <PenWebMacroReference> macroReferences = this.GetAllChildrenByTypeAsList <PenWebMacroReference>();

                foreach (PenWebMacroReference penWebMacroReference in macroReferences)
                {
                    switch (penWebMacroReference.MacroName)
                    {
                    case "TRUE":
                    case "FALSE":
                        break;

                    default:
                        this.MacroReferences.Add(penWebMacroReference.MacroName);
                        break;
                    }
                }

                PenWebFunctionArgumentList penWebFunctionArgumentList = this.GetChildByType <PenWebFunctionArgumentList>();

                if (penWebFunctionArgumentList != null)
                {
                    List <PenWebQualifiedReference> parameterList = penWebFunctionArgumentList.GetAllChildrenByTypeAsList <PenWebQualifiedReference>();

                    foreach (PenWebQualifiedReference penWebQualifiedReference in parameterList)
                    {
                        string typeName = penWebQualifiedReference.TypeName;
                        string itemName = penWebQualifiedReference.ItemName;

                        if (!String.IsNullOrWhiteSpace(typeName) && !String.IsNullOrWhiteSpace(typeName))
                        {
                            this.ParameterList.Add(penWebQualifiedReference);
                        }
                        else
                        {
                            this.ParameterList.Add(penWebQualifiedReference);
                        }
                    }
                }

                if (this.IsDDXExpression)
                {
                    if (MacroReferences.Count == 0)
                    {
                    }

                    if (ParameterList.Count == 0)
                    {
                    }

                    if (String.IsNullOrWhiteSpace(this.Method))
                    {
                    }

                    this.CppFunctionCatagory = CppFunctionCatagory.DDXCall;
                }
                else
                {
                    this.CppFunctionCatagory = CppFunctionCatagory.MethodCall;
                }


                this.SaveToJson = true;

                foreach (string resourceLabel in this.MacroReferences)
                {
                    ResourceIdContext resourceIdContext = CppResourceManager.Self.GetResourceIdContextByLabel(resourceLabel);

                    if (resourceIdContext != null)
                    {
                        this.ResourceIdContexts.Add(resourceIdContext);
                    }
                }
            }
            catch (Exception e)
            {
                LogManager.Self.Log("PenWebCallExpression Exception", e);
            }

            this.CallExpression    = null;
            this.CppExpressionNode = null;
        }
Ejemplo n.º 4
0
        private void CreateWidgetTypeBinding(PenWebCallExpression methodCall, PenWebWidgetType penWebWidgetType)
        {
            string resourceLabel = null;

            ResourceIdContext resourceIdContext = null;

            switch (methodCall.ResourceIdContexts.Count)
            {
            case 0:
                break;

            case 1:
                resourceIdContext = methodCall.ResourceIdContexts[0];
                break;

            default:
                resourceIdContext = methodCall.ResourceIdContexts[0];
                break;
            }

            if (resourceIdContext == null)
            {
                if (methodCall.MacroReferences.Count > 0)
                {
                    resourceLabel = methodCall.MacroReferences[0];
                }
                else
                {
                }
            }

            WidgetTypeBinding widgetTypeBinding = new WidgetTypeBinding();

            widgetTypeBinding.FileName         = this.CppCodeContext.FileName;
            widgetTypeBinding.LineNumber       = methodCall.Location.StartLine;
            widgetTypeBinding.PenWebWidgetType = penWebWidgetType;
            widgetTypeBinding.ResourceLabel    = resourceLabel;

            if (!String.IsNullOrWhiteSpace(resourceLabel))
            {
                this.RegisterTypeBinding(widgetTypeBinding);
            }

            if (resourceIdContext == null)
            {
                IncompleteWidgetTypeBindings.Add(widgetTypeBinding);

                if (!HasIncompleteBindings.ContainsKey(this.CppCodeContext.DialogClassName))
                {
                    HasIncompleteBindings.Add(this.CppCodeContext.DialogClassName, 1);
                    HasIncompleteBinding = true;
                }
                else
                {
                    HasIncompleteBindings[this.CppCodeContext.DialogClassName]++;
                }

                return;
            }

            if (resourceIdContext != null)
            {
                if (!HasBinding)
                {
                    HasBindings.Add(this.CppCodeContext.DialogClassName, 1);
                    HasBinding = true;
                }
                else
                {
                    HasBindings[this.CppCodeContext.DialogClassName]++;
                }

                //widgetTypeBinding.ResourceId = resourceIdContext.ResourceId;

                this.RegisterTypeBinding(widgetTypeBinding);

                //this.WidgetTypeBindings.Add(widgetTypeBinding);
            }
            else
            {
                IncompleteWidgetTypeBindings.Add(widgetTypeBinding);

                if (!HasIncompleteBinding)
                {
                    HasIncompleteBindings.Add(this.CppCodeContext.DialogClassName, 1);
                    HasIncompleteBinding = true;
                }
                else
                {
                    HasIncompleteBindings[this.CppCodeContext.DialogClassName]++;
                }

                IncompleteWidgetTypeBindings.Add(widgetTypeBinding);
            }
        }