/// <summary>
		/// Creates Root Directory catalog from XlsHeader
		/// </summary>
		/// <param name="hdr">XlsHeader object</param>
		public XlsRootDirectory(XlsHeader hdr)
		{
			XlsStream stream = new XlsStream(hdr, hdr.RootDirectoryEntryStart);
			byte[] array = stream.ReadStream();
			byte[] tmp;
			XlsDirectoryEntry entry;
			List<XlsDirectoryEntry> entries = new List<XlsDirectoryEntry>();
			for (int 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 (int 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];
			}
		}
		/// <summary>
		/// Creates Root Directory catalog from XlsHeader
		/// </summary>
		/// <param name="hdr">XlsHeader object</param>
		public XlsRootDirectory(XlsHeader hdr)
		{
			XlsStream stream = new XlsStream(hdr, hdr.RootDirectoryEntryStart, false, null);
			byte[] array = stream.ReadStream();
			byte[] tmp;
			XlsDirectoryEntry entry;
			List<XlsDirectoryEntry> entries = new List<XlsDirectoryEntry>();
			for (int 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, hdr));
			}
			m_entries = entries;
			for (int i = 0; i < entries.Count; i++)
			{
				entry = entries[i];

				//Console.WriteLine("Directory Entry:{0} type:{1}, firstsector:{2}, streamSize:{3}, isEntryMiniStream:{4}", entry.EntryName, entry.EntryType.ToString(), entry.StreamFirstSector, entry.StreamSize, entry.IsEntryMiniStream);
				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];
			}
			stream.CalculateMiniFat(this);
		}
Пример #3
0
        /// <summary>
        /// Creates Root Directory catalog from XlsHeader
        /// </summary>
        /// <param name="hdr">XlsHeader object</param>
        public XlsRootDirectory(XlsHeader hdr)
        {
            XlsStream stream = new XlsStream(hdr, hdr.RootDirectoryEntryStart, false, null);

            byte[]                   array = stream.ReadStream();
            byte[]                   tmp;
            XlsDirectoryEntry        entry;
            List <XlsDirectoryEntry> entries = new List <XlsDirectoryEntry>();

            for (int 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, hdr));
            }
            m_entries = entries;
            for (int i = 0; i < entries.Count; i++)
            {
                entry = entries[i];

                //Console.WriteLine("Directory Entry:{0} type:{1}, firstsector:{2}, streamSize:{3}, isEntryMiniStream:{4}", entry.EntryName, entry.EntryType.ToString(), entry.StreamFirstSector, entry.StreamSize, entry.IsEntryMiniStream);
                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];
                }
            }
            stream.CalculateMiniFat(this);
        }
Пример #4
0
        /// <summary>
        /// Creates Root Directory catalog from XlsHeader
        /// </summary>
        /// <param name="hdr">XlsHeader object</param>
        public XlsRootDirectory(XlsHeader hdr)
        {
            XlsStream stream = new XlsStream(hdr, hdr.RootDirectoryEntryStart, false, null);

            byte[]                   array = stream.ReadStream();
            byte[]                   tmp;
            XlsDirectoryEntry        entry;
            List <XlsDirectoryEntry> entries = new List <XlsDirectoryEntry>();

            for (int 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, hdr));
            }
            m_entries = entries;
            for (int 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];
                }
            }
            stream.CalculateMiniFat(this);
        }
Пример #5
0
        public XlsRootDirectory(XlsHeader hdr)
        {
            XlsStream stream = new XlsStream(hdr, hdr.RootDirectoryEntryStart, false, null);

            byte[] src = stream.ReadStream();
            List <XlsDirectoryEntry> list = new List <XlsDirectoryEntry>();

            for (int i = 0; i < src.Length; i += 0x80)
            {
                byte[] dst = new byte[0x80];
                Buffer.BlockCopy(src, i, dst, 0, dst.Length);
                list.Add(new XlsDirectoryEntry(dst, hdr));
            }
            this.m_entries = list;
            for (int j = 0; j < list.Count; j++)
            {
                XlsDirectoryEntry entry = list[j];
                if ((this.m_root == null) && (entry.EntryType == STGTY.STGTY_ROOT))
                {
                    this.m_root = entry;
                }
                if (entry.ChildSid != uint.MaxValue)
                {
                    entry.Child = list[(int)entry.ChildSid];
                }
                if (entry.LeftSiblingSid != uint.MaxValue)
                {
                    entry.LeftSibling = list[(int)entry.LeftSiblingSid];
                }
                if (entry.RightSiblingSid != uint.MaxValue)
                {
                    entry.RightSibling = list[(int)entry.RightSiblingSid];
                }
            }
            stream.CalculateMiniFat(this);
        }