public static SiteNode GetFilledSiteNode(string rootUri, IHttpResponseProvider httpResponseProvider)
        {
            var rootNode = new SiteNode(rootUri);

            if (UriHelper.IsMediaFile(rootUri))
            {
                try
                {
                    rootNode.Media = httpResponseProvider.RequestLinkBytes(rootUri);
                    _performanceHelper.Increment(Counters.SuccessfullHttpRequests);
                }
                catch
                {
                    rootNode.Media = new byte[0];
                    _performanceHelper.Increment(Counters.FailedHttpRequests);
                }
            }
            else
            {
                try
                {
                    rootNode.Html = httpResponseProvider.RequestHttpLayout(rootUri);
                    _performanceHelper.Increment(Counters.SuccessfullHttpRequests);
                }
                catch
                {
                    rootNode.Html = string.Empty;
                    _performanceHelper.Increment(Counters.FailedHttpRequests);
                }
            }

            NLogger.Logger.Info($"{rootUri} has been handled.");

            return(rootNode);
        }
Example #2
0
 public void saveSlaveData(SiteNode args)
 {
     ownData.name   = args.name;
     ownData.father = args.father;
     ownData.port   = args.port;
     remotePMservice.RegisterSlaves(args);
 }
Example #3
0
        protected override void Start()
        {
            base.Start();
            if (!(HighLogic.LoadedSceneIsFlight || HighLogic.LoadedScene == GameScenes.TRACKSTATION))
            {
                return;
            }
            Debug.Log($"[RACN UI] Start() in {HighLogic.LoadedScene}");
            configWindow        = gameObject.AddComponent <NetUIConfigurationWindow>();
            configWindow.parent = this;

            if (MapView.fetch is MapView map)
            {
                Texture2D defaultTex = GameDatabase.Instance.GetTexture(icon, false);
                foreach (RACommNetHome home in GameObject.FindObjectsOfType <RACommNetHome>())
                {
                    MapUI.GroundStationSiteNode gs = new MapUI.GroundStationSiteNode(home.Comm as RACommNode);
                    SiteNode  siteNode             = SiteNode.Spawn(gs);
                    Texture2D stationTexture       = (GameDatabase.Instance.GetTexture(home.icon, false) is Texture2D tex) ? tex : defaultTex;
                    siteNode.wayPoint.node.SetIcon(Sprite.Create(stationTexture, new Rect(0, 0, stationTexture.width, stationTexture.height), new Vector2(0.5f, 0.5f), 100f));
                    //                    MapView.fetch.siteNodes.Add(SiteNode.Spawn(gs));
                }

//                RAOrbitRenderer.ReplaceOrbitRenderers();
            }
            RATelemetryUpdate.Install();
        }
Example #4
0
 public PuppetSlave()
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     brokersRegistry    = new Dictionary <string, string>();
     allProcess         = new Dictionary <string, string>();
     ownData            = new SiteNode();
     form               = new SlaveRegisterForm();
     channel            = new TcpChannel();
     urlFather          = "";
     remoteSlaveService = new RemotePSlaveService();
     allSlaveProcesses  = new List <Process>();
     RemotingServices.Marshal(remoteSlaveService, "Slave",
                              typeof(RemotePSlaveService));
     ChannelServices.RegisterChannel(channel, false);
     form.addMsgToLog   += new DelAddMsgToLog(addMsgToLog);
     form.setServer     += new DelSetServerInterface(setServerInterface);
     form.registerSlave += new DelRegisterSlave(saveSlaveData);
     form.setTCP        += new DelsSetTCPChanel(setTCPChanel);
     remoteSlaveService.sendMsgToLog   += new DelAddMsgToLog(addMsgToLog);
     remoteSlaveService.getData        += new DelGetSlaveData(getData);
     remoteSlaveService.start          += new DelStartProcess(startProcess);
     remoteSlaveService.registerBroker += new DelStartProcess(registerBroker);
     remoteSlaveService.handShake      += new DelRelation(fatherHandShake);
     remoteSlaveService.myUrlBroker    += new DelSomeInfo(getBrokerUrl);
     remoteSlaveService.addFather      += new DelRelation(childHandShake);
     remoteSlaveService.myFatherUrl    += new DelSomeInfo(getMyFatherUrl);
     remoteSlaveService.searchProcess  += new DelGetInfo(verifyProcessName);
     remoteSlaveService.deliveryMaster += new DelAddMsgToLog(addMsgToLogMaster);
     remoteSlaveService.status         += new DelIniciateRelation(getStatus);
     remoteSlaveService.removeProcess  += new DelFlooding(removeProcessFromList);
 }
