public void EndWrite() { if (CoreObject.Pointer != IntPtr.Zero) { XndSDK.XNDAttrib_EndWrite(CoreObject); } }
public string GetName() { unsafe { return(System.Runtime.InteropServices.Marshal.PtrToStringAnsi(XndSDK.XNDAttrib_GetName(CoreObject))); } }
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); } }
public void SetName(string name) { unsafe { XndSDK.XNDNode_SetName(CoreObject, name); } }
public void TryReleaseHolder() { unsafe { XndSDK.XNDNode_TryReleaseHolder(CoreObject); } }
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)); } }
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)); } }
public bool BeginWrite() { if (CoreObject.Pointer == IntPtr.Zero) { return(false); } XndSDK.XNDAttrib_BeginWrite(CoreObject); return(true); }
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)); } }
public bool DelNode(XndNode node) { unsafe { int ret = XndSDK.XNDNode_DelNode(CoreObject, node.CoreObject); if (ret == 0) { return(false); } return(true); } }
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); }
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); }
public bool Save(FileWriter io) { unsafe { int ret = XndSDK.XNDNode_Save(CoreObject, io.CoreObject); if (ret == 0) { return(false); } return(true); } }
public bool Load(FileReader pRes) { unsafe { int ret = XndSDK.XNDNode_Load(CoreObject, pRes.CoreObject); if (ret == 0) { return(false); } return(true); } }
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); } }
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); }
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)); } }
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); } }
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); } }
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); }
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); } }
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); }
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); } }
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); }
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); } } }
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); }
public XndNode() { mCoreObject = XndSDK.XNDNode_New(); }
public UInt64 GetClassId() { return(XndSDK.XNDNode_GetClassID(CoreObject)); }
public XndNode AddNode(XndNode childNode) { var node = XndSDK.XNDNode_AddNodeWithSource(CoreObject, childNode.CoreObject); return(new XndNode(node)); }
public XndAttrib AddAttrib(XndAttrib srcAtt) { var attr = XndSDK.XNDNode_AddAttribWithSource(CoreObject, srcAtt.CoreObject); return(new XndAttrib(attr)); }