本文整理汇总了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);
}
示例2: ExportData
public void ExportData(System.Xml.XmlWriter writer)
{
ServerInfo host = new ServerInfo();
writer.WriteStartElement("server");
host.WriteXml(writer);
writer.WriteEndElement();
}
示例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();
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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.");
}
示例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;
}
示例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();
}
}
示例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;
}
示例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();
}
}
示例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;
}
示例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 ); // ×ֶδóС
}
示例14: IrcContext
internal IrcContext(Message message, Connection connection, ServerInfo info)
{
_conn = connection;
_info = info;
_msg = message;
Init();
}
示例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);
}