You've already forked linux-packaging-mono
Imported Upstream version 4.6.0.125
Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
This commit is contained in:
parent
a569aebcfd
commit
e79aa3c0ed
@@ -0,0 +1,73 @@
|
||||
#region Using directives
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.DirectoryServices;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace System.Workflow.Activities
|
||||
{
|
||||
[Serializable]
|
||||
sealed internal class DirectoryRootQuery : IDirectoryOperation
|
||||
{
|
||||
private String m_name;
|
||||
private String m_value;
|
||||
private DirectoryQueryOperation m_operation;
|
||||
|
||||
public DirectoryRootQuery(String name, String value, DirectoryQueryOperation operation)
|
||||
{
|
||||
if (name == null)
|
||||
throw new ArgumentNullException("name");
|
||||
if (value == null)
|
||||
throw new ArgumentNullException("value");
|
||||
|
||||
this.m_name = name;
|
||||
this.m_value = value;
|
||||
this.m_operation = operation;
|
||||
}
|
||||
|
||||
public void GetResult(DirectoryEntry rootEntry, DirectoryEntry currentEntry, List<DirectoryEntry> response)
|
||||
{
|
||||
if (rootEntry == null)
|
||||
throw new ArgumentNullException("rootEntry");
|
||||
if (currentEntry == null)
|
||||
throw new ArgumentNullException("currentEntry");
|
||||
if (response == null)
|
||||
throw new ArgumentNullException("response");
|
||||
|
||||
using (DirectorySearcher searcher = new DirectorySearcher(rootEntry))
|
||||
{
|
||||
String strStart = "(";
|
||||
String strOperation = "";
|
||||
String strEnd = ")";
|
||||
|
||||
switch (this.m_operation)
|
||||
{
|
||||
case DirectoryQueryOperation.Equal:
|
||||
strOperation = "=";
|
||||
break;
|
||||
|
||||
case DirectoryQueryOperation.NotEqual:
|
||||
strStart = "(!(";
|
||||
strOperation = "=";
|
||||
strEnd = "))";
|
||||
break;
|
||||
|
||||
default:
|
||||
System.Diagnostics.Debug.Assert(false);
|
||||
break;
|
||||
}
|
||||
|
||||
searcher.Filter = strStart + this.m_name + strOperation + this.m_value + strEnd;
|
||||
|
||||
foreach (SearchResult result in searcher.FindAll())
|
||||
{
|
||||
response.Add(result.GetDirectoryEntry());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user