本文整理汇总了C#中FlexWiki.Federation.NamespaceManagerForNamespace方法的典型用法代码示例。如果您正苦于以下问题:C# Federation.NamespaceManagerForNamespace方法的具体用法?C# Federation.NamespaceManagerForNamespace怎么用?C# Federation.NamespaceManagerForNamespace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FlexWiki.Federation
的用法示例。
在下文中一共展示了Federation.NamespaceManagerForNamespace方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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(QualifiedTopicRevision topic, OutputFormat format, QualifiedTopicRevision previousVersion, Federation aFederation, LinkMaker lm)
{
NamespaceManager relativeToBase = aFederation.NamespaceManagerForNamespace(topic.Namespace);
return FormattedTopicWithSpecificDiffs(topic, format, previousVersion, aFederation, lm);
}
示例2: 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(QualifiedTopicRevision topic, OutputFormat format, QualifiedTopicRevision diffWithThisVersion, Federation aFederation, LinkMaker lm)
{
// Setup a special link maker that knows what to make the edit links return to
LinkMaker linker = lm.Clone();
linker.ReturnToTopicForEditLinks = topic;
NamespaceManager relativeToBase = aFederation.NamespaceManagerForNamespace(topic.Namespace);
WikiOutput output = WikiOutput.ForFormat(format, null);
if (diffWithThisVersion != null)
{
ArrayList styledLines = new ArrayList();
IList leftLines;
IList rightLines;
using (TextReader srLeft = relativeToBase.TextReaderForTopic(topic.AsUnqualifiedTopicRevision()))
{
leftLines = MergeBehaviorLines(srLeft.ReadToEnd().Replace("\r", "").Split('\n'));
}
using (TextReader srRight = relativeToBase.TextReaderForTopic(diffWithThisVersion.AsUnqualifiedTopicRevision()))
{
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.ExternalReferences, 0);
}
else
{
using (TextReader sr = relativeToBase.TextReaderForTopic(topic.AsUnqualifiedTopicRevision()))
{
Format(topic, sr.ReadToEnd(), output, relativeToBase, linker, relativeToBase.ExternalReferences, 0);
}
}
return output.ToString();
}
示例3: UpdateNamespaces
public void UpdateNamespaces(Federation aFed)
{
// just kill the old one and reload a new one
aFed.UnregisterNamespace(aFed.NamespaceManagerForNamespace(Namespace));
LoadNamespaces(aFed);
}
示例4: ValidateParameter
public string ValidateParameter(Federation aFed, string param, string val, bool isCreate)
{
if (param == c_namespace)
{
if (val == "" || val == null)
return "Namespace can not be blank";
if (isCreate && aFed.NamespaceManagerForNamespace(val) != null)
return "Namespace already exists";
// TODO -- check other constraints (valid chars) for namespaces
}
return null;
}
示例5: ValidateDefaultNamespace
private void ValidateDefaultNamespace(Federation aFed)
{
///////////
///Make sure the default namespace is configured
string defaultNamespace = aFed.Configuration.DefaultNamespace;
if (defaultNamespace == null)
{
Result r = new Result("Default namespace not specified", Level.Error);
r.Writer.Write(@"<p>You have not specified the default namespace for your federation in the federation configuration file (<b>" + HtmlWriter.Escape(ApplicationConfigurationPath) + @"</b>).
This setting must be present and must name a namespace listed in your configuration file. <p>Here is an example of a valid federation configuration file:");
r.Writer.Write(ExampleConfig());
AddResult(r);
return;
}
if (aFed.NamespaceManagerForNamespace(defaultNamespace) == null)
{
Result r = new Result("Default namespace not found", Level.Error);
r.Writer.Write(@"<p>You have specified the default namespace for your federation in the federation configuration file (<b>" + HtmlWriter.Escape(ApplicationConfigurationPath) + @"</b>),
but the namespace you specified can not be found (either because it's not listed in the configuration file or it's not valid).
<p>Here is an example of a valid federation configuration file:");
r.Writer.Write(ExampleConfig());
AddResult(r);
return;
}
OK("Valid default namespace setting detected: " + HtmlWriter.Escape(defaultNamespace));
}
示例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.NamespaceManagerForNamespace(val) != null)
return "Namespace already exists";
}
else if (param == ConfigurationParameterNames.ConnectionString)
{
if (val == "")
return "ConnectionString can not be null or blank";
}
return null;
}
示例7: UpdateNamespaces
public void UpdateNamespaces(Federation aFed)
{
// just kill the old ones and reload new ones
foreach (string each in NamespaceNames)
aFed.UnregisterNamespace(aFed.NamespaceManagerForNamespace(each));
LoadNamespaces(aFed);
}