/// <summary>
        /// Возвращает копию команды
        /// </summary>
        public override object Clone()
        {
            TariffMetroCommand command = null;

            switch (type)
            {
            case TariffMetroCommandType.CalculateInterval:
                command = new TariffMetroCommandCalculateInterval((TariffMetroCommandCalculateInterval)this);
                break;

            case TariffMetroCommandType.Goto:
                command = new TariffMetroCommandGoto((TariffMetroCommandGoto)this);
                break;
            }

            return(command);
        }
        private static TariffMetroCommand ParseCommand(string[] sa)
        {
            string type = sa[1];

            if (String.Compare(type, CommandTypeCalculateInterval, true) == 0)
            {
                TariffMetroCommandCalculateInterval cmdCalulateInterval = new TariffMetroCommandCalculateInterval();
                cmdCalulateInterval.StartTime      = ParseTimeSpan(sa[2]);
                cmdCalulateInterval.IntervalAmount = ConvertMoney(ParseInt32(sa[3]));
                cmdCalulateInterval.RountToNext    = (ParseInt32(sa[5]) != 0);

                string[] discretes = sa[4].Split(CommandPropertySplitter);
                if (discretes.Length != 2)
                {
                    throw new FormatException(String.Format("Неверные данные дискрета", sa[4]));
                }

                cmdCalulateInterval.PerDiscreteAmount = ConvertMoney(ParseInt32(discretes[0]));
                cmdCalulateInterval.Discrete          = ParseTimeSpan(discretes[1]);

                return(cmdCalulateInterval);
            }
            else if (String.Compare(type, CommandTypeGoto, true) == 0)
            {
                TariffMetroCommandGoto cmdGoto = new TariffMetroCommandGoto();
                cmdGoto.Destination = ParseInt32(sa[2]);

                return(cmdGoto);
            }
            else if (String.Compare(type, CommandTypeEnd, true) == 0)
            {
                return(new TariffMetroCommandEnd());
            }

            throw new FormatException(String.Format("Неизвестная команда\r\n{0}", type));
        }
 public TariffMetroCommandGoto(TariffMetroCommandGoto command)
     : base(command)
 {
     destination = command.Destination;
 }