Exemple #1
0
 /// <summary>
 /// 获取名字
 /// </summary>
 /// <returns></returns>
 public string getName()
 {
     if (ptr != null && ptr != IntPtr.Zero)
     {
         Std_String s = egetName(ptr);
         return(StrTool.c_str(s));
     }
     return(null);
 }
Exemple #2
0
 // std::string中读取c_str
 public static string c_str(Std_String s)
 {
     try
     {
         if (s.len < 1)
         {
             return(String.Empty);
         }
         if (s.len < 16)
         {
             byte[] c   = BitConverter.GetBytes((ulong)s.data);
             byte[] d   = BitConverter.GetBytes(s.sd);
             byte[] str = new byte[16];
             Array.Copy(c, str, 8);
             Array.Copy(d, 0, str, 8, 8);
             return(Encoding.UTF8.GetString(str, 0, (int)s.len));
         }
         return(readUTF8str(s.data));
     }
     catch (Exception e) { Console.WriteLine(e.StackTrace); }
     return(null);
 }