Exemple #1
0
    public static void Ser(IntPtr ptr)
    {
        int offset = 0;

        StoreDelegateType storeDelegate = StoreDelegateAction;

        Marshal.WriteIntPtr(ptr, offset, Marshal.GetFunctionPointerForDelegate(storeDelegate));
        offset += IntPtr.Size;

        GetHandler = GetHandle;
        Marshal.WriteIntPtr(ptr, offset, Marshal.GetFunctionPointerForDelegate(GetHandler));
        offset += IntPtr.Size;

        StoreStringType storeString = StringStore.OnReceiveStr;

        Marshal.WriteIntPtr(ptr, offset, Marshal.GetFunctionPointerForDelegate(storeString));
        offset += IntPtr.Size;

        RemoveHandle = ObjectStore.OnRemove;
        Marshal.WriteIntPtr(ptr, offset, Marshal.GetFunctionPointerForDelegate(RemoveHandle));
        offset += IntPtr.Size;

        //init ObjectStore
        ObjectStore.Get(0);
    }
Exemple #2
0
 static int StoreDelegateAction(int type, IntPtr ptr)
 {
     switch ((DelegateType)type)
     {
     case DelegateType.StoreString:
         StoreString = Marshal.GetDelegateForFunctionPointer <StoreStringType>(Marshal.ReadIntPtr(ptr));
         break;
     }
     return(0);
 }
Exemple #3
0
    public static void DeSer(IntPtr ptr)
    {
        int offset = 0;

        StoreDelegate = Marshal.GetDelegateForFunctionPointer <StoreDelegateType>(Marshal.ReadIntPtr(ptr, offset));
        offset       += IntPtr.Size;

        GetHandler = Marshal.GetDelegateForFunctionPointer <GetHandlerType>(Marshal.ReadIntPtr(ptr, offset));
        offset    += IntPtr.Size;

        StoreString = Marshal.GetDelegateForFunctionPointer <StoreStringType>(Marshal.ReadIntPtr(ptr, offset));
        offset     += IntPtr.Size;

        RemoveHandle = Marshal.GetDelegateForFunctionPointer <RemoveHandleType>(Marshal.ReadIntPtr(ptr, offset));
        offset      += IntPtr.Size;

        StoreStringType storeString = StringStore.OnReceiveStr;

        StoreDelegate((int)DelegateType.StoreString, Marshal.GetFunctionPointerForDelegate(storeString));
    }