Пример #1
0
 public void EndWrite()
 {
     if (CoreObject.Pointer != IntPtr.Zero)
     {
         XndSDK.XNDAttrib_EndWrite(CoreObject);
     }
 }
Пример #2
0
 public string GetName()
 {
     unsafe
     {
         return(System.Runtime.InteropServices.Marshal.PtrToStringAnsi(XndSDK.XNDAttrib_GetName(CoreObject)));
     }
 }
Пример #3
0
        public void Read(out Support.BitSet data)
        {
            System.Diagnostics.Debug.Assert(Reading);
            data = null;
            if (CoreObject.Pointer == IntPtr.Zero)
            {
                return;
            }

            unsafe
            {
                int bitCount = 0;
                XndSDK.XNDAttrib_Read(CoreObject, (IntPtr)(&bitCount), sizeof(int));
                data = new Support.BitSet();
                int byteCount = 0;
                XndSDK.XNDAttrib_Read(CoreObject, (IntPtr)(&byteCount), sizeof(int));
                byte[] bitData = new byte[byteCount];
                fixed(byte *p = &bitData[0])
                {
                    XndSDK.XNDAttrib_Read(CoreObject, (IntPtr)(p), sizeof(System.Byte) * byteCount);
                }

                data.Init((UInt32)bitCount, bitData);
            }
        }
Пример #4
0
 public void SetName(string name)
 {
     unsafe
     {
         XndSDK.XNDNode_SetName(CoreObject, name);
     }
 }
Пример #5
0
 public void TryReleaseHolder()
 {
     unsafe
     {
         XndSDK.XNDNode_TryReleaseHolder(CoreObject);
     }
 }
Пример #6
0
 public XndAttrib AddAttrib(System.String name)
 {
     unsafe
     {
         //IntPtr namePtr = System.Runtime.InteropServices.Marshal.StringToHGlobalUni(name);
         var attr = XndSDK.XNDNode_AddAttrib(CoreObject, name);
         return(new XndAttrib(attr));
     }
 }
Пример #7
0
 public XndNode AddNode(System.String name, Int64 classId, UInt32 userFlags)
 {
     unsafe
     {
         IntPtr namePtr   = System.Runtime.InteropServices.Marshal.StringToHGlobalAnsi(name);
         var    childNode = XndSDK.XNDNode_AddNode(CoreObject, namePtr, classId, userFlags);
         System.Runtime.InteropServices.Marshal.FreeHGlobal(namePtr);
         return(new XndNode(childNode));
     }
 }
Пример #8
0
        public bool BeginWrite()
        {
            if (CoreObject.Pointer == IntPtr.Zero)
            {
                return(false);
            }

            XndSDK.XNDAttrib_BeginWrite(CoreObject);

            return(true);
        }
Пример #9
0
 public XndNode FindNode(System.String name)
 {
     unsafe
     {
         var node = XndSDK.XNDNode_FindNode(CoreObject, name);
         if (node.Pointer == IntPtr.Zero)
         {
             return(null);
         }
         return(new XndNode(node));
     }
 }
Пример #10
0
 public bool DelNode(XndNode node)
 {
     unsafe
     {
         int ret = XndSDK.XNDNode_DelNode(CoreObject, node.CoreObject);
         if (ret == 0)
         {
             return(false);
         }
         return(true);
     }
 }
Пример #11
0
        public bool Write(IntPtr data, int length)
        {
            System.Diagnostics.Debug.Assert(Writing);
            if (CoreObject.Pointer == IntPtr.Zero)
            {
                return(false);
            }

            XndSDK.XNDAttrib_Write(CoreObject, data, length);

            return(true);
        }
Пример #12
0
        public bool Read(IntPtr buffer, int length)
        {
            System.Diagnostics.Debug.Assert(Reading);
            if (CoreObject.Pointer == IntPtr.Zero)
            {
                return(false);
            }

            XndSDK.XNDAttrib_Read(CoreObject, buffer, length);

            return(true);
        }
