capuchin r52 - in trunk: . data dbus-sharp doc examples src src/capuchin src/libcapuchin src/libcapuchin/Downloaders src/libcapuchin/Verification src/libcapuchin/Xml
- From: sebp svn gnome org
- To: svn-commits-list gnome org
- Subject: capuchin r52 - in trunk: . data dbus-sharp doc examples src src/capuchin src/libcapuchin src/libcapuchin/Downloaders src/libcapuchin/Verification src/libcapuchin/Xml
- Date: Fri, 7 Mar 2008 18:17:34 +0000 (GMT)
Author: sebp
Date: Fri Mar 7 18:17:33 2008
New Revision: 52
URL: http://svn.gnome.org/viewvc/capuchin?rev=52&view=rev
Log:
Did refactoring work
Added:
trunk/src/libcapuchin/AppObjectManager.cs
- copied, changed from r48, /trunk/src/libcapuchin/Capuchin.cs
trunk/src/libcapuchin/IAppObject.cs
trunk/src/libcapuchin/IAppObjectManager.cs
trunk/src/libcapuchin/Xml/
trunk/src/libcapuchin/Xml/ItemsDict.cs
trunk/src/libcapuchin/Xml/Repository.cs
- copied, changed from r47, /trunk/src/libcapuchin/Repository.cs
trunk/src/libcapuchin/Xml/author.cs
trunk/src/libcapuchin/Xml/changelog.cs
trunk/src/libcapuchin/Xml/checksum.cs
trunk/src/libcapuchin/Xml/item.cs
Removed:
trunk/src/libcapuchin/Capuchin.cs
trunk/src/libcapuchin/Downloaders/FtpDownloader.cs
trunk/src/libcapuchin/Repository.cs
Modified:
trunk/ (props changed)
trunk/.svnignore
trunk/Makefile.am
trunk/autogen.sh
trunk/configure.ac
trunk/data/ (props changed)
trunk/dbus-sharp/ (props changed)
trunk/doc/ (props changed)
trunk/examples/ (props changed)
trunk/examples/Makefile.am
trunk/examples/testapp.cs
trunk/src/ (props changed)
trunk/src/capuchin/ (props changed)
trunk/src/capuchin/Main.cs
trunk/src/capuchin/Makefile.am
trunk/src/libcapuchin/ (props changed)
trunk/src/libcapuchin/AppObject.cs
trunk/src/libcapuchin/Download.cs
trunk/src/libcapuchin/DownloadManager.cs
trunk/src/libcapuchin/Globals.cs.in
trunk/src/libcapuchin/Makefile.am
trunk/src/libcapuchin/Verification/ChecksumVerifier.cs
trunk/src/libcapuchin/libcapuchin.mdp
Modified: trunk/.svnignore
==============================================================================
--- trunk/.svnignore (original)
+++ trunk/.svnignore Fri Mar 7 18:17:33 2008
@@ -1,5 +1,5 @@
*.pidb
-*.userprefs
+*.user*
*.mdb
*.exe
*.dll
Modified: trunk/Makefile.am
==============================================================================
--- trunk/Makefile.am (original)
+++ trunk/Makefile.am Fri Mar 7 18:17:33 2008
@@ -1,8 +1,12 @@
-SUBDIRS = data examples
+SUBDIRS = data
if ENABLE_INTERNAL_NDESKDBUS
SUBDIRS += dbus-sharp
endif
SUBDIRS += src
+if WITH_EXAMPLES
+SUBDIRS += examples
+endif
+
bin_SCRIPTS = capuchin
EXTRA_DIST = capuchin-sharp.pc.in \
capuchin.in
Modified: trunk/autogen.sh
==============================================================================
--- trunk/autogen.sh (original)
+++ trunk/autogen.sh Fri Mar 7 18:17:33 2008
@@ -1,7 +1,7 @@
#! /bin/sh
PROJECT=Capuchin
-FILE=src/libcapuchin/Capuchin.cs
+FILE=src/libcapuchin/AppObjectManager.cs
CONFIGURE=configure.ac
: ${AUTOCONF=autoconf}
Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac (original)
+++ trunk/configure.ac Fri Mar 7 18:17:33 2008
@@ -25,6 +25,11 @@
SHAMROCK_EXPAND_DATADIR
SHAMROCK_EXPAND_LIBDIR
+dnl Examples
+AC_ARG_WITH([examples], AC_HELP_STRING([--with-examples], [Compile examples]),
+with_examples=yes, with_examples=no)
+AM_CONDITIONAL(WITH_EXAMPLES, test "x$with_examples" = "xyes")
+
dnl ****************************************************************************
dnl * mono
dnl ****************************************************************************
@@ -51,7 +56,7 @@
dnl ****************************************************************************
dnl * ndesk-dbus
dnl ****************************************************************************
-AC_ARG_ENABLE([internal-dbus], AS_HELP_STRING([--enable-internal-dbus], [Use internal ndesk-dbus library (default: auto)]),
+AC_ARG_ENABLE([internal-dbus], AC_HELP_STRING([--enable-internal-dbus], [Use internal ndesk-dbus library (default: auto)]),
enable_internal_ndeskdbus=$enableval, enable_internal_ndeskdbus=auto)
NDESKDBUS_REQUIRED_VERSION=0.5.2
@@ -62,11 +67,11 @@
AC_MSG_ERROR([Could not find ndesk-dbus library])
fi
enable_internal_ndeskdbus="yes"
- NDESKDBUS_LIBS="-r:../../dbus-sharp/NDesk.DBus.dll"
+ NDESKDBUS_LIBS="dbus-sharp/NDesk.DBus.dll"
else
if test "x$enable_internal_ndeskdbus" = "xyes"; then
enable_internal_ndeskdbus="yes"
- NDESKDBUS_LIBS= "-r:../../dbus-sharp/NDesk.DBus.dll"
+ NDESKDBUS_LIBS= "dbus-sharp/NDesk.DBus.dll"
else
enable_internal_ndeskdbus="no"
fi
Modified: trunk/examples/Makefile.am
==============================================================================
--- trunk/examples/Makefile.am (original)
+++ trunk/examples/Makefile.am Fri Mar 7 18:17:33 2008
@@ -4,5 +4,23 @@
testapp.cs \
testapp.py
+testapp_csharpdir = $(docdir)/examples
+testapp_csharp_SCRIPTS = testapp.exe
+testapp_csharp_sources = testapp.cs
+
+testapp_csharp_build_sources = $(addprefix $(srcdir)/, $(testapp_csharp_sources))
+
+REFERENCES = \
+ -r:$(top_srcdir)/src/libcapuchin/capuchin-sharp.dll \
+ -r:$(top_srcdir)/$(NDESKDBUS_LIBS) \
+ $(GTKSHARP_LIBS)
+
+testapp.exe: $(testapp_csharp_build_sources) $(resources)
+ $(GMCS) $(REFERENCES) $(embedded) -out:$@ $(testapp_csharp_build_sources)
+
+CLEANFILES = \
+ testapp.exe
+
EXTRA_DIST = \
- $(examples_DATA)
+ $(examples_DATA) \
+ $(testapp_sources)
Modified: trunk/examples/testapp.cs
==============================================================================
--- trunk/examples/testapp.cs (original)
+++ trunk/examples/testapp.cs Fri Mar 7 18:17:33 2008
@@ -3,21 +3,21 @@
using System.Threading;
using NDesk.DBus;
-public class TestNSM
+public class TestCapuchin
{
protected const string CAPUCHIN_SERVICE = "org.gnome.Capuchin";
- protected const string CAPUCHIN_PATH = "/org/gnome/Capuchin";
+ protected const string APPOBJECTMANAGER_PATH = "/org/gnome/Capuchin/AppObjectManager";
- protected Capuchin.ICapuchin stuffmanager;
+ protected Capuchin.IAppObjectManager stuffmanager;
protected Capuchin.IAppObject newstuff;
- private static TestNSM test = new TestNSM();
+ private static TestCapuchin test = new TestCapuchin();
- public TestNSM()
+ public TestCapuchin()
{
Bus bus = Bus.Session;
- this.stuffmanager = bus.GetObject<Capuchin.ICapuchin> (CAPUCHIN_SERVICE, new ObjectPath (CAPUCHIN_PATH));
+ this.stuffmanager = bus.GetObject<Capuchin.IAppObjectManager> (CAPUCHIN_SERVICE, new ObjectPath (APPOBJECTMANAGER_PATH));
}
public void testGetNewStuff()
@@ -49,15 +49,15 @@
public void testGetAvailableNewStuff()
{
- string[][] stuff = this.newstuff.GetAvailablePlugins();
+ string[] stuff = this.newstuff.GetAvailablePlugins();
Console.WriteLine ("ALL:");
- foreach (string[] s in stuff)
+ foreach (string s in stuff)
{
- Console.WriteLine ("ID: " + s[0]);
- Console.WriteLine ("Name: " + s[1]);
- Console.WriteLine ("Description: " + this.newstuff.GetDescription(s[0]) );
- IDictionary<string, string> author = this.newstuff.GetAuthor(s[0]);
- Console.WriteLine ("Author: {0} <{1}>", author["name"], author["email"]);
+ Console.WriteLine ("ID: " + s);
+ Console.WriteLine ("Name: " + this.newstuff.GetName(s));
+ Console.WriteLine ("Description: " + this.newstuff.GetDescription(s) );
+ string[] author = this.newstuff.GetAuthor(s);
+ Console.WriteLine ("Author: {0} <{1}>", author[0], author[1]);
}
}
@@ -88,8 +88,8 @@
public void testGetAuthor()
{
- IDictionary<string, string> author = this.newstuff.GetAuthor("leoorg.py");
- Console.WriteLine ("AUTHOR: {0}, {1}", author["name"], author["email"]);
+ string[] author = this.newstuff.GetAuthor("leoorg.py");
+ Console.WriteLine ("AUTHOR: {0}, {1}", author[0], author[1]);
}
public void testUpdate()
Modified: trunk/src/capuchin/Main.cs
==============================================================================
--- trunk/src/capuchin/Main.cs (original)
+++ trunk/src/capuchin/Main.cs Fri Mar 7 18:17:33 2008
@@ -20,7 +20,7 @@
class MainClass
{
public const string OBJECT_SERVICE = "org.gnome.Capuchin";
- public const string CAPUCHIN_OBJECT_PATH = "/org/gnome/Capuchin";
+ public const string APPOBJECTMANAGER_OBJECT_PATH = "/org/gnome/Capuchin/AppObjectManager";
public const string DOWNLOADMANAGER_OBJECT_PATH = "/org/gnome/Capuchin/DownloadManager";
static CapuchinOptions opts = new CapuchinOptions();
@@ -45,8 +45,8 @@
);
}
- Capuchin.Capuchin obj_manager = new Capuchin.Capuchin();
- Bus.Session.Register(OBJECT_SERVICE, new ObjectPath(CAPUCHIN_OBJECT_PATH), obj_manager);
+ Capuchin.AppObjectManager obj_manager = new Capuchin.AppObjectManager();
+ Bus.Session.Register(OBJECT_SERVICE, new ObjectPath(APPOBJECTMANAGER_OBJECT_PATH), obj_manager);
Capuchin.DownloadManager dlm = new Capuchin.DownloadManager();
Bus.Session.Register(OBJECT_SERVICE, new ObjectPath(DOWNLOADMANAGER_OBJECT_PATH), dlm);
Modified: trunk/src/capuchin/Makefile.am
==============================================================================
--- trunk/src/capuchin/Makefile.am (original)
+++ trunk/src/capuchin/Makefile.am Fri Mar 7 18:17:33 2008
@@ -14,7 +14,7 @@
REFERENCES = \
-r:../libcapuchin/capuchin-sharp.dll \
-r:Mono.GetOptions \
- $(NDESKDBUS_LIBS) \
+ -r:$(top_srcdir)/$(NDESKDBUS_LIBS) \
$(GTKSHARP_LIBS)
capuchin.exe: $(capuchin_build_sources) $(resources)
Modified: trunk/src/libcapuchin/AppObject.cs
==============================================================================
--- trunk/src/libcapuchin/AppObject.cs (original)
+++ trunk/src/libcapuchin/AppObject.cs Fri Mar 7 18:17:33 2008
@@ -1,4 +1,3 @@
-
using System;
using System.Collections.Generic;
using System.IO;
@@ -10,37 +9,10 @@
using Capuchin.Verification;
using Capuchin.Compression;
using Capuchin.Logging;
+using Capuchin.Xml;
namespace Capuchin
{
- public enum ActionType {
- UpdatingRepo,
- DownloadingPlugin,
- ExtractingPlugin
- }
-
- public delegate void UpdateFinishedHandler ();
- public delegate void InstallFinishedHandler (string plugin_id);
- public delegate void StatusHandler (ActionType action, string plugin_id, double progress, int speed);
-
- [Interface("org.gnome.Capuchin.AppObject")]
- public interface IAppObject
- {
- event UpdateFinishedHandler UpdateFinished;
- event InstallFinishedHandler InstallFinished;
- event StatusHandler Status;
-
- string GetApplicationName ();
- void Update (bool force_update);
- void Install (string plugin_id);
- string[][] GetAvailablePlugins ();
- string[] GetAvailableUpdates (string[][] plugins);
- string GetDescription (string plugin_id);
- string GetChanges (string plugin_id, string version);
- string[] GetTags (string plugin_id);
- IDictionary<string, string> GetAuthor (string plugin_id);
- void Close ();
- }
public class RepositoryConnectionException : ApplicationException
{
@@ -50,7 +22,7 @@
}
/// <summary>An application specific object that handels the plugins</summary>
- public class AppObject : IDisposable,IAppObject
+ public class AppObject : IDisposable, IAppObject
{
public event UpdateFinishedHandler UpdateFinished;
public event InstallFinishedHandler InstallFinished;
@@ -78,6 +50,7 @@
this.LocalRepo = Path.Combine(Globals.Instance.LOCAL_CACHE_DIR, Path.GetFileName(repository_url));
// Used to map DownloadId to PluginID
this.DownloadToPluginId = new Dictionary<int, string>();
+ Console.WriteLine("NEW DICT");
// Forward DownloadStatus event
Globals.DLM.DownloadStatus += new DownloadManagerStatusHandler(
@@ -152,19 +125,19 @@
/// An array of string arrays of size 2.
/// Whereas the first element is the plugin's id, second the plugin's name.
/// </returns>
- public string[][] GetAvailablePlugins ()
+ public string[] GetAvailablePlugins ()
{
Log.Info("Getting available plugins");
- string[][] stuff = new string[this.RepoItems.Count][];
+ string[] ids = new string[this.RepoItems.Count];
int c=0;
foreach (string id in this.RepoItems.Keys)
{
- stuff[c] = new string[] { id, this.RepoItems[id].Name };
+ ids[c] = id;
c++;
}
- return stuff;
+ return ids;
}
/// <summary>Get all available updates</summary>
@@ -207,6 +180,28 @@
}
/// <summary>
+ /// Returns all plugins that are tagged with the given tag
+ /// </summary>
+ /// <param name="tag">
+ /// A tag
+ /// </param>
+ /// <returns>
+ /// A list of plugin IDs
+ /// </returns>
+ public string[] GetPluginsWithTag (string tag)
+ {
+ return null;
+ }
+
+ /// <summary>
+ /// Get name of plugin with given <code>plugin_id</code>
+ /// </summary>
+ public string GetName (string plugin_id)
+ {
+ return this.RepoItems[plugin_id].Name;
+ }
+
+ /// <summary>
/// Get description for given <code>plugin_id</code>
/// </summary>
public string GetDescription (string plugin_id)
@@ -240,10 +235,12 @@
/// <summary>Get the author's name and e-mail address for the plugin with ID <code>plugin_id</code></summary>
/// <param name="plugin_id">Plugin's ID</param>
/// <returns>Dictionary with keys "name" and "email"</returns>
- public IDictionary<string, string> GetAuthor (string plugin_id)
+ public string[] GetAuthor (string plugin_id)
{
Log.Info("Getting author of plugin with id '{0}'", plugin_id);
- return this.RepoItems[plugin_id].Author;
+
+ author plugin_author = this.RepoItems[plugin_id].Author;
+ return new string[] { plugin_author["name"], plugin_author["email"] };
}
/// <summary>Tell the object that it isn't needed anymore</summary>
@@ -289,7 +286,7 @@
}
/// <summary>Extract file</summary>
- /// <param name="dlobject">A <see cref="Download" /> instance</param>
+ /// <param name="dlobject">A <see cref="Capuchin.Download" /> instance</param>
protected void ExtractFile (object local_file_obj)
{
string local_file = (string)local_file_obj;
@@ -337,7 +334,7 @@
}
/// <summary>Check whether repository's XML file has to be downloaded again</summary>
- /// <exception cref="Nsm.RepositoryConnectionException">
+ /// <exception cref="Capuchin.RepositoryConnectionException">
/// Thrown if connection to repository failed
/// </exception>
private bool IsCacheUpToDate ()
Copied: trunk/src/libcapuchin/AppObjectManager.cs (from r48, /trunk/src/libcapuchin/Capuchin.cs)
==============================================================================
--- /trunk/src/libcapuchin/Capuchin.cs (original)
+++ trunk/src/libcapuchin/AppObjectManager.cs Fri Mar 7 18:17:33 2008
@@ -10,14 +10,8 @@
namespace Capuchin
{
- /// <summary>Entry point for applications to request their own <see cref="Capuchin.AppObject /> object</summary>
- [Interface("org.gnome.Capuchin")]
- public interface ICapuchin
- {
- ObjectPath GetAppObject(string repository_url);
- }
- public class Capuchin : ICapuchin
+ public class AppObjectManager : IAppObjectManager
{
public const string CAPUCHIN_SERVICE = "org.gnome.Capuchin";
@@ -25,7 +19,7 @@
protected Dictionary<string, ObjectPath> Objects;
- public Capuchin()
+ public AppObjectManager()
{
this.Objects = new Dictionary<string, ObjectPath>();
this.CreateCacheIfNotExists();
Modified: trunk/src/libcapuchin/Download.cs
==============================================================================
--- trunk/src/libcapuchin/Download.cs (original)
+++ trunk/src/libcapuchin/Download.cs Fri Mar 7 18:17:33 2008
@@ -2,6 +2,7 @@
using System;
using System.IO;
using System.Threading;
+using Capuchin.Xml;
namespace Capuchin
{
Modified: trunk/src/libcapuchin/DownloadManager.cs
==============================================================================
--- trunk/src/libcapuchin/DownloadManager.cs (original)
+++ trunk/src/libcapuchin/DownloadManager.cs Fri Mar 7 18:17:33 2008
@@ -6,6 +6,7 @@
using NDesk.DBus;
using org.freedesktop.DBus;
using Capuchin.Logging;
+using Capuchin.Xml;
namespace Capuchin
{
Modified: trunk/src/libcapuchin/Globals.cs.in
==============================================================================
--- trunk/src/libcapuchin/Globals.cs.in (original)
+++ trunk/src/libcapuchin/Globals.cs.in Fri Mar 7 18:17:33 2008
@@ -1,15 +1,11 @@
-
using System;
using System.IO;
namespace Capuchin
{
-
public sealed class Globals
- {
-
- public const string SPECS_DIR = "@expanded_datadir@/capuchin/specs";
+ {
public const string GPG_BIN = "@GPG@";
public readonly string LOCAL_CONFIG_DIR;
public readonly string LOCAL_CACHE_DIR;
Added: trunk/src/libcapuchin/IAppObject.cs
==============================================================================
--- (empty file)
+++ trunk/src/libcapuchin/IAppObject.cs Fri Mar 7 18:17:33 2008
@@ -0,0 +1,36 @@
+using System;
+using NDesk.DBus;
+
+namespace Capuchin
+{
+ public enum ActionType {
+ UpdatingRepo,
+ DownloadingPlugin,
+ ExtractingPlugin
+ }
+
+ public delegate void UpdateFinishedHandler ();
+ public delegate void InstallFinishedHandler (string plugin_id);
+ public delegate void StatusHandler (ActionType action, string plugin_id, double progress, int speed);
+
+ [Interface("org.gnome.Capuchin.AppObject")]
+ public interface IAppObject
+ {
+ event UpdateFinishedHandler UpdateFinished;
+ event InstallFinishedHandler InstallFinished;
+ event StatusHandler Status;
+
+ string GetApplicationName ();
+ void Update (bool force_update);
+ void Install (string plugin_id);
+ string[] GetAvailablePlugins ();
+ string[] GetAvailableUpdates (string[][] plugins);
+ string[] GetPluginsWithTag (string tag);
+ string GetName (string plugin_id);
+ string GetDescription (string plugin_id);
+ string GetChanges (string plugin_id, string version);
+ string[] GetTags (string plugin_id);
+ string[] GetAuthor (string plugin_id);
+ void Close ();
+ }
+}
Added: trunk/src/libcapuchin/IAppObjectManager.cs
==============================================================================
--- (empty file)
+++ trunk/src/libcapuchin/IAppObjectManager.cs Fri Mar 7 18:17:33 2008
@@ -0,0 +1,12 @@
+using System;
+using NDesk.DBus;
+
+namespace Capuchin
+{
+ /// <summary>Entry point for applications to request their own <see cref="Capuchin.AppObject /> object</summary>
+ [Interface("org.gnome.Capuchin")]
+ public interface IAppObjectManager
+ {
+ ObjectPath GetAppObject(string repository_url);
+ }
+}
Modified: trunk/src/libcapuchin/Makefile.am
==============================================================================
--- trunk/src/libcapuchin/Makefile.am (original)
+++ trunk/src/libcapuchin/Makefile.am Fri Mar 7 18:17:33 2008
@@ -1,45 +1,43 @@
libcapuchindir=$(pkglibdir)
libcapuchin_SCRIPTS = capuchin-sharp.dll
-CLEANFILES = capuchin-sharp.dll
-DISTCLEANFILES = \
- AssemblyInfo.cs \
- Globals.cs \
- Makefile.in
-EXTRA_DIST = \
- $(libcapuchin_sources) \
- $(libcapuchin_sources_in)
libcapuchin_sources_in = AssemblyInfo.cs.in Globals.cs.in
libcapuchin_generated_sources = $(libcapuchin_sources_in:.in=)
libcapuchin_sources = \
- Capuchin.cs \
- Repository.cs \
- AppObject.cs \
- Download.cs \
- DownloadManager.cs \
- Downloaders/AbstractDownloader.cs \
- Downloaders/HttpDownloader.cs \
- Downloaders/FtpDownloader.cs \
Compression/Decompresser.cs \
Compression/IExtracter.cs \
Compression/TarBz2Extracter.cs \
Compression/TarGzExtracter.cs \
Compression/ZipExtracter.cs \
Compression/TarExtracter.cs \
- Verification/ChecksumVerifier.cs \
- Verification/GnuPGVerifier.cs \
- Verification/IVerifier.cs \
+ Downloaders/AbstractDownloader.cs \
+ Downloaders/HttpDownloader.cs \
Logging/DelayedTextWriter.cs \
Logging/FileSystem.cs \
Logging/Log.cs \
- Logging/TeeTextWriter.cs
+ Logging/TeeTextWriter.cs \
+ Verification/ChecksumVerifier.cs \
+ Verification/GnuPGVerifier.cs \
+ Verification/IVerifier.cs \
+ Xml/author.cs \
+ Xml/changelog.cs \
+ Xml/checksum.cs \
+ Xml/item.cs \
+ Xml/ItemsDict.cs \
+ Xml/Repository.cs \
+ AppObject.cs \
+ AppObjectManager.cs \
+ Download.cs \
+ DownloadManager.cs \
+ IAppObject.cs \
+ IAppObjectManager.cs
REFERENCES = \
-r:System \
-r:System.Xml \
-r:ICSharpCode.SharpZipLib \
-r:Mono.Posix \
- $(NDESKDBUS_LIBS) \
+ -r:$(top_srcdir)/$(NDESKDBUS_LIBS) \
$(GNOMEVFSSHARP_LIBS)
libcapuchin_build_sources = $(addprefix $(srcdir)/, $(libcapuchin_sources))
@@ -47,3 +45,14 @@
capuchin-sharp.dll: $(libcapuchin_build_sources)
$(GMCS) $(REFERENCES) -target:library -out:$@ $(libcapuchin_build_sources)
+
+CLEANFILES = capuchin-sharp.dll
+
+DISTCLEANFILES = \
+ AssemblyInfo.cs \
+ Globals.cs \
+ Makefile.in
+
+EXTRA_DIST = \
+ $(libcapuchin_sources) \
+ $(libcapuchin_sources_in)
Modified: trunk/src/libcapuchin/Verification/ChecksumVerifier.cs
==============================================================================
--- trunk/src/libcapuchin/Verification/ChecksumVerifier.cs (original)
+++ trunk/src/libcapuchin/Verification/ChecksumVerifier.cs Fri Mar 7 18:17:33 2008
@@ -1,6 +1,7 @@
using System;
using System.Security.Cryptography;
+using Capuchin.Xml;
namespace Capuchin.Verification
{
Added: trunk/src/libcapuchin/Xml/ItemsDict.cs
==============================================================================
--- (empty file)
+++ trunk/src/libcapuchin/Xml/ItemsDict.cs Fri Mar 7 18:17:33 2008
@@ -0,0 +1,43 @@
+using System;
+using System.Collections.Generic;
+using System.Xml;
+using System.Xml.Serialization;
+
+namespace Capuchin.Xml
+{
+
+ public class ItemsDict : Dictionary<string, item>, IXmlSerializable
+ {
+ public System.Xml.Schema.XmlSchema GetSchema()
+ {
+ return null;
+ }
+
+ public void ReadXml(XmlReader reader)
+ {
+ XmlSerializer itemSer = new XmlSerializer(typeof(item));
+
+ reader.Read();
+
+ while (reader.NodeType != XmlNodeType.EndElement)
+ {
+ item dictItem = (item)itemSer.Deserialize(reader);
+
+ this.Add(dictItem.Id, dictItem);
+ reader.MoveToContent();
+ }
+ reader.ReadEndElement();
+ }
+
+ public void WriteXml(XmlWriter writer)
+ {
+ XmlSerializer itemSer = new XmlSerializer(typeof(item));
+
+ foreach (string key in this.Keys)
+ {
+ itemSer.Serialize(writer, this[key]);
+ }
+ }
+ }
+
+}
Copied: trunk/src/libcapuchin/Xml/Repository.cs (from r47, /trunk/src/libcapuchin/Repository.cs)
==============================================================================
--- /trunk/src/libcapuchin/Repository.cs (original)
+++ trunk/src/libcapuchin/Xml/Repository.cs Fri Mar 7 18:17:33 2008
@@ -1,9 +1,8 @@
-using System;
-using System.Collections.Generic;
+using System;
using System.Xml;
using System.Xml.Serialization;
-namespace Capuchin
+namespace Capuchin.Xml
{
[XmlRootAttribute(ElementName="repository", Namespace="", IsNullable=false)]
public class Repository
@@ -15,190 +14,5 @@
[XmlElementAttribute("items")]
public ItemsDict items;
- }
-
- public class ItemsDict : Dictionary<string, item>, IXmlSerializable
- {
- public System.Xml.Schema.XmlSchema GetSchema()
- {
- return null;
- }
-
- public void ReadXml(XmlReader reader)
- {
- XmlSerializer itemSer = new XmlSerializer(typeof(item));
-
- reader.Read();
-
- while (reader.NodeType != XmlNodeType.EndElement)
- {
- item dictItem = (item)itemSer.Deserialize(reader);
-
- this.Add(dictItem.Id, dictItem);
- reader.MoveToContent();
- }
- reader.ReadEndElement();
- }
-
- public void WriteXml(XmlWriter writer)
- {
- XmlSerializer itemSer = new XmlSerializer(typeof(item));
-
- foreach (string key in this.Keys)
- {
- itemSer.Serialize(writer, this[key]);
- }
- }
- }
-
- [System.Xml.Serialization.XmlRootAttribute(Namespace = "", IsNullable = false)]
- public class item
- {
- [System.Xml.Serialization.XmlElementAttribute("author", typeof(author), IsNullable = false)]
- public author Author;
-
- [System.Xml.Serialization.XmlElementAttribute("checksum", typeof(checksum), IsNullable = false)]
- public checksum Checksum;
-
- [System.Xml.Serialization.XmlElementAttribute("description", typeof(string), IsNullable = false)]
- public string Description;
-
- [System.Xml.Serialization.XmlElementAttribute("id", typeof(string))]
- public string Id;
-
- [System.Xml.Serialization.XmlElementAttribute("name", typeof(string))]
- public string Name;
-
- [System.Xml.Serialization.XmlElementAttribute("signature", typeof(string), DataType = "anyURI", IsNullable = false)]
- public string Signature;
-
- [XmlArrayAttribute("tags", IsNullable=false)]
- [XmlArrayItemAttribute("tag", typeof(string), IsNullable=false)]
- public string[] Tags;
-
- [System.Xml.Serialization.XmlElementAttribute("url", typeof(string), DataType = "anyURI")]
- public string Url;
-
- [System.Xml.Serialization.XmlElementAttribute("version", typeof(string))]
- public string Version;
-
- [System.Xml.Serialization.XmlElementAttribute("changelog", typeof(changelog), IsNullable = false)]
- public changelog Changelog;
- }
-
- [XmlRootAttribute(ElementName="changelog", Namespace = "", IsNullable = false)]
- public class changelog : Dictionary<string, string>, IXmlSerializable
- {
- public System.Xml.Schema.XmlSchema GetSchema()
- {
- return null;
- }
-
- public void ReadXml(XmlReader reader)
- {
- reader.Read();
-
- string version = null;
- string text = null;
- while (reader.Name != "changelog")
- {
- switch (reader.NodeType)
- {
- case XmlNodeType.Element:
- reader.MoveToAttribute("version");
- version = reader.Value;
- break;
- case XmlNodeType.Text:
- text = reader.Value;
- break;
- case XmlNodeType.EndElement:
- if (version != null && text != null)
- {
- this.Add(version, text);
- version = text = null;
- }
- break;
- }
- reader.Read();
- }
-
- reader.ReadEndElement();
- }
-
- public void WriteXml(XmlWriter writer)
- {
- foreach ( string key in this.Keys )
- {
- writer.WriteStartElement("changes");
- writer.WriteAttributeString("version", key);
- writer.WriteEndElement();
- }
- }
- }
-
-
- [System.Xml.Serialization.XmlRootAttribute(Namespace = "", IsNullable = false)]
- public class checksum
- {
-
- private checksumType typeField;
- private string textField;
-
- [System.Xml.Serialization.XmlAttributeAttribute()]
- public checksumType type
- {
- get
- {
- return this.typeField;
- }
- set
- {
- this.typeField = value;
- }
- }
-
- [System.Xml.Serialization.XmlTextAttribute()]
- public string Text
- {
- get
- {
- return this.textField;
- }
- set
- {
- this.textField = value;
- }
- }
- }
-
- public enum checksumType
- {
-
- sha1,
- md5,
- }
-
- [XmlRootAttribute(ElementName="author", Namespace = "", IsNullable = false)]
- public class author : Dictionary<string, string>, IXmlSerializable
- {
- public System.Xml.Schema.XmlSchema GetSchema()
- {
- return null;
- }
-
- public void ReadXml(XmlReader reader)
- {
- reader.MoveToAttribute("name");
- this.Add("name", reader.Value);
-
- reader.MoveToAttribute("email");
- this.Add("email", reader.Value);
- }
-
- public void WriteXml(XmlWriter writer)
- {
- writer.WriteAttributeString("name", this["name"]);
- writer.WriteAttributeString("email", this["email"]);
- }
}
}
Added: trunk/src/libcapuchin/Xml/author.cs
==============================================================================
--- (empty file)
+++ trunk/src/libcapuchin/Xml/author.cs Fri Mar 7 18:17:33 2008
@@ -0,0 +1,33 @@
+using System;
+using System.Xml;
+using System.Xml.Serialization;
+using System.Collections.Generic;
+
+namespace Capuchin.Xml
+{
+
+ [XmlRootAttribute(ElementName="author", Namespace = "", IsNullable = false)]
+ public class author : Dictionary<string, string>, IXmlSerializable
+ {
+ public System.Xml.Schema.XmlSchema GetSchema()
+ {
+ return null;
+ }
+
+ public void ReadXml(XmlReader reader)
+ {
+ reader.MoveToAttribute("name");
+ this.Add("name", reader.Value);
+
+ reader.MoveToAttribute("email");
+ this.Add("email", reader.Value);
+ }
+
+ public void WriteXml(XmlWriter writer)
+ {
+ writer.WriteAttributeString("name", this["name"]);
+ writer.WriteAttributeString("email", this["email"]);
+ }
+ }
+
+}
Added: trunk/src/libcapuchin/Xml/changelog.cs
==============================================================================
--- (empty file)
+++ trunk/src/libcapuchin/Xml/changelog.cs Fri Mar 7 18:17:33 2008
@@ -0,0 +1,59 @@
+using System;
+using System.Collections.Generic;
+using System.Xml;
+using System.Xml.Serialization;
+
+namespace Capuchin.Xml
+{
+
+ [XmlRootAttribute(ElementName="changelog", Namespace = "", IsNullable = false)]
+ public class changelog : Dictionary<string, string>, IXmlSerializable
+ {
+ public System.Xml.Schema.XmlSchema GetSchema()
+ {
+ return null;
+ }
+
+ public void ReadXml(XmlReader reader)
+ {
+ reader.Read();
+
+ string version = null;
+ string text = null;
+ while (reader.Name != "changelog")
+ {
+ switch (reader.NodeType)
+ {
+ case XmlNodeType.Element:
+ reader.MoveToAttribute("version");
+ version = reader.Value;
+ break;
+ case XmlNodeType.Text:
+ text = reader.Value;
+ break;
+ case XmlNodeType.EndElement:
+ if (version != null && text != null)
+ {
+ this.Add(version, text);
+ version = text = null;
+ }
+ break;
+ }
+ reader.Read();
+ }
+
+ reader.ReadEndElement();
+ }
+
+ public void WriteXml(XmlWriter writer)
+ {
+ foreach ( string key in this.Keys )
+ {
+ writer.WriteStartElement("changes");
+ writer.WriteAttributeString("version", key);
+ writer.WriteEndElement();
+ }
+ }
+ }
+
+}
Added: trunk/src/libcapuchin/Xml/checksum.cs
==============================================================================
--- (empty file)
+++ trunk/src/libcapuchin/Xml/checksum.cs Fri Mar 7 18:17:33 2008
@@ -0,0 +1,48 @@
+using System;
+using System.Xml;
+using System.Xml.Serialization;
+
+namespace Capuchin.Xml
+{
+
+ public enum checksumType
+ {
+ sha1,
+ md5,
+ }
+
+ [XmlRootAttribute(Namespace = "", IsNullable = false)]
+ public class checksum
+ {
+
+ private checksumType typeField;
+ private string textField;
+
+ [XmlAttributeAttribute()]
+ public checksumType type
+ {
+ get
+ {
+ return this.typeField;
+ }
+ set
+ {
+ this.typeField = value;
+ }
+ }
+
+ [XmlTextAttribute()]
+ public string Text
+ {
+ get
+ {
+ return this.textField;
+ }
+ set
+ {
+ this.textField = value;
+ }
+ }
+ }
+
+}
Added: trunk/src/libcapuchin/Xml/item.cs
==============================================================================
--- (empty file)
+++ trunk/src/libcapuchin/Xml/item.cs Fri Mar 7 18:17:33 2008
@@ -0,0 +1,43 @@
+using System;
+using System.Xml;
+using System.Xml.Serialization;
+
+namespace Capuchin.Xml
+{
+
+ [XmlRootAttribute(Namespace = "", IsNullable = false)]
+ public class item
+ {
+ [XmlElementAttribute("author", typeof(author), IsNullable = false)]
+ public author Author;
+
+ [XmlElementAttribute("checksum", typeof(checksum), IsNullable = false)]
+ public checksum Checksum;
+
+ [XmlElementAttribute("description", typeof(string), IsNullable = false)]
+ public string Description;
+
+ [XmlElementAttribute("id", typeof(string))]
+ public string Id;
+
+ [XmlElementAttribute("name", typeof(string))]
+ public string Name;
+
+ [XmlElementAttribute("signature", typeof(string), DataType = "anyURI", IsNullable = false)]
+ public string Signature;
+
+ [XmlArrayAttribute("tags", IsNullable=false)]
+ [XmlArrayItemAttribute("tag", typeof(string), IsNullable=false)]
+ public string[] Tags;
+
+ [XmlElementAttribute("url", typeof(string), DataType = "anyURI")]
+ public string Url;
+
+ [XmlElementAttribute("version", typeof(string))]
+ public string Version;
+
+ [XmlElementAttribute("changelog", typeof(changelog), IsNullable = false)]
+ public changelog Changelog;
+ }
+
+}
Modified: trunk/src/libcapuchin/libcapuchin.mdp
==============================================================================
--- trunk/src/libcapuchin/libcapuchin.mdp (original)
+++ trunk/src/libcapuchin/libcapuchin.mdp Fri Mar 7 18:17:33 2008
@@ -1,4 +1,4 @@
-<Project name="libcapuchin" fileversion="2.0" language="C#" clr-version="Net_2_0" ctype="DotNetProject">
+<Project name="libcapuchin" fileversion="2.0" DefaultNamespace="Capuchin" language="C#" clr-version="Net_2_0" ctype="DotNetProject">
<Configurations active="Debug">
<Configuration name="Debug" ctype="DotNetProjectConfiguration">
<Output directory="bin/Debug" assembly="libcapuchin" />
@@ -15,8 +15,7 @@
</Configurations>
<Contents>
<File name="AppObject.cs" subtype="Code" buildaction="Compile" />
- <File name="Repository.cs" subtype="Code" buildaction="Compile" />
- <File name="Capuchin.cs" subtype="Code" buildaction="Compile" />
+ <File name="AppObjectManager.cs" subtype="Code" buildaction="Compile" />
<File name="Compression/Decompresser.cs" subtype="Code" buildaction="Compile" />
<File name="Compression/IExtracter.cs" subtype="Code" buildaction="Compile" />
<File name="Compression/TarBz2Extracter.cs" subtype="Code" buildaction="Compile" />
@@ -29,7 +28,6 @@
<File name="Globals.cs.in" subtype="Code" buildaction="Nothing" />
<File name="Downloaders" subtype="Directory" buildaction="Compile" />
<File name="Downloaders/HttpDownloader.cs" subtype="Code" buildaction="Compile" />
- <File name="Downloaders/FtpDownloader.cs" subtype="Code" buildaction="Compile" />
<File name="Downloaders/AbstractDownloader.cs" subtype="Code" buildaction="Compile" />
<File name="Download.cs" subtype="Code" buildaction="Compile" />
<File name="DownloadManager.cs" subtype="Code" buildaction="Compile" />
@@ -37,6 +35,15 @@
<File name="Logging/Log.cs" subtype="Code" buildaction="Compile" />
<File name="Logging/TeeTextWriter.cs" subtype="Code" buildaction="Compile" />
<File name="Logging/DelayedTextWriter.cs" subtype="Code" buildaction="Compile" />
+ <File name="IAppObject.cs" subtype="Code" buildaction="Compile" />
+ <File name="IAppObjectManager.cs" subtype="Code" buildaction="Compile" />
+ <File name="Xml" subtype="Directory" buildaction="Compile" />
+ <File name="Xml/Repository.cs" subtype="Code" buildaction="Compile" />
+ <File name="Xml/ItemsDict.cs" subtype="Code" buildaction="Compile" />
+ <File name="Xml/item.cs" subtype="Code" buildaction="Compile" />
+ <File name="Xml/changelog.cs" subtype="Code" buildaction="Compile" />
+ <File name="Xml/checksum.cs" subtype="Code" buildaction="Compile" />
+ <File name="Xml/author.cs" subtype="Code" buildaction="Compile" />
</Contents>
<References>
<ProjectReference type="Gac" localcopy="True" refto="gnome-vfs-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]