コード例 #1
0
        }// PutValuesinPage

        internal static void AddFiles(ArrayList alFiles, String[] files, int nType)
        {
            if (files != null)
            {
                for (int i = 0; i < files.Length; i++)
                {
                    int j;
                    for (j = 0; j < alFiles.Count; j++)
                    {
                        if (((FilePermInfo)alFiles[j]).sPath.Equals(files[i]))
                        {
                            // We have a match... just muck with this guy's setting
                            ((FilePermInfo)alFiles[j]).AddSetting(nType);
                            // Cause our inner for loop to bail...
                            break;
                        }
                    }

                    if (j == alFiles.Count)
                    {
                        // We didn't find a match in our existing file infos....
                        if (files[i].Length > 0)
                        {
                            FilePermInfo fpi = new FilePermInfo(files[i], nType);
                            alFiles.Add(fpi);
                        }
                    }
                }
            }
        }// AddFiles
コード例 #2
0
        }// ValidateData

        protected override void PutValuesinPage()
        {
            // Put in the text for the radio buttons
            m_radUnrestricted.Text             = CResourceStore.GetString("FileIOPerm:GrantUnrestrict");
            m_radGrantFollowingPermission.Text = CResourceStore.GetString("FileIOPerm:GrantFollowing");

            FileIOPermission perm = (FileIOPermission)m_perm;

            CheckUnrestricted(perm);

            if (!perm.IsUnrestricted())
            {
                ArrayList alFiles = new ArrayList();

                AddFiles(alFiles, perm.GetPathList(FileIOPermissionAccess.Read), FILEPERMS.READ);
                AddFiles(alFiles, perm.GetPathList(FileIOPermissionAccess.Write), FILEPERMS.WRITE);
                AddFiles(alFiles, perm.GetPathList(FileIOPermissionAccess.Append), FILEPERMS.APPEND);
                AddFiles(alFiles, perm.GetPathList(FileIOPermissionAccess.PathDiscovery), FILEPERMS.PDISC);


                for (int i = 0; i < alFiles.Count; i++)
                {
                    FilePermInfo fpi = (FilePermInfo)alFiles[i];

                    DataRow newRow;
                    // See if we have some info for this one
                    if (fpi.sPath.Length > 0)
                    {
                        newRow               = m_dt.NewRow();
                        newRow["Path"]       = fpi.sPath;
                        newRow["Read"]       = fpi.fRead;
                        newRow["Write"]      = fpi.fWrite;
                        newRow["Append"]     = fpi.fAppend;
                        newRow["PDiscovery"] = fpi.fPDiscovery;
                        m_dt.Rows.Add(newRow);
                    }
                }
            }

            // We want at least 1 row
            while (m_dt.Rows.Count < 1)
            {
                AddEmptyRow(m_dt);
            }
        }// PutValuesinPage