Esempio n. 1
0
        public void RunActions()
        {
            blogServer.Initialize(Server, Username, Password);

            var pipeline = pipelineFactory.Build();
            var files    = fileSystem.FindFiles("*.md");

            foreach (var file in files)
            {
                var post = new BlogPost(file, fileSystem);
                var html = Markdown.ToHtml(post.GetContent(), pipeline);

                var newName = fileSystem.ChangeExtension(file, ".html");
                fileSystem.WriteText(newName, html);

                var response = (BlogPostResponse)null;
                if (post.PostId < 1)
                {
                    response = blogServer.AddPost(post.PublishDate, html, post.Title, slug: null);
                }
                else
                {
                    response = blogServer.UpdatePost(post.PostId, html, post.Title);
                }

                post.PostId = response.Id;
                post.Link   = response.Permalink;
                post.SaveContent();
            }
        }
Esempio n. 2
0
 protected ValidatorPipe(IPipelineFactory <TInput, TContext> factory,
                         LinkedListNode <Pipeline> node)
 {
     if (node != null)
     {
         _nextStep = factory.Build(node);
     }
 }
Esempio n. 3
0
 private void OnAcceptSocket(IAsyncResult ar)
 {
     try
     {
         Socket socket = _listener.EndAcceptSocket(ar);
         _listener.BeginAcceptSocket(OnAcceptSocket, null);
         _logger.Debug("Accepted client from " + socket.RemoteEndPoint);
         var client = new TcpServerChildChannel(_childPipelineFactory.Build(), _bufferPool);
         client.AssignSocket(socket);
         client.StartChannel();
         SendUpstream(new ChildChannelConnected(client));
     }
     catch (Exception err)
     {
         HandleException(err);
     }
 }
Esempio n. 4
0
 /// <summary>
 /// Create a new object which will handle all communication to/from a specific client.
 /// </summary>
 /// <param name="remoteEndPoint">Remote end point</param>
 /// <returns>Created client</returns>
 protected override INetworkService CreateClient(EndPoint remoteEndPoint)
 {
     return(new PipelineNetworkService(_factory.Build()));
 }