コード例 #1
0
ファイル: DebuggerPanel.cs プロジェクト: slagusev/Krea
        public void refreshCurrentBuildValues()
        {
            this.BuilderState = ResponseBuilder.Instance;
            this.localsListView.BeginUpdate();
            TreeListViewItem itemParent = null;

            if (this.localsListView.SelectedItems.Count > 0)
            {
                itemParent = this.localsListView.SelectedItems[0];
            }

            //Copy all var
            if (this.BuilderState.Locals != null)
            {
                for (int i = 0; i < this.BuilderState.Locals.Count; i++)
                {
                    Local            local     = this.BuilderState.Locals[i];
                    TreeListViewItem localItem = new TreeListViewItem();
                    if (itemParent == null)
                    {
                        this.localsListView.Items.Add(localItem);
                    }
                    else
                    {
                        itemParent.Items.Add(localItem);
                    }


                    localItem.Text = local.Name;
                    if (local.Type == null)
                    {
                        continue;
                    }
                    if (local.Type.Equals("TABLE"))
                    {
                        localItem.ImageIndex = 0;
                    }
                    else if (local.Type.Equals("FIELD"))
                    {
                        localItem.ImageIndex = 3;
                    }
                    else if (local.Type.Equals("FUNCTION"))
                    {
                        localItem.ImageIndex = 2;
                    }
                    else if (local.Type.Equals("USERDATA"))
                    {
                        localItem.ImageIndex = 1;
                    }

                    localItem.SubItems.Add(local.Type);
                    localItem.SubItems.Add(local.Value);
                    localItem.SetIndentation();
                    localItem.Tag = local;
                }
            }

            this.localsListView.EndUpdate();

            //The Watches
            this.watchesListView.Items.Clear();

            if (this.BuilderState.Watchs != null)
            {
                for (int i = 0; i < this.BuilderState.Watchs.Count; i++)
                {
                    Watch watch = this.BuilderState.Watchs[i];
                    if (watch == null)
                    {
                        continue;
                    }
                    TreeListViewItem localItem = new TreeListViewItem();
                    localItem.Text = watch.Number;
                    localItem.SubItems.Add(watch.Expression);
                    this.watchesListView.Items.Add(localItem);
                }
            }

            if (this.BuilderState.Backtraces != null)
            {
                for (int i = 0; i < this.BuilderState.Backtraces.Count; i++)
                {
                    Backtrace trace = this.BuilderState.Backtraces[i];
                    if (trace == null)
                    {
                        continue;
                    }
                    TreeListViewItem localItem = new TreeListViewItem();
                    localItem.Text = trace.Number.ToString();
                    localItem.SubItems.Add(trace.Kind);

                    int indexFileStart = 0;
                    if (trace.File.Contains("\\"))
                    {
                        indexFileStart = trace.File.LastIndexOf("\\") + 1;
                    }

                    localItem.SubItems.Add(trace.File.Substring(indexFileStart, trace.File.Length - indexFileStart));
                    localItem.SubItems.Add(trace.Line.ToString());
                    this.backtraceListView.Items.Add(localItem);
                    localItem.ImageIndex = 2;
                }
            }
        }
コード例 #2
0
        public Backtrace registerBacktrace(string text)
        {
            Backtrace result      = new Backtrace();
            Match     matchresult = Regex.Match(text, @"\W{1,2}\s+(\d+)\W{1}\s+(\W{1}\w+\W{1})\s+([0-9a-zA-Z.\s\\_]+):(\d+)");

            if (matchresult.Success)
            {
                result.Number = Convert.ToInt32(matchresult.Groups[1].Value);
                result.Kind   = matchresult.Groups[2].Value;
                result.File   = matchresult.Groups[3].Value;
                result.Line   = Convert.ToInt32(matchresult.Groups[4].Value);
            }
            else
            {
                matchresult = Regex.Match(text, @"\W{1,2}\s+(\d+)\W{1}\s+(\W*\w+\W*)");
                if (matchresult.Success)
                {
                    result.Number = Convert.ToInt32(matchresult.Groups[1].Value);
                    result.Kind   = matchresult.Groups[2].Value;
                    result.File   = "?";
                    result.Line   = 0;
                }
                else
                {
                    matchresult = Regex.Match(text, @"\W{1,2}\s+(\d+)\W{1}\s+(\w+)\s+([0-9a-zA-Z.\s\\_?]+):(\d+)");
                    if (matchresult.Success)
                    {
                        result.Number = Convert.ToInt32(matchresult.Groups[1].Value);
                        result.Kind   = matchresult.Groups[2].Value;
                        result.File   = matchresult.Groups[3].Value;
                        result.Line   = Convert.ToInt32(matchresult.Groups[4].Value);
                    }
                    else
                    {
                        matchresult = Regex.Match(text, @"\W{1,2}\s+(\d+)\W{1}\s+(\w+)\s+([0-9a-zA-Z.\s\\_?]+)");
                        if (matchresult.Success)
                        {
                            result.Number = Convert.ToInt32(matchresult.Groups[1].Value);
                            result.Kind   = matchresult.Groups[2].Value;
                            result.File   = matchresult.Groups[3].Value;
                            result.Line   = -1;
                        }
                        else
                        {
                            matchresult = Regex.Match(text, @"\s+\W\s+(\d+)\W\s+(\W)\s+at\s+(\W):(\d+)(200\s+OK\s+)*(\d+)*");
                            if (matchresult.Success)
                            {
                                try
                                {
                                    result.Number = Convert.ToInt32(matchresult.Groups[1].Value);
                                    result.Kind   = matchresult.Groups[2].Value;
                                    result.File   = matchresult.Groups[3].Value;
                                    if (matchresult.Groups[5].Value.Contains("OK"))
                                    {
                                        PreviousAnalysedMessage = matchresult.Groups[5].Value + matchresult.Groups[6].Value;
                                    }
                                    result.Line = Convert.ToInt32(matchresult.Groups[4].Value);
                                }
                                catch
                                {
                                }
                            }
                            else
                            {
                                matchresult = Regex.Match(text, @"^\W{1,2}\s+(\d+)\W{1}\s+(\w+)(200\s+OK\s+)*(\d+)*$");
                                if (matchresult.Success)
                                {
                                    try
                                    {
                                        result.Number = Convert.ToInt32(matchresult.Groups[1].Value);
                                        result.Kind   = matchresult.Groups[2].Value;
                                        result.File   = "?";
                                        if (matchresult.Groups[3].Value.Contains("OK"))
                                        {
                                            PreviousAnalysedMessage = matchresult.Groups[3].Value + matchresult.Groups[4].Value;
                                        }
                                        result.Line = 0;
                                    }
                                    catch
                                    {
                                    }
                                }
                            }
                        }
                    }
                }
            }

            if (result.File.Equals(""))
            {
                string s = "";
            }
            return(result);
        }
