コード例 #1
0
        /// <summary>
        /// FileVersion.Current - 46 bytes
        /// </summary>
        /// <returns></returns>
        public new byte[] ToBytes()
        {
            var bytes = new List <byte>();

            var calibrationHRaw   = Convert.ToByte(CalibrationH * 10.0);
            var calibrationLRaw   = Convert.ToByte(CalibrationL * 10.0);
            var decommissionedRaw = ((int)Status) + ((int)Jumper * 16);

            switch (FileVersion)
            {
            case FileVersion.Current:
                bytes.AddRange(base.ToBytes());
                bytes.AddRange(Value.Value.ToBytes());
                bytes.Add((byte)Math.Log(Filter, 2));
                bytes.Add((byte)decommissionedRaw);
                bytes.Add(SubId.ToByte());
                bytes.Add(SubProduct.ToByte());
                bytes.Add((byte)Control);
                bytes.Add((byte)AutoManual);
                bytes.Add((byte)DigitalAnalog);
                bytes.Add((byte)CalibrationSign);
                bytes.Add(SubNumberToByte(SubNumber));
                bytes.Add(calibrationHRaw);
                bytes.Add(calibrationLRaw);
                bytes.Add(ToByte(Value.Unit, DigitalAnalog));
                break;

            default:
                throw new FileVersionNotImplementedException(FileVersion);
            }

            CheckSize(bytes.Count, GetSize(FileVersion));

            return(bytes.ToArray());
        }
コード例 #2
0
        /// <summary>
        /// FileVersion.Current - 45 bytes
        /// </summary>
        /// <returns></returns>
        public new byte[] ToBytes()
        {
            var bytes = new List <byte>();

            switch (FileVersion)
            {
            case FileVersion.Current:
                bytes.AddRange(Description.ToBytes(19));
                bytes.Add((byte)LowVoltage);
                bytes.Add((byte)HighVoltage);
                bytes.AddRange(Label.ToBytes(9));
                bytes.AddRange(Value.Value.ToBytes());
                bytes.Add((byte)AutoManual);
                bytes.Add((byte)DigitalAnalog);
                bytes.Add((byte)HwSwitchStatus);
                bytes.Add((byte)Control);
                bytes.Add((byte)DigitalControl);
                bytes.Add((byte)Decommissioned);
                bytes.Add(VariablePoint.ToByte(Value.Unit, DigitalAnalog));
                bytes.Add(SubId.ToByte());
                bytes.Add(SubProduct.ToByte());
                bytes.Add(SubNumberToByte(SubNumber));
                bytes.Add((byte)PwmPeriod);
                break;

            default:
                throw new FileVersionNotImplementedException(FileVersion);
            }

            CheckSize(bytes.Count, GetSize(FileVersion));

            return(bytes.ToArray());
        }
コード例 #3
0
 public Sub([NotNull] string exchange, [NotNull] string fromSymbol, SubId subId, [NotNull] string toSymbol)
 {
     Check.NotNullOrWhiteSpace(exchange, nameof(exchange));
     Check.NotNullOrWhiteSpace(fromSymbol, nameof(fromSymbol));
     Check.NotNullOrWhiteSpace(toSymbol, nameof(toSymbol));
     this.Exchange   = exchange;
     this.FromSymbol = fromSymbol;
     this.SubId      = subId;
     this.ToSymbol   = toSymbol;
 }
コード例 #4
0
        public override int GetHashCode()
        {
            var hashCode = 966821394;

            hashCode = hashCode * -1521134295 + Mode.GetHashCode();
            hashCode = hashCode * -1521134295 + BuffMode.GetHashCode();
            hashCode = hashCode * -1521134295 + Id.GetHashCode();
            hashCode = hashCode * -1521134295 + SubId.GetHashCode();
            hashCode = hashCode * -1521134295 + Schedule.GetHashCode();
            hashCode = hashCode * -1521134295 + Multiplier.GetHashCode();
            if (Effect != null)
            {
                hashCode = hashCode * -1521134295 + Effect.GetHashCode();
            }
            return(hashCode);
        }
コード例 #5
0
 public override int GetHashCode()
 {
     return(SubId.GetHashCode() + Type.GetHashCode());
 }
コード例 #6
0
 public string GetKey()
 {
     return(string.Format("{0}_{1}", MainId.ToString(), SubId.ToString()));
 }