Example #5
0
        public ActionResult WebSiteMap()
        {
            var      provider = SiteMap.Provider;
            SiteNode list     = new SiteNode();

            list.children = new List <SiteNode>();
            foreach (SiteMapNode item in provider.RootNode.ChildNodes)
            {
                SiteNode node = new SiteNode {
                    text = item.Title, iconCls = item.Description, url = item.Url
                };
                foreach (SiteMapNode childItem in item.ChildNodes)
                {
                    if (node.children == null)
                    {
                        node.children = new List <SiteNode>();
                    }
                    SiteNode childNode = new SiteNode {
                        text = childItem.Title, iconCls = childItem.Description, url = childItem.Url
                    };
                    node.children.Add(childNode);
                }
                list.children.Add(node);
            }
            return(Json(list));
        }
        public static SiteNode GetFilledSiteNode(string rootUri, IHttpResponseProvider httpResponseProvider)
        {
            var rootNode = new SiteNode(rootUri);

            if (UriHelper.IsMediaFile(rootUri))
            {
                try
                {
                    rootNode.Media = httpResponseProvider.RequestLinkBytes(rootUri);
                }
                catch
                {
                    rootNode.Media = new byte[0];
                }
            }
            else
            {
                try
                {
                    rootNode.Html = httpResponseProvider.RequestHttpLayout(rootUri);
                }
                catch
                {
                    rootNode.Html = string.Empty;
                }
            }

            return(rootNode);
        }
Example #7
0
        private static SelectListItemTree CreateItem(SiteNode siteNode, RequestContext requestContext)
        {
            if (siteNode == null)
            {
                return(new SelectListItemTree());
            }

            var selectListItem = new SelectListItemTree();

            var site = Kooboo.CMS.Sites.Models.IPersistableExtensions.AsActual(siteNode.Site);

            selectListItem.Text  = string.IsNullOrEmpty(site.DisplayName) ? site.Name : site.DisplayName;
            selectListItem.Value = site.FullName;

            string parent = requestContext.GetRequestValue("parent");

            selectListItem.Selected = site.FullName.EqualsOrNullEmpty(parent, StringComparison.CurrentCultureIgnoreCase);

            var children = siteNode.Children;
            var items    = new List <SelectListItemTree>();

            foreach (var c in children)
            {
                items.Add(CreateItem(c, requestContext));
            }
            selectListItem.Items = items;
            return(selectListItem);
        }
Example #8
0
        public override BaseNode GenerateRootNode()
        {
            if (Context.Url.Contains("-admin"))
            {
                // We're connected to the Admin URL. Load the Tenant object
                Tenant tenant = new Tenant(Context);
                tenant.EnsureProperties(t => t.RootSiteUrl);

                BaseNode rootNode = new TenantNode(tenant);
                rootNode.Title         = "Tenant " + rootNode.Title;
                rootNode.NodeConnector = this;
                rootNode.OMType        = ObjectModelType.REMOTE;
                rootNode.SPObject      = tenant;
                DoTenant(tenant, rootNode, rootNode);


                return(rootNode);
            }
            else
            {
                Microsoft.SharePoint.Client.Site site = Context.Site;
                Context.Load(site);
                Context.ExecuteQuery();
                BaseNode rootNode = new SiteNode(site);
                rootNode.Title         = RootNodeTitle + rootNode.Title;
                rootNode.NodeConnector = this;
                rootNode.OMType        = ObjectModelType.REMOTE;
                rootNode.SPObject      = site;
                rootNode.LoadedData    = true;
                DoSPWeb(site.RootWeb, rootNode, rootNode);
                return(rootNode);
            }
        }
