public static void SaveChange(string url, RootTree tree, XmlNode node, string node_url) { string [] uSplit = ParseEditUrl(url); string xp = uSplit [2]; string id = uSplit [1]; if (uSplit[0].StartsWith("monodoc:///")) { int prov = int.Parse(uSplit [0].Substring("monodoc:///".Length)); HelpSource hs = tree.GetHelpSourceFromId(prov); changes.AddChange(hs.Name, hs.GetRealPath(id), xp, node, node_url); changes.Save(); } else if (uSplit[0].StartsWith("file:")) { uSplit[0] = uSplit[0].Substring(5); XmlDocument d = new XmlDocument(); d.PreserveWhitespace = true; d.Load(uSplit[0]); XmlNode original = d.SelectSingleNode(xp); original.ParentNode.ReplaceChild(d.ImportNode(node, true), original); d.Save(uSplit[0]); } else { throw new NotImplementedException("Don't know how to save to " + url); } }
public static XmlNode GetNodeFromUrl (string url, RootTree tree) { Console.WriteLine ("Url is: {0}", url); string [] uSplit = ParseEditUrl (url); Console.WriteLine ("Results are: {0}\n{1}\n{2}", uSplit [0], uSplit [1], uSplit [2]); string xp = uSplit [2]; string id = uSplit [1]; XmlDocument d; if (uSplit[0].StartsWith("monodoc:///")) { int prov = int.Parse (uSplit [0].Substring("monodoc:///".Length)); d = tree.GetHelpSourceFromId (prov).GetHelpXmlWithChanges (id); } else if (uSplit[0].StartsWith("file:")) { d = new XmlDocument(); d.PreserveWhitespace = true; d.Load(uSplit[0].Substring(5)); } else { throw new NotImplementedException("Don't know how to load " + url); } return d.SelectSingleNode (xp); }
public static XmlNode GetNodeFromUrl(string url, RootTree tree) { Console.WriteLine("Url is: {0}", url); string [] uSplit = ParseEditUrl(url); Console.WriteLine("Results are: {0}\n{1}\n{2}", uSplit [0], uSplit [1], uSplit [2]); string xp = uSplit [2]; string id = uSplit [1]; XmlDocument d; if (uSplit[0].StartsWith("monodoc:///")) { int prov = int.Parse(uSplit [0].Substring("monodoc:///".Length)); d = tree.GetHelpSourceFromId(prov).GetHelpXmlWithChanges(id); } else if (uSplit[0].StartsWith("file:")) { d = new XmlDocument(); d.PreserveWhitespace = true; d.Load(uSplit[0].Substring(5)); } else { throw new NotImplementedException("Don't know how to load " + url); } return(d.SelectSingleNode(xp)); }
public static void RemoveChange(string url, RootTree tree) { string [] uSplit = ParseEditUrl(url); string xp = uSplit [2]; string id = uSplit [1]; if (uSplit[0].StartsWith("monodoc:///")) { int prov = int.Parse(uSplit [0].Substring("monodoc:///".Length)); HelpSource hs = tree.GetHelpSourceFromId(prov); changes.RemoveChange(hs.Name, hs.GetRealPath(id), xp); changes.Save(); } else if (uSplit[0].StartsWith("file:")) { //TODO: Not implemented } }
public static void RenderEditPreview(string url, RootTree tree, XmlNode new_node, XmlWriter w) { string [] uSplit = ParseEditUrl(url); if (uSplit[0].StartsWith("monodoc:///")) { int prov = int.Parse(uSplit [0].Substring("monodoc:///".Length)); HelpSource hs = tree.GetHelpSourceFromId(prov); hs.RenderPreviewDocs(new_node, w); } else { foreach (HelpSource hs in tree.HelpSources) { if (hs is EcmaUncompiledHelpSource) { // It doesn't matter which EcmaHelpSource is chosen. hs.RenderPreviewDocs(new_node, w); break; } } } }
public static void SaveChange (string url, RootTree tree, XmlNode node, string node_url) { string [] uSplit = ParseEditUrl (url); string xp = uSplit [2]; string id = uSplit [1]; if (uSplit[0].StartsWith("monodoc:///")) { int prov = int.Parse (uSplit [0].Substring("monodoc:///".Length)); HelpSource hs = tree.GetHelpSourceFromId (prov); changes.AddChange (hs.Name, hs.GetRealPath (id), xp, node, node_url); changes.Save (); } else if (uSplit[0].StartsWith("file:")) { uSplit[0] = uSplit[0].Substring(5); XmlDocument d = new XmlDocument(); d.PreserveWhitespace = true; d.Load(uSplit[0]); XmlNode original = d.SelectSingleNode(xp); original.ParentNode.ReplaceChild(d.ImportNode(node, true), original); d.Save(uSplit[0]); } else { throw new NotImplementedException("Don't know how to save to " + url); } }
public static void RenderEditPreview (string url, RootTree tree, XmlNode new_node, XmlWriter w) { string [] uSplit = ParseEditUrl (url); if (uSplit[0].StartsWith("monodoc:///")) { int prov = int.Parse (uSplit [0].Substring("monodoc:///".Length)); HelpSource hs = tree.GetHelpSourceFromId (prov); hs.RenderPreviewDocs (new_node, w); } else { foreach (HelpSource hs in tree.HelpSources) { if (hs is EcmaUncompiledHelpSource) { // It doesn't matter which EcmaHelpSource is chosen. hs.RenderPreviewDocs (new_node, w); break; } } } }
public static void RemoveChange (string url, RootTree tree) { string [] uSplit = ParseEditUrl (url); string xp = uSplit [2]; string id = uSplit [1]; if (uSplit[0].StartsWith("monodoc:///")) { int prov = int.Parse (uSplit [0].Substring("monodoc:///".Length)); HelpSource hs = tree.GetHelpSourceFromId (prov); changes.RemoveChange (hs.Name, hs.GetRealPath (id), xp); changes.Save (); } else if (uSplit[0].StartsWith("file:")) { //TODO: Not implemented } }