Exemplo n.º 1
0
        public static IEnumerable <string> NetWorkstationUserEnumNames(string computer)
        {
            var users  = new List <string>();
            var domain = WorkstationInfo.FromComputer(null).LanGroup;

            foreach (var item in NetApiHelper.NetWkstaUserEnum(computer))
            {
                if (item.username.EndsWith("$"))
                {
                    continue;
                }
                string name;
                if (domain != item.logon_domain)
                {
                    name = String.Format(CultureInfo.CurrentCulture, @"{0}\{1}",
                                         item.logon_domain.ToUpper(CultureInfo.CurrentCulture), item.username);
                }
                else
                {
                    name = item.username;
                }
                if (!users.Contains(name))
                {
                    users.Add(name);
                }
            }
            users.Sort();
            return(users);
        }
Exemplo n.º 2
0
        public void TestAsyncFill()
        {
            Utils.InitPlugins();
            var    strategy = new ComputerFiller();
            var    result   = new Collection <PanelItemBase>();
            string domain   = WorkstationInfo.FromComputer(null).LanGroup;

            strategy.AsyncFill(new DomainPanelItem(null, domain), result);
            Assert.Greater(result.Count, 0);
        }
Exemplo n.º 3
0
        public void TestNetServerEnumComps()
        {
            string domain = WorkstationInfo.FromComputer(null).LanGroup;
            IEnumerable <SERVER_INFO_101> list = NetApiHelper.NetServerEnum(domain,
                                                                            SV_101_TYPES.SV_TYPE_DOMAIN_ENUM);
            int count = 0;

            foreach (SERVER_INFO_101 item in list)
            {
                count++;
            }
            Assert.Greater(count, 0);
        }
Exemplo n.º 4
0
        public void TestAsyncFill()
        {
            Utils.InitPlugins();
            var    strategy = new ShareFiller();
            string domain   = WorkstationInfo.FromComputer(null).LanGroup;
            var    computer = new ComputerPanelItem(new DomainPanelItem(new DomainRoot(), domain),
                                                    SystemInformation.ComputerName);

            ShareFiller.ShowHiddenShares = true;
            var result = new Collection <PanelItemBase>();

            strategy.AsyncFill(computer, result);
            Assert.Greater(result.Count, 0);
            Assert.IsInstanceOf <SharePanelItem>(result[0]);
            ShareFiller.ShowHiddenShares = false;
            strategy.AsyncFill(computer, result);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Starts with curent users's workgroup/domain as root.
        /// </summary>
        /// <returns></returns>
        public PanelItemBase CreateDefaultRoot()
        {
            var domain = WorkstationInfo.FromComputer(null).LanGroup;

            return(new DomainPanelItem(new DomainRoot(), domain));
        }
Exemplo n.º 6
0
        public void TestGetMachineNetBiosDomain()
        {
            string value = WorkstationInfo.FromComputer(null).LanGroup;

            Assert.NotNull(value);
        }
Exemplo n.º 7
0
 public void ExceptionGetMachineNetBiosDomain()
 {
     WorkstationInfo.FromComputer("~!@#$%^&");
 }