當前位置: 首頁>>代碼示例>>C#>>正文


C# Accounting.Account類代碼示例

本文整理匯總了C#中Server.Accounting.Account的典型用法代碼示例。如果您正苦於以下問題:C# Account類的具體用法?C# Account怎麽用?C# Account使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Account類屬於Server.Accounting命名空間,在下文中一共展示了Account類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的Server.Accounting.Account類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。