예제 #1
0
 public PushAnswerCommandRequest(HandshakeResponse response, shareAction1 s1, shareAction2 s2, int questionNumber, String answer) : base(response, s1, s2)
 {
     this.dataBelong = 0;
     this.number     = questionNumber;
     this.dotPwoer   = SubVoteDisplayAction.GetSubVoteDisplayAction(answer);
     this.request    = SubVoteDisplayAction.GetDisplayData(answer);
 }
예제 #2
0
 public BaseCommandRequest(HandshakeResponse response, shareAction1 s1, shareAction2 s2)
 {
     handshakeSecretKey = response.SecretKey;
     machineAddress     = response.Address;
     share1             = s1;
     share2             = s2;
 }
예제 #3
0
 public ConfigureCommandRequest(HandshakeResponse response, shareAction1 s1, shareAction2 s2) : base(response, s1, s2)
 {
     this.dataBelong = 0;
     this.number     = FrequencyAction.GetNuRenewAction();
     this.dotPwoer   = ChannelAction.GetNuRenewAction();
     this.request    = DateAction.GetNuRenewAction();
 }
 public PushScoreCommandRequest(HandshakeResponse response, shareAction1 s1, shareAction2 s2, long problemNumber, String answer) : base(response, s1, s2)
 {
     this.dataBelong         = 64;
     this.number             = 130;
     this.dotPwoer           = SubVoteDisplayAction.GetSubVoteDisplayAction(answer);
     this.request            = SubVoteDisplayAction.GetDisplayData(answer);
     this.handshakeSecretKey = 2;
 }
 public PushNewScoreCommandRequest(HandshakeResponse response, shareAction1 s1, shareAction2 s2, long subNumber, String score, int number) : base(response, s1, s2)
 {
     this.dataBelong = 0;
     this.number     = number;
     this.dotPwoer   = SubVoteDisplayAction.GetSubVoteDisplayAction(score);
     this.request    = SubVoteDisplayAction.GetDisplayData(score) + (((ulong)subNumber) << 32);
 }
        /// <summary>
        /// 分组命令
        /// </summary>
        /// <param name="response">握手返回值</param>
        /// <param name="secrets">密码列表</param>
        /// <param name="groupNumber">当前组数量 从1 开始</param>
        public GroupingCommandRequest(HandshakeResponse response, List <UInt64> secrets, int groupNumber, shareAction1 s1, shareAction2 s2) : base(response, s1, s2)
        {
            this.dataBelong = 0;
            this.number     = groupNumber;
            this.dotPwoer   = secrets.Count();
            var           baseOffset = (groupNumber - 1) * 4;
            var           maxOffset  = baseOffset + 4;
            List <UInt64> secretsInt = new List <UInt64>();

            if (baseOffset + 4 >= secrets.Count())
            {
                maxOffset = secrets.Count();
            }
            for (int i = baseOffset; i < maxOffset; i++)
            {
                secretsInt.Add(secrets[i]);
            }
            if (secretsInt.Count() < 4)
            {
                var count = secretsInt.Count();
                for (int i = 0; i < 4 - count; i++)
                {
                    secretsInt.Add(0);
                }
            }
            this.request += secretsInt[0] << 48;
            this.request += secretsInt[1] << 32;
            this.request += secretsInt[2] << 16;
            this.request += secretsInt[3];
        }