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


C# ServerInfo类代码示例

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


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


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