static WikiMagicWordProcessorTest() { WikiDomain wikiDomain = new WikiDomain("wikipedia"); WikiLanguage wikiLanguage = new WikiLanguage("English", "en"); string folder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); WikiSite = new WikiSite(wikiDomain, wikiLanguage, folder + "\\..\\"); }
static WikiTemplateParseTest() { WikiDomain wikiDomain = new WikiDomain("wikipedia"); WikiLanguage wikiLanguage = new WikiLanguage("English", "en"); string folder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); WikiSite wikiSite = new WikiSite(wikiDomain, wikiLanguage, folder + "\\..\\"); config_ = new Configuration(wikiSite); }
static WikiFrWiktionaryTest() { WikiDomain wikiDomain = new WikiDomain("wiktionary"); WikiLanguage wikiLanguage = new WikiLanguage("French", "fr"); string folder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); WikiSite wikiSite = new WikiSite(wikiDomain, wikiLanguage, folder + "\\..\\"); config_ = new Configuration(wikiSite); }
private void AddDomainToList(WikiDomain wikiDomain) { ListViewItem lvi = new ListViewItem(wikiDomain.Name); lvi.SubItems.Add(wikiDomain.Domain); lvi.SubItems.Add(wikiDomain.FullPath); lvi.SubItems.Add(wikiDomain.FriendlyPath); lvi.Tag = wikiDomain; lvDomains_.Items.Add(lvi); }
static Wiki2HtmlTest() { RootPath = "TestFiles"; WikiDomain wikiDomain = new WikiDomain("wikipedia"); WikiLanguage wikiLanguage = new WikiLanguage("English", "en"); string folder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); WikiSite wikiSite = new WikiSite(wikiDomain, wikiLanguage, folder + "\\..\\"); Config = new Configuration(wikiSite); }
public WikiSite(WikiDomain domain, WikiLanguage language, string folder) { domain_ = domain; language_ = language; string langCode = language_.MimeCode ?? language_.Code; string moduleFilePath = Path.Combine(folder, MESSAGES); string modulefullPath = Path.Combine(moduleFilePath, MESSAGES + langCode + DLL_EXTENTION); try { module_ = new Module(modulefullPath); // Languages may fall-back on others. The only Exception is the default language. if (string.Compare(language.Code, DEF_LANG_CODE, StringComparison.InvariantCultureIgnoreCase) != 0) { string fallbackLangCode = module_.GetStringField(FIELD_FALLBACK); if (string.IsNullOrEmpty(fallbackLangCode)) { fallbackLangCode = DEF_LANG_CODE; } modulefullPath = Path.Combine(moduleFilePath, MESSAGES + fallbackLangCode + DLL_EXTENTION); Module fallbackModule = new Module(modulefullPath); MergeNamespaces(fallbackModule.GetString2StringMapField(FIELD_NAMESPACE_NAMES)); MergeSpecialPageAliases(fallbackModule.GetString2StringsMapField(FIELD_SPECIAL_PAGE_ALIASES)); MergeMagicWords(fallbackModule.GetString2StringsMapField(FIELD_MAGIC_WORDS)); } MergeNamespaces(module_.GetString2StringMapField(FIELD_NAMESPACE_NAMES)); MergeSpecialPageAliases(module_.GetString2StringsMapField(FIELD_SPECIAL_PAGE_ALIASES)); MergeMagicWords(module_.GetString2StringsMapField(FIELD_MAGIC_WORDS)); } catch { } if (!namespaces_.ContainsKey("NS_WIKIPEDIA")) { namespaces_["NS_WIKIPEDIA"] = "Wikipedia"; } CurrentNamespace = Namespace.Main; }
private void btnAddUpdate__Click(object sender, EventArgs e) { if (lvDomains_.SelectedItems != null && lvDomains_.SelectedItems.Count == 1) { // Update. ListViewItem lvi = lvDomains_.SelectedItems[0]; WikiDomain wikiDomain = lvi.Tag as WikiDomain; if (wikiDomain != null) { wikiDomain.Name = txtName_.Text; wikiDomain.Domain = txtDomain_.Text; wikiDomain.FullPath = txtFullPath_.Text; wikiDomain.FriendlyPath = txtFriendlyPath_.Text; lvi.Text = wikiDomain.Name; lvi.SubItems.Clear(); lvi.SubItems.Add(wikiDomain.Domain); lvi.SubItems.Add(wikiDomain.FullPath); lvi.SubItems.Add(wikiDomain.FriendlyPath); } } else { // Add. WikiDomain wikiDomain = new WikiDomain(txtName_.Text, txtDomain_.Text); wikiDomain.FullPath = txtFullPath_.Text; wikiDomain.FriendlyPath = txtFriendlyPath_.Text; int index = Domains.Domains.FindIndex(x => x.Name == wikiDomain.Name && x.Domain == wikiDomain.Domain); if (index >= 0) { MessageBox.Show("Domain already exists.", "Add Domain", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } AddDomainToList(wikiDomain); } FromList(); }
public void Modules() { WikiDomain wikiDomain = new WikiDomain("wikipedia"); WikiLanguage wikiLanguage = new WikiLanguage("Aymara", "ay"); string folder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); WikiSite wikiSite = new WikiSite(wikiDomain, wikiLanguage, folder + "\\..\\"); }