Esempio n. 1
0
        /// <summary>
        /// The managed object.
        /// </summary>
        /// <param name="hash">
        /// The hash.
        /// </param>
        /// <param name="pObj">
        /// The p obj.
        /// </param>
        /// <exception cref="FormatException">
        /// </exception>
        /// <exception cref="ArgumentException">
        /// </exception>
        /// <exception cref="FormatException">
        /// </exception>
        public void ManagedObject(uint hash, ref CIwManaged pObj)
        {
            if (this.mode == IwSerialiseMode.Read)
            {
                IwClassFactory factory = this.ClassRegistry.Get(hash);
                if (factory == null)
                {
                    throw new FormatException(string.Format("Can't Serialise unknown type 0x{0:x}", hash));
                }

                pObj = factory.Create();
            }
            else
            {
                if (hash != pObj.Hash)
                {
                    throw new ArgumentException();
                }
            }

            try
            {
                pObj.Serialise(this);
            }
            catch (Exception ex)
            {
                throw new FormatException(
                          string.Format("Can't Serialise GetResHashed(0x{0:x}, \"0x{1}\")", pObj.Hash, pObj.GetType().Name), ex);
            }
        }
Esempio n. 2
0
        public void ManagedHash <T>(ref T pObj) where T : CIwManaged
        {
            CIwManaged m = pObj;

            ManagedHash(typeof(T).Name.ToeHash(), ref m);
            pObj = (T)m;
        }
Esempio n. 3
0
        /// <summary>
        /// The managed hash.
        /// </summary>
        /// <param name="type">
        /// The type.
        /// </param>
        /// <param name="val">
        /// The val.
        /// </param>
        public void ManagedHash(uint type, ref CIwManaged val)
        {
            uint hash = 0;

            if (this.IsReading())
            {
                this.UInt32(ref hash);
                if (this.resourceResolver != null)
                {
                    val = this.resourceResolver.Resolve(type, hash);
                }
            }
            else
            {
                if (val == null)
                {
                    hash = 0;
                }
                else
                {
                    hash = val.Hash;
                }

                this.UInt32(ref hash);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// The managed object.
        /// </summary>
        /// <param name="pObj">
        /// The p obj.
        /// </param>
        /// <exception cref="FormatException">
        /// </exception>
        public void ManagedObject(ref CIwManaged pObj)
        {
            if (this.mode == IwSerialiseMode.Read)
            {
                uint hash = 0;
                this.UInt32(ref hash);
                IwClassFactory factory = this.ClassRegistry.Get(hash);
                if (factory == null)
                {
                    throw new FormatException(string.Format("Can't Serialise unknown type 0x{0:x}", hash));
                }

                pObj = factory.Create();
            }
            else
            {
                uint hash = pObj.Hash;
                this.UInt32(ref hash);
            }

            Debug.WriteLine(string.Format("Serialise {0}", pObj.GetType().Name));
            pObj.Serialise(this);
        }
Esempio n. 5
0
 /// <summary>
 /// The parse close child.
 /// </summary>
 /// <param name="pParser">
 /// The p parser.
 /// </param>
 /// <param name="pChild">
 /// The p child.
 /// </param>
 public virtual void ParseCloseChild(CIwTextParserITX pParser, CIwManaged pChild)
 {
 }
Esempio n. 6
0
 /// <summary>
 /// The push object.
 /// </summary>
 /// <param name="pObject">
 /// The p object.
 /// </param>
 public void PushObject(CIwManaged pObject)
 {
     this.parseStack.Add(pObject);
 }
Esempio n. 7
0
 /// <summary>
 /// The push object.
 /// </summary>
 /// <param name="pObject">
 /// The p object.
 /// </param>
 public void PushObject(CIwManaged pObject)
 {
     this.parseStack.Add(pObject);
 }
Esempio n. 8
0
 /// <summary>
 /// The parse close child.
 /// </summary>
 /// <param name="pParser">
 /// The p parser.
 /// </param>
 /// <param name="pChild">
 /// The p child.
 /// </param>
 public virtual void ParseCloseChild(CIwTextParserITX pParser, CIwManaged pChild)
 {
 }