コード例 #1
0
ファイル: ChatWindow.cs プロジェクト: Rampant-ai/Senesco
      internal override void ParseBytes(byte[] objectData)
      {
         int index = 0;
         int chatWindow = DataUtils.ReadLong(objectData, ref index);

         Value = new Long(chatWindow);
         this.ObjectDataList.Add(Value);
      }
コード例 #2
0
ファイル: Transaction.cs プロジェクト: Rampant-ai/Senesco
      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);
      }
コード例 #3
0
ファイル: Transaction.cs プロジェクト: Rampant-ai/Senesco
      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();
      }
コード例 #4
0
ファイル: Transaction.cs プロジェクト: Rampant-ai/Senesco
      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;
      }
コード例 #5
0
ファイル: ChatWindow.cs プロジェクト: Rampant-ai/Senesco
 public ChatWindow(int chatWindow)
 {
    Value = new Long(chatWindow);
    this.ObjectDataList.Add(Value);
 }