• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Web.Site类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中N2.Web.Site的典型用法代码示例。如果您正苦于以下问题:C# Site类的具体用法?C# Site怎么用?C# Site使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Site类属于N2.Web命名空间,在下文中一共展示了Site类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: FileSystemRoot

		public FileSystemRoot(string path, Site site)
		{
			Path = path;
			Readers = new PermissionMap(Permission.Read, new[] { "Administrators", "Editors", "Writers" }, new[] { "admin" });
			Writers = new PermissionMap(Permission.Write, new[] { "Administrators", "Editors", "Writers" }, new[] { "admin" });
			Site = site;
		}
开发者ID:grbbod,项目名称:drconnect-jungo,代码行数:7,代码来源:UploadFolderSource.cs


示例2: GetUploadFolders

 public virtual IEnumerable<string> GetUploadFolders(Site site)
 {
     foreach (var folder in globalFolders)
         yield return folder;
     foreach (var folder in site.UploadFolders)
         yield return folder;
 }
开发者ID:GrimaceOfDespair,项目名称:n2cms,代码行数:7,代码来源:UploadFolderSource.cs


示例3: SiteFilteringLanguageGateway

 public SiteFilteringLanguageGateway(ILanguageGateway languages, Site site, IPersister persister, StructureBoundDictionaryCache<int, LanguageInfo[]> languagesCache, DescendantItemFinder descendantFinder)
 {
     this.languages = languages;
     this.site = site;
     this.persister = persister;
     this.languagesCache = languagesCache;
     this.descendantFinder = descendantFinder;
 }
开发者ID:wrohrbach,项目名称:n2cms,代码行数:8,代码来源:SiteFilteringLanguageGateway.cs


示例4: TranslateSpecification

		public TranslateSpecification(string editUrl, ILanguage language, ContentItem existingItem, ItemDefinition definition, Site site)
		{
			EditUrl = editUrl;
			Language = language;
			ExistingItem = existingItem;
			Definition = definition;
			Site = site;
			IsTranslatable = true;
		}
开发者ID:grbbod,项目名称:drconnect-jungo,代码行数:9,代码来源:TranslateSpecification.cs


示例5: FileSystemRoot

		public FileSystemRoot(FolderElement folder, Site site)
		{
			Path = FixPath(folder.Path);
			if (!string.IsNullOrEmpty(folder.Title))
				Title = folder.Title;
			Readers = folder.Readers.ToPermissionMap(Permission.Read, new[] { "Administrators", "Editors", "Writers" }, new[] { "admin" });
			Writers = folder.Writers.ToPermissionMap(Permission.Write, new[] { "Administrators", "Editors" }, new[] { "admin" });
			Site = site;
		}
开发者ID:navneetccna,项目名称:n2cms,代码行数:9,代码来源:UploadFolderSource.cs


示例6: GetSites

        public IEnumerable<Site> GetSites()
        {
            if (string.IsNullOrEmpty(HostName))
                return new Site[0];

            Site s = new Site((Parent ?? this).ID, ID, HostName);
            s.Wildcards = true;

            return new Site[] { s };
        }
开发者ID:JohnsonYuan,项目名称:n2cms,代码行数:10,代码来源:StartPage.cs


示例7: GetLanguageGateway

        /// <summary>Gets the language gateway manaing translations on the given site.</summary>
        /// <param name="managingTranslationsOnSite">the site whose language gateway to get.</param>
        /// <returns>A language gateway filtering languages.</returns>
        public virtual ILanguageGateway GetLanguageGateway(Site managingTranslationsOnSite)
        {
			var gateway = languages;
            if (Enabled && LanguagesPerSite)
                gateway = new SiteFilteringLanguageGateway(languages, managingTranslationsOnSite, persister, languagesCache, descendantFinder);

			return Cache
				? new CachingLanguageGatewayDecorator(gateway, cacheWrapper, persister, LanguagesPerSite ? managingTranslationsOnSite.StartPageID.ToString() : "global")
				: gateway;
        }
开发者ID:meixger,项目名称:n2cms,代码行数:13,代码来源:LanguageGatewaySelector.cs


示例8: GetSites

		public IEnumerable<Site> GetSites()
		{
			if (string.IsNullOrEmpty(HostName))
				return new Site[0];

			Site s = new Site((Parent ?? this).ID, ID, HostName);
			s.Wildcards = true;
			if (SiteUpload)
				s.UploadFolders.Add(new FileSystemRoot("~/Upload/" + HostName, s) { Title = "Upload (" + HostName + ")" });

			return new Site[] {s};
		}
开发者ID:grbbod,项目名称:drconnect-jungo,代码行数:12,代码来源:StartPage.cs


