public Scene LoadData(string path)
        {
            //  Create the scene.
            Scene scene = null;

            //  Open a file stream.
            using (var fileStream = new FileStream(path, FileMode.Open, FileAccess.Read))
            {
                //  Open a binary reader.
                using (var reader = new BinaryReader(fileStream))
                {
                    //	Create a scene.
                    scene = new Scene();

                    //	First, read the header.
                    CaligariFileHeader header = new CaligariFileHeader();
                    header.Read(reader);

                    //	Here we can make sure that it really is a Caligari File.
                    if (header.id != "Caligari " || header.dataMode != 'B')
                    {
                        System.Diagnostics.Debugger.Log(1, "File I/O", "File is not internally compatible.\n");
                        return null;
                    }

                    //	Now we go through the file, peeping at chunks.
                    while (true)
                    {
                        //	Peep at the next chunk.
                        string type = Peep(reader);

                        //	Check for every type of chunk.
                        if (type == "PolH")
                        {
                            //	Read a polygon into the scene.
                            PolygonChunk polyChunk = new PolygonChunk();
                            scene.SceneContainer.AddChild((Polygon)polyChunk.Read(reader));
                        }
                        else if (type == "END ")
                        {
                            //	It's the end of the file, so we may as well break.
                            break;
                        }
                        else
                        {
                            //	Well we don't know what type it is, so just read the generic chunk.
                            CaligariChunk chunk = new CaligariChunk();
                            chunk.Read(reader);
                        }

                    }
                }
            }
            
            //  Return the scene.
            return scene;
        }
        public Scene LoadData(string path)
        {
            //  Create the scene.
            Scene scene = null;

            //  Open a file stream.
            using (var fileStream = new FileStream(path, FileMode.Open, FileAccess.Read))
            {
                //  Open a binary reader.
                using (var reader = new BinaryReader(fileStream))
                {
                    //	Create a scene.
                    scene = new Scene();

                    //	First, read the header.
                    CaligariFileHeader header = new CaligariFileHeader();
                    header.Read(reader);

                    //	Here we can make sure that it really is a Caligari File.
                    if (header.id != "Caligari " || header.dataMode != 'B')
                    {
                        System.Diagnostics.Debugger.Log(1, "File I/O", "File is not internally compatible.\n");
                        return(null);
                    }

                    //	Now we go through the file, peeping at chunks.
                    while (true)
                    {
                        //	Peep at the next chunk.
                        string type = Peep(reader);

                        //	Check for every type of chunk.
                        if (type == "PolH")
                        {
                            //	Read a polygon into the scene.
                            PolygonChunk polyChunk = new PolygonChunk();
                            scene.SceneContainer.AddChild((Polygon)polyChunk.Read(reader));
                        }
                        else if (type == "END ")
                        {
                            //	It's the end of the file, so we may as well break.
                            break;
                        }
                        else
                        {
                            //	Well we don't know what type it is, so just read the generic chunk.
                            CaligariChunk chunk = new CaligariChunk();
                            chunk.Read(reader);
                        }
                    }
                }
            }

            //  Return the scene.
            return(scene);
        }