Esempio n. 1
0
        /// <summary>
        ///     "Reimagines" a well-formatted XML file using a renderer of your choice.
        /// </summary>
        /// <param name="messageFilePath">XML file containing SMS log</param>
        /// <param name="outputPath">directory in which to place output</param>
        /// <param name="mapper"><see cref="IMessageMapper" /> for configuring AutoMapper</param>
        /// <param name="renderer"><see cref="IConversationRenderer" /> with which to process the data</param>
        public static void Process(
                string messageFilePath,
                string outputPath,
                IMessageMapper mapper,
                IConversationRenderer renderer )
        {
            mapper.Configure();
            Directory.CreateDirectory( outputPath );

            var serializer = new XmlSerializer( typeof(smses) );
            var data = (smses) serializer.Deserialize( new StreamReader( messageFilePath ) );
            var bucket = Mapper.Map<MessageBucket>( data );
            var conversations = bucket.SelectConversations();

            renderer.Render( conversations, outputPath );
        }