本文整理汇总了C#中FlexWiki.Federation类的典型用法代码示例。如果您正苦于以下问题:C# Federation类的具体用法?C# Federation怎么用?C# Federation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Federation类属于FlexWiki命名空间,在下文中一共展示了Federation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
[SetUp] public void Init()
{
// Dump the contents of the embedded resources to a file so we can read them
// in during the tests.
meerkatRssPath = Path.GetFullPath("meerkat.rss.xml");
testRssXmlPath = Path.GetFullPath("rsstest.xml");
testRssXslPath = Path.GetFullPath("rsstest.xsl");
Assembly a = Assembly.GetExecutingAssembly();
WriteResourceToFile(a, "FlexWiki.UnitTests.TestContent.meerkat.rss.xml", meerkatRssPath);
WriteResourceToFile(a, "FlexWiki.UnitTests.TestContent.rsstest.xml", testRssXmlPath);
WriteResourceToFile(a, "FlexWiki.UnitTests.TestContent.rsstest.xsl", testRssXslPath);
_lm = new LinkMaker(_base);
TheFederation = new Federation(OutputFormat.HTML, _lm);
TheFederation.WikiTalkVersion = 1;
_cb = CreateStore("FlexWiki");
_cb.Title = "Friendly Title";
WriteTestTopicAndNewVersion(_cb, "HomePage", "Home is where the heart is", user);
WriteTestTopicAndNewVersion(_cb, "BigPolicy", "This is ", user);
WriteTestTopicAndNewVersion(_cb, "BigDog", "This is ", user);
WriteTestTopicAndNewVersion(_cb, "BigAddress", "This is ", user);
WriteTestTopicAndNewVersion(_cb, "BigBox", "This is ", user);
WriteTestTopicAndNewVersion(_cb, "IncludeOne", "inc1", user);
WriteTestTopicAndNewVersion(_cb, "IncludeTwo", "!inc2", user);
WriteTestTopicAndNewVersion(_cb, "IncludeThree", "!!inc3", user);
WriteTestTopicAndNewVersion(_cb, "IncludeFour", "!inc4", user);
WriteTestTopicAndNewVersion(_cb, "IncludeNest", @" {{IncludeNest1}}
{{IncludeNest2}}", user);
WriteTestTopicAndNewVersion(_cb, "TopicWithColor", "Color: Yellow", user);
WriteTestTopicAndNewVersion(_cb, "IncludeNest1", "!hey there", user);
WriteTestTopicAndNewVersion(_cb, "IncludeNest2", "!black dog", user);
WriteTestTopicAndNewVersion(_cb, "IncludeNestURI", @"wiki://IncludeNest1 wiki://IncludeNest2 ", user);
WriteTestTopicAndNewVersion(_cb, "ResourceReference", @"URI: http://www.google.com/$$$", user);
WriteTestTopicAndNewVersion(_cb, "FlexWiki", "flex ", user);
WriteTestTopicAndNewVersion(_cb, "InlineTestTopic", @"aaa @@""foo""@@ zzz", user);
WriteTestTopicAndNewVersion(_cb, "OneMinuteWiki", "one ", user);
WriteTestTopicAndNewVersion(_cb, "TestIncludesBehaviors", "@@[email protected]@ somthing @@[email protected]@ then @@[email protected]@", user);
WriteTestTopicAndNewVersion(_cb, "_Underscore", "Underscore", user);
WriteTestTopicAndNewVersion(_cb, "TopicWithBehaviorProperties", @"
Face: {""hello"".Length}
one
FaceWithArg: {arg | arg.Length }
FaceSpanningLines:{ arg |
arg.Length
}
", user);
WriteTestTopicAndNewVersion(_cb, "TestTopicWithBehaviorProperties", @"
[email protected]@[email protected]@
[email protected]@topics.TopicWithBehaviorProperties.FaceWithArg(""superb"")@@
[email protected]@topics.TopicWithBehaviorProperties.FaceSpanningLines(""parsing is wonderful"")@@
", user);
_externals = new Hashtable();
}
示例2: Main
static void Main(string[] args)
{
if (args.Length < 1)
{
Usage();
return;
}
string fsPath = args[0];
string topic = null;
if (args.Length > 1)
topic = args[1];
LinkMaker lm = new LinkMaker("http://dummy");
PrintTopicApplication application = new PrintTopicApplication(fsPath, lm);
Federation fed = new Federation(application);
if (topic != null)
Print(fed, new TopicName(topic));
else
{
int max = 10;
foreach (TopicName top in fed.DefaultNamespaceManager.AllTopics(ImportPolicy.DoNotIncludeImports))
{
Print(fed, top);
if (max-- <= 0)
break;
}
}
}
示例3: SetUp
public void SetUp()
{
_lm = new LinkMaker(_bh);
MockWikiApplication application = new MockWikiApplication(null, _lm, OutputFormat.HTML,
new MockTimeProvider(TimeSpan.FromSeconds(1)));
Federation = new Federation(application);
}
示例4: Main
static void Main(string[] args)
{
if (args.Length < 1)
{
Usage();
return;
}
string fsPath = args[0];
string topic = null;
if (args.Length > 1)
topic = args[1];
LinkMaker lm = new LinkMaker("http://dummy");
Federation fed = new Federation(fsPath, OutputFormat.HTML, lm);
fed.EnableCaching();
if (topic != null)
Print(fed, new AbsoluteTopicName(topic));
else
{
int max = 10;
foreach (AbsoluteTopicName top in fed.DefaultContentBase.AllTopics(false))
{
Print(fed, top);
if (max-- <= 0)
break;
}
}
}
示例5: CreateNamespaces
/// <summary>
/// Called when a provider is first created. Must register all associated namespaces with the federation.
/// Can also be used to create initial content in the namespaces.
/// </summary>
/// <param name="aFed"></param>
public IList CreateNamespaces(Federation aFed)
{
ArrayList answer = new ArrayList();
if (SqlNamespaceProvider.Exists(Namespace, ConnectionString))
{
throw new Exception("Namespace with the specified name already exists.");
}
this.CreateNamespace(Namespace, ConnectionString);
SqlStore store = new SqlStore();
throw new NotImplementedException();
/*
NamespaceManager manager = aFed.RegisterNamespace(store);
manager.WriteTopic(manager.DefinitionTopicName.LocalName, "");
manager.SetTopicPropertyValue(manager.DefinitionTopicName.LocalName, "Contact", Contact, false);
manager.SetTopicPropertyValue(manager.DefinitionTopicName.LocalName, "Title", Title, false);
string defaultImportedNamespaces = System.Configuration.ConfigurationSettings.AppSettings["DefaultImportedNamespaces"];
if (defaultImportedNamespaces != null)
{
manager.SetTopicPropertyValue(manager.DefinitionTopicName.LocalName, "Import", defaultImportedNamespaces, false);
}
// whoever is last should write a new version
manager.SetTopicPropertyValue(manager.DefinitionTopicName.LocalName, "Description", NamespaceDescription, true);
answer.Add(Namespace);
return ArrayList.ReadOnly(answer);
*/
}
示例6: FileSystemStore
public FileSystemStore(Federation aFed, string ns, string root)
{
// For FileSystemStores, the only thing in the connection string is the root
SetFederation(aFed);
Namespace = ns;
// Calculate the root -- taking into account the relative location of the directory if needed
if (root.StartsWith(".\\"))
{
FileInfo fi = new FileInfo(aFed.FederationNamespaceMapFilename);
root = fi.DirectoryName + "\\" + root.Substring(2);
}
_Root = root;
_State = State.New;
if (Directory.Exists(root))
{
Read();
}
else
{
try
{
Directory.CreateDirectory(root);
}
catch (DirectoryNotFoundException e)
{
e.ToString();
}
}
}
示例7: 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);
}
示例8: NewsletterManager
public NewsletterManager(Federation aFed, LinkMaker lm, IDeliveryBoy boy, string newslettersFrom, string headInsert)
{
_LinkMaker = lm;
_NewslettersFrom = newslettersFrom;
_Federation = aFed;
_DeliveryBoy = boy;
_HeadInsert = headInsert;
}
示例9: LoadNamespaces
/// <summary>
/// Called when a provider should instantiate and register all of its namespaces in a federation.
/// Note that when a provider is first created (e.g., via the admin UI) that this function is not
/// called.
/// </summary>
/// <param name="aFed"></param>
public void LoadNamespaces(Federation aFed)
{
throw new NotImplementedException();
/*
SqlStore store = new SqlStore();
aFed.RegisterNamespace(store);
*/
}
示例10: NewsletterDaemon
public NewsletterDaemon(Federation fed, string rootURL, string newslettersFrom,
string headInsert, bool sendAsAttachments)
{
_TheFederation = fed;
RootURL = rootURL;
_NewslettersFrom = newslettersFrom;
_HeadInsert = headInsert;
_sendAsAttachments = sendAsAttachments;
}
示例11: BehaviorInterpreter
public BehaviorInterpreter(string contextString, string input, Federation aFed, int wikiTalkVersion, IWikiToPresentation presenter)
{
_Federation = aFed;
_ContextString = contextString == null ? "(unknown location)" : contextString;
WikiTalkVersion = wikiTalkVersion;
Presenter = presenter;
Input = input;
State = InterpreterState.ReadyToParse;
}
示例12: Print
static void Print(Federation federation, TopicName topic)
{
string formattedBody = federation.GetTopicFormattedContent(new QualifiedTopicRevision(topic), null);
// Now calculate the borders
string leftBorder = federation.GetTopicFormattedBorder(topic, Border.Left);
string rightBorder =federation.GetTopicFormattedBorder(topic, Border.Right);
string topBorder = federation.GetTopicFormattedBorder(topic, Border.Top);
string bottomBorder = federation.GetTopicFormattedBorder(topic, Border.Bottom);
// Console.Out.WriteLine(formattedBody);
}
示例13: 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);
}
示例14: Print
static void Print(Federation federation, AbsoluteTopicName topic)
{
bool diffs = false;
string formattedBody = federation.GetTopicFormattedContent(topic, diffs);
// Now calculate the borders
string leftBorder = federation.GetTopicFormattedBorder(topic, Border.Left);
string rightBorder =federation.GetTopicFormattedBorder(topic, Border.Right);
string topBorder = federation.GetTopicFormattedBorder(topic, Border.Top);
string bottomBorder = federation.GetTopicFormattedBorder(topic, Border.Bottom);
// Console.Out.WriteLine(formattedBody);
}
示例15: NamespaceManager
// Constructors
internal NamespaceManager(Federation federation, ContentProviderBase contentProvider,
string ns, NamespaceProviderParameterCollection parameters)
{
_federation = federation;
_contentProviderChain = contentProvider;
_namespace = ns;
if (parameters != null)
{
foreach (NamespaceProviderParameter parameter in parameters)
{
_parameters.Add(parameter);
}
}
_contentProviderChain.Initialize(this);
}