Exemple #1
0
		void AddBlock (Block block)
		{
			switch (block.Code) {
			case BlockCode.Directives:
				AddDirectivesBlock (block as DirectivesBlock);
				break;
			case BlockCode.End:
				AddEndBlock (block as EndBlock);
				break;
			case BlockCode.Events:
				AddEventsBlock (block as EventsBlock);
				break;
			case BlockCode.Intro:
				AddIntroBlock (block as IntroBlock);
				break;
			case BlockCode.Loaded:
				AddLoadedBlock (block as LoadedBlock);
				break;
			case BlockCode.Mapping:
				AddMappingBlock (block as MappingBlock);
				break;
			case BlockCode.Statistical:
				AddStatBlock (block as StatBlock);
				break;
			case BlockCode.Unloaded:
			default:
				break;
			}
		}
Exemple #2
0
        public bool ReadBlock()
        {
            current_block = null;
            if (stream == null)
                return false;

            byte[] buffer = new byte [HeaderSize];
            stream.Read (buffer, 0, HeaderSize);
            offset += (uint) HeaderSize;
            Header hdr = new Header (buffer);

            count += hdr.CounterDelta;
            buffer = new byte [hdr.Length];
            stream.Read (buffer, 0, hdr.Length);
            current_block =  DecodeBlock (hdr.Code, (uint) hdr.Length, buffer);
            offset += (uint) hdr.Length;
            if (hdr.Code == BlockCode.End) {
                stream.Close ();
                stream = null;
            }

            return current_block != null;
        }