Server.TreasureRegion.Initialize C# (CSharp) Méthode

Initialize() public static méthode

public static Initialize ( ) : void
Résultat void
		public static void Initialize()
		{
			string filePath = Path.Combine( Core.BaseDirectory, "Data/treasure.cfg" );
			int i = 0, x = 0, y = 0;

			if ( File.Exists( filePath ) )
			{
				using ( StreamReader ip = new StreamReader( filePath ) )
				{
					string line;

					while ( (line = ip.ReadLine()) != null )
					{
						i++;

						try
						{
							string[] split = line.Split( ' ' );

							x = Convert.ToInt32( split[0] );
							y = Convert.ToInt32( split[1] );

							try
							{
								new TreasureRegion( x, y, Map.Felucca );
							}
							catch ( Exception e )
							{
								Console.WriteLine( "{0} {1} {2} {3}", i, x, y, e );
							}
						}
						catch
						{
                            Console.WriteLine( "Warning: Error in Line '{0}' of Data/treasure.cfg", line );
						}
					}
				}
			}
		}