Exemplo n.º 1
0
        // Issue 10 - End

        static BodyTable()
        {
            // Issue 10 - Update the code to Net Framework 3.5 - http://code.google.com/p/pandorasbox3/issues/detail?id=10 - Smjert
            m_Entries = new Dictionary <int, BodyTableEntry>();
            // Issue 10 - End

            string filePath = ArtViewer.ArtViewer.MulManager["body.def", true];

            if (filePath == null)
            {
                return;
            }

            StreamReader def = new StreamReader(filePath);

            string line;

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

                try
                {
                    int index1 = line.IndexOf(" {");
                    int index2 = line.IndexOf("} ");

                    string param1 = line.Substring(0, index1);
                    string param2 = line.Substring(index1 + 2, index2 - index1 - 2);
                    string param3 = line.Substring(index2 + 2);

                    int indexOf = param2.IndexOf(',');

                    if (indexOf > -1)
                    {
                        param2 = param2.Substring(0, indexOf).Trim();
                    }

                    int iParam1 = Convert.ToInt32(param1);
                    int iParam2 = Convert.ToInt32(param2);
                    int iParam3 = Convert.ToInt32(param3);

                    m_Entries[iParam1] = new BodyTableEntry(iParam2, iParam1, iParam3);
                }
                catch
                {
                }
            }
        }
Exemplo n.º 2
0
		// Issue 10 - End

		static BodyTable()
		{
			// Issue 10 - Update the code to Net Framework 3.5 - http://code.google.com/p/pandorasbox3/issues/detail?id=10 - Smjert
			m_Entries = new Dictionary<int, BodyTableEntry>();
			// Issue 10 - End

			string filePath = ArtViewer.ArtViewer.MulManager[ "body.def", true ];

			if ( filePath == null )
				return;

			StreamReader def = new StreamReader( filePath );

			string line;

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

				try
				{
					int index1 = line.IndexOf( " {" );
					int index2 = line.IndexOf( "} " );

					string param1 = line.Substring( 0, index1 );
					string param2 = line.Substring( index1 + 2, index2 - index1 - 2 );
					string param3 = line.Substring( index2 + 2 );

					int indexOf = param2.IndexOf( ',' );

					if ( indexOf > -1 )
						param2 = param2.Substring( 0, indexOf ).Trim();

					int iParam1 = Convert.ToInt32( param1 );
					int iParam2 = Convert.ToInt32( param2 );
					int iParam3 = Convert.ToInt32( param3 );

					m_Entries[iParam1] = new BodyTableEntry( iParam2, iParam1, iParam3 );
				}
				catch
				{
				}
			}
		}