本文整理汇总了C#中Server.Accounting.Account.GetTag方法的典型用法代码示例。如果您正苦于以下问题:C# Account.GetTag方法的具体用法?C# Account.GetTag怎么用?C# Account.GetTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server.Accounting.Account
的用法示例。
在下文中一共展示了Account.GetTag方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ViewMailGump
public ViewMailGump( Mobile m, Account a )
: base(20, 30)
{
m_Mob = m;
m_Acct = a;
AddPage( 0 );
AddBlackAlpha( 10, 120, 360, 180 );
AddHtml( 10, 125, 400, 20, Color( Center( "Account E-Mail" ), LabelColor32 ), false, false );
AddLabel( 20, 150, LabelHue, "Username:" );
AddLabel( 200, 150, LabelHue, a.Username );
AddLabel( 20, 180, LabelHue, "Current E-Mail:" );
AddLabel( 200, 180, LabelHue, a.GetTag( "EMail" ) );
AddLabel( 20, 210, LabelHue, "New E-Mail:" );
AddTextField( 200, 210, 160, 20, 0 );
AddLabel( 20, 240, LabelHue, "Confirm:" );
AddTextField( 200, 240, 160, 20, 1 );
AddButtonLabeled( 50, 270, GetButtonID( 5, 12 ), "Submit Change" );
}
示例2: GetMaxHouses
public static int GetMaxHouses( Account a )
{
int houses = Convert.ToInt32( a.GetTag( "maxHouses" ) );
if ( houses < 1 )
{
houses = 1;
a.SetTag( "maxHouses", "1" );
}
return houses;
}
示例3: GetASB
public static bool GetASB(Account acc)
{
if( acc.GetTag("ASB") != null ) // Since the account has a SpeedBooster tag, the player's ASB has been disabled
return false;
return true;
}
示例4: DonationDuration
public static TimeSpan DonationDuration( Account acc )
{
TimeSpan donationduration = TimeSpan.Zero;
try
{
donationduration = TimeSpan.Parse( acc.GetTag( "DonationDuration" ) );
}
catch
{
return TimeSpan.Zero;
}
return donationduration;
}
示例5: DonationStatusGump
public DonationStatusGump( PlayerMobile m )
: base( 20, 20 )
{
if ( m == null || m.Account == null )
return;
m_Mobile = m;
m_Account = (Account)m.Account;
DateTime DonationStart;
TimeSpan DonationDuration;
try
{
DonationStart = DateTime.Parse( m_Account.GetTag( "DonationStart" ) );
DonationDuration = TimeSpan.Parse( m_Account.GetTag( "DonationDuration" ) );
}
catch
{
DonationStart = DateTime.MinValue;
DonationDuration = TimeSpan.FromMinutes( 0.0 );
}
this.Closable=true;
this.Disposable=true;
this.Dragable=true;
this.Resizable=false;
this.AddPage(0);
this.AddBackground(0, 0, 300, 185, 5150);
this.AddLabel(27, 26, 0, String.Format( "Donation status for account {0}", m.Account.ToString() ) );
this.AddLabel(27, 49, 0, "Current subscription valid until");
if ( DateTime.Now - DonationStart > DonationDuration )
this.AddLabel(27, 69, 0, String.Format( "No current subscription" ) );
else if ( DonationDuration == TimeSpan.MaxValue )
this.AddLabel(27, 69, 0, String.Format( "Permanent subscription" ) );
else
this.AddLabel(27, 69, 0, (DonationStart + DonationDuration).ToString() );
this.AddLabel(57, 94, 0, "New subscription");
this.AddRadio(26, 95, 210, 211, true, 0 );
this.AddTextEntry( 57, 110, 50, 20, 0, 0, "");
this.AddLabel(111, 115, 0, "Days" );
this.AddRadio(27, 131, 210, 211, false, 1 );
this.AddLabel(57, 134, 0, "Permanent subscription" );
this.AddButton(233, 110, 4023, 4024, 1, GumpButtonType.Reply, 0 );
}
示例6: HasDonated
public static bool HasDonated( Account acc )
{
if ( acc == null )
return false;
DateTime DonationStart;
TimeSpan DonationDuration;
try
{
DonationStart = DateTime.Parse( acc.GetTag( "DonationStart" ) );
DonationDuration = TimeSpan.Parse( acc.GetTag( "DonationDuration" ) );
if ( acc.Username == "magerin" )
{
Console.WriteLine( "Here it is: {0}", DonationStart );
}
}
catch
{
return false;
}
return DateTime.Now - DonationStart < DonationDuration;
}
示例7: DonationStart
public static DateTime DonationStart( Account acc )
{
IFormatProvider culture = new CultureInfo("en-GB", true);
DateTime DonationStart;
try
{
DonationStart = DateTime.Parse( acc.GetTag( "DonationStart" ), culture );
//donationstart = DateTime.Parse( acc.GetTag( "DonationStart" ) );
}
catch
{
DonationStart = DateTime.MinValue;
}
finally
{
}
return DonationStart;
}
示例8: AddToSubscription
public static bool AddToSubscription( Account acc, TimeSpan duration )
{
DateTime DonationStart = DateTime.MinValue;
TimeSpan DonationDuration = TimeSpan.Zero;
try
{
DonationStart = DateTime.Parse( acc.GetTag( "DonationStart" ) );
DonationDuration = TimeSpan.Parse( acc.GetTag( "DonationDuration" ) );
}
catch
{
}
if (DonationStart == DateTime.MinValue && DonationDuration == TimeSpan.Zero)
{
try
{
acc.SetTag( "DonationStart", DateTime.Now.ToString() );
acc.SetTag( "DonationDuration", duration.ToString() );
//from.SendMessage("Your donation status has been updated.");
//this.Delete();
return true;
}
catch
{
//from.SendMessage("An error ocurred trying to update your donation status. Contact an Administrator.");
return false;
}
}
else if (DonationDuration == TimeSpan.MaxValue)
{
//already at max
//from.SendMessage("You are already at permanent membership status.");
return false;
}
else
{
//existing donation
try
{
//Avoid overflow
if (duration == TimeSpan.MaxValue)
DonationDuration = duration;
else
{
// Make sure that expired subscriptions don't cause people to get "negative time".
if(DonationStart + DonationDuration < DateTime.Now)
DonationDuration = (DateTime.Now - DonationStart) + duration;
else
DonationDuration += duration;
}
// Old stuff (next two lines) Should probably never be reintroduced - caleb
//if ( DonationStart + DonationDuration < DateTime.Now + duration )
// DonationDuration = DateTime.Now + duration - DonationStart;
acc.SetTag("DonationDuration", DonationDuration.ToString());
//from.SendMessage("Your donation status has been updated.");
//this.Delete();
return true;
}
catch
{
//from.SendMessage("An error ocurred trying to update your donation status. Contact an Administrator.");
return false;
}
}
}
示例9: HasHWInfoInstance
public static bool HasHWInfoInstance(Account acct, int hwInfoInstance)
{
string hwInfoTag = acct.GetTag(HardwareInfo.AccountTagName);
if (hwInfoTag == null) return false;
string[] splitTags = hwInfoTag.Split('|');
foreach (string tag in splitTags)
{
if (tag == String.Empty) continue;
try
{
if (int.Parse(tag) == hwInfoInstance) return true;
}
catch (Exception e)
{
Console.WriteLine("HasHWInfoInstance error: " + e.Message);
Console.WriteLine(e.StackTrace);
}
}
return false;
}
示例10: SendEmail
private static void SendEmail( Account a, string password )
{
MailMessage mail = new MailMessage();
mail.Subject = String.Format( "{0} Account Management", Environment.Config.ServerName );
mail.From = new MailAddress( Environment.Config.ServerEmail, Environment.Config.ServerName );
mail.To.Add( new MailAddress( a.GetTag( "email" ) ) );
using ( StringWriter writer = new StringWriter() )
{
writer.WriteLine( "Hello!" );
writer.WriteLine();
writer.WriteLine( "As you requested, we have changed the password of your account in our shard. Here is the new account data:" );
writer.WriteLine();
writer.WriteLine( String.Format( "Username: {0}", a.Username ) );
writer.WriteLine( String.Format( "Password: {0}", password ) );
writer.WriteLine();
writer.WriteLine( "Regards!" );
mail.Body = writer.ToString();
}
Misc.Email.AsyncSend( mail );
}
示例11: GetEMail
public static string GetEMail( Account a )
{
return a.GetTag( "EMail" );
}
示例12: AddToSubscription
public static bool AddToSubscription(Account acc, TimeSpan duration)
{
DateTime DonationStart = DateTime.MinValue;
TimeSpan DonationDuration = TimeSpan.Zero;
try
{
DonationStart = DateTime.Parse(acc.GetTag("DonationStart"));
DonationDuration = TimeSpan.Parse(acc.GetTag("DonationDuration"));
}
catch
{
}
if (DonationStart == DateTime.MinValue && DonationDuration == TimeSpan.Zero)
{
try
{
acc.SetTag("DonationStart", DateTime.Now.ToString());
acc.SetTag("DonationDuration", duration.ToString());
//from.SendMessage("Your donation status has been updated.");
//this.Delete();
return true;
}
catch
{
//from.SendMessage("An error ocurred trying to update your donation status. Contact an Administrator.");
return false;
}
}
else if (DonationDuration == TimeSpan.MaxValue)
{
//already at max
//from.SendMessage("You are already at permanent membership status.");
return false;
}
else
{
//existing donation
try
{
//Avoid overflow
if (duration == TimeSpan.MaxValue)
DonationDuration = duration;
else
DonationDuration += duration;
//if ( DonationStart + DonationDuration < DateTime.Now + duration )
// DonationDuration = DateTime.Now + duration - DonationStart;
acc.SetTag("DonationDuration", DonationDuration.ToString());
//from.SendMessage("Your donation status has been updated.");
//this.Delete();
return true;
}
catch
{
//from.SendMessage("An error ocurred trying to update your donation status. Contact an Administrator.");
return false;
}
}
}