Check if sdlxliff file is already in use

Dear all,

I would like to check whether an sdlxliff file stored on a network drive is already open in the Studio editor. For this purpose, I use the method below (source: http://stackoverflow.com/questions/9277461/how-can-i-know-file-is-already-open-or-in-use, with minor changes).

With e.g. a Word file, it works correctly and returns true if the file is open in Word. With an sdlxliff file, however, it always returns false even though the file is open in the Studio editor.

Does Studio set such kind of lock to open files? If not, is there any alternative way of checking if a particular sdlxliff file is in use by Studio?

Any hint will be much appreciated.

protected static bool IsFileLocked(FileInfo file)

{

FileStream stream = null;

try

{

stream = file.Open(FileMode.Open, FileAccess.Read, FileShare.None);

}

catch (IOException)

{

return true;

}

finally

{

if (stream != null)

stream.Close();

}

return false;

}

 

Regards,

 

Dino