Пример #13
0
 public bool Save(FileWriter io)
 {
     unsafe
     {
         int ret = XndSDK.XNDNode_Save(CoreObject, io.CoreObject);
         if (ret == 0)
         {
             return(false);
         }
         return(true);
     }
 }
Пример #14
0
 public bool Load(FileReader pRes)
 {
     unsafe
     {
         int ret = XndSDK.XNDNode_Load(CoreObject, pRes.CoreObject);
         if (ret == 0)
         {
             return(false);
         }
         return(true);
     }
 }
Пример #15
0
 public bool DelAttrib(System.String name)
 {
     unsafe
     {
         //IntPtr namePtr = System.Runtime.InteropServices.Marshal.StringToHGlobalUni(name);
         int ret = XndSDK.XNDNode_DelAttrib(CoreObject, name);
         if (ret == 0)
         {
             return(false);
         }
         return(true);
     }
 }
Пример #16
0
        public bool BeginRead()
        {
            if (CoreObject.Pointer == IntPtr.Zero)
            {
                return(false);
            }

#if DEBUG && PWindow
            XndSDK.XNDAttrib_BeginRead(CoreObject, GetCurSourceFileName(), GetLineNum());
#else
            XndSDK.XNDAttrib_BeginRead(CoreObject, "", 0);
#endif
            return(true);
        }
Пример #17
0
        public XndAttrib FindAttrib(System.String name)
        {
            unsafe
            {
                //IntPtr namePtr = System.Runtime.InteropServices.Marshal.StringToHGlobalUni(name);
                var attr = XndSDK.XNDNode_FindAttrib(CoreObject, name);
                if (attr.Pointer == IntPtr.Zero)
                {
                    return(null);
                }

                return(new XndAttrib(attr));
            }
        }
Пример #18
0
 public List <XndAttrib> GetAttribs()
 {
     unsafe
     {
         List <XndAttrib> attribList = new List <XndAttrib>();
         int count = XndSDK.XNDNode_GetAttribNumber(CoreObject);
         for (int i = 0; i < count; i++)
         {
             var       attrHandle = XndSDK.XNDNode_GetAttrib(CoreObject, i);
             XndAttrib nd         = new XndAttrib(attrHandle);
             attribList.Add(nd);
         }
         return(attribList);
     }
 }
Пример #19
0
 public List <XndNode> GetNodes()
 {
     unsafe
     {
         List <XndNode> nodeList = new List <XndNode>();
         int            count    = XndSDK.XNDNode_GetNodeNumber(CoreObject);
         for (int i = 0; i < count; i++)
         {
             var     childHandle = XndSDK.XNDNode_GetNode(CoreObject, i);
             XndNode nd          = new XndNode(childHandle);
             nodeList.Add(nd);
         }
         return(nodeList);
     }
 }
Пример #20
0
        public bool Write(EngineNS.Color color)
        {
            System.Diagnostics.Debug.Assert(Writing);
            if (CoreObject.Pointer == IntPtr.Zero)
            {
                return(false);
            }

            unsafe
            {
                Int32 val = color.ToArgb();
                XndSDK.XNDAttrib_Write(CoreObject, (IntPtr)(&val), sizeof(Int32));
            }
            return(true);
        }
Пример #21
0
        public void Read(out System.String data)
        {
            System.Diagnostics.Debug.Assert(Reading);
            if (CoreObject.Pointer == IntPtr.Zero)
            {
                data = "";
                return;
            }

            unsafe
            {
                IntPtr strPtr = XndSDK.XNDAttrib_ReadStringA(CoreObject);
                data = System.Runtime.InteropServices.Marshal.PtrToStringAnsi(strPtr);
                XndSDK.XNDAttrib_FreeStringA(strPtr);
            }
        }
