예제 #1
0
 protected PiVoteAction(IrcBot botMethods, VotingClient client, CertificateStorage certificateStorage, IrcEventArgs eventArgs)
 {
     BotMethods         = botMethods;
     Client             = client;
     CertificateStorage = certificateStorage;
     EventArgs          = eventArgs;
 }
        public TallyAction(IrcBot botMethods, VotingClient client, CertificateStorage certificateStorage, IrcEventArgs eventArgs)
            : base(botMethods, client, certificateStorage, eventArgs)
        {
            if (eventArgs.Data.MessageArray.Length == 2)
            {
                int votingNumberTemp;

                if (int.TryParse(eventArgs.Data.MessageArray[1], out votingNumberTemp))
                {
                    if (votingNumberTemp >= 0)
                    {
                        votingNumber = votingNumberTemp;
                    }
                }
            }
        }
예제 #3
0
        public override void Activate()
        {
            actionQueue        = new Queue <PiVoteAction>();
            certificateStorage = new CertificateStorage();

            if (!certificateStorage.TryLoadRoot("./root.pi-cert"))
            {
                throw new Exception("Cannot find root certificate file.");
            }

            client = new VotingClient(certificateStorage);

            var serverIpAddress  = Dns.GetHostEntry(PiVoteServerAddress).AddressList.First();
            var serverIpEndPoint = new IPEndPoint(serverIpAddress, PiVoteServerPort);

            client.Connect(serverIpEndPoint);

            BotMethods.AddCommand(new Commandlet(CommandListVotings, CommandListVotingsDescription, ListVotingsHandler, this));
            BotMethods.AddCommand(new Commandlet(CommandTally, CommandTallyDescription, TallyHandler, this));
            BotMethods.AddCommand(new Commandlet(CommandStatus, CommandStatusDescription, StatusHandler, this));

            base.Activate();
        }
 public ListVotingsAction(IrcBot botMethods, VotingClient client, CertificateStorage certificateStorage, IrcEventArgs eventArgs)
     : base(botMethods, client, certificateStorage, eventArgs)
 {
 }
예제 #5
0
 public frmTallier()
 {
     InitializeComponent(); var actLog = new Action<String>(log);
     vc = new VotingClient(actLog);
     fillCmbElections();
 }