Exemplo n.º 1
0
        public static FileShareList Load()
        {
            List <FileShare> objFileShares = new List <FileShare>();

            string strQuery = String.Format("select * from win32_share where type = 0");
            ManagementObjectSearcher objManagementObjectSearcher = new ManagementObjectSearcher(strQuery);

            if (objManagementObjectSearcher != null)
            {
                ManagementObjectCollection objManagementObjectCollection = objManagementObjectSearcher.Get();
                foreach (ManagementObject objManagementObject in objManagementObjectCollection)
                {
                    string strName        = ((objManagementObject["Name"] != null) ? objManagementObject["Name"].ToString() : string.Empty);
                    string strPath        = ((objManagementObject["Path"] != null) ? objManagementObject["Path"].ToString() : string.Empty);
                    string strDescription = ((objManagementObject["Description"] != null) ? objManagementObject["Description"].ToString() : string.Empty);

                    FileShare objFileShare = new FileShare(strName, strPath, strDescription);
                    objFileShares.Add(objFileShare);
                }
            }

            FileShareList objFileShareList = new FileShareList(objFileShares);

            return(objFileShareList);
        }
Exemplo n.º 2
0
        public void Refresh()
        {
            base.Clear();

            FileShareList objFileShareList = FileShareList.Load();

            base.AddRange(objFileShareList);
        }
Exemplo n.º 3
0
        public static FileShareList Load()
        {
            FileShareList objFileShareList = FileShare.Load();

            return(objFileShareList);
        }