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

C# ServerInfo类代码示例

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

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



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

示例1: UpdateAuthenticationManager

        private void UpdateAuthenticationManager()
        {
            // Register the server information with the AuthenticationManager
            Esri.ArcGISRuntime.Security.ServerInfo serverInfo = new ServerInfo
            {
                ServerUri = new Uri(ServerUrl),
                OAuthClientInfo = new OAuthClientInfo
                {
                    ClientId = ClientId,
                    RedirectUri = new Uri(RedirectUrl)
                }
            };

            // If a client secret has been configured, set the authentication type to OAuthAuthorizationCode
            if (!string.IsNullOrEmpty(ClientSecret))
            {
                // Use OAuthAuthorizationCode if you need a refresh token (and have specified a valid client secret)
                serverInfo.TokenAuthenticationType = TokenAuthenticationType.OAuthAuthorizationCode;
                serverInfo.OAuthClientInfo.ClientSecret = ClientSecret;
            }
            else
            {
                // Otherwise, use OAuthImplicit
                serverInfo.TokenAuthenticationType = TokenAuthenticationType.OAuthImplicit;
            }

            // Register this server with AuthenticationManager
            AuthenticationManager.Current.RegisterServer(serverInfo);

            // Use the OAuthAuthorize class in this project to handle OAuth communication
            AuthenticationManager.Current.OAuthAuthorizeHandler = new OAuthAuthorize();

            // Use a function in this class to challenge for credentials
            AuthenticationManager.Current.ChallengeHandler = new ChallengeHandler(CreateCredentialAsync);
        }
开发者ID:Esri,项目名称:arcgis-runtime-samples-dotnet,代码行数:35,代码来源:OAuth.xaml.cs


示例2: ExportData

 public void ExportData(System.Xml.XmlWriter writer)
 {
     ServerInfo host = new ServerInfo();
     writer.WriteStartElement("server");
     host.WriteXml(writer);
     writer.WriteEndElement();
 }
开发者ID:jackiechou,项目名称:thegioicuaban.com,代码行数:7,代码来源:ServerController.cs


