ide delete file
This commit is contained in:
@@ -20,11 +20,11 @@ public class IdeFileOperationsService(SharpIdeSolutionModificationService sharpI
|
||||
await _sharpIdeSolutionModificationService.RemoveDirectory(folder);
|
||||
}
|
||||
|
||||
// public async Task DeleteFile(SharpIdeFile file)
|
||||
// {
|
||||
// File.Delete(file.Path);
|
||||
// await _sharpIdeSolutionModificationService.RemoveFile(file);
|
||||
// }
|
||||
public async Task DeleteFile(SharpIdeFile file)
|
||||
{
|
||||
File.Delete(file.Path);
|
||||
await _sharpIdeSolutionModificationService.RemoveFile(file);
|
||||
}
|
||||
|
||||
public async Task CreateCsFile(SharpIdeFolder parentFolder, string newFileName)
|
||||
{
|
||||
|
||||
@@ -68,4 +68,12 @@ public class SharpIdeSolutionModificationService(FileChangedService fileChangedS
|
||||
SolutionModel.AllFiles.Add(sharpIdeFile);
|
||||
await _fileChangedService.SharpIdeFileAdded(sharpIdeFile, contents);
|
||||
}
|
||||
|
||||
public async Task RemoveFile(SharpIdeFile file)
|
||||
{
|
||||
var parentFolderOrProject = (IFolderOrProject)file.Parent;
|
||||
parentFolderOrProject.Files.Remove(file);
|
||||
SolutionModel.AllFiles.Remove(file);
|
||||
await _fileChangedService.SharpIdeFileRemoved(file);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user