VRMLParser(StreamReader stream, Func<double, bool> progressInfo, VRMLParserErrorHandling errorHandling)
		{
			try
			{
				if(errorHandling==null) errorHandling=new VRMLParserErrorHandling();

				this.stream=stream;
				this.progressInfo=progressInfo;
				this.errorHandling=errorHandling;

				lastProgressInfoLine=line=1;
				ParseX3DScene();

				if(attic.Count!=0) ErrorUnexpectedEndOfStream();
			}
			catch
			{
				if(!errorHandling.AlwaysReturnSuccessful) throw;
				while(attic.Count>0) PopNameState();
			}
			finally
			{
				stream.Close();
			}
		}
		public static Scene Parse(StreamReader stream, Func<double, bool> progressInfo, VRMLParserErrorHandling errorHandling)
		{
			Scene ret=new Scene();
			VRMLParser parser=new VRMLParser(stream, progressInfo, errorHandling);
			foreach(X3DNode node in parser.nodes)
			{
				X3DChildNode child=node as X3DChildNode;
				if(child==null) continue; // TODO
				ret.Nodes.Add(child);
			}
			return ret;
		}
Example #3
0
        VRMLParser(StreamReader stream, Func <double, bool> progressInfo, VRMLParserErrorHandling errorHandling)
        {
            try
            {
                if (errorHandling == null)
                {
                    errorHandling = new VRMLParserErrorHandling();
                }

                this.stream        = stream;
                this.progressInfo  = progressInfo;
                this.errorHandling = errorHandling;

                lastProgressInfoLine = line = 1;
                ParseX3DScene();

                if (attic.Count != 0)
                {
                    ErrorUnexpectedEndOfStream();
                }
            }
            catch
            {
                if (!errorHandling.AlwaysReturnSuccessful)
                {
                    throw;
                }
                while (attic.Count > 0)
                {
                    PopNameState();
                }
            }
            finally
            {
                stream.Close();
            }
        }
Example #4
0
        public static Scene Parse(StreamReader stream, Func <double, bool> progressInfo, VRMLParserErrorHandling errorHandling)
        {
            Scene      ret    = new Scene();
            VRMLParser parser = new VRMLParser(stream, progressInfo, errorHandling);

            foreach (X3DNode node in parser.nodes)
            {
                X3DChildNode child = node as X3DChildNode;
                if (child == null)
                {
                    continue;                             // TODO
                }
                ret.Nodes.Add(child);
            }
            return(ret);
        }