示例#1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HfaEntry"/> class with the intention that it would
        /// be written to disk later.
        /// </summary>
        /// <param name="hfaIn">The HfaInfo.</param>
        /// <param name="name">The name.</param>
        /// <param name="typename">The type name.</param>
        /// <param name="parent">The parent.</param>
        public HfaEntry(HfaInfo hfaIn, string name, string typename, HfaEntry parent)
        {
            // Initialize
            Hfa      = hfaIn;
            Parent   = parent;
            Name     = name;
            TypeName = typename;
            Children = new List <HfaEntry>();

            // Update the previous or parent node to refer to this one
            if (parent == null)
            {
                // do nothing
            }
            else if (parent.Child == null)
            {
                parent.Child   = this;
                parent.IsDirty = true;
            }
            else
            {
                HfaEntry prev = parent.Children[parent.Children.Count - 1];
                prev.Next    = this;
                prev.IsDirty = true;
            }

            IsDirty = true;
        }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HfaEntry"/> class.
        /// </summary>
        /// <param name="hfaIn">The HfaInfo.</param>
        /// <param name="nPos">The position.</param>
        /// <param name="parent">The parent.</param>
        /// <param name="prev">The previous HfaEntry.</param>
        public HfaEntry(HfaInfo hfaIn, long nPos, HfaEntry parent, HfaEntry prev)
        {
            // Initialize fields
            _name     = new char[64];
            _typeName = new char[32];
            Hfa       = hfaIn;
            FilePos   = nPos;
            Parent    = parent;
            Prev      = prev;
            Hfa.Fp.Seek(nPos, SeekOrigin.Begin);
            Children = new List <HfaEntry>();

            // Read entry information from the file
            int[]  anEntryNums = new int[6];
            byte[] entryBytes  = new byte[24];
            Hfa.Fp.Read(entryBytes, 0, 24);
            Buffer.BlockCopy(entryBytes, 0, anEntryNums, 0, 24);

            NextPos  = anEntryNums[0];
            ChildPos = anEntryNums[3];
            DataPos  = anEntryNums[4];
            DataSize = anEntryNums[5];

            // Read the name
            byte[] nameBytes = new byte[64];
            Hfa.Fp.Read(nameBytes, 0, 64);

            _name = Encoding.Default.GetChars(nameBytes);

            // Read the type
            byte[] typeBytes = new byte[32];
            Hfa.Fp.Read(typeBytes, 0, 32);
            _typeName = Encoding.Default.GetChars(typeBytes);
        }
示例#3
0
        /// <summary>
        /// Creates a new instance of HfaEntry from the file
        /// </summary>
        public HfaEntry(HfaInfo hfaIn, long nPos, HfaEntry parent, HfaEntry prev)
        {
            // Initialize fields
            _name = new char[64];
            _typeName = new char[32];
            _hfa = hfaIn;
            _filePos = nPos;
            _parent = parent;
            _prev = prev;
            _hfa.Fp.Seek(nPos, SeekOrigin.Begin);
            _children = new List<HfaEntry>();
            // Read entry information from the file

            int[] anEntryNums = new int[6];
            byte[] entryBytes = new byte[24];
            _hfa.Fp.Read(entryBytes, 0, 24);
            Buffer.BlockCopy(entryBytes, 0, anEntryNums, 0, 24);

            // Undecipherable Code since no implementation of the method HFAStandard exists
            // for (i = 0; i < 6; i++)
            //    HFAStandard(4, anEntryNumns + i);

            NextPos = anEntryNums[0];
            ChildPos = anEntryNums[3];
            DataPos = anEntryNums[4];
            DataSize = anEntryNums[5];

            // Read the name
            byte[] nameBytes = new byte[64];
            _hfa.Fp.Read(nameBytes, 0, 64);

            _name = Encoding.Default.GetChars(nameBytes);

            // Read the type
            byte[] typeBytes = new byte[32];
            _hfa.Fp.Read(typeBytes, 0, 32);
            _typeName = Encoding.Default.GetChars(typeBytes);
        }
示例#4
0
        /// <summary>
        /// Creates a new instance of HfaEntry from the file
        /// </summary>
        public HfaEntry(HfaInfo hfaIn, long nPos, HfaEntry parent, HfaEntry prev)
        {
            // Initialize fields
            _name     = new char[64];
            _typeName = new char[32];
            _hfa      = hfaIn;
            _filePos  = nPos;
            _parent   = parent;
            _prev     = prev;
            _hfa.Fp.Seek(nPos, SeekOrigin.Begin);
            _children = new List <HfaEntry>();
            // Read entry information from the file

            int[]  anEntryNums = new int[6];
            byte[] entryBytes  = new byte[24];
            _hfa.Fp.Read(entryBytes, 0, 24);
            Buffer.BlockCopy(entryBytes, 0, anEntryNums, 0, 24);

            // Undecipherable Code since no implementation of the method HFAStandard exists
            // for (i = 0; i < 6; i++)
            //    HFAStandard(4, anEntryNumns + i);

            NextPos  = anEntryNums[0];
            ChildPos = anEntryNums[3];
            DataPos  = anEntryNums[4];
            DataSize = anEntryNums[5];

            // Read the name
            byte[] nameBytes = new byte[64];
            _hfa.Fp.Read(nameBytes, 0, 64);

            _name = Encoding.Default.GetChars(nameBytes);

            // Read the type
            byte[] typeBytes = new byte[32];
            _hfa.Fp.Read(typeBytes, 0, 32);
            _typeName = Encoding.Default.GetChars(typeBytes);
        }
示例#5
0
        /// <summary>
        /// Create a new instance of the entry with the intention that it would
        /// be written to disk later
        /// </summary>
        /// <param name="hfaIn"></param>
        /// <param name="name"></param>
        /// <param name="typename"></param>
        /// <param name="parent"></param>
        public HfaEntry(HfaInfo hfaIn, string name, string typename, HfaEntry parent)
        {
            // Initialize
            _hfa = hfaIn;
            _parent = parent;
            Name = name;
            TypeName = typename;
            _children = new List<HfaEntry>();

            // Update the previous or parent node to refer to this one
            if (parent == null)
            {
                // do nothing
            }
            else if (parent.Child == null)
            {
                parent.Child = this;
                parent.IsDirty = true;
            }
            else
            {
                HfaEntry prev = parent.Children[parent.Children.Count - 1];
                prev.Next = this;
                prev.IsDirty = true;
            }
            IsDirty = true;
        }