Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono-tools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel de Icaza <miguel@gnome.org>2008-12-10 03:58:55 +0300
committerMiguel de Icaza <miguel@gnome.org>2008-12-10 03:58:55 +0300
commit0c469784b017d688e6433959d9be6f3b4f77ac27 (patch)
tree72b32d5484a78e48f895315ff0ec9494516d361f /webcompare
parentff376d5e6d72117edd966b370684cdefc2fab4a6 (diff)
webcompare added
svn path=/trunk/mono-tools/; revision=121180
Diffstat (limited to 'webcompare')
-rw-r--r--webcompare/Global.asax22
-rw-r--r--webcompare/Makefile26
-rw-r--r--webcompare/index.aspx233
-rw-r--r--webcompare/mn.pngbin0 -> 530 bytes
-rw-r--r--webcompare/sc.gifbin0 -> 70 bytes
-rw-r--r--webcompare/se.gifbin0 -> 73 bytes
-rw-r--r--webcompare/sm.gifbin0 -> 75 bytes
-rw-r--r--webcompare/st.gifbin0 -> 101 bytes
-rw-r--r--webcompare/sx.gifbin0 -> 73 bytes
9 files changed, 281 insertions, 0 deletions
diff --git a/webcompare/Global.asax b/webcompare/Global.asax
new file mode 100644
index 00000000..3ea8280a
--- /dev/null
+++ b/webcompare/Global.asax
@@ -0,0 +1,22 @@
+<%@ Import Namespace="GuiCompare" %>
+<%@ Import Namespace="System.Threading" %>
+<%@ Assembly name="Mono.API.Compare" %>
+
+<script runat="server" language="c#" >
+public static CompareContext CompareContext;
+
+void Application_Start ()
+{
+ // Temporary, while we add a sync version of the API
+ CompareContext = new CompareContext (() => new MasterAssembly ("masterinfos/mscorlib.xml"),
+ () => new CecilAssembly ("/mono/lib/mono/2.0/mscorlib.dll"));
+ ManualResetEvent r = new ManualResetEvent (false);
+ CompareContext.Finished += delegate { r.Set (); };
+ CompareContext.Compare ();
+ r.WaitOne ();
+ CompareContext.Comparison.PropagateCounts ();
+
+ Console.WriteLine ("Compare complete");
+}
+
+</script> \ No newline at end of file
diff --git a/webcompare/Makefile b/webcompare/Makefile
new file mode 100644
index 00000000..df46c8dc
--- /dev/null
+++ b/webcompare/Makefile
@@ -0,0 +1,26 @@
+base = ../gui-compare
+
+SOURCES = \
+ $(base)/AssemblyResolver.cs \
+ $(base)/CompareContext.cs \
+ $(base)/Comparison.cs \
+ $(base)/CecilMetadata.cs \
+ $(base)/MasterMetadata.cs \
+ $(base)/Metadata.cs \
+ $(base)/Masterinfo.cs
+
+all: bin/Mono.API.Compare.dll
+
+bin/Mono.API.Compare.dll: $(SOURCES) Makefile
+ -mkdir bin
+ gmcs -debug -target:library -out:bin/Mono.API.Compare.dll $(SOURCES) -r:`pkg-config --variable Libraries cecil`
+
+get: masterinfos-3.5.tar.gz
+ tar xzvf masterinfos-3.5.tar.gz
+
+masterinfos-3.5.tar.gz:
+ wget http://mono.ximian.com/masterinfos/2.4/masterinfos-3.5.tar.gz
+
+
+run: all
+ xsp2
diff --git a/webcompare/index.aspx b/webcompare/index.aspx
new file mode 100644
index 00000000..a24894c0
--- /dev/null
+++ b/webcompare/index.aspx
@@ -0,0 +1,233 @@
+<%@ Page Language="C#" %>
+<%@ Import Namespace="System.Web" %>
+<%@ Import Namespace="System.Collections.Specialized" %>
+<%@ Import Namespace="GuiCompare" %>
+<!--
+
+ TODO:
+
+ Add Error messages generated by the compare process.
+
+
+ Cleanup:
+
+ * Change all the ComparisonNode public fields to use CamelCasing.
+ * -->
+<head>
+ <style type="text/css">
+.icons {
+ width: 12px;
+ height: 1em;
+ display: inline-block;
+ background: no-repeat left bottom;
+}
+
+.suffix {
+ margin-left: 0.5em;
+}
+
+.missing {
+ background-image: url(sm.gif);
+}
+
+.extra {
+ background-image: url(sx.gif);
+}
+
+.ok {
+ background-image: url(sc.gif);
+}
+
+.warning {
+ background-image: url(mn.png);
+}
+
+.niex {
+ background-image: url(se.gif);
+}
+
+.todo {
+ background-image: url(st.gif);
+}
+
+ </style>
+</head>
+<script runat="server" language="c#">
+
+static string Get (int count, string kind)
+{
+ if (count == 0)
+ return "";
+
+ return String.Format ("<div style='display: inline-block;' title='{0} {2}'><div class='icons suffix {1}'></div>{0}</div>", count, kind, kind);
+}
+
+static string GetStatus (ComparisonNode n)
+{
+ string status =
+ Get (n.Missing, "missing") +
+ Get (n.Extra, "extra") +
+ Get (n.Warning, "warning") +
+ Get (n.Todo, "todo") +
+ Get (n.Niex, "niex");
+
+ if (status != "")
+ return n.name + status;
+
+ return n.name;
+}
+
+public void Page_Load ()
+{
+ ComparisonNode n = global_asax.CompareContext.Comparison;
+
+ //TreeNode tn = new TreeNode ("<img src='sm.gif' border=0 align=absmiddle>" + n.name);
+ //TreeNode tn = new TreeNode (n.name);
+ //TreeNode tn = new TreeNode ("<div class='ok'></div>" + n.name);
+
+ TreeNode tn = new TreeNode (GetStatus (n), n.name);
+ tn.SelectAction = TreeNodeSelectAction.None;
+ tn.PopulateOnDemand = true;
+ tree.Nodes.Add (tn);
+}
+
+string Missing (string member)
+{
+ return "<img src='sm.gif' border=0 align=absmiddle>" + member;
+}
+
+string Extra (string member)
+{
+ return "<img src='sx.gif' border=0 align=absmiddle>" + member;
+}
+
+string Ok (string member)
+{
+ return "<img src='sc.gif' border=0 align=absmiddle>" + member;
+}
+
+string Error (string member)
+{
+ return "<img src='se.gif' border=0 align=absmiddle>" + member;
+}
+
+string LeafMemberStatus (ComparisonNode cn)
+{
+ if (cn.Niex != 0)
+ return Error ("");
+ else
+ return MemberStatus (cn);
+}
+
+string MemberStatus (ComparisonNode cn)
+{
+ switch (cn.status){
+ case ComparisonStatus.None:
+ return Ok ("");
+
+ case ComparisonStatus.Missing:
+ return Missing ("");
+
+ case ComparisonStatus.Extra:
+ return Extra ("");
+
+ case ComparisonStatus.Error:
+ return Error ("");
+
+ default:
+ return "Unknown status: " + cn.status;
+ }
+}
+
+ComparisonNode ComparisonNodeFromTreeNode (TreeNode tn)
+{
+ if (tn.Parent == null){
+ return global_asax.CompareContext.Comparison;
+ return null;
+ }
+
+ var match = ComparisonNodeFromTreeNode (tn.Parent);
+ if (match == null)
+ return null;
+ foreach (var n in match.children){
+ if (n.name == tn.Value)
+ return n;
+ }
+ return null;
+}
+
+void TreeNodePopulate (object sender, TreeNodeEventArgs e)
+{
+ Console.WriteLine ("Populating {0}", e.Node.Text);
+
+ ComparisonNode cn = ComparisonNodeFromTreeNode (e.Node);
+ if (cn == null){
+ Console.WriteLine ("ERROR: Did not find the node");
+ return;
+ }
+
+ foreach (var child in cn.children){
+ TreeNode tn;
+
+ switch (child.type){
+ case CompType.Namespace:
+ tn = new TreeNode (GetStatus (child), child.name);
+ break;
+
+ case CompType.Class:
+ tn = new TreeNode (MemberStatus (child) + " class " + GetStatus (child), child.name);
+ break;
+
+ case CompType.Struct:
+ tn = new TreeNode (MemberStatus (child) + "struct " + GetStatus (child), child.name);
+ break;
+
+ case CompType.Interface:
+ tn = new TreeNode (MemberStatus (child) + "interface " + GetStatus (child), child.name);
+ break;
+
+ case CompType.Enum:
+ tn = new TreeNode (MemberStatus (child) + "enum " + GetStatus (child), child.name);
+ break;
+
+ case CompType.Method:
+ tn = new TreeNode (LeafMemberStatus (child) + child.name, child.name);
+ break;
+
+ case CompType.Property:
+ case CompType.Field:
+ case CompType.Delegate:
+ case CompType.Event:
+
+ case CompType.Assembly:
+ case CompType.Attribute:
+ tn = new TreeNode (MemberStatus (child) + " " + child.type.ToString() + " " + child.name, child.name);
+ break;
+
+ default:
+ tn = new TreeNode ("Unknown type: " + child.type.ToString());
+ break;
+ }
+
+ if (child.children.Count != 0)
+ tn.PopulateOnDemand = true;
+
+ e.Node.ChildNodes.Add (tn);
+ }
+}
+</script>
+
+<body>
+ <%=DateTime.Now %>
+
+ <form id="form" runat="server">
+ <div>
+ <asp:TreeView ID="tree" Runat="server" OnTreeNodePopulate="TreeNodePopulate"
+ EnableClientScript="true"
+ PopulateNodesFromClient="true"
+ ExpandDepth="0">
+ </asp:TreeView>
+ </div>
+ </form>
+</body>
+</html>
diff --git a/webcompare/mn.png b/webcompare/mn.png
new file mode 100644
index 00000000..ac804a43
--- /dev/null
+++ b/webcompare/mn.png
Binary files differ
diff --git a/webcompare/sc.gif b/webcompare/sc.gif
new file mode 100644
index 00000000..8dcc7c12
--- /dev/null
+++ b/webcompare/sc.gif
Binary files differ
diff --git a/webcompare/se.gif b/webcompare/se.gif
new file mode 100644
index 00000000..5767faeb
--- /dev/null
+++ b/webcompare/se.gif
Binary files differ
diff --git a/webcompare/sm.gif b/webcompare/sm.gif
new file mode 100644
index 00000000..79de6567
--- /dev/null
+++ b/webcompare/sm.gif
Binary files differ
diff --git a/webcompare/st.gif b/webcompare/st.gif
new file mode 100644
index 00000000..568da35f
--- /dev/null
+++ b/webcompare/st.gif
Binary files differ
diff --git a/webcompare/sx.gif b/webcompare/sx.gif
new file mode 100644
index 00000000..57d57318
--- /dev/null
+++ b/webcompare/sx.gif
Binary files differ