public string GetTemporaryFile()
{
lock(emulatorTemporaryPath)
{
string path;
do
{
var fileName = string.Format("{0}.tmp", Guid.NewGuid());
path = Path.Combine(emulatorTemporaryPath, fileName);
// this is guid, collision is very unlikely
}
while(File.Exists(path));
using(File.Create(path))
{
//that's the simplest way to create and NOT have the file open
}
var ofc = OnFileCreated;
if(ofc != null)
{
ofc(path);
}
return path;
}
}