Example #1
0
        /// <summary>
        /// Loads a collection of chunks from a Quetzal file.
        /// </summary>
        /// <param name="stream">The stream to read from.</param>
        /// <returns>A new <see cref="Quetzal"/> instance initialized
        /// from the stream.</returns>
        /// <remarks>
        /// Duplicate chunks are not supported by this class. Only the last
        /// chunk of a given type will be available.
        /// </remarks>
        public static Blorb FromStream(Stream stream)
        {
            var result = new Blorb();

            result.Load(stream, IFRS);

            return(result);
        }
Example #2
0
        public EngineClient(Stream gameFile)
        {
            lineEvents = new EventWaitHandle[] { lineReady, stop };
            keyEvents  = new EventWaitHandle[] { keyReady, stop };

            var buffer = new byte[gameFile.Length];

            gameFile.Read(buffer, 0, buffer.Length);

            try
            {
                var blorb = Blorb.FromStream(new MemoryStream(buffer));
                game = new MemoryStream(blorb[Blorb.GLUL]);
            }
            catch
            {
                game = new MemoryStream(buffer);
            }

            thread = new Thread(Run);
            thread.Start();
        }