/// <summary>
        /// Find all live PersistDirectoryAtoms by traversing all UserEditAtoms starting from CurrentUserAtom.
        /// </summary>
        /// <returns>List of PersistDirectoryAtoms. The oldest PersitDirectoryAtom will be the first element of the list.</returns>
        private List <PersistDirectoryAtom> FindLivePersistDirectoryAtoms()
        {
            List <PersistDirectoryAtom> result = new List <PersistDirectoryAtom>();

            UserEditAtom userEditAtom = this.LastUserEdit;

            while (userEditAtom != null)
            {
                this.PowerpointDocumentStream.Seek(userEditAtom.OffsetPersistDirectory, SeekOrigin.Begin);
                PersistDirectoryAtom pdAtom = (PersistDirectoryAtom)Record.ReadRecord(this.PowerpointDocumentStream);
                result.Insert(0, pdAtom);

                this.PowerpointDocumentStream.Seek(userEditAtom.OffsetLastEdit, SeekOrigin.Begin);

                if (userEditAtom.OffsetLastEdit != 0)
                {
                    userEditAtom = (UserEditAtom)Record.ReadRecord(this.PowerpointDocumentStream);
                }
                else
                {
                    userEditAtom = null;
                }
            }

            return(result);
        }
        public PowerpointDocument(StructuredStorageReader file)
        {
            try
            {
                this.CurrentUserStream = file.GetStream("Current User");
                Record rec = Record.ReadRecord(this.CurrentUserStream);
                if (rec is CurrentUserAtom)
                {
                    this.CurrentUserAtom = (CurrentUserAtom)rec;
                }
                else
                {
                    this.CurrentUserStream.Position = 0;
                    byte[] bytes = new byte[this.CurrentUserStream.Length];
                    this.CurrentUserStream.Read(bytes);
                    string s = Encoding.UTF8.GetString(bytes).Replace("\0", "");
                }
            }
            catch (InvalidRecordException e)
            {
                throw new InvalidStreamException("Current user stream is not valid", e);
            }

            // Optional 'Pictures' stream
            if (file.FullNameOfAllStreamEntries.Contains("\\Pictures"))
            {
                try
                {
                    this.PicturesStream    = file.GetStream("Pictures");
                    this.PicturesContainer = new Pictures(new BinaryReader(this.PicturesStream), (uint)this.PicturesStream.Length, 0, 0, 0);
                }
                catch (InvalidRecordException e)
                {
                    throw new InvalidStreamException("Pictures stream is not valid", e);
                }
            }


            this.PowerpointDocumentStream = file.GetStream("PowerPoint Document");

            try
            {
                this.DocumentSummaryInformationStream = file.GetStream("DocumentSummaryInformation");
                ScanDocumentSummaryInformation();
            }
            catch (StructuredStorage.Common.StreamNotFoundException e)
            {
                //ignore
            }


            if (this.CurrentUserAtom != null)
            {
                this.PowerpointDocumentStream.Seek(this.CurrentUserAtom.OffsetToCurrentEdit, SeekOrigin.Begin);
                this.LastUserEdit = (UserEditAtom)Record.ReadRecord(this.PowerpointDocumentStream);
            }

            this.ConstructPersistObjectDirectory();

            this.IdentifyDocumentPersistObject();
            this.IdentifyMasterPersistObjects();
            this.IdentifySlidePersistObjects();
            this.IdentifyOlePersistObjects();
            this.IdentifyVbaProjectObject();
        }