示例#1
0
 public ulong GetUID(ILibrary _lib)
 {
     byte[] b = BitConverter.GetBytes(this.Hash);
     b[0] = 0;
     b[1] = this.Category.ID;
     b[2] = _lib.ID;
     ulong v = BitConverter.ToUInt64(b, 0);
     if(_lib.GetItemByUID(v)!=null)
     {
         for (int i = 0; i < 255; i++)
         {
             v++;
             if (_lib.GetItemByUID(v) == null)
                 return v;
         }
         throw new Exception("Unable to get an UID!");
     }
     return v;
 }