Example #9
0
 public void SaveScreenshotAsPng(SiteNode node)
 {
     using (var ms = new MemoryStream(node.Screenshot))
     {
         var img = Image.FromStream(ms);
         img.Save(folderPath + node.Name + ".png");
     }
 }
Example #10
0
 public void SaveScreenshotAsJpg(SiteNode node)
 {
     using (var ms = new MemoryStream(node.Screenshot))
     {
         var img = Image.FromStream(ms);
         //img.Save(folderPath + node.Name + ".jpg");
         img.Save(folderPath + InvalidFileRegex.Replace(node.Name, string.Empty) + ".jpg");
     }
 }
 public static IEnumerable <string> GetSiteNodeUriParts(SiteNode node)
 {
     return(node.Uri.Split(new[] { UrlSchemeSeparator }, StringSplitOptions.None).Last().Split('/')
            .Where(part => !string.IsNullOrEmpty(part))
            .Select(part => !part.Contains("?") ? part : Regex.Match(part, UriWithoutParamsRegexString).Value.TrimEnd('?'))
            .Select(part => !part.Contains("#") ? part : Regex.Match(part, UriWithoutTagsRegexString).Value.TrimEnd('#'))
            .Select(part => !part.Contains("mailto") ? part : Regex.Match(part, UriWithoutMailToRegexString).Value)
            .ToList());
 }
Example #12
0
 public static void Print(SiteNode node)
 {
     counterOfSites++;
     Console.WriteLine($"!Current site tittle: {node.Name} |{counterOfSites}");
     foreach (var element in node.Links)
     {
         Console.WriteLine(element.Text);
     }
     Console.WriteLine();
 }
        public static IEnumerable <string> GetSiteNodeLinks(string rootUri, SiteNode node, TransitionToOtherDomainsLimits transactionLimits, IHtmlCrawler htmlCrawler)
        {
            var links = htmlCrawler.FindHtmlPageLinks(node.Html).Where(UriHelper.IsValidLink);

            var result = FilterLinksAccordingToTransitionToOtherDomainsLimits(rootUri, links, transactionLimits);

            NLogger.Logger.Info($"{result.Count()} links found for uri {node.Uri}");

            return(result);
        }
Example #14
0
        private void register_click(object sender, EventArgs e)
        {
            addMsgToLog("Registering Slaves::");
            setTCP(portBox.Text);
            SiteNode data = new SiteNode();

            data.port   = portBox.Text;
            data.name   = nameBox.Text;
            data.father = fatherBox.Text;
            registerSlave(data);
        }
Example #15
0
        public virtual SiteNode GetSiteNode(Site site)
        {
            SiteNode siteNode = new SiteNode()
            {
                Site = site.AsActual()
            };

            siteNode.Children = ChildSites(site)
                                .Select(it => GetSiteNode(it))
                                .Where(it => it != null);

            return(siteNode);
        }
Example #16
0
        public static string PrintSingleNodeToForm(SiteNode node)
        {
            string value = "";

            counterOfSites++;
            value += ($"!Current site tittle: {node.Name} |{counterOfSites}");
            foreach (var element in node.Links)
            {
                value += (element.Text + "\n");
            }
            value += "\n";
            return(value);
        }
Example #17
0
        protected virtual SiteNode GetSiteNodeFromReader(IDataReader reader)
        {
            SiteNode siteNode = new SiteNode()
            {
                Id = (Guid)reader["Id"],
                ItemId = (Guid)reader["ItemId"],
                DisplayOnMainMenu = (bool)reader["DisplayOnMainMenu"],
                DisplayOnSideMenu = (bool)reader["DisplayOnSideMenu"],
                ParentId = (Guid)reader["ParentId"],
                SortOrder = (int)reader["SortOrder"],
                Title = reader["Title"].ToString(),
                Url = reader["Url"].ToString()
            };

            return siteNode;
        }
        public static void WriteSiteNodeToFileSystem(SiteNode node, string writePath)
        {
            File.Create(writePath).Close();

            if (node.Media != null)
            {
                FileSystemHelper.CreateImageFile(writePath, node.Media);
            }
            else if (!string.IsNullOrEmpty(node.Html))
            {
                FileSystemHelper.CreateTextFile(writePath, node.Html);
            }
            else
            {
                throw new InvalidOperationException($"Strange link (-_-): {node.Uri} ");
            }
        }
