Skip to content

Instantly share code, notes, and snippets.

"<?xml version=\"1.0\"?>\r\n<NormWebSynchPacket xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\r\n <_PacketType>8</_PacketType>\r\n <_lstOBEX>\r\n <ProtocolOBEX>\r\n <Data>7b0HYBxJliUmL23Ke39K9UrX4HShCIBgEyTYkEAQ7MGIzeaS7B1pRyMpqyqBymVWZV1mFkDM7Z28995777333nvvvfe6O51OJ/ff/z9cZmQBbPbOStrJniGAqsgfP358Hz8ifo1f89f4NX6N/5se/MTzG/1a9M+Xy6peFE07vsonzfVyOs6XbdEWeTNKfzKvm6JafrY73sF/o/RkXbbrOv9sma/bOitH6cv1pCymv1d+/aZ6my8/W67L8tcF9J0hoOOnWZv9/qfmr9dtNX171uaL35xeSn7/l3U1W0/bs6e/7u//Ilvkv9Hv/zRvpnWxagmL3+D3f5LV02qW/4a//+uszJvTd2+yd7/B70//nNCHv9Hv/9WyaL/Is4bw+w1+/5fZ9O1PtNc/9vs/r6YZ3qaX1qtVWeT1yxe//u//3by4mLe/7u//7aqc/fq//5fLb2fL2a/3+39eV+uVIHG2yC6oo+O2zabzBSH/m7iP31yv8l8TD9GT/qH///q//q/xG/wGv96v+WvRg2HQ8+v92iBv+1PF+c709zk9efb7fAZ6J/wP/8vPr/froNWTL3/wey/uv325c//3+Yxe/TV+w/8H</Data>\r\n <CRC>bpR1Sg==</CRC>\r\n </ProtocolOBEX>\r\n </_lstOBEX>\r\n</NormWebSynchPacket>"
using System;
using System.Collections.Generic;
using System.Collections;
using System.Text;
using System.Web;
using System.Net;
using System.IO;
namespace ZNWSynch
{
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
/// <summary>
/// Deserializes an XML Document to Object of T
/// </summary>
/// <typeparam name="T">Object</typeparam>
/// <param name="Buffer">XML as Byte Array</param>
/// <returns>Object of T</returns>
public static T XMLToObject<T>(Byte[] Buffer)
{
XmlSerializer formatter = new XmlSerializer(typeof(T));
MemoryStream ms = new MemoryStream(Buffer);
namespace normist.websync.entities.Data_Entities
{
#region Data Structures
/// <summary>
/// Stock Item
/// </summary>
[Serializable]
public class StockItem
@bdallen
bdallen / gist:1375179
Created November 18, 2011 01:03
Blah
private string GetManufacturer(string MacAddress)
{
using (ISession session = Global._DatabaseConn.OpenSession())
{
using (ITransaction transaction = session.BeginTransaction())
{
string strManuFacturer = "N/A";
var OID = session.Query<normutils.data.Entities.MACIdentifier>();
var Type = (from t in OID
where t.ID == MacAddress.Substring(0,8)
@bdallen
bdallen / gist:1375162
Created November 18, 2011 00:56
Blah
using (ISession session = Global._DatabaseConn.OpenSession())
{
using (ITransaction transaction = session.BeginTransaction())
{
// Get list of all Leases
//Leases = session.CreateCriteria(typeof(normutils.data.Entities.DHCPLease)).List<normutils.data.Entities.DHCPLease>();
var LQ = session.Query<normutils.data.Entities.DHCPLease>();
var Leases = from v in LQ
where v.BindState == "active"
orderby v.Name ascending
@bdallen
bdallen / gist:1347115
Created November 8, 2011 05:50
Hmmm....
public class DHCPLease : IComparer
{
public virtual string ID { get; set; }
public virtual string Name { get; set; }
public virtual string IPAddress { get; set; }
public virtual string BindState { get; set; }
public virtual string NextBindState { get; set; }
int IComparer.Compare(object obj1, object obj2)
{
public static MemoryStream StockXML(List<CapitalData.DataObjects.StockItem> stockList)
{
MemoryStream ms = new MemoryStream();
MD5 md5 = new MD5CryptoServiceProvider();
Byte[] originalBytes;
Byte[] encodedBytes;
XmlWriterSettings settings = new XmlWriterSettings();
settings.Indent = true;