Exemplo n.º 1
0
        public void ReadLine(string line)
        {
            if (line.Length < 24)
            {
                // There is nothing useful in the line, do nothing
                return;
            }

            // Check the position of the timestamp-log divider
            if (!line.Substring(1).Contains(" - "))
            {
                // Do nothing if the divider was not found
                return;
            }

            // Timestamp is in the first 19 characters
            DateTime thisTime = DateTime.ParseExact(line.Substring(0, 19), "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture);
            string   rest     = line.Substring(22).Trim(); // Next three characters are " - "

            switch (rest)
            {
            case s_startingVotingSession:
                this.state     = DICXState.Started;
                this.startTime = thisTime;
                break;

            case s_ballotReview:
                this.state = DICXState.BallotReview;
                break;

            case s_prepareBallot:
                this.state = DICXState.BallotCasting;
                break;

            case s_ballotCast:
                this.state = DICXState.Ready;
                this.WriteBallotCastNormalRecord(this.startTime, thisTime);
                break;
            }
        }
Exemplo n.º 2
0
 private void ClearState()
 {
     this.state    = DICXState.Ready;
     this.fileName = "";
 }