本文整理汇总了C#中StringTable.GetIndexOrAppend方法的典型用法代码示例。如果您正苦于以下问题:C# StringTable.GetIndexOrAppend方法的具体用法?C# StringTable.GetIndexOrAppend怎么用?C# StringTable.GetIndexOrAppend使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringTable
的用法示例。
在下文中一共展示了StringTable.GetIndexOrAppend方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateNamespaceIndexMappings
/// <summary>
/// compares the new server namespace table with the (saved) table known to the client. Provides a
/// mapping for any namespaces which are new or removed and indices which have changed.
/// </summary>
/// <param name="clsid"></param>
private void GenerateNamespaceIndexMappings(Guid clsid)
{
try
{
StringTable savedStringTable = new StringTable();
for (int i = 0; i < m_configFile.SavedNamespaceTable.Length; i++)
savedStringTable.Append(m_configFile.SavedNamespaceTable[i]);
NamespaceTable serverNamespaceTable = m_session.NamespaceUris;
string[] serverNamespaceArray = serverNamespaceTable.ToArray();
for (int i = 0; i < serverNamespaceArray.Length; i++)
{
// Generate the serverIndex->clientIndex mapping table. Update the client namespace
// table in the process if new namespaces have been added to the server namespace
m_serverMappingTable.Add(savedStringTable.GetIndexOrAppend(serverNamespaceArray[i]));
}
m_configFile.SavedNamespaceTable = savedStringTable.ToArray();
for (int i = 0; i < m_configFile.SavedNamespaceTable.Length; i++)
{
// Generate the clientIndex->serverIndex mapping table
m_clientmappingTable.Add(serverNamespaceTable.GetIndex(m_configFile.SavedNamespaceTable[i]));
}
}
catch (Exception e)
{
Utils.Trace(e, "Unexpected error in InitNamespaceMappingTable");
}
}
示例2: ImportServerIndex
/// <summary>
/// Exports a server index.
/// </summary>
private uint ImportServerIndex(uint serverIndex, StringTable serverUris)
{
// nothing special required for indexes 0.
if (serverIndex <= 0)
{
return serverIndex;
}
// return a bad value if parameters are bad.
if (serverUris == null || this.ServerUris == null || this.ServerUris.Length <= serverIndex-1)
{
return UInt16.MaxValue;
}
// find or append uri.
return serverUris.GetIndexOrAppend(this.ServerUris[serverIndex - 1]);
}