/// <summary>
		/// Creates Root Directory catalog from XlsHeader
		/// </summary>
		/// <param name="hdr">XlsHeader object</param>
		public XlsRootDirectory(XlsHeader hdr)
		{
			var stream = new XlsStream(hdr, hdr.RootDirectoryEntryStart);
			var array = stream.ReadStream();
			byte[] tmp;
			XlsDirectoryEntry entry;
			var entries = new List<XlsDirectoryEntry>();
			for (var i = 0; i < array.Length; i += XlsDirectoryEntry.Length)
			{
				tmp = new byte[XlsDirectoryEntry.Length];
				Buffer.BlockCopy(array, i, tmp, 0, tmp.Length);
				entries.Add(new XlsDirectoryEntry(tmp));
			}
			m_entries = entries;
			for (var i = 0; i < entries.Count; i++)
			{
				entry = entries[i];
				if (m_root == null && entry.EntryType == STGTY.STGTY_ROOT)
					m_root = entry;
				if (entry.ChildSid != (uint)FATMARKERS.FAT_FreeSpace)
					entry.Child = entries[(int)entry.ChildSid];
				if (entry.LeftSiblingSid != (uint)FATMARKERS.FAT_FreeSpace)
					entry.LeftSibling = entries[(int)entry.LeftSiblingSid];
				if (entry.RightSiblingSid != (uint)FATMARKERS.FAT_FreeSpace)
					entry.RightSibling = entries[(int)entry.RightSiblingSid];
			}
		}
Пример #2
0
        /// <summary>
        /// Creates Root Directory catalog from XlsHeader
        /// </summary>
        /// <param name="hdr">XlsHeader object</param>
        public XlsRootDirectory(XlsHeader hdr)
        {
            var stream = new XlsStream(hdr, hdr.RootDirectoryEntryStart);
            var array  = stream.ReadStream();

            byte[]            tmp;
            XlsDirectoryEntry entry;
            var entries = new List <XlsDirectoryEntry>();

            for (var i = 0; i < array.Length; i += XlsDirectoryEntry.Length)
            {
                tmp = new byte[XlsDirectoryEntry.Length];
                Buffer.BlockCopy(array, i, tmp, 0, tmp.Length);
                entries.Add(new XlsDirectoryEntry(tmp));
            }
            m_entries = entries;
            for (var i = 0; i < entries.Count; i++)
            {
                entry = entries[i];
                if (m_root == null && entry.EntryType == STGTY.STGTY_ROOT)
                {
                    m_root = entry;
                }
                if (entry.ChildSid != (uint)FATMARKERS.FAT_FreeSpace)
                {
                    entry.Child = entries[(int)entry.ChildSid];
                }
                if (entry.LeftSiblingSid != (uint)FATMARKERS.FAT_FreeSpace)
                {
                    entry.LeftSibling = entries[(int)entry.LeftSiblingSid];
                }
                if (entry.RightSiblingSid != (uint)FATMARKERS.FAT_FreeSpace)
                {
                    entry.RightSibling = entries[(int)entry.RightSiblingSid];
                }
            }
        }