会社のデバイス予約用のある種のグローバルストレージとしてファイルを使用するアプリケーションの場合、ファイルの読み取りと書き込み(またはファイルのロック、読み取り、書き込み、ロック解除)の方法が必要です。小さなコードスニペットは、私が言っていることを示しています。
FileStream in = new FileStream("storage.bin", FileMode.Open);
//read the file
in.Close();
//!!!!!
//here is the critical section since between reading and writing, there shouldnt
//be a way for another process to access and lock the file, but there is the chance
//because the in stream is closed
//!!!!!
FileStream out = new FileStream("storage.bin", FileMode.Create);
//write data to file
out.Close();
これはこのようなものになるはずです
LockFile("storage.bin");
//read from it...
//OVERwrite it....
UnlockFile("storage.bin");
プログラムは2000台のデバイスで同時に実行する必要があるため、この方法は絶対に安全である必要があります