Example #19
0
        protected virtual SiteNode GetSiteNode(Site site, string userName)
        {
            if (ServiceFactory.UserManager.Authorize(site, userName))
            {
                SiteNode siteNode = new SiteNode()
                {
                    Site = site.AsActual()
                };

                siteNode.Children = ChildSites(site)
                                    .Select(it => GetSiteNode(it, userName))
                                    .Where(it => it != null);

                return(siteNode);
            }
            return(null);
        }
Example #20
0
        private static void CreateItem(SiteNode siteNode, RequestContext requestContext, List <SelectListItem> list)
        {
            var selectListItem = new SelectListItem();

            list.Add(selectListItem);
            if (siteNode != null)
            {
                var site = (siteNode.Site).AsActual();
                selectListItem.Text  = site.FriendlyName;
                selectListItem.Value = site.FullName;

                siteNode.Children.ForEach((node, index) =>
                {
                    CreateItem(node, requestContext, list);
                });
            }
        }
Example #21
0
        private static void SetPathsDijkstra(List <SiteNode> siteList)
        {
            List <SiteNode> sites = new List <SiteNode>(siteList);

            foreach (SiteNode node in sites)
            {
                node.Distance = double.MaxValue;
                node.Previous = null;
            }

            if (sites.Count > 0)
            {
                sites.First().Distance = 0;
            }

            while (sites.Count > 0)
            {
                SiteNode current = sites.First();
                foreach (SiteNode site in sites)
                {
                    if (site.Distance < current.Distance)
                    {
                        current = site;
                    }
                }

                if (current.Distance == double.MaxValue)
                {
                    break;
                }

                sites.Remove(current);


                foreach (SitePath path in current.Paths)
                {
                    double distance = current.Distance + path.Weight;
                    if (distance < path.SiteNode.Distance)
                    {
                        path.SiteNode.Distance = distance;
                        path.SiteNode.Previous = current;
                    }
                }
            }
        }
 public override void Add(SiteNode node)
 {
     using (SqlConnection cn = new SqlConnection(this.ConnectionString))
     {
         SqlCommand cmd = new SqlCommand("SharpCMS_SiteNodes_AddSiteNode", cn);
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.Add("@Id", SqlDbType.UniqueIdentifier).Value = node.Id;
         cmd.Parameters.Add("@ParentId", SqlDbType.UniqueIdentifier).Value = node.ParentId;
         cmd.Parameters.Add("@Title", SqlDbType.NVarChar).Value = node.Title;
         cmd.Parameters.Add("@DisplayOnMainMenu", SqlDbType.Bit).Value = node.DisplayOnMainMenu;
         cmd.Parameters.Add("@DisplayOnSideMenu", SqlDbType.Bit).Value = node.DisplayOnSideMenu;
         cmd.Parameters.Add("@ItemId", SqlDbType.UniqueIdentifier).Value = node.ItemId;
         cmd.Parameters.Add("@SortOrder", SqlDbType.Int).Value = node.SortOrder;
         cmd.Parameters.Add("@Url", SqlDbType.NVarChar).Value = node.Url;
         cn.Open();
         int ret = ExecuteNonQuery(cmd);
     }
 }
