Skip to content

Instantly share code, notes, and snippets.

@bdallen
Created December 13, 2011 04:54
Show Gist options
  • Save bdallen/1470661 to your computer and use it in GitHub Desktop.
Save bdallen/1470661 to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
namespace normist.websync.entities.Protocol
{
[Serializable]
public struct ProtocolOBEX
{
public byte[] Data;
public byte[] CRC;
}
[Serializable]
public class NormWebSynchPacket
{
public PacketType _PacketType;
public List<ProtocolOBEX> _lstOBEX;
public NormWebSynchPacket()
{
_lstOBEX = new List<ProtocolOBEX>();
}
/// <summary>
/// Add a OBEX Data
/// </summary>
/// <param name="Data"></param>
public void AddOBEXData(byte[] Data)
{
ProtocolOBEX _obx = new ProtocolOBEX();
_obx.Data = Data;
_obx.CRC = normist.utilities.DataIntegrity.CRC.CalculateCRC(Data);
_lstOBEX.Add(_obx);
}
/// <summary>
/// Serialize to XML
/// </summary>
/// <returns></returns>
public byte[] ToXML()
{
byte[] bytSerialized = normist.utilities.Serializers.XML.ObjectToXML(this);
return bytSerialized;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment