Forge
csharpdeeb25a2
1#nullable enable
2
3using System.IO;
4
5namespace CascadeIDE.Features.Workspace.DataAcquisition;
6
7/// <summary>Безопасное чтение текстовых файлов workspace (ADR 0102).</summary>
8public static class WorkspaceTextFileReader
9{
10 public static bool TryReadAllText(string absolutePath, out string content)
11 {
12 content = "";
13 if (string.IsNullOrWhiteSpace(absolutePath) || !File.Exists(absolutePath))
14 return false;
15
16 try
17 {
18 content = File.ReadAllText(absolutePath);
19 return true;
20 }
21 catch
22 {
23 return false;
24 }
25 }
26}
27
View only · write via MCP/CIDE