Server.Body.Body C# (CSharp) Méthode

Body() static private méthode

static private Body ( ) : System
Résultat System
        static Body()
        {
            if ( File.Exists( "Data/bodyTable.cfg" ) )
            {
                using ( StreamReader ip = new StreamReader( "Data/bodyTable.cfg" ) )
                {
                    m_Types = new BodyType[1000];

                    string line;

                    while ( (line = ip.ReadLine()) != null )
                    {
                        if ( line.Length == 0 || line.StartsWith( "#" ) )
                            continue;

                        string[] split = line.Split( '\t' );

                        try
                        {
                            int bodyID = int.Parse( split[0] );
                            BodyType type = (BodyType)Enum.Parse( typeof( BodyType ), split[1], true );

                            if ( bodyID >= 0 && bodyID < m_Types.Length )
                                m_Types[bodyID] = type;
                        }
                        catch
                        {
                            Console.WriteLine( "Warning: Invalid bodyTable entry:" );
                            Console.WriteLine( line );
                        }
                    }
                }
            }
            else
            {
                Console.WriteLine( "Warning: Data/bodyTable.cfg does not exist" );

                m_Types = new BodyType[0];
            }
        }

Same methods

Body::Body ( int bodyID ) : System