SIL.Utils.MockFileOS.GetFileInfo C# (CSharp) Method

GetFileInfo() private method

Gets the file info for the given filename (Using a case-insensitive lookup).
filename is a null reference filename is an empty string ("") or /// contains only white space File not found File locked
private GetFileInfo ( string filename, FileLockType lockNeeded ) : MockFile
filename string The fully-qualified file name
lockNeeded FileLockType Indicates what type of access is needed. If a /// permission is needed that is not available, throws an IOException
return MockFile
		private MockFile GetFileInfo(string filename, FileLockType lockNeeded)
		{
			if (filename == null)
				throw new ArgumentNullException("filename");
			if (filename.Trim() == string.Empty)
				throw new ArgumentException("Empty filename");

			MockFile finfo = m_existingFiles[GetKey(filename)];
			if (lockNeeded == FileLockType.None)
				return finfo;

			switch (finfo.Lock)
			{
				case FileLockType.Read:
					if (lockNeeded == FileLockType.Write)
						throw new IOException("File " + filename + " is locked (open for read).");
					break;
				case FileLockType.Write:
					throw new IOException("File " + filename + " is locked (open for write).");
			}
			return finfo;
		}

Same methods

MockFileOS::GetFileInfo ( string filename ) : MockFile