Create cs file v2

This commit is contained in:
Matt Parker
2025-10-20 19:45:58 +10:00
parent 7d379939e9
commit 6fa0049f62
4 changed files with 42 additions and 1 deletions

View File

@@ -59,4 +59,13 @@ public class SharpIdeSolutionModificationService(FileChangedService fileChangedS
await _fileChangedService.SharpIdeFileRemoved(file);
}
}
public async Task CreateFile(SharpIdeFolder parentFolder, string fileName, string contents)
{
var newFilePath = Path.Combine(parentFolder.Path, fileName);
var sharpIdeFile = new SharpIdeFile(newFilePath, fileName, parentFolder, []);
parentFolder.Files.Add(sharpIdeFile);
SolutionModel.AllFiles.Add(sharpIdeFile);
await _fileChangedService.SharpIdeFileAdded(sharpIdeFile, contents);
}
}