Beispiel #1
0
        /// <summary>
        /// Don't call this outside of the Parse functions.
        /// This is here to eliminate redundant code.
        /// </summary>
        private static T CommonInit <T>(SakuraiArchiveNode root, SakuraiEntryNode parent, VoidPtr addr, params object[] parameters) where T : SakuraiEntryNode
        {
            int  offset     = root.Offset(addr);
            bool attributes = parameters.Contains("Attributes");

            if (offset <= 0 && !attributes)
            {
                return(null);
            }

            if (attributes)
            {
                parameters = new object[0];
            }

            T n = Activator.CreateInstance(typeof(T), parameters) as T;

            n.Setup(root, parent, offset);
            n.OnParse(addr);
            return(n);
        }
Beispiel #2
0
 /// <summary>
 /// Returns an offset of the given address relative to the base address.
 /// </summary>
 public int Offset(VoidPtr address)
 {
     return(_root.Offset(address));
 }