Exemplo n.º 1
0
 public override bool Equals(object obj)
 {
     if ((obj == null) || !this.GetType().Equals(obj.GetType()))
     {
         return(false);
     }
     else
     {
         RegId p = (RegId)obj;
         return(p == this);
     }
 }
Exemplo n.º 2
0
        internal void ReleaseBricks(RegId id)
        {
            List <Chunk> ch_list;

            if (!m_Registry.TryGetValue(id, out ch_list))
            {
                Debug.Log("Tried to release bricks with id=" + id.id + " but no bricks were registered under this id.");
                return;
            }

            // clean up the index
            m_Index.RemoveBricks(id);

            // clean up the pool
            m_Pool.Deallocate(ch_list);
            m_Registry.Remove(id);
        }
Exemplo n.º 3
0
        public void ReadWrite(ref UserId userId)
        {
            if (this.Serializing)
            {
                this.ReadWrite(userId);
            }
            else
            {
                var typeFlag = new VarInt();
                this.ReadWrite(ref typeFlag);

                var len = typeFlag.ToLong();

                if (SerializeFlag.FlagRegIDMin <= len && len <= SerializeFlag.FlagRegIDMax)
                {
                    RegId uid = new RegId();
                    this.ReadWriteAsCompactVarInt(ref uid.Height);
                    this.ReadWriteAsCompactVarInt(ref uid.Index);
                    uid.CompactIntoDest();
                    userId = uid;
                }
                else if (len == SerializeFlag.FlagKeyID)
                {
                    uint160 key = new uint160(0);
                    this.ReadWrite(ref key);
                    userId = new Wicc.Entities.KeyId(key);
                }
                else if (len == SerializeFlag.FlagPubKey)
                {
                    var bytes = new byte[len];
                    this.ReadWrite(ref bytes);
                    userId = new PubKeyId(bytes);
                }
                else if (len == SerializeFlag.FlagNullType)
                {
                    userId = new NullId();
                }
                else
                {
                    //TODO
                    throw new NullReferenceException();
                }
            }
        }
Exemplo n.º 4
0
 public DelegateVoteTx() : base(TxType.DELEGATE_VOTE_TX)
 {
     TxUid = new RegId(0, 0);
 }