Permalink
Browse files

[monkeydoc] Add back several legacy members in their own class for ma…

…ximum compatibility
  • Loading branch information...
1 parent 4719113 commit 3ba6045b6029b206ccafe824da1e239cd6d6ebd5 @garuma garuma committed Dec 20, 2012
@@ -5,7 +5,8 @@ include ../../build/rules.make
LIBRARY = monkeydoc.dll
LIBRARY_PACKAGE = monkeydoc
# Remove a bunch of "obsolete"-type warning for Lucene.NET
-LOCAL_MCS_FLAGS = /nowarn:618,612,672,809
+# also activate legacy mode to compile old monodoc.dll api
+LOCAL_MCS_FLAGS = /nowarn:618,612,672,809 /define:LEGACY_MODE
JAY_FLAGS = -ct
@@ -19,7 +19,11 @@ public enum SortType {
// The HelpSource class keeps track of the archived data, and its
// tree
//
- public class HelpSource
+ public
+#if LEGACY_MODE
+ partial
+#endif
+ class HelpSource
{
static int id;
@@ -0,0 +1,36 @@
+using System;
+using System.IO;
+using System.Linq;
+using System.Xml;
+using System.Diagnostics;
+using System.Collections.Generic;
+
+using Mono.Utilities;
+using Lucene.Net.Index;
+
+#if LEGACY_MODE
+
+namespace MonkeyDoc
+{
+ public partial class HelpSource
+ {
+ [Obsolete]
+ public static bool use_css;
+ [Obsolete]
+ public static bool FullHtml = true;
+ [Obsolete]
+ public static bool UseWebdocCache;
+
+ [Obsolete ("Use MonkeyDoc.Providers.HtmlGenerator.InlineCss")]
+ public string InlineCss {
+ get { return MonkeyDoc.Generators.HtmlGenerator.InlineCss; }
+ }
+
+ [Obsolete]
+ public string InlineJavaScript {
+ get { return null; }
+ }
+ }
+}
+
+#endif
@@ -7,9 +7,13 @@
namespace MonkeyDoc
{
- public class Node : IComparable<Node>, IComparable
+ public
+#if LEGACY_MODE
+ partial
+#endif
+ class Node : IComparable<Node>, IComparable
{
- readonly Tree tree;
+ readonly Tree parentTree;
string caption, element, pubUrl;
public bool Documented;
bool loaded;
@@ -31,10 +35,10 @@ public Node (Node parent, string caption, string element) : this (parent.Tree, c
internal Node (Tree tree, string caption, string element)
{
- this.tree = tree;
+ this.parentTree = tree;
this.caption = caption;
this.element = element;
- this.elementSort = tree.HelpSource != null && tree.HelpSource.SortType == SortType.Element;
+ this.elementSort = parentTree.HelpSource != null && parentTree.HelpSource.SortType == SortType.Element;
}
/// <summary>
@@ -48,8 +52,8 @@ internal Node (Node parent, int address) : this (parent.tree, address)
internal Node (Tree tree, int address)
{
this.address = address;
- this.tree = tree;
- this.elementSort = tree.HelpSource != null && tree.HelpSource.SortType == SortType.Element;
+ this.parentTree = tree;
+ this.elementSort = parentTree.HelpSource != null && parentTree.HelpSource.SortType == SortType.Element;
if (address > 0)
LoadNode ();
}
@@ -61,7 +65,7 @@ internal Node ()
void LoadNode ()
{
- tree.InflateNode (this);
+ parentTree.InflateNode (this);
if (parent != null)
parent.RegisterFullNode (this);
}
@@ -244,7 +248,7 @@ internal void Deserialize (BinaryReader reader)
nodes.Add (t);
}
- if (tree.ForceResort)
+ if (parentTree.ForceResort)
nodes.Sort ();
}
@@ -284,7 +288,7 @@ internal string GetInternalUrl ()
get {
if (pubUrl != null)
return pubUrl;
- return pubUrl = tree.HelpSource != null ? tree.HelpSource.GetPublicUrl (this) : GetInternalUrl ();
+ return pubUrl = parentTree.HelpSource != null ? parentTree.HelpSource.GetPublicUrl (this) : GetInternalUrl ();
}
}
@@ -0,0 +1,23 @@
+using System;
+using System.IO;
+using System.Text;
+using System.Linq;
+using System.Xml;
+using System.Collections.Generic;
+
+#if LEGACY_MODE
+
+namespace MonkeyDoc
+{
+ public partial class Node
+ {
+ [Obsolete ("Use `Tree' instead of 'tree'")]
+ public Tree tree {
+ get {
+ return this.Tree;
+ }
+ }
+ }
+}
+
+#endif
@@ -15,7 +15,11 @@
namespace MonkeyDoc
{
- public class RootTree : Tree
+ public
+#if LEGACY_MODE
+ partial
+#endif
+ class RootTree : Tree
{
public const int MonodocVersion = 2;
const string RootNamespace = "root:/";
@@ -0,0 +1,38 @@
+using System;
+using System.IO;
+using System.Linq;
+using System.Xml;
+using System.Diagnostics;
+using System.Collections.Generic;
+
+using Mono.Utilities;
+using Lucene.Net.Index;
+
+#if LEGACY_MODE
+
+namespace MonkeyDoc
+{
+ using Generators;
+
+ public partial class RootTree
+ {
+ static IDocGenerator<string> rawGenerator = new RawGenerator ();
+ static HtmlGenerator htmlGenerator = new HtmlGenerator (null);
+
+ [Obsolete ("Use RawGenerator directly")]
+ public XmlDocument GetHelpXml (string id)
+ {
+ var doc = new XmlDocument ();
+ doc.LoadXml (RenderUrl (id, rawGenerator));
+ return doc;
+ }
+
+ [Obsolete ("Use the RenderUrl variant accepting a generator")]
+ public string RenderUrl (string url, out Node n)
+ {
+ return RenderUrl (url, htmlGenerator, out n);
+ }
+ }
+}
+
+#endif
@@ -16,7 +16,11 @@ namespace MonkeyDoc
/* Ideally this class should also be abstracted to let user have something
* else than a file as a backing store, a database for instance
*/
- public class Tree
+ public
+#if LEGACY_MODE
+ partial
+#endif
+ class Tree
{
const long CurrentVersionNumber = 1;
public readonly HelpSource HelpSource;
@@ -0,0 +1,18 @@
+using System;
+using System.IO;
+using System.Text;
+using System.Linq;
+using System.Xml;
+using System.Collections.Generic;
+
+namespace MonkeyDoc
+{
+ public partial class Tree
+ {
+ public List<Node> Nodes {
+ get {
+ return RootNode.Nodes;
+ }
+ }
+ }
+}
@@ -13,8 +13,11 @@ MonkeyDoc/providers/addins-provider.cs
MonkeyDoc/providers/ecmauncompiled-provider.cs
MonkeyDoc/providers/EcmaDoc.cs
MonkeyDoc/HelpSource.cs
+MonkeyDoc/HelpSource_Legacy.cs
MonkeyDoc/Tree.cs
+MonkeyDoc/Tree_Legacy.cs
MonkeyDoc/Node.cs
+MonkeyDoc/Node_Legacy.cs
MonkeyDoc/generator.cs
MonkeyDoc/caches/NullCache.cs
MonkeyDoc/caches/FileCache.cs
@@ -24,6 +27,7 @@ MonkeyDoc/cache.cs
MonkeyDoc/index.cs
MonkeyDoc/settings.cs
MonkeyDoc/RootTree.cs
+MonkeyDoc/RootTree_Legacy.cs
MonkeyDoc/TypeUtils.cs
MonkeyDoc/generators/html/Man2Html.cs
MonkeyDoc/generators/html/Toc2Html.cs

0 comments on commit 3ba6045

Please sign in to comment.