public byte[] GetEncodedDeltaFrame(ushort sequenceNumber) { DeltaFrame delta = new DeltaFrame(); delta.ConfigurationVersion = m_MetaFrame.ConfigurationVersion; delta.MetaFrame = m_MetaFrame; delta.NetworkMessageHeader = new NetworkMessageHeader { PublisherID = new String(PublisherId), VersionAndFlags = 0xD1, ExtendedFlags1 = new ExtendedFlags1 { RawValue = 0x04 } }; delta.Flags1 = new DataSetFlags1 { RawValue = 0xEB }; delta.Flags2 = new DataSetFlags2 { RawValue = 0x11 }; delta.FieldIndexList = new List <ushort>(); delta.PayloadHeader = new DataSetPayloadHeader { Count = 1, DataSetWriterID = new[] { m_MetaFrame.DataSetWriterID } }; delta.Items = new List <DataPointValue>(); delta.FieldIndexList = new List <ushort>(); for (int i = 0; i < m_ProcessValues.Values.Count; i++) { if (m_ProcessValues.Values.ElementAt(i) .IsModified) { DataPointValue dataPoint = m_ProcessValues.Values.ElementAt(i) .DataPoint; dataPoint.Index = i; delta.Items.Add(dataPoint); m_ProcessValues.Values.ElementAt(i) .IsModified = false; delta.FieldIndexList.Add((ushort)i); } } delta.FieldCount = (ushort)delta.Items.Count; delta.DataSetMessageSequenceNumber = sequenceNumber; delta.Timestamp = DateTime.Now; using (MemoryStream outputStream = new MemoryStream()) { delta.Encode(outputStream); return(outputStream.ToArray()); } }
public override byte[] GetEncodedDeltaFrame() { FileInfo assetInfo = GetFileInfo(); DeltaFrame delta = new DeltaFrame(); delta.ConfigurationVersion = m_MetaFrame.ConfigurationVersion; delta.NetworkMessageHeader = new NetworkMessageHeader { PublisherID = new String(m_PublisherID), VersionAndFlags = 0xD1, ExtendedFlags1 = new ExtendedFlags1 { RawValue = 0x04 } }; delta.Flags1.RawValue = 0xEB; delta.Flags2.RawValue = 0x01; delta.Items = new List <DataPointValue> { new File { Path = new String(assetInfo.FullName), Content = GetContent(), Time = assetInfo.LastWriteTimeUtc.ToFileTimeUtc(), FileType = new String("asset") } }; delta.MetaFrame = m_MetaFrame; delta.PayloadHeader = new DataSetPayloadHeader { Count = 1, DataSetWriterID = new ushort[] { 2000 } }; delta.FieldCount = (ushort)delta.Items.Count; delta.FieldIndexList = new List <ushort> { 0 }; byte[] result = null; using (MemoryStream outputStream = new MemoryStream()) { delta.Encode(outputStream); result = outputStream.ToArray(); } return(result); }