private void parseWikiStructure(String s) { UTF8Encoding encoding = new UTF8Encoding(); byte[] buffer = encoding.GetBytes(s); MemoryStream memoryStream = new MemoryStream(buffer, false); XmlSerializer serializer = new XmlSerializer(typeof(WikiStructure)); wiki = (WikiStructure)serializer.Deserialize(memoryStream); memoryStream.Close(); }
void XWikiAddIn_LoginSuccessul() { statusMessage = "[XWord] Loading wiki structure ..."; this.Application.StatusBar = statusMessage; this.Wiki = RequestWikiStructure(); menuManager.EnableAllXWordMenus(); toolbarManager.EnableAllXWordToolbarButtons(); statusMessage = "[XWord] Logged in to " + serverURL; this.Application.StatusBar = statusMessage; Log.Success("Logged in to " + serverURL); }
/// <summary> /// Removes all protected pages from the Word wiki structure. /// </summary> /// <param name="wiki">The wiki instance.</param> /// <param name="wildcards">The list of protected pages wildcards.</param> public void HideProtectedPages(WikiStructure wiki, List <String> wildcards) { foreach (XWikiDocument doc in wiki.GetAllDocuments()) { foreach (String wildcard in wildcards) { String docFullName = doc.space + "." + doc.name; if (UtilityClass.IsWildcardMatch(wildcard, docFullName, true)) { wiki.RemoveXWikiDocument(doc); break; } } } }
/// <summary> /// Requests the spaces and pages of the wiki from the server. /// </summary> /// <returns>A WikiStructure instance.</returns> private WikiStructure RequestWikiStructure() { WikiStructure wikiStructure = new WikiStructure(); List <String> spacesNames = Client.GetSpacesNames(); spacesNames.Sort(); wikiStructure.AddSpaces(spacesNames); //TODO: Implement user option if (true) { foreach (String spaceName in spacesNames) { List <String> pagesNames = Client.GetPagesNames(spaceName); wikiStructure[spaceName].AddDocuments(pagesNames); } } //TODO: Add opt-in prefetch return(wikiStructure); }
/// <summary> /// Removes all protected pages from the Word wiki structure. /// </summary> /// <param name="wiki">The wiki instance.</param> /// <param name="wildcards">The list of protected pages wildcards.</param> public void HideProtectedPages(WikiStructure wiki, List<String> wildcards) { foreach (XWikiDocument doc in wiki.GetAllDocuments()) { foreach (String wildcard in wildcards) { String docFullName = doc.space + "." + doc.name; if (UtilityClass.IsWildcardMatch(wildcard, docFullName, true)) { wiki.RemoveXWikiDocument(doc); break; } } } }
/// <summary> /// Requests the spaces and pages of the wiki from the server. /// </summary> /// <returns>A WikiStructure instance.</returns> private WikiStructure RequestWikiStructure() { WikiStructure wikiStructure = new WikiStructure(); List<String> spacesNames = Client.GetSpacesNames(); spacesNames.Sort(); wikiStructure.AddSpaces(spacesNames); //TODO: Implement user option if (true) { foreach (String spaceName in spacesNames) { List<String> pagesNames = Client.GetPagesNames(spaceName); wikiStructure[spaceName].AddDocuments(pagesNames); } } //TODO: Add opt-in prefetch return wikiStructure; }