当前位置: 首页>>代码示例>>C#>>正文


C# Federation.ContentBaseForNamespace方法代码示例

本文整理汇总了C#中FlexWiki.Federation.ContentBaseForNamespace方法的典型用法代码示例。如果您正苦于以下问题:C# Federation.ContentBaseForNamespace方法的具体用法?C# Federation.ContentBaseForNamespace怎么用?C# Federation.ContentBaseForNamespace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FlexWiki.Federation的用法示例。


在下文中一共展示了Federation.ContentBaseForNamespace方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpdateNamespaces

		public void UpdateNamespaces(Federation aFed)
		{
			// just kill the old ones and reload new ones
			foreach (string each in NamespaceNames)
				aFed.UnregisterNamespace(aFed.ContentBaseForNamespace(each));
			LoadNamespaces(aFed);
		}
开发者ID:nuxleus,项目名称:flexwiki,代码行数:7,代码来源:CalendarNamespaceProvider.cs

示例2: FormattedTopic

		/// <summary>
		/// Answer the formatted text for a given topic, formatted using a given OutputFormat and possibly showing diffs with the previous revision
		/// </summary>
		/// <param name="topic">The topic</param>
		/// <param name="format">What format</param>
		/// <param name="showDiffs">true to show diffs</param>
		/// <param name="accumulator">composite cache rule in which to accumulate cache rules</param>
		/// <returns></returns>
		public static string FormattedTopic(AbsoluteTopicName topic, OutputFormat format, bool showDiffs, Federation aFederation, LinkMaker lm, CompositeCacheRule accumulator)
		{ 
		
			// Show the current topic (including diffs if there is a previous version)
			AbsoluteTopicName previousVersion = null;
			ContentBase relativeToBase = aFederation.ContentBaseForNamespace(topic.Namespace);

			if (showDiffs)
				previousVersion = relativeToBase.VersionPreviousTo(topic.LocalName);

			return FormattedTopicWithSpecificDiffs(topic, format, previousVersion, aFederation, lm, accumulator);
		}
开发者ID:nuxleus,项目名称:flexwiki,代码行数:20,代码来源:Formatter.cs

示例3: FormattedTopicWithSpecificDiffs

		/// <summary>
		/// Answer the formatted text for a given topic, formatted using a given OutputFormat and possibly showing diffs
		/// with a specified revision
		/// </summary>
		/// <param name="topic">The topic</param>
		/// <param name="format">What format</param>
		/// <param name="showDiffs">true to show diffs</param>
		/// <param name="accumulator">composite cache rule in which to accumulate cache rules (ignored for diffs)</param>
		/// <returns></returns>
		public static string FormattedTopicWithSpecificDiffs(AbsoluteTopicName topic, OutputFormat format, AbsoluteTopicName diffWithThisVersion, Federation aFederation, LinkMaker lm, CompositeCacheRule accumulator)
		{ 

			// Setup a special link maker that knows what to make the edit links return to 
			LinkMaker linker = lm.Clone();
			linker.ReturnToTopicForEditLinks = topic;
			ContentBase relativeToBase = aFederation.ContentBaseForNamespace(topic.Namespace);

			if (accumulator != null)
				accumulator.Add(relativeToBase.CacheRuleForAllPossibleInstancesOfTopic(topic));
			WikiOutput output = WikiOutput.ForFormat(format, null);
			if (diffWithThisVersion != null)
			{
				ArrayList styledLines = new ArrayList();
				IList leftLines;
				IList rightLines;
				using (TextReader srLeft = relativeToBase.TextReaderForTopic(topic.LocalName))
				{
					leftLines = MergeBehaviorLines(srLeft.ReadToEnd().Replace("\r", "").Split('\n'));
				}
				using (TextReader srRight = relativeToBase.TextReaderForTopic(diffWithThisVersion.LocalName))
				{
					rightLines = MergeBehaviorLines(srRight.ReadToEnd().Replace("\r", "").Split('\n'));
				}
				IEnumerable diffs = Diff.Compare(leftLines, rightLines);
				foreach (LineData ld in diffs)
				{ 
					LineStyle style = LineStyle.Unchanged;
					switch (ld.Type)
					{
						case LineType.Common:
							style = LineStyle.Unchanged;
							break;

						case LineType.LeftOnly:
							style = LineStyle.Add;
							break;

						case LineType.RightOnly:
							style = LineStyle.Delete;
							break;
					}
					styledLines.Add(new StyledLine(ld.Text, style));
				}
				Format(topic, styledLines, output, relativeToBase, linker, relativeToBase.ExternalWikiHash(), 0, accumulator);
			}
			else
			{
				using (TextReader sr = relativeToBase.TextReaderForTopic(topic.LocalName))
				{
					Format(topic, sr.ReadToEnd(), output, relativeToBase, linker, relativeToBase.ExternalWikiHash(), 0, accumulator);
				}
			}

			return output.ToString();
		}
开发者ID:nuxleus,项目名称:flexwiki,代码行数:65,代码来源:Formatter.cs

示例4: FormattedTopic

		/// <summary>
		/// Answer the formatted text for a given topic, formatted using a given OutputFormat and possibly showing diffs with the previous revision
		/// </summary>
		/// <param name="topic">The topic</param>
		/// <param name="format">What format</param>
		/// <param name="showDiffs">true to show diffs</param>
		/// <param name="accumulator">composite cache rule in which to accumulate cache rules</param>
		/// <returns></returns>
		public static string FormattedTopic(AbsoluteTopicName topic, OutputFormat format, AbsoluteTopicName previousVersion, Federation aFederation, LinkMaker lm, CompositeCacheRule accumulator)
		{ 
			ContentBase relativeToBase = aFederation.ContentBaseForNamespace(topic.Namespace);
			return FormattedTopicWithSpecificDiffs(topic, format, previousVersion, aFederation, lm, accumulator);
		}
开发者ID:nuxleus,项目名称:flexwiki,代码行数:13,代码来源:Formatter.cs

示例5: UpdateNamespaces

		/// <summary>
		/// Called when a provider definition is changed.  Should make sure the right changes happen in the federation
		/// to reflect the updated provider definition (e.g., removing/adding/updating namespace registrations).
		/// </summary>
		/// <param name="aFed"></param>
		public void UpdateNamespaces(Federation aFed)
		{
			// just kill the old one and reload a new one
			aFed.UnregisterNamespace(aFed.ContentBaseForNamespace(Namespace));
			LoadNamespaces(aFed);
		}
开发者ID:nuxleus,项目名称:flexwiki,代码行数:11,代码来源:SqlNamespaceProvider.cs

示例6: ValidateParameter

		/// <summary>
		/// Validate the parameters for creating the Namespace.
		/// </summary>
		/// <param name="param">Parameters name</param>
		/// <param name="val">Parameter value to validate.</param>
		/// <returns>returns null to indicate success otherwise returns 
		/// the error message to be displayed.</returns>
		public string ValidateParameter(Federation aFed, string param, string val, bool isCreate)
		{
			if (param == ConfigurationParameterNames.Namespace)
			{
				// Would need to be consistent with the namespace 
				// names for the FileSystemNameSpaceProvider
				if (val == "" || val == null)
					return "Namespace can not be blank";
				if (isCreate && aFed.ContentBaseForNamespace(val) != null)
					return "Namespace already exists";
			}
			else if (param == ConfigurationParameterNames.ConnectionString)
			{
				if (val == "")
					return "ConnectionString can not be null or blank";
			}
			return null;
		}
开发者ID:nuxleus,项目名称:flexwiki,代码行数:25,代码来源:SqlNamespaceProvider.cs


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