internal ServerInfo1(NetServerEnum2Response enclosing) { this._enclosing = enclosing; }
/// <exception cref="SharpCifs.Smb.SmbException"></exception> /// <exception cref="UnknownHostException"></exception> /// <exception cref="System.UriFormatException"></exception> internal virtual void DoNetServerEnum(List<object> list, bool files, string wildcard , int searchAttributes, ISmbFilenameFilter fnf, ISmbFileFilter ff) { int listType = Url.GetHost().Length == 0 ? 0 : GetType(); SmbComTransaction req; SmbComTransactionResponse resp; if (listType == 0) { Connect0(); req = new NetServerEnum2(Tree.Session.transport.Server.OemDomainName, NetServerEnum2 .SvTypeDomainEnum); resp = new NetServerEnum2Response(); } else { if (listType == TypeWorkgroup) { req = new NetServerEnum2(Url.GetHost(), NetServerEnum2.SvTypeAll); resp = new NetServerEnum2Response(); } else { throw new SmbException("The requested list operations is invalid: " + Url); } } bool more; do { int n; Send(req, resp); if (resp.Status != WinError.ErrorSuccess && resp.Status != WinError.ErrorMoreData) { throw new SmbException(resp.Status, true); } more = resp.Status == WinError.ErrorMoreData; n = more ? resp.NumEntries - 1 : resp.NumEntries; for (int i = 0; i < n; i++) { IFileEntry e = resp.Results[i]; string name = e.GetName(); if (fnf != null && fnf.Accept(this, name) == false) { continue; } if (name.Length > 0) { // if !files we don't need to create SmbFiles here SmbFile f = new SmbFile(this, name, e.GetType(), AttrReadonly | AttrDirectory, 0L, 0L, 0L); if (ff != null && ff.Accept(f) == false) { continue; } if (files) { list.Add(f); } else { list.Add(name); } } } if (GetType() != TypeWorkgroup) { break; } req.SubCommand = unchecked(SmbComTransaction.NetServerEnum3); req.Reset(0, ((NetServerEnum2Response)resp).LastName); resp.Reset(); } while (more); }