BattleShip.FileManager.ChangeFileStatus C# (CSharp) Method

ChangeFileStatus() private method

lock or unlock the bnav file The lock work with a copy of the original file with '.lock' at the end. - ex 'BN-V02-2016-01-02-14-20-50.bnav.lock' To unlock the original file the '.lock' file is deleted
private ChangeFileStatus ( bool _lock ) : void
_lock bool
return void
        private void ChangeFileStatus(bool _lock)
        {
            //ChangeFileStatus(true); -> verrouille le fichier
            //ChangeFileStatus(false); -> deverrouille le fichier
            if (fileName != null)
            {
                string fullFileNameLocked;
                fullFileNameLocked = fullFileName + ".lock";

                // Lock the file
                if (_lock)
                {
                    // Create the file and close it immediatly to avoid processus acces error
                    FileStream myFileStream;
                    myFileStream = File.Create(path + fullFileNameLocked); //The lock file is created 'BN-.......bnav.lock'
                    myFileStream.Close();
                }

                //Unlock the file
                if (!_lock)
                {
                    File.Delete(path + fullFileNameLocked);
                }
            }
        }