当前位置: 首页>>代码示例>>C#>>正文


C# Server类代码示例

本文整理汇总了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;
        }
开发者ID:NiFree,项目名称:KerbalMultiPlayer,代码行数:31,代码来源:ServerMain.cs

示例2: DatabaseHelper

 public DatabaseHelper(string connectionString)
 {
     if (Server == null)
     {
         Server = GetServer(connectionString);
     }
 }
开发者ID:chuckconway,项目名称:chucksoft-code-generator,代码行数:7,代码来源:DatabaseHelper.cs

示例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;
    }
开发者ID:Maurdekye,项目名称:Misc-Projects,代码行数:27,代码来源:Program.cs

示例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);
        }
开发者ID:paladin74,项目名称:Dapple,代码行数:27,代码来源:FolderDatasetList.cs

示例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();
            }
        }
开发者ID:rcdosado,项目名称:SMO,代码行数:30,代码来源:ManageTables.cs

示例6: AggiungiServerDialogBox

        public AggiungiServerDialogBox()
        {
            InitializeComponent();
            server = new Server(){Name="Server1", IP = "192.168.1.1", ControlPort=1500};

            textGrid.DataContext = server;
        }
开发者ID:giu-fio,项目名称:remote-control-client,代码行数:7,代码来源:AggiungiServerDialogBox.xaml.cs

示例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();
        }
开发者ID:jordanbang,项目名称:MusicDiff-Windows,代码行数:26,代码来源:Form1.cs

示例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;
                }
            }
        }
开发者ID:nairit,项目名称:SignalR,代码行数:27,代码来源:Program.cs

示例9: HttpHandlerContext

		public HttpHandlerContext(Server server, HttpRequestProcessor.Host host, Connection connection, IIdentity identity)
		{
			Server = server;
			Host = host;
			Connection = connection;
			Identity = identity;
		}
开发者ID:ridhouan,项目名称:teamlab.v6.5,代码行数:7,代码来源:HttpHandlerContext.cs

示例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");
            }
        }
开发者ID:sethusrinivasan,项目名称:SMO,代码行数:27,代码来源:SMOTransferScriptTriggers.cs

示例11: SnapshotManagement

 public SnapshotManagement(SqlRepository Repository)
 {
     _Repository = Repository;
     _Server = new Server(
         new ServerConnection(Repository.Connection)
     );
 }
开发者ID:gravesmw,项目名称:SQLSnapshot,代码行数:7,代码来源:SnapshotManagement.cs

示例12: DataManager

 public DataManager(Client<Message> client, Server<Message> server)
 {
     _networkClient = client;
     _networkServer = server;
     networkTimeout = -1;
     int.TryParse(ConfigurationManager.AppSettings[timeoutConfigString], out networkTimeout);
 }
开发者ID:andreikalatsei,项目名称:milskype,代码行数:7,代码来源:NetworkDataManager.cs

示例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>();
        }
开发者ID:CaptainMuscles,项目名称:Terraria-s-Dedicated-Server-Mod,代码行数:12,代码来源:PluginManager.cs

示例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;
 }
开发者ID:Jaans,项目名称:csla,代码行数:22,代码来源:DataPortalEventArgs.cs

示例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.");
     }
 }
开发者ID:BTKY,项目名称:SpeedCodingNetworkGame,代码行数:29,代码来源:LoginCommand.cs


注:本文中的Server类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。