Пример #22
0
        public bool Read(out EngineNS.Color color)
        {
            System.Diagnostics.Debug.Assert(Reading);
            if (CoreObject.Pointer == IntPtr.Zero)
            {
                color = EngineNS.Color.White;
                return(false);
            }

            unsafe
            {
                Int32 val = 0;
                XndSDK.XNDAttrib_Read(CoreObject, (IntPtr)(&val), sizeof(Int32));
                color = Color.FromArgb(val);
            }
            return(true);
        }
Пример #23
0
        public void Write(System.String data)
        {
            System.Diagnostics.Debug.Assert(Writing);
            if (CoreObject.Pointer == IntPtr.Zero)
            {
                return;
            }

            unsafe
            {
                if (data == null)
                {
                    data = "";
                }
                //IntPtr strPtr = System.Runtime.InteropServices.Marshal.StringToHGlobalUni(data);
                XndSDK.XNDAttrib_WriteStringA(CoreObject, data);
                //System.Runtime.InteropServices.Marshal.FreeHGlobal(strPtr);
            }
        }
Пример #24
0
        public bool Read(out System.Byte[] data, int length)
        {
            System.Diagnostics.Debug.Assert(Reading);
            data = new System.Byte[length];
            if (CoreObject.Pointer == IntPtr.Zero)
            {
                return(false);
            }

            unsafe
            {
                fixed(void *pinData = &data[0])
                {
                    XndSDK.XNDAttrib_Read(CoreObject, (IntPtr)pinData, sizeof(System.Byte) * length);
                }
            }

            return(true);
        }
Пример #25
0
        public void Write(Support.BitSet data)
        {
            System.Diagnostics.Debug.Assert(Writing);
            if (CoreObject.Pointer == IntPtr.Zero)
            {
                return;
            }

            unsafe
            {
                var bitCount = data.BitCount;
                XndSDK.XNDAttrib_Write(CoreObject, (IntPtr)(&bitCount), sizeof(int));
                byte[] bitData   = data.Data;
                int    byteCount = bitData.Length;
                XndSDK.XNDAttrib_Write(CoreObject, (IntPtr)(&byteCount), sizeof(int));
                fixed(byte *p = &bitData[0])
                {
                    XndSDK.XNDAttrib_Write(CoreObject, (IntPtr)(p), sizeof(System.Byte) * byteCount);
                }
            }
        }
Пример #26
0
        public bool Read(out EngineNS.RName rname)
        {
            System.Diagnostics.Debug.Assert(Reading);
            rname = EngineNS.RName.EmptyName;
            if (CoreObject.Pointer == IntPtr.Zero)
            {
                return(false);
            }

            byte ver = 0;

            Read(out ver);
            unsafe
            {
                switch (ver)
                {
                case 0:
                {
                    IntPtr strPtr = XndSDK.XNDAttrib_ReadStringA(CoreObject);
                    var    name   = System.Runtime.InteropServices.Marshal.PtrToStringAnsi(strPtr);
                    XndSDK.XNDAttrib_FreeStringA(strPtr);
                    byte type;
                    Read(out type);
                    rname = EngineNS.RName.GetRName(name, (RName.enRNameType)type);
                }
                break;

                case 1:
                {
                    var se = EngineNS.IO.Serializer.TypeDescGenerator.Instance.GetSerializer(typeof(EngineNS.RName));
                    rname = (EngineNS.RName)se.ReadValue(this);
                }
                break;
                }
            }
            return(true);
        }
Пример #27
0
 public XndNode()
 {
     mCoreObject = XndSDK.XNDNode_New();
 }
Пример #28
0
 public UInt64 GetClassId()
 {
     return(XndSDK.XNDNode_GetClassID(CoreObject));
 }
Пример #29
0
        public XndNode AddNode(XndNode childNode)
        {
            var node = XndSDK.XNDNode_AddNodeWithSource(CoreObject, childNode.CoreObject);

            return(new XndNode(node));
        }
Пример #30
0
        public XndAttrib AddAttrib(XndAttrib srcAtt)
        {
            var attr = XndSDK.XNDNode_AddAttribWithSource(CoreObject, srcAtt.CoreObject);

            return(new XndAttrib(attr));
        }