Example #23
0
        //private static void SetPathsDijkstra(List<SiteNode> siteList)
        //{
        //    List<SiteNode> sites = new List<SiteNode>(siteList);
        //    foreach (SiteNode node in sites)
        //    {
        //        node.Distance = double.MaxValue;
        //        node.Previous = null;
        //    }

        //    if (sites.Count > 0)
        //    {
        //        sites.First().Distance = 0;
        //    }

        //    while (sites.Count > 0)
        //    {
        //        SiteNode current = sites.First();
        //        foreach (SiteNode site in sites)
        //        {
        //            if (site.Distance < current.Distance)
        //            {
        //                current = site;
        //            }
        //        }

        //        if (current.Distance == double.MaxValue)
        //        {
        //            break;
        //        }

        //        sites.Remove(current);


        //        foreach (SitePath path in current.Paths)
        //        {
        //            double distance = current.Distance + path.Weight;
        //            if (distance < path.SiteNode.Distance)
        //            {
        //                path.SiteNode.Distance = distance;
        //                path.SiteNode.Previous = current;
        //            }
        //        }
        //    }
        //}

        private static void SetPathsPrim(List <SiteNode> siteList)
        {
            List <SiteNode> sites = new List <SiteNode>(siteList);

            foreach (SiteNode node in sites)
            {
                node.Distance = double.MaxValue;
                node.Previous = null;
            }

            SiteNode current = null;

            if (sites.Count > 0)
            {
                sites.First().Distance = 0;
                current = sites.First();
            }
            while (sites.Count > 0)
            {
                foreach (SitePath path in current.Paths)
                {
                    if (path.Weight < path.SiteNode.Distance && sites.Contains(path.SiteNode))
                    {
                        path.SiteNode.Distance = path.Weight;
                        path.SiteNode.Previous = current;
                    }
                }

                sites.Remove(current);
                current.Distance = double.MaxValue;
                foreach (SiteNode site in sites)
                {
                    if (site.Distance < current.Distance)
                    {
                        current = site;
                    }
                }

                if (current.Distance == double.MaxValue)
                {
                    break;
                }
            }
        }
        public override void update()
        {
            CswNbtMetaDataNodeType SiteNt = _CswNbtSchemaModTrnsctn.MetaData.getNodeType("Site");

            if (null != SiteNt && SiteNt.getObjectClass().ObjectClass == CswEnumNbtObjectClass.LocationClass)
            {
                foreach (CswNbtObjClassLocation SiteNode in SiteNt.getNodes(true, false, false, false))
                {
                    if (SiteNode.Name.Text == "Site 1")
                    {
                        SiteNode.IsDemo    = false;
                        SiteNode.Name.Text = "Default Site"; //Sitename cannot be changed do to unique constraint.
                        SiteNode.postChanges(ForceUpdate: false);
                        break;
                    }
                }
            }

            CswNbtMetaDataObjectClass InventoryGroupClass = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(CswEnumNbtObjectClass.InventoryGroupClass);

            foreach (CswNbtObjClassInventoryGroup InventoryGroup in InventoryGroupClass.getNodes(true, false, false, false))
            {
                if (InventoryGroup.Name.Text == "Default Inventory Group")
                {
                    InventoryGroup.IsDemo = false;
                    InventoryGroup.postChanges(ForceUpdate: false);
                    break;
                }
            }

            CswNbtMetaDataObjectClass WorkUnitClass = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(CswEnumNbtObjectClass.WorkUnitClass);

            foreach (CswNbtObjClassWorkUnit WorkUnit in WorkUnitClass.getNodes(true, false, false, false))
            {
                if (WorkUnit.Name.Text == "Default Work Unit")
                {
                    WorkUnit.IsDemo = false;
                    WorkUnit.postChanges(ForceUpdate: false);
                    break;
                }
            }
        }
Example #25
0
        protected override void Start()
        {
            base.Start();
            if (!(HighLogic.LoadedSceneIsFlight || HighLogic.LoadedScene == GameScenes.TRACKSTATION))
            {
                return;
            }

            if (MapView.fetch is MapView)
            {
                Texture2D defaultTex = GameDatabase.Instance.GetTexture(icon, false);
                foreach (RACommNetHome home in FindObjectsOfType <RACommNetHome>())
                {
                    MapUI.GroundStationSiteNode gs = new MapUI.GroundStationSiteNode(home.Comm);
                    SiteNode  siteNode             = SiteNode.Spawn(gs);
                    Texture2D stationTexture       = (GameDatabase.Instance.GetTexture(home.icon, false) is Texture2D tex) ? tex : defaultTex;
                    siteNode.wayPoint.node.SetIcon(Sprite.Create(stationTexture, new Rect(0, 0, stationTexture.width, stationTexture.height), new Vector2(0.5f, 0.5f), 100f));
                    siteNode.wayPoint.node.OnUpdateVisible += home.OnUpdateVisible;
                }
            }
            RATelemetryUpdate.Install();
        }
