Esempio n. 1
0
      internal override void ParseBytes(byte[] objectData)
      {
         int index = 0;
         int chatWindow = DataUtils.ReadLong(objectData, ref index);

         Value = new Long(chatWindow);
         this.ObjectDataList.Add(Value);
      }
Esempio n. 2
0
      public void Configure(bool reply, int id, int errorCode)
      {
         Id = new Short(id);
         m_errorCode = new Long(errorCode);

         if (reply)
            m_class = new Short(1);
         else
            m_class = new Short(0);
      }
Esempio n. 3
0
      public byte[] GetBytes()
      {
         //TODO: also could create these if they're not set, and log warning.
         //if (m_class == null || m_id == null || m_taskNumber == null || m_errorCode == null)
         //{
         //   s_log.ErrorFormat("Required header object is missing.");
         //   return null;
         //}

         List<byte> byteList = new List<byte>();
         byteList.AddRange(m_class.GetBytes());          // Transaction class
         byteList.AddRange(Id.GetBytes());             // Transaction ID
         byteList.AddRange(m_taskNumber.GetBytes());     // Task number
         byteList.AddRange(m_errorCode.GetBytes());      // Error code

         // Construct the data block in a separate list since we need to prefix the count.
         List<byte> dataBlock = new List<byte>();
         dataBlock.AddRange(new Short(m_objectList.Count).GetBytes());
         foreach (HotlineObject obj in m_objectList)
            dataBlock.AddRange(obj.GetBytes());

         // Calculate the total length of the data block.
         Long dataBlockLength = new Long(dataBlock.Count);
         byte[] lengthBytes = dataBlockLength.GetBytes();
         
         // Write the final length to the byte list twice.
         byteList.AddRange(lengthBytes);
         byteList.AddRange(lengthBytes);
         
         // Now include the data block in the final output list.
         byteList.AddRange(dataBlock);

         // Convert the final list to an array.
         return byteList.ToArray();
      }
Esempio n. 4
0
      private int SetTaskNumber()
      {
         // Get a task number and increment the counter so each number is used only once.
         int taskNumber = s_taskCounter++;

         // Record the task number in active task list.
         TransactionFactory.AddActiveTransaction(taskNumber, this);

         // Set the task number as a Long in this instance.
         m_taskNumber = new Long(taskNumber);

         // Return the assigned integer.
         return taskNumber;
      }
Esempio n. 5
0
 public ChatWindow(int chatWindow)
 {
    Value = new Long(chatWindow);
    this.ObjectDataList.Add(Value);
 }