Create cs file v2
This commit is contained in:
@@ -18,4 +18,19 @@ public class IdeFileOperationsService(SharpIdeSolutionModificationService sharpI
|
||||
Directory.Delete(folder.Path, true);
|
||||
await _sharpIdeSolutionModificationService.RemoveDirectory(folder);
|
||||
}
|
||||
|
||||
// public async Task DeleteFile(SharpIdeFile file)
|
||||
// {
|
||||
// File.Delete(file.Path);
|
||||
// await _sharpIdeSolutionModificationService.RemoveFile(file);
|
||||
// }
|
||||
|
||||
public async Task CreateCsFile(SharpIdeFolder parentFolder, string newFileName, string @namespace)
|
||||
{
|
||||
var newFilePath = Path.Combine(parentFolder.Path, newFileName);
|
||||
var className = Path.GetFileNameWithoutExtension(newFileName);
|
||||
var fileText = NewFileTemplates.CsharpClass(className, @namespace);
|
||||
await File.WriteAllTextAsync(newFilePath, fileText);
|
||||
await _sharpIdeSolutionModificationService.CreateFile(parentFolder, newFileName, fileText);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user