Exemplo n.º 1
0
 public static long PopLong(RopLib rop, long val, int err)
 {
     if (err != ROPE.RNP_SUCCESS)
     {
         throw new RopError(err);
     }
     return(val);
 }
Exemplo n.º 2
0
 public static bool PopBool(RopLib rop, bool val, int err)
 {
     if (err != ROPE.RNP_SUCCESS)
     {
         throw new RopError(err);
     }
     return(val);
 }
Exemplo n.º 3
0
 public static RopHandle PopHandle(RopLib rop, RopHandle val, int err)
 {
     if (err != ROPE.RNP_SUCCESS)
     {
         throw new RopError(err);
     }
     return(val);
 }
Exemplo n.º 4
0
 public static int PopInt(RopLib rop, int val, int err)
 {
     if (err != ROPE.RNP_SUCCESS)
     {
         throw new RopError(err);
     }
     return(val);
 }
Exemplo n.º 5
0
 /**
  * Terminates the instance
  */
 public void Close()
 {
     clear();
     if (lib != null)
     {
         lib.CleanUp();
     }
     lib = null;
 }
Exemplo n.º 6
0
        private SortedDictionary <int, SortedDictionary <RopObject, int> > t2objs; //tag->set

        private void IniRopBind(bool checkLibVer)
        {
            this.cnt  = 1;
            this.lib  = new RopLib();
            this.tags = new List <int>();
            this.tags.Add(this.cnt);
            this.t2objs = new SortedDictionary <int, SortedDictionary <RopObject, int> >();
            if (checkLibVer && !(this.lib.rnp_version() >= this.lib.rnp_version_for(0, 9, 0)) && !((long)lib.rnp_version_commit_timestamp() >= ropid()))
            {
                throw new RopError(ROP_ERROR_LIBVERSION);
            }
        }
Exemplo n.º 7
0
        public static string GetRopString(RopLib rop, int ret, RopHandle ropStr, bool freeBuf = true)
        {
            string sval = RopHandle.Str(ropStr);

            if (freeBuf)
            {
                rop.rnp_buffer_destroy(ropStr);
            }
            if (ret != ROPE.RNP_SUCCESS)
            {
                throw new RopError(ret);
            }
            return(sval);
        }
Exemplo n.º 8
0
 public static string[] GetRopStrings(RopLib rop, int ret, RopHandle[] ropStrs, bool freeBuf = true)
 {
     string[] svals = new string[ropStrs.Length];
     for (int idx = 0; idx < ropStrs.Length; idx++)
     {
         svals[idx] = RopHandle.Str(ropStrs[idx]);
         if (freeBuf)
         {
             rop.rnp_buffer_destroy(ropStrs[idx]);
         }
     }
     if (ret != ROPE.RNP_SUCCESS)
     {
         throw new RopError(ret);
     }
     return(svals);
 }
Exemplo n.º 9
0
        public int WriteString(object buf, int maxLen)
        {
            int len = 0;
            var enc = RopLib.Encode(buf);

            if (!enc.P.Equals(IntPtr.Zero))
            {
                unsafe {
                    byte *src = (byte *)enc.P.ToPointer();
                    byte *dst = (byte *)ptr.ToPointer();
                    while (*src != 0 && len < maxLen - 1)
                    {
                        dst[len++] = *src++;
                    }
                    dst[len] = 0;
                }
            }
            RopLib.FreeEncoded(enc);
            return(len);
        }