本文整理汇总了C#中StringTable.Append方法的典型用法代码示例。如果您正苦于以下问题:C# StringTable.Append方法的具体用法?C# StringTable.Append怎么用?C# StringTable.Append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringTable
的用法示例。
在下文中一共展示了StringTable.Append方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ServerObject
/// <summary>
/// Constructs the server.
/// </summary>
public ServerObject(string applicationUri, NodeManager nodeManager)
{
// the namespace table is used for the namepace indexes in NodeIds and QualifiedNames
// The first index (added by default) is the UA namespace. The second is the application uri.
m_namespaceUris = new NamespaceTable();
m_namespaceUris.Append(applicationUri);
// the server table is used for the server index in remote NodeIds (a.k.a. ExpandedNodeIds)
// The first index is always the current server.
m_serverUris = new StringTable();
m_serverUris.Append(applicationUri);
m_serviceLevel = 100;
m_serverStatus = new ServerStatusDataType();
m_serverStatus.StartTime = DateTime.UtcNow;
m_serverStatus.CurrentTime = DateTime.UtcNow;
m_serverStatus.State = ServerState.Running_0;
m_serverStatus.SecondsTillShutdown = 0;
m_serverStatus.ShutdownReason = null;
m_serverStatus.BuildInfo = new BuildInfo();
m_serverStatus.BuildInfo.BuildDate = new DateTime(2008, 7, 1);
m_serverStatus.BuildInfo.SoftwareVersion = "1.00";
m_serverStatus.BuildInfo.BuildNumber = "218.0";
m_serverStatus.BuildInfo.ManufacturerName = "My Company";
m_serverStatus.BuildInfo.ProductName = "My Sample Server";
m_serverStatus.BuildInfo.ProductUri = "http://mycompany.com/MySampleServer/v1.0";
// tell the node manager to call this object whenever the value of these attributes are read.
nodeManager.SetReadValueCallback(new NodeId(Variables.Server_NamespaceArray), GetNamespaceArray);
nodeManager.SetReadValueCallback(new NodeId(Variables.Server_ServerArray), GetServerArray);
nodeManager.SetReadValueCallback(new NodeId(Variables.Server_ServiceLevel), GetServiceLevel);
nodeManager.SetReadValueCallback(new NodeId(Variables.Server_ServerStatus), GetServerStatus);
nodeManager.SetReadValueCallback(new NodeId(Variables.Server_ServerStatus_StartTime), GetServerStatus_StartTime);
nodeManager.SetReadValueCallback(new NodeId(Variables.Server_ServerStatus_CurrentTime), GetServerStatus_CurrentTime);
nodeManager.SetReadValueCallback(new NodeId(Variables.Server_ServerStatus_State), GetServerStatus_State);
}
示例2: ServerInternalData
/// <summary>
/// Initializes the datastore with the server configuration.
/// </summary>
/// <param name="serverDescription">The server description.</param>
/// <param name="configuration">The configuration.</param>
/// <param name="messageContext">The message context.</param>
/// <param name="certificateValidator">The certificate validator.</param>
/// <param name="instanceCertificate">The instance certificate.</param>
public ServerInternalData(
ServerProperties serverDescription,
ApplicationConfiguration configuration,
ServiceMessageContext messageContext,
CertificateValidator certificateValidator,
X509Certificate2 instanceCertificate)
{
m_serverDescription = serverDescription;
m_configuration = configuration;
m_messageContext = messageContext;
m_endpointAddresses = new List<Uri>();
foreach (string baseAddresses in m_configuration.ServerConfiguration.BaseAddresses)
{
Uri url = Utils.ParseUri(baseAddresses);
if (url != null)
{
m_endpointAddresses.Add(url);
}
}
m_namespaceUris = m_messageContext.NamespaceUris;
m_factory = m_messageContext.Factory;
m_serverUris = new StringTable();
m_typeTree = new TypeTable(m_namespaceUris);
#if LEGACY_CORENODEMANAGER
m_typeSources = new TypeSourceTable();
#endif
// add the server uri to the server table.
m_serverUris.Append(m_configuration.ApplicationUri);
// create the default system context.
m_defaultSystemContext = new ServerSystemContext(this);
}
示例3: 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");
}
}
示例4: CreateDecoder
/// <summary>
/// Creates an decoder to restore Variant values.
/// </summary>
private XmlDecoder CreateDecoder(ISystemContext context, XmlElement source)
{
ServiceMessageContext messageContext = new ServiceMessageContext();
messageContext.NamespaceUris = context.NamespaceUris;
messageContext.ServerUris = context.ServerUris;
messageContext.Factory = context.EncodeableFactory;
XmlDecoder decoder = new XmlDecoder(source, messageContext);
NamespaceTable namespaceUris = new NamespaceTable();
if (NamespaceUris != null)
{
for (int ii = 0; ii < NamespaceUris.Length; ii++)
{
namespaceUris.Append(NamespaceUris[ii]);
}
}
StringTable serverUris = new StringTable();
if (ServerUris != null)
{
serverUris.Append(context.ServerUris.GetString(0));
for (int ii = 0; ii < ServerUris.Length; ii++)
{
serverUris.Append(ServerUris[ii]);
}
}
decoder.SetMappingTables(namespaceUris, serverUris);
return decoder;
}