Beispiel #1
0
        // Protected/Private methods --------------------------------------------------------
        protected override void Init(Stream streamHRF, string uriHRF, FileAccess mode)
        {
            tempfileName = null;

            if (mode == FileAccess.Read) {
                MemoryStream ms = new MemoryStream();
                Scanner s = new Scanner();

                if (streamHRF != null) s.Init(streamHRF);
                else s.Init(uriHRF);

                Parser p = new Parser(s);
                p.Parse(ms);

                if (p.ParserErrors.List.Count >0)
                    throw new BREException(p.ParserErrors.List.Count +
                                 		       " HRF Parser error(s), top one is: " +
                                               p.ParserErrors.List[0]);

                ms.Seek(0, SeekOrigin.Begin);
                base.Init(ms, null, FileAccess.Read);
            }
            else {
                if (streamHRF != null) resultStream = streamHRF;
                else resultStream = new FileStream(uriHRF, FileMode.Create);

                tempfileName = Path.GetTempFileName();
                base.Init(null, tempfileName, FileAccess.Write);
            }
        }
Beispiel #2
0
	/*------------------------------------------------------------------------*
	 *----- SCANNER DESCRIPTION ----------------------------------------------*
	 *------------------------------------------------------------------------*/
	
		public Parser(Scanner scanner) {
			errors = new Errors();
			this.scanner = scanner;
		}