コード例 #3
0
ファイル: ResponseBuilder.cs プロジェクト: nadar71/Krea
        public Backtrace registerBacktrace(string text)
        {
            Backtrace result = new Backtrace();
            Match matchresult = Regex.Match(text, @"\W{1,2}\s+(\d+)\W{1}\s+(\W{1}\w+\W{1})\s+([0-9a-zA-Z.\s\\_]+):(\d+)");
            if (matchresult.Success)
            {
                result.Number = Convert.ToInt32(matchresult.Groups[1].Value);
                result.Kind = matchresult.Groups[2].Value;
                result.File = matchresult.Groups[3].Value;
                result.Line = Convert.ToInt32(matchresult.Groups[4].Value);
            }
            else
            {
                matchresult = Regex.Match(text, @"\W{1,2}\s+(\d+)\W{1}\s+(\W*\w+\W*)");
                if (matchresult.Success)
                {
                    result.Number = Convert.ToInt32(matchresult.Groups[1].Value);
                    result.Kind = matchresult.Groups[2].Value;
                    result.File = "?";
                    result.Line = 0;
                }
                else {
                    matchresult = Regex.Match(text, @"\W{1,2}\s+(\d+)\W{1}\s+(\w+)\s+([0-9a-zA-Z.\s\\_?]+):(\d+)");
                    if (matchresult.Success)
                    {
                        result.Number = Convert.ToInt32(matchresult.Groups[1].Value);
                        result.Kind = matchresult.Groups[2].Value;
                        result.File = matchresult.Groups[3].Value;
                        result.Line = Convert.ToInt32(matchresult.Groups[4].Value);
                    }
                    else {
                        matchresult = Regex.Match(text, @"\W{1,2}\s+(\d+)\W{1}\s+(\w+)\s+([0-9a-zA-Z.\s\\_?]+)");
                        if (matchresult.Success)
                        {
                            result.Number = Convert.ToInt32(matchresult.Groups[1].Value);
                            result.Kind = matchresult.Groups[2].Value;
                            result.File = matchresult.Groups[3].Value;
                            result.Line = -1;
                        }
                        else
                        {
                            matchresult = Regex.Match(text, @"\s+\W\s+(\d+)\W\s+(\W)\s+at\s+(\W):(\d+)(200\s+OK\s+)*(\d+)*");
                            if (matchresult.Success)
                            {
                                try
                                {
                                    result.Number = Convert.ToInt32(matchresult.Groups[1].Value);
                                    result.Kind = matchresult.Groups[2].Value;
                                    result.File = matchresult.Groups[3].Value;
                                    if (matchresult.Groups[5].Value.Contains("OK"))
                                    {
                                        PreviousAnalysedMessage = matchresult.Groups[5].Value + matchresult.Groups[6].Value;
                                    }
                                    result.Line = Convert.ToInt32(matchresult.Groups[4].Value);
                                }
                                catch
                                {

                                }
                            }
                            else {
                                matchresult = Regex.Match(text, @"^\W{1,2}\s+(\d+)\W{1}\s+(\w+)(200\s+OK\s+)*(\d+)*$");
                                if (matchresult.Success)
                                {
                                    try
                                    {
                                        result.Number = Convert.ToInt32(matchresult.Groups[1].Value);
                                        result.Kind = matchresult.Groups[2].Value;
                                        result.File = "?";
                                        if (matchresult.Groups[3].Value.Contains("OK"))
                                        {
                                            PreviousAnalysedMessage = matchresult.Groups[3].Value + matchresult.Groups[4].Value;
                                        }
                                        result.Line = 0;
                                    }
                                    catch
                                    {

                                    }
                                }
                            }
                        }
                    }
                }
            }

            if (result.File.Equals(""))
            {
                string s = "";
            }
            return result;
        }