本文整理汇总了C#中Server类的典型用法代码示例。如果您正苦于以下问题:C# Server类的具体用法?C# Server怎么用?C# Server使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Server类属于命名空间,在下文中一共展示了Server类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: hostServer
static ServerStatus hostServer(ServerSettings.ConfigStore settings)
{
Server server = new Server(settings);
try
{
server.hostingLoop();
}
catch (Exception e)
{
Log.Error("Unexpected exception encountered! Crash report written to log file");
Log.Error(e.ToString());
if (server.threadExceptionStackTrace != null && server.threadExceptionStackTrace.Length > 0)
{
Log.Error("Stacktrace: ");
Log.Error(server.threadExceptionStackTrace);
}
//server.clearState();
//return ServerStatus.CRASHED;
}
server.clearState();
if (server.stop)
return ServerStatus.STOPPED;
if (!settings.autoRestart || server.quit)
return ServerStatus.QUIT;
return ServerStatus.RESTARTING;
}
示例2: DatabaseHelper
public DatabaseHelper(string connectionString)
{
if (Server == null)
{
Server = GetServer(connectionString);
}
}
示例3: GetOfficeChannels
public Dictionary<Channel, List<User>> GetOfficeChannels(Server NewServer)
{
//Console.WriteLine("Scanning for office channels");
Dictionary<Channel, List<User>> OfficeChannels = new Dictionary<Channel, List<User>>();
foreach (Channel ServerChannel in NewServer.AllChannels)
{
if (ServerChannel.Type == ChannelType.Voice)
{
if (ServerChannel.Name.Contains("Office"))
{
Match NameMatch = Regex.Match(ServerChannel.Name, "(.+?)'s Office");
if (NameMatch.Success)
{
List<User> OfficeUsers = NewServer.FindUsers(NameMatch.Groups[1].Value, exactMatch: true).Where(U => U.ServerPermissions.MoveMembers).ToList();
if (OfficeUsers.Count > 0)
{
OfficeChannels[ServerChannel] = OfficeUsers;
//await ServerChannel.Edit(maxusers: 2);
//Console.WriteLine(($"Registered Office Channel '{ServerChannel}' with users [{string.Join(", ", OfficeUsers)}]"));
}
}
}
}
}
return OfficeChannels;
}
示例4: Parse
internal static FolderDatasetList Parse(Server oServer, string strKey, int iTimestamp, System.Xml.XmlDocument oCatalog, out string strEdition)
{
strEdition = string.Empty;
ArrayList oList = new ArrayList();
// --- get the catalog edition ---
System.Xml.XmlNodeList oNodeList = oCatalog.SelectNodes("//" + Geosoft.Dap.Xml.Common.Constant.Tag.CONFIGURATION_TAG);
if (oNodeList != null && oNodeList.Count != 0)
{
System.Xml.XmlNode oAttr = oNodeList[0].Attributes.GetNamedItem(Geosoft.Dap.Xml.Common.Constant.Attribute.VERSION_ATTR);
if (oAttr != null)
strEdition = oAttr.Value;
}
oNodeList = oCatalog.SelectNodes("//" + Geosoft.Dap.Xml.Common.Constant.Tag.ITEM_TAG);
if (oNodeList != null)
{
foreach (System.Xml.XmlElement oDatasetNode in oNodeList)
{
Geosoft.Dap.Common.DataSet oDataSet;
oServer.Command.Parser.DataSet(oDatasetNode, out oDataSet);
oList.Add(oDataSet);
}
}
return new FolderDatasetList(strKey, iTimestamp, oList);
}
示例5: ManageTables_Load
private void ManageTables_Load(object sender, System.EventArgs e)
{
ServerConnection ServerConn;
ServerConnect scForm;
DialogResult dr;
// Display the main window first
this.Show();
Application.DoEvents();
ServerConn = new ServerConnection();
scForm = new ServerConnect(ServerConn);
dr = scForm.ShowDialog(this);
if ((dr == DialogResult.OK) &&
(ServerConn.SqlConnectionObject.State == ConnectionState.Open))
{
SqlServerSelection = new Server(ServerConn);
if (SqlServerSelection != null)
{
this.Text = Properties.Resources.AppTitle + SqlServerSelection.Name;
// Refresh database list
ShowDatabases(true);
}
}
else
{
this.Close();
}
}
示例6: AggiungiServerDialogBox
public AggiungiServerDialogBox()
{
InitializeComponent();
server = new Server(){Name="Server1", IP = "192.168.1.1", ControlPort=1500};
textGrid.DataContext = server;
}
示例7: Form1
public Form1()
{
InitializeComponent();
listView1.Items.Clear();
listView1.View = View.Details;
listView1.Columns.Add("Path");
listView1.Columns[0].Width = listView1.Width - 4;
listView1.HeaderStyle = ColumnHeaderStyle.None;
string dir = "D:\\iTunes Music\\Music";
List<System.IO.FileInfo> files = new List<FileInfo>();
List<string> dirs = new List<string>(Directory.EnumerateFiles(dir, "*.*", SearchOption.AllDirectories));
foreach (var subDir in dirs)
{
FileInfo file = new FileInfo(subDir);
TagLib.File sameFile = TagLib.File.Create(subDir);
Console.WriteLine(subDir);
int length = sameFile.Tag.Performers.Length;
listView1.Items.Add(new ListViewItem("Title: " + sameFile.Tag.Title + " - Artist: " + (length > 0 ? sameFile.Tag.Performers[0] : "")));
}
Console.WriteLine("\n{0} directories found.", dirs.Count);
Server server = new Server("http://*:8000/");
server.AddRequestHandler(new DiffSyncRequestHandler());
server.Start();
}
示例8: Main
static void Main(string[] args)
{
Debug.Listeners.Add(new ConsoleTraceListener());
Debug.AutoFlush = true;
string url = "http://localhost:8081/";
var server = new Server(url);
server.Configuration.DisconnectTimeout = TimeSpan.Zero;
// Map connections
server.MapConnection<MyConnection>("/echo")
.MapConnection<Raw>("/raw")
.MapHubs();
server.Start();
Console.WriteLine("Server running on {0}", url);
while (true)
{
ConsoleKeyInfo ki = Console.ReadKey(true);
if (ki.Key == ConsoleKey.X)
{
break;
}
}
}
示例9: HttpHandlerContext
public HttpHandlerContext(Server server, HttpRequestProcessor.Host host, Connection connection, IIdentity identity)
{
Server = server;
Host = host;
Connection = connection;
Identity = identity;
}
示例10: Main
static void Main(string[] args)
{
// connect to default instance on local machine
Server server = new Server(".");
ScriptingOptions so = new ScriptingOptions();
so.Triggers = true;
Microsoft.SqlServer.Management.Smo.Transfer tr = new Transfer();
// Note: Make sure that srcdb exists on local machine's default instance
tr.Database = server.Databases["srcdb"];
tr.DestinationDatabase = "targetdb";
tr.DestinationServer = ".";
tr.DestinationLoginSecure = true;
tr.Options = so;
// Enumerate scripts
List<string> scripts = tr.EnumScriptTransfer().ToList<string>();
// print generated scripts to console
foreach (string script in scripts)
{
Console.WriteLine(script);
Console.WriteLine("GO");
}
}
示例11: SnapshotManagement
public SnapshotManagement(SqlRepository Repository)
{
_Repository = Repository;
_Server = new Server(
new ServerConnection(Repository.Connection)
);
}
示例12: DataManager
public DataManager(Client<Message> client, Server<Message> server)
{
_networkClient = client;
_networkServer = server;
networkTimeout = -1;
int.TryParse(ConfigurationManager.AppSettings[timeoutConfigString], out networkTimeout);
}
示例13: PluginManager
/// <summary>
/// PluginManager class constructor
/// </summary>
/// <param name="pluginPath">Path to plugin directory</param>
/// <param name="server">Current Server instance</param>
public PluginManager(String pluginPath, Server server)
{
this.pluginPath = pluginPath;
this.server = server;
plugins = new Dictionary<String, Plugin>();
}
示例14: DataPortalEventArgs
/// <summary>
/// Creates an instance of the object.
/// </summary>
/// <param name="dataPortalContext">
/// Data portal context object.
/// </param>
/// <param name="objectType">
/// Business object type.
/// </param>
/// <param name="obj">
/// Criteria or business object for request.
/// </param>
/// <param name="operation">
/// Data portal operation being performed.
/// </param>
public DataPortalEventArgs(Server.DataPortalContext dataPortalContext, Type objectType, object obj, DataPortalOperations operation)
{
_dataPortalContext = dataPortalContext;
_operation = operation;
_objectType = objectType;
_object = obj;
}
示例15: Run
public void Run(ManagerLogger managerLogger, Server server, NetIncomingMessage inc, PlayerAndConnection playerAndConnection, GameRoom gameRoom)
{
managerLogger.AddLogMessage("server", "New connection...");
var data = inc.ReadByte();
if (data == (byte)PacketType.Login)
{
managerLogger.AddLogMessage("server", "..connection accpeted.");
playerAndConnection = CreatePlayer(inc, gameRoom.Players, gameRoom.ManagerCamera);
inc.SenderConnection.Approve();
var outmsg = server.NetServer.CreateMessage();
outmsg.Write((byte)PacketType.Login);
outmsg.Write(true);
outmsg.Write(gameRoom.Players.Count);
for (int n = 0; n < gameRoom.Players.Count; n++)
{
var p = gameRoom.Players[n];
outmsg.Write(p.Player.Username);
outmsg.WriteAllProperties(p.Player.Position);
}
server.NetServer.SendMessage(outmsg, inc.SenderConnection, NetDeliveryMethod.ReliableOrdered, 0);
var command = new PlayerPositionCommand();
command.Run(managerLogger, server,inc,playerAndConnection,gameRoom);
server.SendNewPlayerEvent(playerAndConnection.Player.Username, gameRoom.GameRoomId);
}
else
{
inc.SenderConnection.Deny("Didn't send correct information.");
}
}