Created
December 13, 2011 04:54
-
-
Save bdallen/1470661 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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