Exemplo n.º 1
0
        /// <summary>
        /// Saves the options to the specified writer.
        /// </summary>
        public void Save(Stream stream)
        {
            if (stream == null)
            {
                throw new ArgumentNullException(nameof(stream));
            }

            StringBuilder sb = new StringBuilder()
                               .AppendLine("[TeleCommand]")
                               .Append("CommandID=").AppendLine(CommandID.ToString())
                               .Append("CreationTime=").AppendLine(CreationTime.ToString(DateTimeFormatInfo.InvariantInfo))
                               .Append("ClientName=").AppendLine(ClientName)
                               .Append("UserID=").AppendLine(UserID.ToString())
                               .Append("CnlNum=").AppendLine(CnlNum.ToString())
                               .Append("ObjNum=").AppendLine(ObjNum.ToString())
                               .Append("DeviceNum=").AppendLine(DeviceNum.ToString())
                               .Append("CmdNum=").AppendLine(CmdNum.ToString())
                               .Append("CmdCode=").AppendLine(CmdCode)
                               .Append("CmdVal=").AppendLine(CmdVal.ToString(NumberFormatInfo.InvariantInfo))
                               .Append("CmdData=").AppendLine(ScadaUtils.BytesToHex(CmdData))
                               .Append("RecursionLevel=").AppendLine(RecursionLevel.ToString())
                               .AppendLine("End=");

            using (StreamWriter writer = new StreamWriter(stream, Encoding.UTF8, 1024, true))
            {
                writer.Write(sb.ToString());
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Compares the current instance with another object of the same type
 /// </summary>
 public int CompareTo(object obj)
 {
     return(CnlNum.CompareTo((int)obj));
 }
Exemplo n.º 3
0
 /// <summary>
 /// Сравнить текущий объект с другим объектом такого же типа
 /// </summary>
 public int CompareTo(InCnlProps other)
 {
     return(CnlNum.CompareTo(other.CnlNum));
 }