Axiom.Serialization.MaterialSerializer.ParseScript C# (CSharp) Метод

ParseScript() публичный Метод

Parses a Material script file passed in the specified stream.
public ParseScript ( Stream stream, string groupName, string fileName ) : void
stream Stream Stream containing the material file data.
groupName string Name of the material group.
fileName string
Результат void
	    public void ParseScript( Stream stream, string groupName, string fileName )
		{
#if !(WINDOWS_PHONE)
			StreamReader script = new StreamReader( stream, System.Text.Encoding.UTF8 );
#else
			StreamReader script = new StreamReader( stream, System.Text.Encoding.UTF8 );
#endif

			string line = string.Empty;
			bool nextIsOpenBrace = false;

			scriptContext.section = MaterialScriptSection.None;
			scriptContext.groupName = groupName;
			scriptContext.material = null;
			scriptContext.technique = null;
			scriptContext.pass = null;
			scriptContext.textureUnit = null;
			scriptContext.program = null;
			scriptContext.lineNo = 0;
			scriptContext.techLev = -1;
			scriptContext.passLev = -1;
			scriptContext.stateLev = -1;
			scriptContext.filename = fileName;

			// parse through the data to the end
			while ( ( line = ParseHelper.ReadLine( script ) ) != null )
			{
				scriptContext.lineNo++;

				// ignore blank lines and comments
				if ( line.Length == 0 || line.StartsWith( "//" ) )
				{
					continue;
				}

				if ( nextIsOpenBrace )
				{
					if ( line != "{" )
					{
						// MONO: Couldn't put a literal "{" in the format string
						LogParseError( scriptContext, "Expecting '{0}' but got {1} instead", "{", line );
					}

					nextIsOpenBrace = false;
				}
				else
				{
					nextIsOpenBrace = ParseScriptLine( line );
				}
			} // while

			if ( scriptContext.section != MaterialScriptSection.None )
			{
				LogParseError( scriptContext, "Unexpected end of file." );
			}
		}
		#endregion Public Methods