Pchp.Library.Streams.StreamWrapper.CheckOptions C# (CSharp) Method

CheckOptions() private method

Checks whether the supported read/write access matches the reqiured one.
private CheckOptions ( StreamAccessOptions accessOptions, FileAccess supportedAccess, string path ) : bool
accessOptions StreamAccessOptions The access options specified by the user.
supportedAccess FileAccess The read/write access options supported by the stream.
path string The path given by user to report errors.
return bool
        internal bool CheckOptions(StreamAccessOptions accessOptions, FileAccess supportedAccess, string path)
        {
            FileAccess requiredAccess = (FileAccess)accessOptions & FileAccess.ReadWrite;
            FileAccess faultyAccess = requiredAccess & ~supportedAccess;
            if ((faultyAccess & FileAccess.Read) > 0)
            {
                PhpException.Throw(PhpError.Warning, ErrResources.stream_open_read_unsupported, FileSystemUtils.StripPassword(path));
                return false;
            }
            else if ((faultyAccess & FileAccess.Write) > 0)
            {
                PhpException.Throw(PhpError.Warning, ErrResources.stream_open_write_unsupported, FileSystemUtils.StripPassword(path));
                return false;
            }
            return true;
        }