示例#1
0
        internal void AddPathList(FileIOPermissionAccess access, AccessControlActions control, string[] pathListOrig, bool checkForDuplicates, bool needFullPath, bool copyPathList)
        {
            if (pathListOrig == null)
            {
                throw new ArgumentNullException("pathList");
            }
            if (pathListOrig.Length == 0)
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_EmptyPath"));
            }
            FileIOPermission.VerifyAccess(access);
            if (this.m_unrestricted)
            {
                return;
            }
            string[] str = pathListOrig;
            if (copyPathList)
            {
                str = new string[pathListOrig.Length];
                Array.Copy((Array)pathListOrig, (Array)str, pathListOrig.Length);
            }
            FileIOPermission.CheckIllegalCharacters(str);
            ArrayList listFromExpressions = StringExpressionSet.CreateListFromExpressions(str, needFullPath);

            if ((access & FileIOPermissionAccess.Read) != FileIOPermissionAccess.NoAccess)
            {
                if (this.m_read == null)
                {
                    this.m_read = new FileIOAccess();
                }
                this.m_read.AddExpressions(listFromExpressions, checkForDuplicates);
            }
            if ((access & FileIOPermissionAccess.Write) != FileIOPermissionAccess.NoAccess)
            {
                if (this.m_write == null)
                {
                    this.m_write = new FileIOAccess();
                }
                this.m_write.AddExpressions(listFromExpressions, checkForDuplicates);
            }
            if ((access & FileIOPermissionAccess.Append) != FileIOPermissionAccess.NoAccess)
            {
                if (this.m_append == null)
                {
                    this.m_append = new FileIOAccess();
                }
                this.m_append.AddExpressions(listFromExpressions, checkForDuplicates);
            }
            if ((access & FileIOPermissionAccess.PathDiscovery) != FileIOPermissionAccess.NoAccess)
            {
                if (this.m_pathDiscovery == null)
                {
                    this.m_pathDiscovery = new FileIOAccess(true);
                }
                this.m_pathDiscovery.AddExpressions(listFromExpressions, checkForDuplicates);
            }
            if ((control & AccessControlActions.View) != AccessControlActions.None)
            {
                if (this.m_viewAcl == null)
                {
                    this.m_viewAcl = new FileIOAccess();
                }
                this.m_viewAcl.AddExpressions(listFromExpressions, checkForDuplicates);
            }
            if ((control & AccessControlActions.Change) == AccessControlActions.None)
            {
                return;
            }
            if (this.m_changeAcl == null)
            {
                this.m_changeAcl = new FileIOAccess();
            }
            this.m_changeAcl.AddExpressions(listFromExpressions, checkForDuplicates);
        }