Server.Commands.SignParser.Parse C# (CSharp) Méthode

Parse() public static méthode

public static Parse ( Mobile from ) : void
from Mobile
Résultat void
		public static void Parse( Mobile from )
		{
			string cfg = Path.Combine( Core.BaseDirectory, "Data/signs.cfg" );

			if ( File.Exists( cfg ) )
			{
				List<SignEntry> list = new List<SignEntry>();
				from.SendMessage( "Generating signs, please wait." );

				using ( StreamReader ip = new StreamReader( cfg ) )
				{
					string line;

					while ( (line = ip.ReadLine()) != null )
					{
						string[] split = line.Split( ' ' );

						SignEntry e = new SignEntry(
							line.Substring( split[0].Length + 1 + split[1].Length + 1 + split[2].Length + 1 + split[3].Length + 1 + split[4].Length + 1 ),
							new Point3D( Utility.ToInt32( split[2] ), Utility.ToInt32( split[3] ), Utility.ToInt32( split[4] ) ),
							Utility.ToInt32( split[1] ), Utility.ToInt32( split[0] ) );

						list.Add( e );
					}
				}

				Map[] brit = new Map[]{ Map.Felucca };
				Map[] fel = new Map[]{ Map.Felucca };

				for ( int i = 0; i < list.Count; ++i )
				{
					SignEntry e = list[i];
					Map[] maps = null;

					switch ( e.m_Map )
					{
						case 0: maps = brit; break; // Felucca
						case 1: maps = fel; break;  // Felucca
					}

					for ( int j = 0; maps != null && j < maps.Length; ++j )
						Add_Static( e.m_ItemID, e.m_Location, maps[j], e.m_Text );
				}

				from.SendMessage( "Sign generating complete." );
			}
			else
			{
				from.SendMessage( "{0} not found!", cfg );
			}
		}