Beispiel #1
0
        public override void ToStream(Stream output)
        {
            output.Write(TLUtils.SignatureToBytes(Signature));

            Flags.ToStream(output);
            FromPeer.ToStream(output);
            Id.ToStream(output);
            RandomIds.ToStream(output);
            ToPeer.ToStream(output);
        }
Beispiel #2
0
 public override byte[] ToBytes()
 {
     return(TLUtils.Combine(
                TLUtils.SignatureToBytes(Signature),
                Flags.ToBytes(),
                FromPeer.ToBytes(),
                Id.ToBytes(),
                RandomIds.ToBytes(),
                ToPeer.ToBytes()));
 }
        private void Roll()
        {
            // Generate a random value between the selected min-max range, and assign it to our dictionary of random values
            int    oldValue;
            Random rndNum  = new Random(int.Parse(Guid.NewGuid().ToString().Substring(0, 8), NumberStyles.HexNumber));
            int    randval = (rndNum.Next((Max - Min) + 1)) + Min;

            Logger.Log("Generating RNG for profile between {0} and {1}, result={2}", Min, Max, randval);
            if (!RandomIds.TryGetValue(Id, out oldValue))
            {
                RandomIds.Add(Id, randval);
            }
            else
            {
                RandomIds[Id] = randval;
            }
            _isDone = true;
        }