本文整理汇总了C#中Server.Initialize方法的典型用法代码示例。如果您正苦于以下问题:C# Server.Initialize方法的具体用法?C# Server.Initialize怎么用?C# Server.Initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server
的用法示例。
在下文中一共展示了Server.Initialize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Manager
public Manager(Configuration configuration, Action<string> outputText)
{
Log.InitializeOutputSource(outputText, Path.Combine(configuration.StoragePath, "log.txt"));
m_configuration = configuration;
m_server = new Server();
m_info = new AppInfo(m_server, m_configuration);
m_server.Initialize(m_info);
m_features = new Dictionary<FeatureType, Feature>();
// Initialize features; we should have a better factory for this; any new features should be added here.
m_features.Add(FeatureType.Contact, new Features.ContactFeature(m_info));
m_features.Add(FeatureType.Company, new Features.CompanyFeature(m_info));
m_features.Add(FeatureType.List, new Features.ListFeature(m_info));
m_features.Add(FeatureType.ListMembership, new Features.ListMembershipFeature(m_info));
m_features.Add(FeatureType.Workflow, new Features.WorkflowFeature(m_info));
m_features.Add(FeatureType.WorkflowEnrollment, new Features.WorkflowEnrollmentFeature(m_info));
m_features.Add(FeatureType.ContactProperty, new Features.ContactPropertyFeature(m_info));
m_features.Add(FeatureType.CompanyProperty, new Features.CompanyPropertyFeature(m_info));
m_features.Add(FeatureType.ContactPropertyGroup, new Features.SingleCallFeature(m_info, FeatureType.ContactPropertyGroup, "contacts/v2/groups"));
m_features.Add(FeatureType.CompanyPropertyGroup, new Features.SingleCallFeature(m_info, FeatureType.CompanyPropertyGroup, "companies/v2/groups"));
m_features.Add(FeatureType.Form, new Features.FormFeature(m_info));
m_features.Add(FeatureType.CalendarEvent, new Features.CalendarEventFeature(m_info));
}
示例2: Main
static void Main(string[] args)
{
Trace.Listeners.Add(new ConsoleTraceListener());
try
{
const int maxConnection = 10;
const int receiveBufferSize = 4096;
const int port = 1337;
using (Server server = new Server(maxConnection, receiveBufferSize))
{
IPEndPoint endpoint = new IPEndPoint(IPAddress.Loopback, port);
server.Initialize();
server.Start(endpoint);
System.Console.ReadKey();
}
}
catch (Exception ex)
{
Trace.WriteLine(ex.Message);
}
}