示例#1
0
        /// <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());
        }