예제 #1
0
        public DebugTOParams(DebugTO debugTo, bool isInput, string leftLabel = "", string rightLabel = "", List<string> regions = null)
        {
            _debugTo = debugTo;
            _isInput = isInput;
            _leftLabel = leftLabel;
            _rightLabel = rightLabel;
            _labelText = "";
            _regions = regions;

        }
        public List<IDebugItemResult> CreateDebugItemForInput(DebugTO debugTo, string labelText, string leftLabel, string rightLabel, List<string> regions)
        {
            var results = new List<IDebugItemResult>();
            if(debugTo.LeftEntry != null)
            {
                GetValue(debugTo.LeftEntry, debugTo, leftLabel, regions, results);
                debugTo.LeftEntry.DisposeCache();
            }

            if(debugTo.RightEntry != null)
            {
                GetValue(debugTo.RightEntry, debugTo, rightLabel, regions, results);
            }

            return results;
        }
        public List<IDebugItemResult> CreateDebugItemForOutput(DebugTO debugTo, string labelText, List<string> regions)
        {
            var results = new List<IDebugItemResult>();
            if(debugTo.TargetEntry != null)
            {
                GetValue(debugTo.TargetEntry, debugTo, labelText, regions, results);
                debugTo.TargetEntry.DisposeCache();
            }

            return results;
        }
        static void GetValue(IBinaryDataListEntry entry, DebugTO debugTo, string labelText, List<string> regions, List<IDebugItemResult> results)
        {
            ComplexExpressionAuditor auditor = entry.ComplexExpressionAuditor;
            if(auditor != null)
            {
                int grpIdx = 0;
                IList<ComplexExpressionAuditItem> complexExpressionAuditItems = auditor.FetchAuditItems();

                foreach(ComplexExpressionAuditItem item in complexExpressionAuditItems)
                {
                    string groupName = null;
                    string displayExpression = item.Expression;
                    string rawExpression = item.RawExpression;
                    if(regions != null && regions.Count > 0)
                    {
                        //    
                    }

                    if(displayExpression.Contains("().") || displayExpression.Contains("(*)."))
                    {
                        grpIdx++;
                        groupName = displayExpression;
                        displayExpression = rawExpression;
                    }
                    else
                    {
                        if(regions != null && regions.Count > 0)
                        {
                            string indexRegionFromRecordset = DataListUtil.ExtractIndexRegionFromRecordset(displayExpression);
                            int indexForRecset;
                            int.TryParse(indexRegionFromRecordset, out indexForRecset);

                            if(indexForRecset > 0)
                            {
                                int indexOfOpenningBracket = displayExpression.IndexOf("(", StringComparison.Ordinal) + 1;
                                string group = displayExpression.Substring(0, indexOfOpenningBracket) + "*" + displayExpression.Substring(indexOfOpenningBracket + indexRegionFromRecordset.Length);

                                if(regions.Contains(@group))
                                {
                                    grpIdx++;
                                    groupName = @group;
                                }
                            }
                        }
                    }

                    int count = complexExpressionAuditItems.Count(i => i.Expression.Equals(item.Expression));
                    if(count < 2)
                    {
                        groupName = "";
                    }

                    var debugOperator = "";
                    var debugType = DebugItemResultType.Value;
                    if(DataListUtil.IsEvaluated(displayExpression))
                    {
                        debugOperator = "=";
                        debugType = DebugItemResultType.Variable;
                    }
                    else
                    {
                        displayExpression = null;
                    }
                    results.Add(new DebugItemResult
                    {
                        Type = debugType,
                        Label = labelText,
                        Variable = displayExpression,
                        Operator = debugOperator,
                        GroupName = groupName,
                        Value = item.BoundValue,
                        GroupIndex = grpIdx
                    });
                }
            }
            else
            {
                //Could not evaluate
                results.Add(new DebugItemResult
                {
                    Type = DebugItemResultType.Value,
                    Label = labelText,
                    Variable = debugTo.Expression,
                    Operator = "=",
                    GroupName = "",
                    Value = ""
                });
            }
        }
 public DebugItemVariableParams(DebugTO debugTO, List<string> regions = null)
 {
     _debugTO = debugTO;
     _labelText = "";
     _regions = regions;
 }