Ejemplo n.º 1
0
        /// <summary>
        /// Returns the input string representation
        /// </summary>
        /// <returns>string representation</returns>
        public string GetInputString()
        {
            var arrayDescription = ToArray();

            return(IODefinition.GetDescription(arrayDescription[(int)KeyDefinitionIndices.Flags],
                                               arrayDescription[(int)KeyDefinitionIndices.Value]));
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Constructor based on input/output definitions
 /// </summary>
 /// <param name="zInputDef">the input definition</param>
 /// <param name="zOutputDef">the output definition</param>
 public IOPairDefinition(IODefinition zInputDef, IODefinition zOutputDef)
 {
     m_nHash = (int)(zInputDef.Flags & 0xFF) + (int)((zInputDef.Value & 0xFF) << 8);
     m_zStream.WriteByte(zInputDef.Flags);
     m_zStream.WriteByte(zInputDef.Value);
     m_zStream.WriteByte(0x01);
     m_zStream.WriteByte(zOutputDef.Flags);
     m_zStream.WriteByte(zOutputDef.Value);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Appends an output definition
        /// </summary>
        /// <param name="zOutputDef"></param>
        /// <returns></returns>
        public bool AddOutputDefinition(IODefinition zOutputDef)
        {
            m_zStream.Seek((int)KeyDefinitionIndices.Count, SeekOrigin.Begin);
            byte byCount = (byte)m_zStream.ReadByte();

            // don't allow more than 255 outputs
            if (byCount == 0xFF)
            {
                return(false);
            }
            m_zStream.Seek((int)KeyDefinitionIndices.Count, SeekOrigin.Begin);
            m_zStream.WriteByte(++byCount);
            m_zStream.Seek(0, SeekOrigin.End);
            m_zStream.WriteByte(zOutputDef.Flags);
            m_zStream.WriteByte(zOutputDef.Value);
            return(true);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Returns the output string representation
        /// </summary>
        /// <returns>string representation</returns>
        public string GetOutputString()
        {
            var arrayDescription = ToArray();
            var zBuilder         = new StringBuilder();
            var nIdx             = (int)KeyDefinitionIndices.Count + 1; // start with the first output key definition

            while (nIdx < arrayDescription.Length)
            {
                zBuilder.Append(IODefinition.GetDescription(arrayDescription[(int)KeyDefinitionIndices.Flags + nIdx],
                                                            arrayDescription[(int)KeyDefinitionIndices.Value + nIdx]));
                if ((nIdx + (int)KeyDefinitionIndices.Count) < arrayDescription.Length)
                {
                    zBuilder.Append("+");
                }
                nIdx += (int)KeyDefinitionIndices.Count;
            }
            return(zBuilder.ToString());
        }