• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Server类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Server的典型用法代码示例。如果您正苦于以下问题:C# Server类的具体用法?C# Server怎么用?C# Server使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Server类属于命名空间,在下文中一共展示了Server类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: Execute

        public override void Execute(Server server, MinecraftClient user, string text, params string[] parameters)
        {
            bool add = false;
            var current = server.MinecraftServer.GetLevel(user).Time;
            long? time = null;
            if (parameters.Length == 0)
            {
                user.SendChat("The current time is " + current + ", or " + LongToTimeString(current));
                return;
            }
            if (parameters[0].ToLower() == "day")
                time = 0;
            else if (parameters[0].ToLower() == "night")
                time = 12000;
            else if (parameters[0].ToLower() == "noon")
                time = 6000;
            else if (parameters[0].ToLower() == "midnight")
                time = 18000;
            else
            {
                string timeString;
                if (parameters[0].ToLower() == "set" && parameters.Length > 1)
                    timeString = parameters[1];
                else if (parameters[0].ToLower() == "add" && parameters.Length > 1)
                {
                    timeString = parameters[1];
                    add = true;
                }
                else
                    timeString = parameters[0];
                if (timeString.Contains(":"))
                {
                    try
                    {
                        time = TimeStringToLong(timeString);
                    }
                    catch { }
                }
                else
                {
                    long _time;
                    if (long.TryParse(timeString, out _time))
                        time = _time;
                }
                if (add)
                    time += current;
            }

            if (time == null)
            {
                user.SendChat(ChatColors.Red + "Invalid time specified.");
                return;
            }

            time = time.Value % 24000;

            server.MinecraftServer.GetLevel(user).Time = time.Value; // TODO: Add event listener in Craft.Net
            server.SendChatToGroup("server.op", ChatColors.Gray + user.Username + " set the time in " + user.World.Name +
                " to " + time.Value + ", or " + LongToTimeString(time.Value));
        }
开发者ID:NiLSPACE,项目名称:PartyCraft,代码行数:60,代码来源:TimeCommand.cs


示例17: Program

        private Program()
        {
            Log.Info("Loading settings");
            Config.Load();

            AppDomain.CurrentDomain.UnhandledException += (s, e) => {
                Log.Fatal(e.ExceptionObject.ToString());
            };

            Log.Info("Connecting to database");
            Database.Instance.Connect();

            String region = Database.Instance.GetServerRegion(Config.ServerId);
            if (region == String.Empty)
                Log.Fatal("Server region not found");

            Database.Instance.CleanServerStatus(Config.ServerId);

            String listen = String.Format("ws://{0}:{1}/", Config.Host, Config.Port);
            Server server = new Server(region);
            server.Start(listen);

            Database.Instance.ServerStatus(Config.ServerId, Config.Host + ":" + Config.Port, true);

            AppDomain.CurrentDomain.ProcessExit += (s, e) =>
            {
                Database.Instance.ServerStatus(Config.ServerId, null, false);
            };

            while(true)
                Console.ReadKey();
        }
开发者ID:jjkl,项目名称:AgarioServer,代码行数:32,代码来源:Program.cs


示例18: OnCraft

        public override bool OnCraft( bool exceptional, bool makersMark, Mobile from, Server.Engines.Craft.CraftSystem craftSystem, Type typeRes, BaseTool tool, Server.Engines.Craft.CraftItem craftItem, int resHue )
        {
            if ( exceptional )
                ArmorAttributes.MageArmor = 1;

            return base.OnCraft( exceptional, makersMark, from, craftSystem, typeRes, tool, craftItem, resHue );
        }
开发者ID:Ravenwolfe,项目名称:xrunuo,代码行数:7,代码来源:PlateMempo.cs


示例19: CoreGetColumnParameters

		protected override IEnumerable<DbParameter> CoreGetColumnParameters(Type connectionType, string dataSourceTag, Server server, Database database, Schema schema, Table table)
		{
			if ((object)connectionType == null)
				throw new ArgumentNullException(nameof(connectionType));

			if ((object)dataSourceTag == null)
				throw new ArgumentNullException(nameof(dataSourceTag));

			if ((object)server == null)
				throw new ArgumentNullException(nameof(server));

			if ((object)database == null)
				throw new ArgumentNullException(nameof(database));

			if ((object)schema == null)
				throw new ArgumentNullException(nameof(schema));

			if ((object)table == null)
				throw new ArgumentNullException(nameof(table));

			if (dataSourceTag.SafeToString().ToLower() == ODBC_SQL_SERVER_DATA_SOURCE_TAG)
			{
				return new DbParameter[]
						{
							//DatazoidLegacyInstanceAccessor.AdoNetBufferingLegacyInstance.ReflectionFascadeLegacyInstance.CreateParameter(connectionType, null,ParameterDirection.Input, DbType.String, 100, 0, 0, true, "@P1", server.ServerName),
							//DatazoidLegacyInstanceAccessor.AdoNetBufferingLegacyInstance.ReflectionFascadeLegacyInstance.CreateParameter(connectionType, null,ParameterDirection.Input, DbType.String, 100, 0, 0, true, "@P2", database.DatabaseName),
							DatazoidLegacyInstanceAccessor.AdoNetBufferingLegacyInstance.CreateParameter(connectionType, null, ParameterDirection.Input, DbType.String, 100, 0, 0, true, "@P3", schema.SchemaName),
							DatazoidLegacyInstanceAccessor.AdoNetBufferingLegacyInstance.CreateParameter(connectionType, null, ParameterDirection.Input, DbType.String, 100, 0, 0, true, "@P4", table.TableName)
						};
			}

			throw new ArgumentOutOfRangeException(string.Format("dataSourceTag: '{0}'", dataSourceTag));
		}
开发者ID:textmetal,项目名称:main,代码行数:33,代码来源:OdbcSchemaSourceStrategy.cs


示例20: RunSqlScriptOnConnection

		public static bool RunSqlScriptOnConnection(string connectionString, string filePath, out string errorMessage)
		{
			try
			{
				var scriptContents = File.ReadAllText(filePath);
				var sqlConnection = new SqlConnection(connectionString);
				var server = new Server(new ServerConnection(sqlConnection));
				server.ConnectionContext.ExecuteNonQuery(scriptContents);

				errorMessage = string.Empty;

				return true;
			}
			catch (ExecutionFailureException ex)
			{
				var sqlException = ex.InnerException as SqlException;
				if (sqlException != null)
				{
					errorMessage = string.Format("At line {0}:\n{1}", sqlException.LineNumber, sqlException.Message);
				}
				else if (ex.InnerException != null)
				{
					errorMessage = ex.InnerException.Message;
				}
				else
					errorMessage = ex.Message;
			}
			catch (Exception ex)
			{
				errorMessage = ex.Message;
			}

			return false;
		}
开发者ID:srmrco,项目名称:SqlRunnerNet,代码行数:34,代码来源:SqlScriptRunner.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ServerConnection类代码示例发布时间:2022-05-24
下一篇:
C# SeriesCollection类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap