public void AsyncFill(PanelItemBase parent, ICollection <PanelItemBase> result) { if (parent == null) { throw new ArgumentNullException("parent"); } //result.Add(new PanelItemDoubleDot(parent)); foreach (var item in NetApiHelper.NetShareEnum(parent.Name)) { var si = new ShareInfo(item); //if (!Settings.Settings.Instance.ShowHiddenShares && SI.IsHidden) // continue; //if (!Settings.Settings.Instance.ShowPrinters && SI.IsPrinter) // continue; if (!ShowHiddenShares && si.IsHidden || !ShowPrinters && si.IsPrinter) { continue; } result.Add(new SharePanelItem(parent, si)); } // enum logged users foreach (var item in NetworkHelper.NetWorkstationUserEnumNames(parent.Name)) { var si = new ShareInfo(); si.Name = item; si.ShareType = 100; result.Add(new SharePanelItem(parent, si)); } }
public void TestNetShareEnum() { string comp = SystemInformation.ComputerName; IEnumerable <SHARE_INFO_1> list = NetApiHelper.NetShareEnum(comp); int count = 0; foreach (SHARE_INFO_1 item in list) { count++; } Assert.Greater(count, 0); }