本文整理汇总了C#中Server.Network.NetState.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# NetState.ToString方法的具体用法?C# NetState.ToString怎么用?C# NetState.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server.Network.NetState
的用法示例。
在下文中一共展示了NetState.ToString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteLine
public static void WriteLine(NetState state, string text)
{
LazyInitialize();
if (!m_Enabled) return;
try
{
Account acct = state.Account as Account;
string name = acct == null ? "(UNKNOWN)" : acct.Username;
string accesslevel = acct == null ? "NoAccount" : acct.AccessLevel.ToString();
string statestr = state == null ? "NULLSTATE" : state.ToString();
m_Output.WriteLine("{0}: {1}: {2}: {3}", DateTime.Now, statestr, name, text);
string path = Core.BaseDirectory;
Commands.CommandLogging.AppendPath(ref path, LogBaseDirectory);
Commands.CommandLogging.AppendPath(ref path, LogSubDirectory);
Commands.CommandLogging.AppendPath(ref path, accesslevel);
path = Path.Combine(path, String.Format("{0}.log", name));
using (StreamWriter sw = new StreamWriter(path, true))
sw.WriteLine("{0}: {1}: {2}", DateTime.Now, statestr, text);
}
catch
{
}
}
示例2: ClientGump
public ClientGump( Mobile from, NetState state, string initialText ) : base( 30, 20 )
{
if ( state == null )
return;
m_State = state;
AddPage( 0 );
AddBackground( 0, 0, 400, 274, 5054 );
AddImageTiled( 10, 10, 380, 19, 0xA40 );
AddAlphaRegion( 10, 10, 380, 19 );
AddImageTiled( 10, 32, 380, 232, 0xA40 );
AddAlphaRegion( 10, 32, 380, 232 );
AddHtml( 10, 10, 380, 20, Color( Center( "User Information" ), LabelColor32 ), false, false );
int line = 0;
AddHtml( 14, 36 + (line * 20), 200, 20, Color( "Address:", LabelColor32 ), false, false );
AddHtml( 70, 36 + (line++ * 20), 200, 20, Color( state.ToString(), LabelColor32 ), false, false );
AddHtml( 14, 36 + (line * 20), 200, 20, Color( "Client:", LabelColor32 ), false, false );
AddHtml( 70, 36 + (line++ * 20), 200, 20, Color( state.Version == null ? "(null)" : state.Version.ToString(), LabelColor32 ), false, false );
AddHtml( 14, 36 + (line * 20), 200, 20, Color( "Version:", LabelColor32 ), false, false );
ExpansionInfo info = state.ExpansionInfo;
string expansionName = info.Name;
if ( info.ID == (int)Expansion.None )
expansionName = (((state.Flags & 0x04) != 0) ? "Blackthorn's Revenge" : ((state.Flags & 0x02) != 0) ? "Third Dawn" : ((state.Flags & 0x01) != 0) ? "Renaissance" : "The Second Age" );
AddHtml( 70, 36 + (line++ * 20), 200, 20, Color( expansionName, LabelColor32 ), false, false );
Account a = state.Account as Account;
Mobile m = state.Mobile;
if ( from.AccessLevel >= AccessLevel.GameMaster && a != null )
{
AddHtml( 14, 36 + (line * 20), 200, 20, Color( "Account:", LabelColor32 ), false, false );
AddHtml( 70, 36 + (line++ * 20), 200, 20, Color( a.Username, LabelColor32 ), false, false );
}
if ( m != null )
{
AddHtml( 14, 36 + (line * 20), 200, 20, Color( "Mobile:", LabelColor32 ), false, false );
AddHtml( 70, 36 + (line++ * 20), 200, 20, Color( String.Format( "{0} (0x{1:X})", m.Name, m.Serial.Value ), LabelColor32 ), false, false );
AddHtml( 14, 36 + (line * 20), 200, 20, Color( "Location:", LabelColor32 ), false, false );
AddHtml( 70, 36 + (line++ * 20), 200, 20, Color( String.Format( "{0} [{1}]", m.Location, m.Map ), LabelColor32 ), false, false );
AddButton( 13, 157, 0xFAB, 0xFAD, 1, GumpButtonType.Reply, 0 );
AddHtml( 48, 158, 200, 20, Color( "Send Message", LabelColor32 ), false, false );
AddImageTiled( 12, 182, 376, 80, 0xA40 );
AddImageTiled( 13, 183, 374, 78, 0xBBC );
AddTextEntry( 15, 183, 372, 78, 0x480, 0, "" );
AddImageTiled( 245, 35, 142, 144, 5058 );
AddImageTiled( 246, 36, 140, 142, 0xA40 );
AddAlphaRegion( 246, 36, 140, 142 );
line = 0;
if ( BaseCommand.IsAccessible( from, m ) )
{
AddButton( 246, 36 + (line * 20), 0xFA5, 0xFA7, 4, GumpButtonType.Reply, 0 );
AddHtml( 280, 38 + (line++ * 20), 100, 20, Color( "Properties", LabelColor32 ), false, false );
}
if ( from != m )
{
AddButton( 246, 36 + (line * 20), 0xFA5, 0xFA7, 5, GumpButtonType.Reply, 0 );
AddHtml( 280, 38 + (line++ * 20), 100, 20, Color( "Go to them", LabelColor32 ), false, false );
AddButton( 246, 36 + (line * 20), 0xFA5, 0xFA7, 6, GumpButtonType.Reply, 0 );
AddHtml( 280, 38 + (line++ * 20), 100, 20, Color( "Bring them here", LabelColor32 ), false, false );
}
AddButton( 246, 36 + (line * 20), 0xFA5, 0xFA7, 7, GumpButtonType.Reply, 0 );
AddHtml( 280, 38 + (line++ * 20), 100, 20, Color( "Move to target", LabelColor32 ), false, false );
if ( from.AccessLevel >= AccessLevel.GameMaster && from.AccessLevel > m.AccessLevel )
{
AddButton( 246, 36 + (line * 20), 0xFA5, 0xFA7, 8, GumpButtonType.Reply, 0 );
AddHtml( 280, 38 + (line++ * 20), 100, 20, Color( "Disconnect", LabelColor32 ), false, false );
if ( m.Alive )
{
AddButton( 246, 36 + (line * 20), 0xFA5, 0xFA7, 9, GumpButtonType.Reply, 0 );
AddHtml( 280, 38 + (line++ * 20), 100, 20, Color( "Kill", LabelColor32 ), false, false );
}
else
{
AddButton( 246, 36 + (line * 20), 0xFA5, 0xFA7, 10, GumpButtonType.Reply, 0 );
AddHtml( 280, 38 + (line++ * 20), 100, 20, Color( "Resurrect", LabelColor32 ), false, false );
//.........这里部分代码省略.........
示例3: ClientGump
public ClientGump( Mobile from, NetState state, string initialText ) : base( 30, 20 )
{
if ( state == null )
return;
m_State = state;
AddPage( 0 );
AddBackground( 0, 0, 400, 274, 5054 );
AddImageTiled( 10, 10, 380, 19, 0xA40 );
AddAlphaRegion( 10, 10, 380, 19 );
AddImageTiled( 10, 32, 380, 232, 0xA40 );
AddAlphaRegion( 10, 32, 380, 232 );
AddHtml( 10, 10, 380, 20, Color( Center( "User Information" ), LabelColor32 ), false, false );
int line = 0;
AddHtml( 14, 36 + (line * 20), 200, 20, Color( "Client:", LabelColor32 ), false, false );
AddHtml( 70, 36 + (line++ * 20), 200, 20, Color( state.Version == null ? "(null)" : state.Version.ToString(), LabelColor32 ), false, false );
AddHtml( 14, 36 + (line * 20), 200, 20, Color( "Version:", LabelColor32 ), false, false );
AddHtml( 70, 36 + (line++ * 20), 200, 20, Color( ((state.Flags & 0x08) != 0) ? "Age of Shadows" : ((state.Flags & 0x04) != 0) ? "Blackthorn's Revenge" : ((state.Flags & 0x02) != 0) ? "Third Dawn" : ((state.Flags & 0x01) != 0) ? "Renaissance" : "The Second Age", LabelColor32 ), false, false ); // some flags yet unverified
Account a = state.Account as Account;
Mobile m = state.Mobile;
if ( from.AccessLevel >= AccessLevel.GameMaster && a != null )
{
AddHtml( 14, 36 + (line * 20), 200, 20, Color( "Account:", LabelColor32 ), false, false );
AddHtml( 70, 36 + (line++ * 20), 200, 20, Color( a.Username, LabelColor32 ), false, false );
}
if ( from.AccessLevel >= AccessLevel.GameMaster && m != null && from.AccessLevel >= m.AccessLevel )
{
AddHtml( 14, 36 + (line * 20), 200, 20, Color( "Address:", LabelColor32 ), false, false );
AddHtml( 70, 36 + (line++ * 20), 200, 20, Color( state.ToString(), LabelColor32 ), false, false );
}
if ( m != null )
{
AddHtml( 14, 36 + (line * 20), 200, 20, Color( "Mobile:", LabelColor32 ), false, false );
AddHtml( 70, 36 + (line++ * 20), 200, 20, Color( String.Format( "{0} (0x{1:X})", m.Name, m.Serial.Value ), LabelColor32 ), false, false );
AddHtml( 14, 36 + (line * 20), 200, 20, Color( "Location:", LabelColor32 ), false, false );
AddHtml( 70, 36 + (line++ * 20), 200, 20, Color( String.Format( "{0} [{1}]", m.Location, m.Map ), LabelColor32 ), false, false );
AddButton( 13, 157, 0xFAB, 0xFAD, 1, GumpButtonType.Reply, 0 );
AddHtml( 48, 158, 200, 20, Color( "Send Message", LabelColor32 ), false, false );
AddImageTiled( 12, 182, 376, 80, 0xA40 );
AddImageTiled( 13, 183, 374, 78, 0xBBC );
AddTextEntry( 15, 183, 372, 78, 0x480, 0, "" );
AddImageTiled( 245, 35, 142, 144, 5058 );
AddImageTiled( 246, 36, 140, 142, 0xA40 );
AddAlphaRegion( 246, 36, 140, 142 );
line = 0;
if ( from != m )
{
AddButton( 246, 36 + (line * 20), 0xFA5, 0xFA7, 5, GumpButtonType.Reply, 0 );
AddHtml( 280, 38 + (line++ * 20), 100, 20, Color( "Go to them", LabelColor32 ), false, false );
}
if ( from.AccessLevel >= AccessLevel.GameMaster )
{
if ( from != m )
{
AddButton( 246, 36 + (line * 20), 0xFA5, 0xFA7, 6, GumpButtonType.Reply, 0 );
AddHtml( 280, 38 + (line++ * 20), 100, 20, Color( "Bring them here", LabelColor32 ), false, false );
}
AddButton( 246, 36 + (line * 20), 0xFA5, 0xFA7, 7, GumpButtonType.Reply, 0 );
AddHtml( 280, 38 + (line++ * 20), 100, 20, Color( "Move to target", LabelColor32 ), false, false );
AddButton( 246, 36 + (line * 20), 0xFA5, 0xFA7, 4, GumpButtonType.Reply, 0 );
AddHtml( 280, 38 + (line++ * 20), 100, 20, Color( "Properties", LabelColor32 ), false, false );
}
if ( from.AccessLevel >= AccessLevel.GameMaster && from.AccessLevel > m.AccessLevel )
{
AddButton( 246, 36 + (line * 20), 0xFA5, 0xFA7, 8, GumpButtonType.Reply, 0 );
AddHtml( 280, 38 + (line++ * 20), 100, 20, Color( "Disconnect", LabelColor32 ), false, false );
if ( m.Alive )
{
AddButton( 246, 36 + (line * 20), 0xFA5, 0xFA7, 9, GumpButtonType.Reply, 0 );
AddHtml( 280, 38 + (line++ * 20), 100, 20, Color( "Kill", LabelColor32 ), false, false );
}
else
{
AddButton( 246, 36 + (line * 20), 0xFA5, 0xFA7, 10, GumpButtonType.Reply, 0 );
AddHtml( 280, 38 + (line++ * 20), 100, 20, Color( "Resurrect", LabelColor32 ), false, false );
}
//.........这里部分代码省略.........
示例4: OnResponse
public override void OnResponse( NetState state, RelayInfo info )
{
if ( info.ButtonID != 1 )
return;
if ( LogRequested[m_Account] != null )
{
m_Mobile.SendMessage( "Sorry, you may only use this option once per day." );
return;
}
string email = AccountManagement.GetEMail( m_Account );
if ( email == null || email.Length == 0 || !Email.IsValid( email ) )
return;
m_Mobile.SendMessage( "An e-mail has been dispatched to {0} with a listing of all IP addresses that have accessed this account.", email );
StringBuilder sb = new StringBuilder( m_Account.LoginIPs.Length );
for ( int i = 0; i < m_Account.LoginIPs.Length; i++ )
{
IPAddress ip = m_Account.LoginIPs[i];
sb.Append( String.Format("- {0}\n", ip.ToString()) );
}
//MailMessage mm = new MailMessage( "Divinity CE Account Manager <[email protected]>", email );
MailMessage mm = new MailMessage(new MailAddress("[email protected]", "Divinity CE Account Manager"), new MailAddress(email, m_Mobile.Name));
mm.Subject = "Divinity CE Account Management";
mm.Body = String.Format(
"{0},\n\tAs you requested, the following is a listing of all IP addresses that have accessed your account.\n\n{1}\n\nIf you have any questions, comments, suggestions, or require assistance, please do not hesitate to page or visit our forums at https://github.com/msturgill/divinity\n\n\tThank you,\n\t\tThe Divinity CE Administration Team\n\t\thttps://github.com/msturgill/divinity\n\n\nThis message is not spam. This request was initiated by {2}. If you feel you received this message in error, please disregard it.", m_Mobile.Name, sb.ToString(), state.ToString());
Email.AsyncSend( mm );
LogRequested[m_Account] = 1;
}
示例5: AccountGump
public AccountGump( Mobile from, NetState state, bool showOnlyCredits ) : base( 30, 20 )
{
if ( null == state )
return;
PlayerMobile mobile = (PlayerMobile)from;
AddPage( 1 );
if ( !showOnlyCredits )
{
AddBackground( 50, 0, 479, 309, 9270 );
AddImage( 0, 0, 10400 );
AddImage( 0, 225, 10402 );
AddImage( 495, 0, 10410 );
AddImage( 495, 225, 10412 );
AddImage( 60, 15, 5536 );
AddImage( 275, 15, 1025 );
AddLabel( 205, 43, NewsGump.kLabelColor, "Account Name" );
AddLabel( 205, 57, 0x480, mobile.Account.ToString() );
AddLabel( 205, 80, NewsGump.kLabelColor, "Account Password" );
AddLabel( 205, 98, NewsGump.kDataColor, "-(Protected)-" );
AddLabel( 355, 43, NewsGump.kLabelColor, "Online Character" );
AddLabel( 355, 57, NewsGump.kDataColor, mobile.Name );
AddLabel( 355, 80, NewsGump.kLabelColor, "Character Age" );
AddLabel( 355, 100, NewsGump.kDataColor, mobile.GameTime.Days.ToString() + " Days" );
AddLabel( 355, 115, NewsGump.kDataColor, mobile.GameTime.Hours.ToString() + " Hours" );
AddLabel( 355, 130, NewsGump.kDataColor, mobile.GameTime.Minutes.ToString() + " Minutes" );
AddLabel( 355, 144, NewsGump.kDataColor, mobile.GameTime.Seconds.ToString() + " Seconds" );
AddLabel( 205, 120, NewsGump.kLabelColor, "Account Access Level" );
AddLabel( 205, 135, NewsGump.kDataColor, from.AccessLevel.ToString() );
AddButton( 470, 15, 25, 26, 0, GumpButtonType.Reply, 0 ); // Close
AddLabel( 355, 165, NewsGump.kLabelColor, "IP Address" );
AddLabel( 355, 180, NewsGump.kDataColor, state.ToString());
AddLabel( 205, 165, NewsGump.kLabelColor, "Client Version" );
AddLabel( 205, 180, NewsGump.kDataColor, (( state.Flags ) != 0 ) ? "Samurai Empire" : (( state.Flags ) != 0) ? "Age of Shadows" : (( state.Flags ) != 0) ? "Blackthorn's Revenge" : (( state.Flags ) != 0 ) ? "Third Dawn" : (( state.Flags ) != 0 ) ? "Renaissance" : "The Second Age" );
AddLabel( 205, 200, NewsGump.kLabelColor, "Client Patch" );
AddLabel( 205, 215, NewsGump.kDataColor, null == state.Version ? "(null)" : state.Version.ToString() );
AddButton( 445, 15, 22153, 22154, 0, GumpButtonType.Page, 2 ); // About
AddPage( 2 );
}
// Credits page
AddBackground( 50, 0, 479, 309, 9270 );
AddImage( 0, 0, 10400 );
AddImage( 0, 225, 10402 );
AddImage( 495, 0, 10410 );
AddImage( 495, 225, 10412 );
AddImage( 60, 15, 5536 );
AddLabel( 205, 45, NewsGump.kLabelColor, "Code By" );
AddLabel( 205, 60, NewsGump.kDataColor, "Xanthos" );
AddLabel( 205, 80, NewsGump.kLabelColor, "Inspiration By" );
AddLabel( 205, 95, NewsGump.kDataColor, "Princess Monika" );
AddLabel( 205, 110, NewsGump.kLabelColor, "Gumps By" );
AddLabel( 205, 125, NewsGump.kDataColor, "Viago" );
AddLabel( 355, 45, NewsGump.kLabelColor, "Credit To" );
AddLabel( 355, 60, NewsGump.kDataColor, "Xuse" );
AddLabel( 355, 75, NewsGump.kDataColor, "The RunUO Comunity" );
AddLabel( 355, 90, NewsGump.kDataColor, "Lady Rouge" );
AddLabel( 355, 105, NewsGump.kDataColor, "RoninGT" );
AddButton( 470, 15, 25, 26, 0, GumpButtonType.Reply, 0 ); // Close
}