csharpdeeb25a2 | 1 | using System.IO; |
| 2 | |
| 3 | namespace CascadeIDE.ViewModels; |
| 4 | |
| 5 | /// <summary>Элемент стека вызовов для панели отладки.</summary> |
| 6 | public sealed class DebugStackFrameViewModel |
| 7 | { |
| 8 | public DebugStackFrameViewModel(int frameIndex, string name, string? file, int line) |
| 9 | { |
| 10 | FrameIndex = frameIndex; |
| 11 | Name = name; |
| 12 | FilePath = file; |
| 13 | Line = line; |
| 14 | FileNameOnly = string.IsNullOrEmpty(file) ? "" : Path.GetFileName(file); |
| 15 | HasFile = !string.IsNullOrEmpty(file) && !string.IsNullOrEmpty(FileNameOnly); |
| 16 | LocationText = HasFile ? $"{FileNameOnly}:{line}" : (line > 0 ? $"(строка {line})" : "—"); |
| 17 | DisplayText = $"{Name} — {FilePath ?? ""}:{Line}"; |
| 18 | } |
| 19 | |
| 20 | public int FrameIndex { get; } |
| 21 | public string FrameIndexText => FrameIndex.ToString(); |
| 22 | public string Name { get; } |
| 23 | public string? FilePath { get; } |
| 24 | public int Line { get; } |
| 25 | public string FileNameOnly { get; } |
| 26 | public bool HasFile { get; } |
| 27 | public string LocationText { get; } |
| 28 | public string DisplayText { get; } |
| 29 | } |
| 30 | |
View only · write via MCP/CIDE