public Block(uint offSet, string fileName, string hash, string mime, uint subKey, byte[] data, uint cookie = 0, uint ttl = 0, byte flag = 1) { if (mime.Length > 256) { mime = mime.Remove(256); } this.Mime = mime; this.SubKey = subKey; this.Data = data; this.Offset = offSet; this.FileName = fileName; this.Hash = hash; this.TTL = ttl; this.Flag = flag; if (cookie == 0) { byte[] buffer = ValidateCodeGenerator.NextBytes(4); this.Cookie = BitConverter.ToUInt32(buffer, 0); } else { this.Cookie = cookie; } }
public BlockIndex(uint offSet, string fileName, string hash, uint cookie = 0, uint ttl = 0, byte flag = 1) { this.Offset = offSet; this.FileName = fileName; this.Hash = hash; this.TTL = ttl; this.Flag = flag; if (cookie == 0) { byte[] buffer = ValidateCodeGenerator.NextBytes(4); this.Cookie = BitConverter.ToUInt32(buffer, 0); } else { this.Cookie = cookie; } }