本文整理汇总了C#中Server.Accounting.Account类的典型用法代码示例。如果您正苦于以下问题:C# Account类的具体用法?C# Account怎么用?C# Account使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Account类属于Server.Accounting命名空间,在下文中一共展示了Account类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Load
private static void Load()
{
string filePath = Path.Combine( "Saves/Accounts", "accounts.xml" );
if ( !File.Exists( filePath ) )
return;
XmlDocument doc = new XmlDocument();
doc.Load( filePath );
XmlElement root = doc["accounts"];
foreach ( XmlElement accountXmlElement in root.GetElementsByTagName( "account" ) )
{
try
{
Account acct = new Account( accountXmlElement );
Accounts.AddAccount( acct );
}
catch
{
Console.WriteLine( "Warning: Account instance load failed" );
}
}
}
开发者ID:Ravenwolfe,项目名称:xrunuo,代码行数:26,代码来源:AccountPersistence.cs
示例2: Initialize
public static void Initialize()
{
if ( Accounts.Count == 0 && !Core.Service )
{
Console.WriteLine( "This server has no accounts." );
Console.Write( "Do you want to create the owner account now? (y/n)" );
if( Console.ReadKey( true ).Key == ConsoleKey.Y )
{
Console.WriteLine();
Console.Write( "Username: " );
string username = Console.ReadLine();
Console.Write( "Password: " );
string password = Console.ReadLine();
Account a = new Account( username, password );
a.AccessLevel = AccessLevel.Owner;
Console.WriteLine( "Account created." );
}
else
{
Console.WriteLine();
Console.WriteLine( "Account not created." );
}
}
}
开发者ID:greeduomacro,项目名称:last-wish,代码行数:30,代码来源:AccountPrompt.cs
示例3: DonationHuePickerGump
public DonationHuePickerGump(Mobile m, int[] hues, GetHueMethod gethuemethod, SetHueMethod sethuemethod, string caption)
: base(20, 20)
{
if (m == null || m.Account == null || hues == null || hues.Length <= 0 || gethuemethod == null || sethuemethod == null || caption == null)
return;
m_Account = (Account)m.Account;
m_Hues = hues;
m_GetHueMethod = gethuemethod;
m_SetHueMethod = sethuemethod;
m_Caption = caption;
int cushue = m_GetHueMethod(m_Account);
AddPage(0);
AddBackground(0, 0, 200, 120 + m_Hues.Length * 30, 2600);
AddLabel(50, 30, 2401, m_Caption);
int c = 0;
foreach (int hue in m_Hues)
{
AddRadio(30, 50 + c * 30, 9727, 9730, (cushue == hue), c);
AddLabel(65, 55 + c * 30, (hue == 0) ? 2401 : (hue == 1177) ? 52 : hue - 1, (hue == 0) ? "Regular Hue" : (hue == 1177) ? "Blaze Hue" : "*****");
c++;
}
AddButton(30, 60 + c * 30, 4005, 4007, 1, GumpButtonType.Reply, 0);
AddLabel(65, 60 + c * 30, 2401, "Apply");
}
开发者ID:kamronbatman,项目名称:Defiance-AOS-Pre-2012,代码行数:30,代码来源:DonationGumps.cs
示例4: Load
public static void Load()
{
m_Accounts = new Dictionary<string, IAccount>( 32, StringComparer.OrdinalIgnoreCase );
string filePath = Path.Combine( "Saves/Accounts", "accounts.xml" );
if ( !File.Exists( filePath ) )
return;
XmlDocument doc = new XmlDocument();
doc.Load( filePath );
XmlElement root = doc["accounts"];
foreach ( XmlElement account in root.GetElementsByTagName( "account" ) )
{
try
{
Account acct = new Account( account );
}
catch
{
Console.WriteLine( "Warning: Account instance load failed" );
}
}
}
开发者ID:greeduomacro,项目名称:last-wish,代码行数:26,代码来源:Accounts.cs
示例5: CreateAccount
public static Account CreateAccount( string username, string password, string linkedEmail = null )
{
Account account = new Account( username, password, linkedEmail );
if ( m_Accounts.Count == 0 )
account.AccessLevel = AccessLevel.Owner;
return AddAccount( account );
}
开发者ID:xrunuo,项目名称:xrunuo,代码行数:9,代码来源:Accounts.cs
示例6: AddAccount
public static Account AddAccount( string user, string pass )
{
Account a = new Account( user, pass );
if ( m_Accounts.Count == 0 )
a.AccessLevel = AccessLevel.Administrator;
m_Accounts[a.Username] = a;
return a;
}
开发者ID:BackupTheBerlios,项目名称:sunuo-svn,代码行数:10,代码来源:Accounts.cs
示例7: GetProgress
protected virtual int GetProgress(ConquestState state, Account account)
{
if (state.User == null)
return 0;
if (account == null || DateTime.UtcNow - account.Created < AccountAge)
{
return 0;
}
return 1;
}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:12,代码来源:AccountAgeConquest.cs
示例8: CreateMobile
private static Mobile CreateMobile( Account a )
{
if ( a.Count >= a.Limit )
return null;
for ( int i = 0; i < a.Length; ++i )
{
if ( a[i] == null )
return (a[i] = new PlayerMobile());
}
return null;
}
开发者ID:Grimoric,项目名称:RunUO.T2A,代码行数:13,代码来源:CharacterCreation.cs
示例9: GetAccountInfo
public static void GetAccountInfo(Account a, out AccessLevel accessLevel, out bool online)
{
accessLevel = a.AccessLevel;
online = false;
for (int j = 0; j < 5; ++j)
{
Mobile check = a[j];
if (check == null)
continue;
if (check.AccessLevel > accessLevel)
accessLevel = check.AccessLevel;
if (check.NetState != null)
online = true;
}
}
开发者ID:kamronbatman,项目名称:DefianceUO-Pre1.10,代码行数:19,代码来源:NewPlayerSkillStone.cs
示例10: Deserialize
public void Deserialize( GenericReader reader )
{
int version = reader.ReadInt();
switch ( version )
{
case 0:
{
m_Account = Accounts.GetAccount( reader.ReadString() );
m_HorseHue = reader.ReadInt();
m_SandalHue = reader.ReadInt();
m_BandanaHue = reader.ReadInt();
m_RobeHue = reader.ReadInt();
for ( int i = 0; i < 9; i++ )
reader.ReadInt();
break;
}
}
}
开发者ID:kamronbatman,项目名称:DefianceUO-Pre1.10,代码行数:19,代码来源:DonationSystem.cs
示例11: DonationSettingsGump
public DonationSettingsGump( Mobile m ) : base( 20, 20 )
{
if ( !(m is PlayerMobile ) || m == null || m.Account == null )
return;
m_Account = (Account)m.Account;
AddPage( 0 );
AddBackground( 0, 0, 300, 250, 2600 );
AddLabel( 60, 30, 2401, "Donation Settings" );
int errors = 0;
TryButton( 30, 50, m, 90, 1, ref errors );
AddLabel( 65, 50, 2401, "Set Horse Hue" );
TryButton( 30, 70, m, 30, 2, ref errors );
AddLabel( 65, 70, 2401, "Set Sandal Hue" );
TryButton( 30, 90, m, 30, 3, ref errors );
AddLabel( 65, 90, 2401, "Set Bandana Hue" );
TryButton( 30, 110, m, 180, 4, ref errors );
AddLabel( 65, 110, 2401, "Set Robe Hue" );
TimeSpan timeleft = ((PlayerMobile)m).DonationTimeLeft;
if ( timeleft == TimeSpan.MaxValue )
AddLabel( 30, 140, 2401, "You have a permanent membership" );
else
{
if ( timeleft > TimeSpan.FromSeconds( 0.0 ) )
AddLabel( 30, 140, 2401, String.Format( "Your membership expires in {0} days", (int)timeleft.TotalDays ) );
if ( errors > 0 )
AddLabel( 30, 160, 37, "* required membership length" );
AddLabel( 30, 180, 2401, "Type [donate to donate" );
}
}
开发者ID:kamronbatman,项目名称:DefianceUO-Pre1.10,代码行数:39,代码来源:DonationGumps.cs
示例12: InitJail
/// <summary>
/// Initializes a jailing action by sending the JailReasonGump
/// </summary>
/// <param name="from">The GM performing the jailing</param>
/// <param name="offender">The account being jailed</param>
/// <returns>True if the jailing can proceed</returns>
public static bool InitJail(Mobile from, Account offender)
{
if (CanBeJailed(offender))
{
from.SendGump(new JailReasonGump(offender));
return true;
}
JailEntry jail = GetCurrentJail(offender);
if (jail == null)
{
from.SendMessage("You can't jail that account because it's either already jailed or a staff account.");
}
else
{
from.SendMessage("That account has already been jailed. Please review the existing jail record.");
from.SendGump(new JailViewGump(from, jail, null));
}
return false;
}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:28,代码来源:JailSystem.cs
示例13: GetOnlineMobile
/// <summary>
/// Gets the online mobile for a given account.
/// This method will not return any staff mobiles.
/// </summary>
/// <param name="account">The account object</param>
/// <returns>A mobile if one is online, null otherwise</returns>
public static Mobile GetOnlineMobile(Account account)
{
if (account == null)
{
return null;
}
for (int i = 0; i < account.Length; i++)
{
Mobile m = account[i];
if (m != null && m.NetState != null && m.AccessLevel == AccessLevel.Player)
{
return m;
}
}
return null;
}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:25,代码来源:JailSystem.cs
示例14: GetCurrentJail
/// <summary>
/// Gets the current jail record for a given account
/// </summary>
/// <param name="acc">The account being examined</param>
/// <returns>A JailEntry if one is matching, null otherwise</returns>
private static JailEntry GetCurrentJail(Account acc)
{
if (acc == null)
{
return null;
}
return m_Jailings.FirstOrDefault(jail => jail.Account == acc && jail.FullJail);
}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:14,代码来源:JailSystem.cs
示例15: SearchHistory
/// <summary>
/// Searches the jail history for references of an account
/// </summary>
/// <param name="account">The account to search for</param>
/// <returns>An ArrayList of JailEntry objects</returns>
public static List<JailEntry> SearchHistory(Account account)
{
List<JailEntry> history = GetHistory();
history.AddRange(m_ExpiredJailings);
history.AddRange(m_Jailings);
return history.Where(jail => jail.Account != null && jail.Account == account).ToList();
}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:14,代码来源:JailSystem.cs
示例16: HasHalfLevel
public static bool HasHalfLevel(Account acct)
{
TimeSpan totalTime = (DateTime.UtcNow - acct.Created);
Double level = (totalTime.TotalDays / RewardInterval.TotalDays);
return level >= 0.5;
}
开发者ID:Tiedor,项目名称:JustUO,代码行数:8,代码来源:RewardSystem.cs
示例17: GetRewardLevel
public static int GetRewardLevel(Account acct)
{
TimeSpan totalTime = (DateTime.UtcNow - acct.Created);
int level = (int)(totalTime.TotalDays / RewardInterval.TotalDays);
if (level < 0)
level = 0;
return level;
}
开发者ID:Tiedor,项目名称:JustUO,代码行数:11,代码来源:RewardSystem.cs
示例18: ImportAccount
private static bool ImportAccount(Dictionary<string, string> accountData)
{
try
{
// On vérifie s'il y a déjà un compte qui existe avec ce login, si oui on ne fait rien
IAccount account = Accounts.GetAccount(accountData["LOGIN"]);
if (account != null) return false;
// On vérifie que le joueur n'ait pas de plevel pour ne pas importer les comptes GM et autres
string plevel = null;
accountData.TryGetValue("PLEVEL", out plevel);
if (plevel != null) return false;
// On crée un nouveau compte et on l'ajoute à la liste des comtes
IAccount newAccount = new Account(accountData["LOGIN"], accountData["PASSWORD"]);
Accounts.Add(newAccount);
}
catch //(KeyNotFoundException knfe)
{
// S'il manque des informations comme le login ou le password on n'importe pas le compte
return false;
}
return true;
}
开发者ID:greeduomacro,项目名称:vivre-uo,代码行数:24,代码来源:SphereAccountsImporter.cs
示例19: AddTagValuePrompt
public AddTagValuePrompt( Account acct, string name )
{
m_Account = acct;
m_Name = name;
}
开发者ID:Grimoric,项目名称:RunUO.T2A,代码行数:5,代码来源:AdminGump.cs
示例20: LogIPAccess
public static void LogIPAccess(IPAddress ipAddress, Account acct, Mobile mob)
{
string directory = "Logs/Login";
if (!Directory.Exists(directory))
{
Directory.CreateDirectory(directory);
}
try
{
using (var op = new StreamWriter(Path.Combine(directory, String.Format("{0}.log", acct.Username.ToLower())), true))
{
op.WriteLine("{0} - {1} - {2} - created character: {3}", DateTime.UtcNow, acct.Username, ipAddress, mob);
}
}
catch
{
Console.WriteLine(
"Failed to write to file: {0}", Path.Combine("Logs/Login", String.Format("{0}.log", acct.Username.ToLower())));
}
}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:22,代码来源:CharacterCreation.cs
注:本文中的Server.Accounting.Account类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论