Пример #1
0
 public TrinityErrorCode RemoveCell(long cellId)
 {
     using (var req = new __CellIdStructWriter(cellId))
         using (var rsp = m_mod.RemoveCell(0, req))
         {
             return((TrinityErrorCode)rsp.code);
         }
 }
Пример #2
0
 public bool Contains(long cellId)
 {
     using (var req = new __CellIdStructWriter(cellId))
         using (var rsp = m_mod.AddCell(0, req))
         {
             // remote returns E_CELL_FOUND or E_CELL_NOT_FOUND
             return(rsp.code == (int)TrinityErrorCode.E_CELL_FOUND);
         }
 }
Пример #3
0
 public TrinityErrorCode GetCellType(long cellId, out ushort cellType)
 {
     using (var req = new __CellIdStructWriter(cellId))
         using (var rsp = m_mod.GetCellType(0, req))
         {
             if (rsp.code >= 0)
             {
                 cellType = (ushort)rsp.code;
                 return(TrinityErrorCode.E_SUCCESS);
             }
             else
             {
                 cellType = 0;
                 return((TrinityErrorCode)rsp.code);
             }
         }
 }
Пример #4
0
        public unsafe TrinityErrorCode LoadCell(long cellId, out byte[] cellBuff, out ushort cellType)
        {
            using (var req = new __CellIdStructWriter(cellId))
            {
                TrinityResponse  rsp     = null;
                TrinityErrorCode errcode = TrinityErrorCode.E_RPC_EXCEPTION;

                cellBuff = null;
                cellType = 0;

                try
                {
                    var sp   = PointerHelper.New(req.buffer);
                    *sp.ip++ = TrinityProtocol.TrinityMsgHeader + sizeof(long);
                    *sp.sp++ = (short)TrinityMessageType.SYNC_WITH_RSP;
                    *sp.sp++ = (short)TSL.CommunicationModule.TrinityClientModule.SynReqRspMessageType.LoadCell;

                    m_mod.SendMessage(m_ep, req.buffer, req.BufferLength, out rsp);

                    sp      = PointerHelper.New(rsp.Buffer);
                    errcode = (TrinityErrorCode)(*sp.ip++);
                    if (errcode == TrinityErrorCode.E_SUCCESS)
                    {
                        var length = *sp.ip++;
                        cellType = (ushort)(*sp.sp++);
                        cellBuff = new byte[length];
                        fixed(byte *p = cellBuff)
                        {
                            Memory.memcpy(p, sp.bp, (ulong)length);
                        }
                    }
                    /* otherwise, fails with returned error code */
                }
                finally
                {
                    rsp?.Dispose();
                }

                return(errcode);
            }
        }
Пример #5
0
 public override void LoadCellHandler(__CellIdStructReader request, __CellIdStructWriter response)
 {
     throw new NotImplementedException();
 }