/// <summary> /// Send a new asset to the Agent /// </summary> /// <param name="asset">The asset</param> public void AddAsset(Asset asset) { UTF8Encoding encoder = new UTF8Encoding(); StringBuilder result = new StringBuilder(); DateTime now = DateTime.UtcNow; result.Append(now.ToString("yyyy-MM-dd\\THH:mm:ss.fffffffK")); result.Append("|@ASSET@|"); result.Append(asset.AssetId); result.Append('|'); result.Append(asset.GetMTCType()); result.Append("|--multiline--ABCD\n"); XmlWriterSettings settings = new XmlWriterSettings(); settings.OmitXmlDeclaration = true; XmlWriter writer = XmlWriter.Create(result, settings); asset.ToXml(writer); writer.Close(); result.Append("\n--multiline--ABCD\n"); SendToAll(result.ToString()); }
/// <summary> /// Send a new asset to the Agent /// </summary> /// <param name="asset">The asset</param> public void AddAsset(Asset asset) { StringBuilder result = new StringBuilder(); DateTime now = DateTime.UtcNow; result.Append(now.ToString(SHDR_TIME_FORMAT)); result.Append("|@ASSET@|"); result.Append(asset.AssetId); result.Append('|'); result.Append(asset.GetMTCType()); result.Append("|--multiline--ABCD\r\n"); XmlWriterSettings settings = new XmlWriterSettings(); settings.OmitXmlDeclaration = true; XmlWriter writer = XmlWriter.Create(result, settings); asset.ToXml(writer); writer.Close(); result.Append("\r\n--multiline--ABCD\r\n"); SendToAll(result.ToString()); }
public void AddAsset(Asset asset) { UTF8Encoding encoding = new UTF8Encoding(); StringBuilder output = new StringBuilder(); output.Append(DateTime.UtcNow.ToString(@"yyyy-MM-dd\THH:mm:ss.fffffffK")); output.Append("|@ASSET@|"); output.Append(asset.AssetId); output.Append('|'); output.Append(asset.GetMTCType()); output.Append("|--multiline--ABCD\n"); XmlWriterSettings settings = new XmlWriterSettings { OmitXmlDeclaration = true }; XmlWriter writer = XmlWriter.Create(output, settings); asset.ToXml(writer); writer.Close(); output.Append("\n--multiline--ABCD\n"); this.SendToAll(output.ToString()); }