Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
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;
 }