示例3: ConfirmActivity

        public void ConfirmActivity(ServerInfo serverInfo, List<Cert> certList)
        {
            string connString = String.Format(settingsHelper.connectionString, serverInfo.address);
            SqlConnection connection = new SqlConnection(connString);
            DataClassesDataContext database = new DataClassesDataContext();

            try
            {
                connection.Open();

                foreach (var cert in certList)
                {
                    var queryRequest = from r in database.Requests
                                       join l in database.Logs on r.LogId equals l.ID
                                       join u in database.Users on l.ID_user equals u.ID
                                       join c in database.Computers on l.ID_pc equals c.ID
                                       where u.Username == cert.user && c.PC_name == SystemInformation.ComputerName
                                       select r;

                    if (queryRequest.Any())
                    {
                        queryRequest.First().Confirmed = 1;
                        database.SubmitChanges();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                connection.Close();
            }
        }
开发者ID:mkaszta,项目名称:Emplokey,代码行数:35,代码来源:ConnManager.cs


示例4: SendingBlockQuery

 public void SendingBlockQuery(ServerInfo server, string urlString, IEnumerable<ServerInfo> sources, double timeOutInMilliseconds)
 {
     if (this.IsEnabled())
     {
         this.SendingBlockQuery(server.Hostname, urlString, string.Join(",", sources), timeOutInMilliseconds);
     }
 }
开发者ID:darting,项目名称:MetricSystem,代码行数:7,代码来源:Events.cs


示例5: QueryFinished

 public void QueryFinished(ServerInfo server, string status, int httpStatusCode = 0, string diagnostics = null)
 {
     if (this.IsEnabled())
     {
         this.QueryFinished(server.ToString(), status, httpStatusCode, diagnostics);
     }
 }
开发者ID:darting,项目名称:MetricSystem,代码行数:7,代码来源:Events.cs


示例6: SaveServerInfo

        public void SaveServerInfo(ServerInfo serverInfo)
        {
            if (!File.Exists(settingsHelper.userPath + settingsHelper.defaultSettingsFile))
            {
                XDocument xSettings = new XDocument(
                new XDeclaration("1.0", "UTF-16", null),
                new XElement(settingsHelper.xNameSpace + "Emplokey_settings",
                    new XElement("Server",
                        new XElement("Address", serverInfo.address),
                        new XElement("DbName", serverInfo.dbName)
                    )));

                xSettings.Save(settingsHelper.userPath + settingsHelper.defaultSettingsFile);
            }
            else
            {
                XDocument xSettings = XDocument.Load(settingsHelper.userPath + settingsHelper.defaultSettingsFile);

                var queryServer = (from q in xSettings.Descendants("Server")
                                   select q).First();

                queryServer.Element("Address").Value = serverInfo.address;
                queryServer.Element("DbName").Value = serverInfo.dbName;

                xSettings.Save(settingsHelper.userPath + settingsHelper.defaultSettingsFile);
            }
        }
开发者ID:mkaszta,项目名称:Emplokey,代码行数:27,代码来源:ConnManager.cs


示例7: ServerInfoCommandOnRoundStart

        private void ServerInfoCommandOnRoundStart(object sender, ServerInfo lastRoundServerInfo)
        {
            if (!_rconClient.ServerInfoCommand.ServerInfo.IsPregame)
                return;

            _rconClient.SendMessageAll("KD: Pre-game starting. In pre-game widget use is FREE.");
        }
开发者ID:KernelNO,项目名称:BFH-Rcon-Admin,代码行数:7,代码来源:PreGame.cs


示例8: UpdateAuthenticationManager

        private void UpdateAuthenticationManager()
        {
            // Register the server information with the AuthenticationManager
            ServerInfo portalServerInfo = new ServerInfo
            {
                ServerUri = new Uri(OAuthPage.PortalUrl),
                OAuthClientInfo = new OAuthClientInfo
                {
                    ClientId = OAuthPage.AppClientId,
                    RedirectUri = new Uri(OAuthPage.OAuthRedirectUrl)
                },
                // Specify OAuthAuthorizationCode if you need a refresh token (and have specified a valid client secret)
                // Otherwise, use OAuthImplicit
                TokenAuthenticationType = TokenAuthenticationType.OAuthImplicit
            };

            // Get a reference to the (singleton) AuthenticationManager for the app
            AuthenticationManager thisAuthenticationManager = AuthenticationManager.Current;

            // Register the server information
            thisAuthenticationManager.RegisterServer(portalServerInfo);

            // Assign the method that AuthenticationManager will call to challenge for secured resources
            thisAuthenticationManager.ChallengeHandler = new ChallengeHandler(CreateCredentialAsync);

            // Set the OAuth authorization handler to this class (Implements IOAuthAuthorize interface)
            thisAuthenticationManager.OAuthAuthorizeHandler = this;
        }
开发者ID:Esri,项目名称:arcgis-runtime-samples-dotnet,代码行数:28,代码来源:OAuthPageRenderer.cs


示例9: GetPcLockStatus

        public bool GetPcLockStatus(ServerInfo serverInfo)
        {
            string connString = String.Format(settingsHelper.connectionString, serverInfo.address);
            SqlConnection connection = new SqlConnection(connString);
            DataClassesDataContext database = new DataClassesDataContext();

            try
            {
                connection.Open();

                var queryPc = from c in database.Computers
                              where c.PC_name == Environment.MachineName
                              select c.Lock_status;

                if (queryPc.Count() > 0)
                {
                    if (queryPc.First() == 1)
                        return true;
                    else return false;
                }
                else
                {
                    return false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return false;
            }
            finally
            {
                connection.Close();
            }
        }
开发者ID:mkaszta,项目名称:Emplokey,代码行数:35,代码来源:CertManager.cs


示例10: Query

 internal static DataTable Query(string sql, ServerInfo info)
 {
     var data = QuerySet(sql, info);
     if (data != null && data.Tables.Count > 0)
         return data.Tables[0];
     return null;
 }
开发者ID:jundingzhou,项目名称:SQLMonitor,代码行数:7,代码来源:SQLHelper.cs


示例11: EndSession

        public void EndSession(ServerInfo serverInfo, int sessionId)
        {
            string connString = String.Format(settingsHelper.connectionString, serverInfo.address);
            SqlConnection connection = new SqlConnection(connString);
            DataClassesDataContext database = new DataClassesDataContext();

            try
            {
                connection.Open();

                var queryLogs = from l in database.Logs
                                where l.ID == sessionId
                                select l;

                if (queryLogs.Any())
                {
                    queryLogs.First().Time_logout = DateTime.Now;
                    database.SubmitChanges();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                connection.Close();
            }
        }
开发者ID:mkaszta,项目名称:Emplokey,代码行数:29,代码来源:CertManager.cs


示例12: GetPingerDelayRetry

 // Delay for failed ping
 public int GetPingerDelayRetry(ServerInfo server)
 {
     int delay = Engine.Instance.Storage.GetInt("pinger.retry");
     if (delay == 0)
         delay = Conversions.ToInt32(server.Provider.GetKeyValue("pinger_retry", "5"));
     return delay;
 }
开发者ID:Clodo76,项目名称:airvpn-client,代码行数:8,代码来源:Pinger.cs


示例13: AccountLoginAck

        /// <summary>
        /// 
        /// </summary>
        internal AccountLoginAck( ServerInfo[] serverInfo )
            : base( 0x708, 0 /*6 + ?*/ )
        {
            WriterStream.Write( (ushort)0 /*6 + ?*/ );      // ×ֶδóС
            WriterStream.Write( (ushort)base.PacketID );    // ×ֶαàºÅ
            WriterStream.Write( (ushort)0x00 );             // ×ֶα£Áô
            //////////////////////////////////////////////////////////////////////////


            WriterStream.Write( (uint)0x0C000000 );
            WriterStream.Write( (sbyte)0x0 );

            // дÈëChannelsÐÅÏ¢
            for ( int iIndex = 0; iIndex < serverInfo.Length; iIndex++ )
            {
                WriterStream.Write( (sbyte)( 48 + iIndex ) );
                WriterStream.WriteAsciiNull( serverInfo[iIndex].ServerName );
                WriterStream.Write( (int)serverInfo[iIndex].ServerGuid );
            }


            //////////////////////////////////////////////////////////////////////////
            WriterStream.Seek( 0, SeekOrigin.Begin );
            WriterStream.Write( (ushort)WriterStream.Length );     // ×ֶδóС
        }
开发者ID:andyhebear,项目名称:HappyQ-WowServer,代码行数:28,代码来源:LoginPackets.cs


示例14: IrcContext

 internal IrcContext(Message message, Connection connection, ServerInfo info)
 {
     _conn = connection;
     _info = info;
     _msg = message;
     Init();
 }
开发者ID:strider-,项目名称:IrcBot,代码行数:7,代码来源:IrcContext.cs


示例15: SerializeDeserialize

        public void SerializeDeserialize()
        {
            const string logo = "logo";
            const string name = "name";
            const string desc = "description";

            ServerInfo info = new ServerInfo (new ServerSettings
            {
                ServerLogo = logo,
                Name = name,
                Description = desc,
                ServerPassword = "passworded"
            }, new GuestUserProvider());

            var stream = new MemoryStream (new byte[20480], true);
            var writer = new StreamValueWriter (stream);
            var reader = new StreamValueReader (stream);

            info.Serialize (null, writer);
            long length = stream.Position;
            stream.Position = 0;

            info = new ServerInfo (null, reader);
            Assert.AreEqual (length, stream.Position);
            Assert.AreEqual (logo, info.Logo);
            Assert.AreEqual (name, info.Name);
            Assert.AreEqual (desc, info.Description);
            Assert.AreEqual (true, info.Passworded);
            Assert.AreEqual (UserRegistrationMode.None, info.RegistrationMode);
            Assert.IsNull (info.RegistrationContent);
        }
开发者ID:ermau,项目名称:Gablarski,代码行数:31,代码来源:ServerInfoTests.cs


示例16: Client

        public Client(IPAddress address, UInt16 port)
        {
            this.address = address;
            this.port = port;
            fetcher = new ContentFetcher (address, port);

            ContentNode node = ContentParser.Parse (ContentCodeBag.Default, fetcher.Fetch ("/server-info"));
            serverInfo = ServerInfo.FromNode (node);
        }
开发者ID:gburt,项目名称:dmap-sharp,代码行数:9,代码来源:Client.cs


示例17: OnHandshake

        public override void OnHandshake(ServerInfo info)
        {
            if (ClientSession.Instance != null)
            {
                ClientSession.Instance.Handshake(info);
            }

            this.Send(frmMain.Instance.GetHashPacket());
        }
开发者ID:Yaminike,项目名称:ms-MapleLauncher,代码行数:9,代码来源:ServerSession.cs


示例18: SetServerInfo

        /// <summary>
        /// Updates or inserts the server info.
        /// </summary>
        /// <param name="info">The info.</param>
        public void SetServerInfo(ServerInfo info)
        {
            var existingInfo = this.UnitOfWork.Get<ServerInfo>(info.Id);

            if (existingInfo != null)
                this.UnitOfWork.Update(info);
            else
                this.UnitOfWork.Insert(info);
        }
开发者ID:DropZone,项目名称:LogC,代码行数:13,代码来源:Repository.cs


示例19: DiscoverIp

        public void DiscoverIp(ServerInfo server)
        {
            string[] methods = Engine.Instance.Storage.Get("discover.ip_webservice.list").Split(';');
            bool onlyFirstResponse = Engine.Instance.Storage.GetBool("discover.ip_webservice.first");

            foreach (string method in methods)
            {
                try
                {
                    if ((method.StartsWith("http://")) || (method.StartsWith("https://")))
                    {
                        // Fetch a webservice

                        string url = method;
                        url = url.Replace("{@ip}", server.IpEntry);

                        XmlDocument xmlDoc = Engine.Instance.XmlFromUrl(url, null, "iptitle", false); // Clodo: Bypass proxy?

                        if (xmlDoc.DocumentElement.HasChildNodes)
                        {
                            // Node renaming
                            Utils.XmlRenameTagName(xmlDoc.DocumentElement, "CountryCode", "country_code");

                            // Node parsing
                            //string countryCode = Utils.XmlGetBody(Utils.XmlGetFirstElementByTagName(xmlDoc.DocumentElement, "country_code")).ToLowerInvariant().Trim();
                            string countryCode = Utils.XmlGetBody(xmlDoc.DocumentElement.SelectSingleNode(".//country_code") as XmlElement).ToLowerInvariant().Trim();
                            if (CountriesManager.IsCountryCode(countryCode))
                            {
                                if(server.CountryCode != countryCode)
                                {
                                    server.CountryCode = countryCode;
                                    Engine.Instance.MarkServersListUpdated();
                                    Engine.Instance.MarkAreasListUpdated();
                                }
                            }

                            string cityName = Utils.XmlGetBody(xmlDoc.DocumentElement.SelectSingleNode(".//city_name") as XmlElement).Trim();
                            if (cityName == "N/A")
                                cityName = "";
                            if (cityName != "")
                                server.Location = cityName;

                            if (onlyFirstResponse)
                                break;
                        }
                        else
                        {
                            Engine.Instance.Logs.Log(LogType.Fatal, "Unable to fetch " + url);
                        }
                    }
                }
                catch (Exception)
                {
                }
            }
        }
开发者ID:Clodo76,项目名称:airvpn-client,代码行数:56,代码来源:Discover.cs


示例20: LastUpdateTimeCannotBeSetBackwards

        public void LastUpdateTimeCannotBeSetBackwards()
        {
            var serverInfo = new ServerInfo(new ServerRegistration {Hostname = "foo", Port = 4200});

            var timeToSet = DateTimeOffset.Now;
            serverInfo.LastUpdateTime = timeToSet;
            Assert.AreEqual(timeToSet, serverInfo.LastUpdateTime);

            serverInfo.LastUpdateTime = timeToSet.Subtract(TimeSpan.FromSeconds(1));
            Assert.AreEqual(timeToSet, serverInfo.LastUpdateTime);
        }
开发者ID:darting,项目名称:MetricSystem,代码行数:11,代码来源:ServerInfoTests.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# ServerMessage类代码示例发布时间:2022-05-24
下一篇:
C# ServerConnection类代码示例发布时间: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