Example #26
0
        protected virtual SiteNode GetSiteNode(Site site, string userName)
        {
            var visible = string.IsNullOrEmpty(userName) || ServiceFactory.UserManager.Authorize(site, userName);

            SiteNode siteNode = new SiteNode()
            {
                Site = site.AsActual()
            };

            siteNode.Children = ChildSites(site)
                                .Select(it => GetSiteNode(it, userName))
                                .Where(it => it != null);

            if (visible == true || siteNode.Children.Count() > 0)
            {
                return(siteNode);
            }
            else
            {
                return(null);
            }
        }
Example #27
0
        public static void PrintAlsoToTxtFile(SiteNode node, string pathToFile)
        {
            string pathWithFilename = pathToFile + "consoleLog.txt";

            if (counterOfSites == 1)
            {
                File.WriteAllText(pathWithFilename, null);
            }


            using (StreamWriter writer = File.AppendText(pathWithFilename))
            {
                writer.AutoFlush = true;
                writer.WriteLine($"!Current site tittle: {node.Name} |{counterOfSites}");
                foreach (var element in node.Links)
                {
                    writer.WriteLine(element.Text);
                }
                writer.WriteLine();
                writer.Flush();
            }
        }
        public static void WriteSiteNodeToFileSystem(SiteNode node, string writePath)
        {
            File.Create(writePath).Close();

            if (node.Media != null)
            {
                FileSystemHelper.CreateImageFile(writePath, node.Media);

                NLogger.Logger.Info($"Image has been copied to {writePath}");
            }
            else if (!string.IsNullOrEmpty(node.Html))
            {
                FileSystemHelper.CreateTextFile(writePath, node.Html);

                NLogger.Logger.Info($"Html page has been copied to {writePath}.");
            }
            else
            {
                NLogger.Logger.Error($"Strange link can not be handled (-_-): {node.Uri}");

                throw new InvalidOperationException($"Strange link (-_-): {node.Uri}");
            }
        }
 public override void Save(SiteNode node)
 {
     //TODO: Implement method
 }
Example #30
0
 public abstract void Add(SiteNode node);
