本文整理汇总了C#中Hashtable.Put方法的典型用法代码示例。如果您正苦于以下问题:C# Hashtable.Put方法的具体用法?C# Hashtable.Put怎么用?C# Hashtable.Put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hashtable
的用法示例。
在下文中一共展示了Hashtable.Put方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DcerpcBinding
static DcerpcBinding()
{
_interfaces = new Hashtable();
_interfaces.Put("srvsvc", Srvsvc.GetSyntax());
_interfaces.Put("lsarpc", Lsarpc.GetSyntax());
_interfaces.Put("samr", Samr.GetSyntax());
_interfaces.Put("netdfs", Netdfs.GetSyntax());
}
示例2: Setup
public void Setup(int scenewidth, int sceneheight, int cellsize)
{
Cols = scenewidth / cellsize;
Rows = sceneheight / cellsize;
Buckets = new Hashtable<int, IList<GameObject>>(Cols * Rows);
for (int i = 0; i < Cols * Rows; i++)
{
Buckets.Put(i, new LinkedList<GameObject>());
}
SceneWidth = scenewidth;
SceneHeight = sceneheight;
CellSize = cellsize;
}
示例3: EnsurePropertyMap
private void EnsurePropertyMap()
{
lock (this)
{
if (_properties == null)
{
_properties = new Hashtable<string, IProperty[]>();
var props = GetType().GetAnnotation<IProperties>(typeof (IProperties));
if (props == null)
return;
string currentSignature = null;
ArrayList<IProperty> list = new ArrayList<IProperty>();
var empty = new IProperty[0];
foreach (var property in props.Properties())
{
var signature = property.DeclaringTypeDescriptor();
if (currentSignature != signature)
{
if(currentSignature != null)
_properties.Put(currentSignature, list.ToArray(empty));
currentSignature = signature;
list.Clear();
}
list.Add(property);
}
if (currentSignature != null)
_properties.Put(currentSignature, list.ToArray(empty));
}
}
}
示例4: BuildEvents
/// <summary>
/// Build all properties for a given definingType.
/// </summary>
private static EventInfo[] BuildEvents(Type definingType, Type declaringType)
{
Hashtable<string, Event> events = new Hashtable<string, Event>();
foreach (var method in declaringType.GetMethods())
{
var methodName = method.Name;
bool isAdd = methodName.StartsWith("add_");
bool isRemove = methodName.StartsWith("remove_");
if (!isAdd && !isRemove) continue;
int idxStart = isAdd ? 4 : 7;
int len = methodName.Length - idxStart;
// cut out an eventual postfix.
int wannaBeRichIdx = methodName.IndexOf("$");
if (wannaBeRichIdx != -1)
len = wannaBeRichIdx - idxStart;
string eventName = methodName.Substring(idxStart, len);
var @event = events.Get(eventName);
if (@event == null)
events.Put(eventName, @event = new Event() { Name=eventName});
if (isAdd)
@event.Add = method;
else
@event.Remove = method;
}
List<EventInfo> p = new List<EventInfo>();
foreach (var @event in new IterableWrapper<Event>(events.Values()))
{
if (@event.Add == null || @event.Remove == null)
continue;
EventInfo e = new EventInfo(declaringType, @event.Name, @event.Add, @event.Remove, new IAttribute[0]);
p.Add(e);
}
return p.ToArray();
}
示例5: DoShareEnum
/// <exception cref="SharpCifs.Smb.SmbException"></exception>
/// <exception cref="UnknownHostException"></exception>
/// <exception cref="System.UriFormatException"></exception>
internal virtual void DoShareEnum(List<object> list, bool files, string wildcard, int
searchAttributes, ISmbFilenameFilter fnf, ISmbFileFilter ff)
{
string p = Url.AbsolutePath;
IOException last = null;
IFileEntry[] entries;
UniAddress addr;
IFileEntry e;
Hashtable map;
if (p.LastIndexOf('/') != (p.Length - 1))
{
throw new SmbException(Url + " directory must end with '/'");
}
if (GetType() != TypeServer)
{
throw new SmbException("The requested list operations is invalid: " + Url);
}
map = new Hashtable();
if (_enableDfs && Dfs.IsTrustedDomain(GetServer(), Auth))
{
try
{
entries = DoDfsRootEnum();
for (int ei = 0; ei < entries.Length; ei++)
{
e = entries[ei];
if (map.ContainsKey(e) == false)
{
map.Put(e, e);
}
}
}
catch (IOException ioe)
{
if (Log.Level >= 4)
{
Runtime.PrintStackTrace(ioe, Log);
}
}
}
addr = GetFirstAddress();
while (addr != null)
{
try
{
last = null;
DoConnect();
try
{
entries = DoMsrpcShareEnum();
}
catch (IOException ioe)
{
if (Log.Level >= 3)
{
Runtime.PrintStackTrace(ioe, Log);
}
entries = DoNetShareEnum();
}
for (int ei = 0; ei < entries.Length; ei++)
{
e = entries[ei];
if (map.ContainsKey(e) == false)
{
map.Put(e, e);
}
}
break;
}
catch (IOException ioe)
{
if (Log.Level >= 3)
{
Runtime.PrintStackTrace(ioe, Log);
}
last = ioe;
if (!(ioe is SmbAuthException))
{
RemoveCurrentAddress();
addr = GetNextAddress();
}
else
{
break;
}
}
}
if (last != null && map.Count == 0)
{
if (last is SmbException == false)
{
throw new SmbException(Url.ToString(), last);
}
//.........这里部分代码省略.........
示例6: TestDocRevisionsPerformance
/// <exception cref="Couchbase.Lite.CouchbaseLiteException"></exception>
public virtual void TestDocRevisionsPerformance()
{
long startMillis = Runtime.CurrentTimeMillis();
for (int j = 0; j < GetNumberOfDocuments(); j++)
{
Document doc = docs[j];
for (int k = 0; k < GetNumberOfUpdates(); k++)
{
IDictionary<string, object> contents = new Hashtable(doc.GetProperties());
bool wasChecked = (bool)contents.Get("toogle");
//toggle value of check property
contents.Put("toogle", !wasChecked);
try
{
doc.PutProperties(contents);
}
catch (CouchbaseLiteException cblex)
{
Log.E(Tag, "Document update failed", cblex);
//return false;
throw;
}
}
}
Log.V("PerformanceStats", Tag + "," + Sharpen.Extensions.ValueOf(Runtime.CurrentTimeMillis
() - startMillis).ToString() + "," + GetNumberOfDocuments() + ",,,," + GetNumberOfUpdates
());
}
示例7: GetLocalGroupsMap
/// <summary>
/// This specialized method returns a Map of users and local groups for the
/// target server where keys are SIDs representing an account and each value
/// is an List<object> of SIDs represents the local groups that the account is
/// a member of.
/// </summary>
/// <remarks>
/// This specialized method returns a Map of users and local groups for the
/// target server where keys are SIDs representing an account and each value
/// is an List<object> of SIDs represents the local groups that the account is
/// a member of.
/// <p/>
/// This method is designed to assist with computing access control for a
/// given user when the target object's ACL has local groups. Local groups
/// are not listed in a user's group membership (e.g. as represented by the
/// tokenGroups constructed attribute retrived via LDAP).
/// <p/>
/// Domain groups nested inside a local group are currently not expanded. In
/// this case the key (SID) type will be SID_TYPE_DOM_GRP rather than
/// SID_TYPE_USER.
/// </remarks>
/// <param name="authorityServerName">The server from which the local groups will be queried.
/// </param>
/// <param name="auth">The credentials required to query groups and group members.</param>
/// <param name="flags">
/// Flags that control the behavior of the operation. When all
/// name associated with SIDs will be required, the SID_FLAG_RESOLVE_SIDS
/// flag should be used which causes all group member SIDs to be resolved
/// together in a single more efficient operation.
/// </param>
/// <exception cref="System.IO.IOException"></exception>
internal static Hashtable GetLocalGroupsMap(string authorityServerName, NtlmPasswordAuthentication
auth, int flags)
{
Sid domsid = GetServerSid(authorityServerName, auth);
DcerpcHandle handle = null;
SamrPolicyHandle policyHandle = null;
SamrDomainHandle domainHandle = null;
Samr.SamrSamArray sam = new Samr.SamrSamArray();
MsrpcEnumerateAliasesInDomain rpc;
lock (SidCache)
{
try
{
handle = DcerpcHandle.GetHandle("ncacn_np:" + authorityServerName + "[\\PIPE\\samr]"
, auth);
policyHandle = new SamrPolicyHandle(handle, authorityServerName, unchecked(0x02000000));
domainHandle = new SamrDomainHandle(handle, policyHandle, unchecked(0x02000000), domsid);
rpc = new MsrpcEnumerateAliasesInDomain(domainHandle, unchecked(0xFFFF), sam
);
handle.Sendrecv(rpc);
if (rpc.Retval != 0)
{
throw new SmbException(rpc.Retval, false);
}
Hashtable map = new Hashtable();
for (int ei = 0; ei < rpc.Sam.Count; ei++)
{
Samr.SamrSamEntry entry = rpc.Sam.Entries[ei];
Sid[] mems = GetGroupMemberSids0(handle, domainHandle, domsid
, entry.Idx, flags);
Sid groupSid = new Sid(domsid, entry.Idx);
groupSid.Type = SidTypeAlias;
groupSid.DomainName = domsid.GetDomainName();
groupSid.AcctName = (new UnicodeString(entry.Name, false)).ToString();
for (int mi = 0; mi < mems.Length; mi++)
{
List<object> groups = (List<object>)map.Get(mems[mi]);
if (groups == null)
{
groups = new List<object>();
map.Put(mems[mi], groups);
}
if (!groups.Contains(groupSid))
{
groups.Add(groupSid);
}
}
}
return map;
}
finally
{
if (handle != null)
{
if (policyHandle != null)
{
if (domainHandle != null)
{
domainHandle.Close();
}
policyHandle.Close();
}
handle.Close();
}
}
}
}