gentlesea
14 years agoFrequent Contributor
Code for removing existing regions (e.g. images) from the store of the current project
Hello, please have a look at the following code:
var projectPath = aqFileSystem.GetFolderInfo(Project.Path);
var regionsPath = projectPath.Path + "\Stores\\Regions\\";
foundFiles = aqFileSystem.FindFiles(regionsPath, "*.png", true);
if (foundFiles != null)
{
while (foundFiles.HasNext())
{
aFile = foundFiles.Next();
var fileToBeDeleted = aFile.Path;
aqFileSystem.DeleteFile(fileToBeDeleted);
}
}
else
Log.Message("No files were found.");
var fileToBeDeleted = projectPath.Path + "\Stores\\Regions.tcRegions";
aqFileSystem.DeleteFile(fileToBeDeleted);
fileToBeDeleted = projectPath.Path + "\Stores\\Stores.tcStores";
aqFileSystem.DeleteFile(fileToBeDeleted);
I tried to remove the regions and store like above. But I do not know how to trigger a refresh of the project or better add a blank store with one blank regions object. Can you help me with this?