예제 #1
0
		internal void PopulateDomainList()
		{
			ComputerBrowser ce;
			string domainName = "";
			string currentDomain = System.Environment.UserDomainName;
			int index = -1;

			Cursor.Current = Cursors.WaitCursor;

			// browse for domains
			ce = new ComputerBrowser(ComputerBrowser.ServerType.SV_TYPE_DOMAIN_ENUM);
			for (int i=0; i<ce.Length; i++)
			{
				domainName = ce[i].Name;
				// Add the name to the dropdown list if it already doesn't exist
				bool found = false;
				foreach (string str in domain_comboBox.Items)
				{
					if (str.ToLower() == domainName.ToLower())
						found = true;
				}
				if (!found)
				{
					domain_comboBox.Items.Add(domainName);
				}
				// Save the index of the current machine's domain so it will be selected by default
				if (domainName.ToLower() == currentDomain.ToLower())
				{
					index = i;
				}
			}
			if (index == -1)
			{
				index = domain_comboBox.Items.Add(currentDomain);
			}
			domain_comboBox.SelectedIndex = index;
			Cursor.Current = Cursors.Default;
		}
예제 #2
0
		internal string [] GetHostNames()
		{
			ComputerBrowser ce;
			string [] results = null;

			Cursor.Current = Cursors.WaitCursor;

			ce = new ComputerBrowser(domain_comboBox.Text);
			int numServer = ce.Length;

			if (ce.LastError.Length == 0)
			{
				IEnumerator enumerator = ce.GetEnumerator();

				// add the domain text to the dropdown list if it isn't already there
				bool found = false;
				foreach (string str in domain_comboBox.Items)
				{
					if (str == domain_comboBox.Text)
					{
						found = true;
					}
				}
				if (!found)
				{
					domain_comboBox.Items.Add(domain_comboBox.Text);
				}

				results = new string[numServer];
				int i = 0;
				while (enumerator.MoveNext())
				{
					results[i] = ce[i].Name;
					i++;
				}
			}
			else
			{
				output_textBox.Text = "Error \"" + ce.LastError + "\"";
			}

			Cursor.Current = Cursors.Default;
			return results;
		}
예제 #3
0
			internal NetworkComputers(ComputerBrowser.SERVER_INFO_101 info)
			{
				_computerinfo = info;
			}