示例9: GetChildren_OfSite_ReturnsSiteUploadFolders

        public void GetChildren_OfSite_ReturnsSiteUploadFolders()
        {
            fs.CreateDirectory("/siteupload/");
            var start2 = CreateOneItem<RootNode>(2, "start", root);
            var site = new Site(1, 2);
            site.UploadFolders.Add("/siteupload/");
            host.AddSites(new[] { site });
            initializer.Start();

            var defaultresult = vnf.GetChildren("/");
            var siteresult = vnf.GetChildren("/start/");

            Assert.That(defaultresult.Any(c => c.Name == "siteupload"), Is.False);
            Assert.That(siteresult.Any(c => c.Name == "siteupload"), Is.True);
        }
开发者ID:sergheizagaiciuc,项目名称:n2cms,代码行数:15,代码来源:VirtualFolderInitializerTests.cs


示例10: ExtractSites

 public static IList<Site> ExtractSites(HostSection config)
 {
     List<Site> sites = new List<Site>();
     foreach (SiteElement configElement in config.Sites)
     {
         Site s = new Site(configElement.RootID ?? config.RootID, configElement.ID, configElement.Name);
         s.Wildcards = configElement.Wildcards || config.Wildcards;
         foreach (FolderElement folder in configElement.UploadFolders)
             s.UploadFolders.Add(folder.Path);
         foreach (string key in configElement.Settings.AllKeys)
             s.Settings[key] = configElement.Settings[key].Value;
         sites.Add(s);
     }
     return sites;
 }
开发者ID:sergheizagaiciuc,项目名称:n2cms,代码行数:15,代码来源:Host.cs


示例11: ExtractSites

        public static IList<Site> ExtractSites(HostSection config)
        {
            List<Site> sites = new List<Site>();
            foreach (SiteElement configElement in config.Sites)
            {
                Site s = new Site(configElement.RootID ?? config.RootID, configElement.ID, configElement.Name);
                s.Wildcards = configElement.Wildcards || config.Wildcards;

                foreach (FolderElement folder in configElement.UploadFolders.AllElements)
                {
                    if (string.IsNullOrEmpty(folder.Path))
                        throw new ConfigurationErrorsException("Upload path configured for site '" + configElement.Name + "' cannot be empty.");
                    s.UploadFolders.Add(FixPath(folder.Path));
                }
                foreach (string key in configElement.Settings.AllKeys)
                    s.Settings[key] = configElement.Settings[key].Value;
                sites.Add(s);
            }
            return sites;
        }
开发者ID:GrimaceOfDespair,项目名称:n2cms,代码行数:20,代码来源:Host.cs


示例12: LocateStartPage

        private ContentItem LocateStartPage(ContentItem startPageConfigured)
        {
            ContentItem startPage = startPageConfigured;
            lock (_syncLock)
            {               
                if (host.CurrentSite.StartPageID != host.CurrentSite.RootItemID) // only when start <> root
                {
                    if (startPage != null)
                    {
                        if (!(startPage is IStartPage))
                        {
                            logger.WarnFormat("Configured start page is no IStartPage #{0} -> {1}",
                                               host.CurrentSite.StartPageID,
                                               startPage.GetType().FullName);
                            startPage = null;
                        }

                        if (startPage != null && !startPage.IsPublished())
                        {
                            logger.ErrorFormat("Configured start page is not published #{0} -> {1}", startPage.ID,
                                               startPage.GetType().FullName);
                            startPage = null;
                        }
                    }

                    if (startPage == null)
                    {
                        // try to locate start page below root
                        var root = persister.Repository.Get(host.CurrentSite.RootItemID);
                        if (root == null)
                        {
                            // no content?
                            return null;
                        }

                        ItemList children = root.GetChildren(new TypeFilter(typeof (IStartPage)), new PublishedFilter());
                        if (children.Count == 1)
                        {
                            startPage = children[0];
                            logger.InfoFormat("Auto updated start page to #{0} -> {1}", startPage.ID,
                                              startPage.GetType().FullName);
                            var newSite = new Site(root.ID, startPage.ID);
                            host.ReplaceSites(newSite, new List<Site>());
                        }
                    }

                    if (startPage == null)
                        return startPageConfigured; // keep configured
                }
            }
            return startPage;
        }
开发者ID:grbbod,项目名称:drconnect-jungo,代码行数:52,代码来源:UrlParser.cs


示例13: AddSiteFilesNodes

        private void AddSiteFilesNodes(HierarchyNode<ContentItem> parent, Site site, List<ContentItem> selectionTrail)
        {
            var startPage = Engine.Persister.Get(site.StartPageID);
            var sizes = Engine.Resolve<ImageSizeCache>();

            HierarchyNode<ContentItem> node = null;
            foreach(var dir in Engine.GetContentAdapter<NodeAdapter>(startPage).GetChildren(startPage, Interfaces.Managing).OfType<Directory>())
            {
                if (node == null)
                    node = new HierarchyNode<ContentItem>(startPage);
                var directoryNode = CreateDirectoryNode(FS, dir, node, selectionTrail);
                node.Children.Add(directoryNode);
            }

            if (node != null)
                parent.Children.Add(node);
        }
开发者ID:sale42,项目名称:n2cms,代码行数:17,代码来源:Tree.aspx.cs


