예제 #1
0
 internal static void SaveSnifferAsXml(InMemorySniffer sniffer, string fileName, string xslTransform)
 {
     using (XmlFileSniffer output = new XmlFileSniffer(fileName, xslTransform, BinaryPresentationMethod.ByteCount))
     {
         sniffer?.Replay(output);
     }
 }
예제 #2
0
 internal static void SaveSnifferAsText(InMemorySniffer sniffer, string fileName)
 {
     using (TextFileSniffer output = new TextFileSniffer(fileName, BinaryPresentationMethod.ByteCount))
     {
         sniffer?.Replay(output);
     }
 }
예제 #3
0
        /// <summary>
        /// Converts the latest Xmpp communication that the sniffer holds to xml.
        /// </summary>
        /// <param name="sniffer">The sniffer whose contents to get.</param>
        /// <returns>The xmpp communication in xml.</returns>
        public static string SnifferToXml(this InMemorySniffer sniffer)
        {
            XmlWriterSettings settings = new XmlWriterSettings()
            {
                Encoding            = Encoding.UTF8,
                Indent              = true,
                IndentChars         = "  ",
                ConformanceLevel    = ConformanceLevel.Auto,
                NewLineChars        = Environment.NewLine,
                NewLineHandling     = NewLineHandling.Replace,
                NewLineOnAttributes = false
            };

            return(SnifferToXml(sniffer, settings));
        }
예제 #4
0
        internal static string SnifferToXml(InMemorySniffer sniffer, XmlWriterSettings settings)
        {
            if (sniffer is null)
            {
                return(string.Empty);
            }

            StringBuilder sb = new StringBuilder();

            using (XmlWriter writer = XmlWriter.Create(sb, settings))
                using (XmlWriterSniffer output = new XmlWriterSniffer(writer, BinaryPresentationMethod.ByteCount))
                {
                    sniffer.Replay(output);
                }

            return(sb.ToString());
        }
예제 #5
0
        /// <summary>
        /// Converts the latest Xmpp communication that the sniffer holds to plain text.
        /// </summary>
        /// <param name="sniffer">The sniffer whose contents to get.</param>
        /// <returns>The xmpp communication in plain text.</returns>
        public static string SnifferToText(this InMemorySniffer sniffer)
        {
            if (sniffer is null)
            {
                return(string.Empty);
            }

            StringBuilder sb = new StringBuilder();

            using (StringWriter writer = new StringWriter(sb))
                using (TextWriterSniffer output = new TextWriterSniffer(writer, BinaryPresentationMethod.ByteCount))
                {
                    sniffer.Replay(output);
                }

            return(sb.ToString());
        }
예제 #6
0
 public NeuronService(
     Assembly appAssembly,
     ITagProfile tagProfile,
     IUiDispatcher uiDispatcher,
     INetworkService networkService,
     ILogService logService,
     ISettingsService settingsService,
     Profiler startupProfiler)
 {
     this.appAssembly     = appAssembly;
     this.networkService  = networkService;
     this.logService      = logService;
     this.tagProfile      = tagProfile;
     this.settingsService = settingsService;
     this.contracts       = new NeuronContracts(this.tagProfile, uiDispatcher, this, this.logService, this.settingsService);
     this.muc             = new NeuronMultiUserChat(this.tagProfile, uiDispatcher, this, this.logService);
     this.thingRegistry   = new NeuronThingRegistry(this.tagProfile, uiDispatcher, this, this.logService);
     this.sniffer         = new InMemorySniffer(250);
     this.startupProfiler = startupProfiler;
 }