Example #31
0
        public static void Init()
        {
            Guid id = Guid.NewGuid();

            _nodes = new List<SiteNode>();
            _articles = new List<Article>();

            Article homeArticle = new Article()
            {
                Abstract = "Home Page Abstract",
                Created = DateTime.Now,
                CreatedBy = "Admin",
                Description = "Home Page Description",
                Id = Guid.NewGuid(),
                IsActive = true,
                Keywords = "Home Page Keywords",
                ParentId = Guid.Empty,
                Text = "<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas porttitor congue massa. Fusce " +
                       "posuere, magna sed pulvinar ultricies, purus lectus malesuada libero, sit amet commodo magna eros " +
                       "quis urna. Nunc viverra imperdiet enim. Fusce est. Vivamus a tellus." +
                       "</p>" +
                       "<p>" +
                       "Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. " +
                       "Proin pharetra nonummy pede. Mauris et orci. Aenean nec lorem. In porttitor. Donec laoreet " +
                       "nonummy augue." +
                       "</p>" +
                       "<p>" +
                       "Suspendisse dui purus, scelerisque at, vulputate vitae, pretium mattis, nunc. Mauris eget neque " +
                       "at sem venenatis eleifend. Ut nonummy. Fusce aliquet pede non pede. Suspendisse dapibus lorem " +
                       "pellentesque magna. Integer nulla." +
                       "</p>",
                Title = "Волонтерство",
                Updated = DateTime.Now,
                UpdatedBy = "Admin"
            };

            Article newsArticle = new Article()
            {
                Abstract = "News Page Abstract",
                Created = DateTime.Now,
                CreatedBy = "Admin",
                Description = "News Page Description",
                Id = Guid.NewGuid(),
                IsActive = true,
                Keywords = "News Page Keywords",
                ParentId = homeArticle.Id,
                Text = "<p>News Page Text</p>",
                Title = "Новости",
                Updated = DateTime.Now,
                UpdatedBy = "Admin"
            };

            Article actionsArticle = new Article()
            {
                Abstract = "Actions Page Abstract",
                Created = DateTime.Now,
                CreatedBy = "Admin",
                Description = "Actions Page Description",
                Id = Guid.NewGuid(),
                IsActive = true,
                Keywords = "Actions Page Keywords",
                ParentId = homeArticle.Id,
                Text = "<p>Actions Page Text</p>",
                Title = "Акции",
                Updated = DateTime.Now,
                UpdatedBy = "Admin"
            };

            Article companyArticle = new Article()
            {
                Abstract = "Company Page Abstract",
                Created = DateTime.Now,
                CreatedBy = "Admin",
                Description = "Company Page Description",
                Id = Guid.NewGuid(),
                IsActive = true,
                Keywords = "Company Page Keywords",
                ParentId = homeArticle.Id,
                Text = "<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas porttitor congue massa. Fusce " +
                       "posuere, magna sed pulvinar ultricies, purus lectus malesuada libero, sit amet commodo magna eros " +
                       "quis urna. Nunc viverra imperdiet enim. Fusce est. Vivamus a tellus." +
                       "</p>" +
                       "<p>" +
                       "Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. " +
                       "Proin pharetra nonummy pede. Mauris et orci. Aenean nec lorem. In porttitor. Donec laoreet " +
                       "nonummy augue." +
                       "</p>" +
                       "<p>" +
                       "Suspendisse dui purus, scelerisque at, vulputate vitae, pretium mattis, nunc. Mauris eget neque " +
                       "at sem venenatis eleifend. Ut nonummy. Fusce aliquet pede non pede. Suspendisse dapibus lorem " +
                       "pellentesque magna. Integer nulla." +
                       "</p>",
                Title = "О Центре",
                Updated = DateTime.Now,
                UpdatedBy = "Admin"
            };

            Article contactsArticle = new Article()
            {
                Abstract = "Contact Page Abstract",
                Created = DateTime.Now,
                CreatedBy = "Admin",
                Description = "Contact Page Description",
                Id = Guid.NewGuid(),
                IsActive = true,
                Keywords = "Contact Page Keywords",
                ParentId = companyArticle.Id,
                Text = "<p>Contact Page Text</p>",
                Title = "Контакты",
                Updated = DateTime.Now,
                UpdatedBy = "Admin"
            };

            Article historyArticle = new Article()
            {
                Abstract = "History Page Abstract",
                Created = DateTime.Now,
                CreatedBy = "Admin",
                Description = "History Page Description",
                Id = Guid.NewGuid(),
                IsActive = true,
                Keywords = "History Page Keywords",
                ParentId = companyArticle.Id,
                Text = "<p>History Page Text</p>",
                Title = "История",
                Updated = DateTime.Now,
                UpdatedBy = "Admin"
            };

            Article otherArticle = new Article()
            {
                Abstract = "Other Page Abstract",
                Created = DateTime.Now,
                CreatedBy = "Admin",
                Description = "Other Page Description",
                Id = Guid.NewGuid(),
                IsActive = true,
                Keywords = "Other Page Keywords",
                ParentId = historyArticle.Id,
                Text = "<p>Other Page Text</p>",
                Title = "Они",
                Updated = DateTime.Now,
                UpdatedBy = "Admin"
            };

            _articles.Add(homeArticle);
            _articles.Add(newsArticle);
            _articles.Add(actionsArticle);
            _articles.Add(companyArticle);
            _articles.Add(contactsArticle);
            _articles.Add(historyArticle);
            _articles.Add(otherArticle);

            SiteNode homeNode = new SiteNode()
            {
                ItemId = homeArticle.Id,
                DisplayOnMainMenu = false,
                DisplayOnSideMenu = false,
                Id = id,
                ParentId = Guid.Empty,
                SortOrder = 500,
                Title = homeArticle.Title,
                Url = "/Default.aspx"
            };

            id = Guid.NewGuid();
            SiteNode newsNode = new SiteNode()
            {
                ItemId = newsArticle.Id,
                DisplayOnMainMenu = true,
                DisplayOnSideMenu = true,
                Id = id,
                ParentId = homeNode.Id,
                SortOrder = 500,
                Title = newsArticle.Title,
                Url = "/Article.aspx?Id=" + newsArticle.Id.ToString()
            };

            id = Guid.NewGuid();
            SiteNode actionsNode = new SiteNode()
            {
                ItemId = actionsArticle.Id,
                DisplayOnMainMenu = true,
                DisplayOnSideMenu = true,
                Id = id,
                ParentId = homeNode.Id,
                SortOrder = 500,
                Title = actionsArticle.Title,
                Url = "/Article.aspx?Id=" + actionsArticle.Id.ToString()
            };

            id = Guid.NewGuid();
            SiteNode companyNode = new SiteNode()
            {
                ItemId = companyArticle.Id,
                DisplayOnMainMenu = true,
                DisplayOnSideMenu = true,
                Id = id,
                ParentId = homeNode.Id,
                SortOrder = 500,
                Title = companyArticle.Title,
                Url = "/Article.aspx?Id=" + companyArticle.Id.ToString()
            };

            id = Guid.NewGuid();
            SiteNode contactNode = new SiteNode()
            {
                ItemId = contactsArticle.Id,
                DisplayOnMainMenu = false,
                DisplayOnSideMenu = true,
                Id = id,
                ParentId = companyNode.Id,
                SortOrder = 500,
                Title = contactsArticle.Title,
                Url = "/Article.aspx?Id=" + contactsArticle.Id.ToString()
            };

            id = Guid.NewGuid();
            SiteNode historyNode = new SiteNode()
            {
                ItemId = historyArticle.Id,
                DisplayOnMainMenu = false,
                DisplayOnSideMenu = true,
                Id = id,
                ParentId = companyNode.Id,
                SortOrder = 500,
                Title = historyArticle.Title,
                Url = "/Article.aspx?Id=" + historyArticle.Id.ToString()
            };

            id = Guid.NewGuid();
            SiteNode otherNode = new SiteNode()
            {
                ItemId = otherArticle.Id,
                DisplayOnMainMenu = false,
                DisplayOnSideMenu = true,
                Id = id,
                ParentId = historyNode.Id,
                SortOrder = 500,
                Title = otherArticle.Title,
                Url = "/Article.aspx?Id=" + otherArticle.Id.ToString()
            };

            _nodes.Add(homeNode);
            _nodes.Add(newsNode);
            _nodes.Add(actionsNode);
            _nodes.Add(companyNode);
            _nodes.Add(contactNode);
            _nodes.Add(historyNode);
            _nodes.Add(otherNode);
        }
Example #32
0
 public SitePath(double distance, SiteNode siteNode)
 {
     Weight = distance; SiteNode = siteNode;
 }
Example #33
0
 public abstract void Save(SiteNode node);
        public static IEnumerable <string> GetSiteNodeLinks(string rootUri, SiteNode node, TransitionToOtherDomainsLimits transactionLimits, IHtmlCrawler htmlCrawler)
        {
            var links = htmlCrawler.FindHtmlPageLinks(node.Html).Where(UriHelper.IsValidLink);

            return(FilterLinksAccordingToTransitionToOtherDomainsLimits(rootUri, links, transactionLimits));
        }
Example #35
0
 public SitePath(double distance, SiteNode siteNode) { Weight = distance; SiteNode = siteNode; }
 public void Save(SiteNode node)
 {
     throw new NotImplementedException();
 }