Ejemplo n.º 1
0
        public void Execute(LinkInput input, ILinksService links)
        {
            var manifest = links.GetLinkManifest(input.AppFolder);

            if (input.CleanAllFlag && links.LinkManifestExists(input.AppFolder))
            {
                manifest.RemoveAllLinkedFolders();

                links.Save(manifest, input.AppFolder);

                ConsoleWriter.Write("Removed all package links from the manifest file for " + input.AppFolder);

                listCurrentLinks(input.AppFolder, manifest);

                return;
            }



            if (input.BottleFolder.IsNotEmpty())
            {
                updateManifest(links, input, manifest);
            }
            else
            {
                listCurrentLinks(input.AppFolder, manifest);
            }
        }
Ejemplo n.º 2
0
        private void Next()
        {
            HttpHelper httpHelper = new HttpHelper()
            {
            };
            var sr = httpHelper.GetHtml(new HttpItem()
            {
                URL     = spliderInfo.Domain,
                Timeout = 5600
            });

            HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
            doc.LoadHtml(sr.Html);
            var nodes = doc.DocumentNode.Descendants("a").Where(x => x.GetAttributeValue("href", true)).ToList();

            foreach (var node in nodes)
            {
                Links.Add(new LinkModel()
                {
                    Id = nodes.IndexOf(node) + 1, Title = node.InnerHtml, Url = node.GetAttributeValue("href", "")
                });
            }

            IList <LinksModel> models  = Mapper.DynamicMap <IList <LinkModel>, IList <LinksModel> >(Links);
            ILinksService      service = IOCContainer.Instance.Resolve <ILinksService>();

            service.Save(models);
        }
Ejemplo n.º 3
0
        private void updateManifest(ILinksService links, LinkInput input, LinkManifest manifest)
        {
            if (input.RemoveFlag)
            {
                manifest.RemoveLink(input.RelativePathOfPackage());
                ConsoleWriter.Write("Folder {0} was removed from the application at {1}", input.BottleFolder,
                                    input.AppFolder);
            }
            else
            {
                if (input.RemoteFlag)
                {
                    var link = addRemoteLink(input, manifest);
                    Console.WriteLine("Setting remote link " + link);
                }
                else
                {
                    add(input, manifest);
                }
            }

            links.Save(manifest, input.AppFolder);
        }