示例14: GetUploadDirectories

		public virtual IEnumerable<DirectoryData> GetUploadDirectories(Site site)
		{
			foreach (var uploadFolder in site.UploadFolders.Where(uf => uf.Readers.Authorizes(WebContext.User, null, Permission.Read)))
			{
				yield return FileSystem.GetDirectoryOrVirtual(uploadFolder.Path);
			}
		}
开发者ID:EzyWebwerkstaden,项目名称:n2cms,代码行数:7,代码来源:NodeAdapter.cs


示例15: ReplaceSites

    	/// <summary>Replaces the site list with new sites.</summary>
		/// <param name="newDefaultSite">The default site to use.</param>
    	/// <param name="newSites">The new site list.</param>
    	public void ReplaceSites(Site newDefaultSite, IEnumerable<Site> newSites)
        {
            if(newSites == null) throw new ArgumentNullException("newSites");

			var previous = sites;
			sites = new SiteTable(newDefaultSite, newSites);

			var args = new SitesChangedEventArgs();
			args.PreviousDefault = previous.DefaultSite;
			args.PreviousSites = previous.Sites;
			args.CurrentDefault = sites.DefaultSite;
			args.CurrentSites = sites.Sites;

			if (SitesChanged != null)
			{
				SitesChanged.Invoke(this, args);
			}
		}
开发者ID:grbbod,项目名称:drconnect-jungo,代码行数:21,代码来源:Host.cs


示例16: AddSiteFilesNodes

        private void AddSiteFilesNodes(HierarchyNode<ContentItem> parent, Site site, List<ContentItem> selectionTrail)
        {
            var siteNode = Engine.Persister.Get(site.StartPageID);

            HierarchyNode<ContentItem> node = null;
            foreach (DirectoryData dd in Engine.Resolve<IContentAdapterProvider>()
                .ResolveAdapter<NodeAdapter>(siteNode)
                .GetUploadDirectories(site))
            {
                if(node == null)
                    node = new HierarchyNode<ContentItem>(siteNode);
                var dir = new Directory(dd, parent.Current);
                dir.Set(FS);
                var directoryNode = CreateDirectoryNode(FS, dir, node, selectionTrail);
                node.Children.Add(directoryNode);
            }

            if (node != null)
                parent.Children.Add(node);
        }
开发者ID:AnonymousRetard,项目名称:n2cms,代码行数:20,代码来源:Tree.aspx.cs


示例17: GetUploadDirectories

 public virtual IEnumerable<DirectoryData> GetUploadDirectories(Site site)
 {
     foreach (string uploadFolder in site.UploadFolders)
     {
         yield return FileSystem.GetDirectory(uploadFolder);
     }
 }
开发者ID:AnonymousRetard,项目名称:n2cms,代码行数:7,代码来源:NodeAdapter.cs


示例18: Get_UploadFolder_GivesSiteUploadFolder

        public void Get_UploadFolder_GivesSiteUploadFolder()
        {
            fs.CreateDirectory("/siteupload/");
            var start2 = CreateOneItem<RootNode>(2, "start", root);
            var site = new Site(1, 2);
            site.UploadFolders.Add("/siteupload/");
            host.AddSites(new[] { site });
            initializer.Start();
            vnf.Register(nodeProvider);

            var defaultresult = vnf.Get("/siteupload/");
            var siteresult = vnf.Get("/start/siteupload/");

            Assert.That(defaultresult, Is.Null);
            Assert.That(siteresult, Is.Not.Null);
            Assert.That(siteresult.Name, Is.EqualTo("siteupload"));
        }
开发者ID:nicklv,项目名称:n2cms,代码行数:17,代码来源:VirtualFolderInitializerTests.cs


示例19: GetLanguageGateway

        /// <summary>Gets the language gateway manaing translations on the given site.</summary>
        /// <param name="managingTranslationsOnSite">the site whose language gateway to get.</param>
        /// <returns>A language gateway filtering languages.</returns>
        public ILanguageGateway GetLanguageGateway(Site managingTranslationsOnSite)
        {
            if (Enabled && LanguagesPerSite)
                return new SiteFilteringLanguageGateway(languages, managingTranslationsOnSite, persister, languagesCache, descendantFinder);

            return languages;
        }
开发者ID:arp51,项目名称:n2cms,代码行数:10,代码来源:LanguageGatewaySelector.cs


示例20: GetHostedUrl

        private string GetHostedUrl(ContentItem item, string url, Site site)
        {
            if (string.IsNullOrEmpty(site.Authority))
                return item.FindPath(PathData.DefaultAction).GetRewrittenUrl();

            return Url.Parse(url).SetAuthority(site.Authority);
        }
开发者ID:GrimaceOfDespair,项目名称:n2cms,代码行数:7,代码来源:MultipleHostsUrlParser.cs



注:本文中的N2.Web.Site类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Web.Url类代码示例发布时间:2022-05-26
下一篇:
C# Web.PathData类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap