Author: bnickel
Date: 2008-01-03 02:59:47 -0500 (Thu, 03 Jan 2008)
New Revision: 92157

Added:
   trunk/taglib-sharp/docs/Package.en.xml.in
   trunk/taglib-sharp/docs/XmlInjector.cs
Removed:
   trunk/taglib-sharp/docs/MonodocNodeConfig.cs
   trunk/taglib-sharp/docs/Package.en.xml
Modified:
   trunk/taglib-sharp/ChangeLog
   trunk/taglib-sharp/configure.ac
   trunk/taglib-sharp/docs/Makefile.am
   trunk/taglib-sharp/src/Makefile.am
Log:
2008-01-03  Brian Nickel <[EMAIL PROTECTED]>
        
        *  src/Makefile.am: Generate taglib-sharp.dll.xml instead.
        *  docs/Package.en.xml.in: Contains missing documentation and rules for
        XmlInjector.exe.
        
        *  docs/XmlInjector.cs: A new XML manager which can remove, replace, and
        insert nodes into an XML document based on XPath queries.
        
        *  docs/Makefile.am: Build XML from the slashdoc and use XmlInjector.exe
        to insert missing parts into documentation as well as modify monodoc.xml
        
        *  docs/Package.en.xml: Depreciated by docs/Package.en.xml.in.
        
        *  docs/MonodocNodeConfig.cs: Depreciated by docs/XmlInjector.cs.
        
        *  configure.ac: Generate docs/Package.en.xml from
        docs/Package.en.xml.in


Modified: trunk/taglib-sharp/ChangeLog
===================================================================
--- trunk/taglib-sharp/ChangeLog        2008-01-03 05:27:10 UTC (rev 92156)
+++ trunk/taglib-sharp/ChangeLog        2008-01-03 07:59:47 UTC (rev 92157)
@@ -1,3 +1,22 @@
+2008-01-03  Brian Nickel <[EMAIL PROTECTED]>
+       
+       *  src/Makefile.am: Generate taglib-sharp.dll.xml instead.
+       *  docs/Package.en.xml.in: Contains missing documentation and rules for
+       XmlInjector.exe.
+       
+       *  docs/XmlInjector.cs: A new XML manager which can remove, replace, and
+       insert nodes into an XML document based on XPath queries.
+       
+       *  docs/Makefile.am: Build XML from the slashdoc and use XmlInjector.exe
+       to insert missing parts into documentation as well as modify monodoc.xml
+       
+       *  docs/Package.en.xml: Depreciated by docs/Package.en.xml.in.
+       
+       *  docs/MonodocNodeConfig.cs: Depreciated by docs/XmlInjector.cs.
+       
+       *  configure.ac: Generate docs/Package.en.xml from
+       docs/Package.en.xml.in
+
 2008-01-02  Brian Nickel <[EMAIL PROTECTED]>
        
        * src/Makefile.am: Generate taglib-sharp-docs.xml when building docs.

Modified: trunk/taglib-sharp/configure.ac
===================================================================
--- trunk/taglib-sharp/configure.ac     2008-01-03 05:27:10 UTC (rev 92156)
+++ trunk/taglib-sharp/configure.ac     2008-01-03 07:59:47 UTC (rev 92157)
@@ -105,6 +105,7 @@
 src/policy.2.0.taglib-sharp.config
 examples/Makefile
 docs/Makefile
+docs/Package.en.xml
 ])
 
 echo "TagLib# ($ASSEMBLY_NAME-$ASSEMBLY_VERSION) is ready to be compiled."

Modified: trunk/taglib-sharp/docs/Makefile.am
===================================================================
--- trunk/taglib-sharp/docs/Makefile.am 2008-01-03 05:27:10 UTC (rev 92156)
+++ trunk/taglib-sharp/docs/Makefile.am 2008-01-03 07:59:47 UTC (rev 92157)
@@ -1,15 +1,13 @@
 DOC_UPDATER = @MONODOCER@ -delete -pretty
 DOC_ASSEMBLER = @MDASSEMBLER@ --out taglib-sharp-docs --ecma
 
-ASSEMBLIES = \
-       $(top_builddir)/src/taglib-sharp.dll
+ASSEMBLY = $(top_builddir)/src/$(ASSEMBLY_NAME).dll
+SLASHDOC = $(ASSEMBLY).xml
 
-ASSEMBLIES_BUILD = $(foreach asm,$(ASSEMBLIES),$(addprefix -assembly:,$(asm)))
-
 if BUILD_DOCS
-all: MonodocNodeConfig.exe
+all: XmlInjector.exe
 
-MonodocNodeConfig.exe: MonodocNodeConfig.cs
+XmlInjector.exe: XmlInjector.cs
        mcs -out:$@ -r:System.Xml $<
 
 monodocdir = $(DESTDIR)$(DOCDIR)
@@ -18,32 +16,42 @@
        taglib-sharp-docs.tree \
        taglib-sharp-docs.source
 
-update-docs: $(ASSEMBLIES)
-       $(DOC_UPDATER) $(ASSEMBLIES_BUILD) -path:en
+$(srcdir)/en/index.xml: $(ASSEMBLY) $(SLASHDOC) $(srcdir)/XmlInjector.exe 
$(srcdir)/Package.en.xml
+# monodocer will create duplicate tags if run multiple times. Delete the whole
+# directory and start over.
+       if [ -d $(srcdir)/en ]; then \
+               rm -rf $(srcdir)/en; \
+       fi
+       monodocer /assembly:$(ASSEMBLY) /importslashdoc:$(SLASHDOC) /path:en
+       $(MONO) $(srcdir)/XmlInjector.exe $(srcdir)/Package.en.xml 
InsertMissingValues
 
-update-html:
+update-html: $(srcdir)/en
        if [ -d taglib-sharp-web-docs ]; then \
                rm -rf taglib-sharp-web-docs; \
        fi; \
        mkdir taglib-sharp-web-docs; \
        monodocs2html --source en --dest taglib-sharp-web-docs;
 
-taglib-sharp-docs.zip taglib-sharp-docs.tree: $(srcdir)/en/*/*.xml 
$(srcdir)/en/*.xml
+taglib-sharp-docs.zip taglib-sharp-docs.tree: $(srcdir)/en/index.xml
        $(DOC_ASSEMBLER) $(srcdir)/en
 
-install-data-hook:
-       $(MONO) $(top_builddir)/docs/MonodocNodeConfig.exe --insert "TagLib#" 
classlib-taglib-sharp $(DOCDIR)/../monodoc.xml
+install-data-hook: $(srcdir)/XmlInjector.exe $(srcdir)/Package.en.xml
+       $(MONO) $(srcdir)/XmlInjector.exe $(srcdir)/Package.en.xml 
InjectMenuItem
 
-uninstall-hook:
-       $(MONO) $(top_builddir)/docs/MonodocNodeConfig.exe --remove 
classlib-taglib-sharp $(DOCDIR)/../monodoc.xml
+uninstall-hook: $(srcdir)/XmlInjector.exe $(srcdir)/Package.en.xml
+       $(MONO) $(srcdir)/XmlInjector.exe $(srcdir)/Package.en.xml 
RemoveMenuItem
+
+clean-local:
+       if [ -d $(srcdir)/en ]; then \
+               rm -rf $(srcdir)/en; \
+       fi
+
 endif
 
 EXTRA_DIST = \
-       $(srcdir)/en/*.xml \
-       $(srcdir)/en/*/*.xml \
        taglib-sharp-docs.source \
-       MonodocNodeConfig.cs \
-       Package.en.xml
+       XmlInjector.cs \
+       Package.en.xml.in
        
 DISTCLEANFILES = \
        taglib-sharp-docs.zip \
@@ -53,5 +61,4 @@
        Makefile.in
 
 CLEANFILES = \
-       MonodocNodeConfig.exe
-
+       XmlInjector.exe

Deleted: trunk/taglib-sharp/docs/MonodocNodeConfig.cs
===================================================================
--- trunk/taglib-sharp/docs/MonodocNodeConfig.cs        2008-01-03 05:27:10 UTC 
(rev 92156)
+++ trunk/taglib-sharp/docs/MonodocNodeConfig.cs        2008-01-03 07:59:47 UTC 
(rev 92157)
@@ -1,136 +0,0 @@
-/***************************************************************************
- *  MonodocNodeConfig.cs
- *
- *  Copyright (C) 2005 Novell
- *  Written by Aaron Bockover ([EMAIL PROTECTED])
- ****************************************************************************/
-
-/*  THIS FILE IS LICENSED UNDER THE MIT LICENSE AS OUTLINED IMMEDIATELY BELOW: 
- *
- *  Permission is hereby granted, free of charge, to any person obtaining a
- *  copy of this software and associated documentation files (the "Software"), 
 
- *  to deal in the Software without restriction, including without limitation  
- *  the rights to use, copy, modify, merge, publish, distribute, sublicense,  
- *  and/or sell copies of the Software, and to permit persons to whom the  
- *  Software is furnished to do so, subject to the following conditions:
- *
- *  The above copyright notice and this permission notice shall be included in 
- *  all copies or substantial portions of the Software.
- *
- *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
- *  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
- *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 
THE 
- *  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
- *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
- *  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
- *  DEALINGS IN THE SOFTWARE.
- */
-
-using System;
-using System.Xml;
-
-public static class MonodocNodeConfig
-{
-    private static XmlDocument document;
-
-    public static int Main(string [] args)
-    {
-        bool insert_mode = false;
-        string xml_file = null;
-        string label = null;
-        string name = null;
-        
-        switch(args[0]) {
-            case "--insert":
-                if(args.Length != 4) {
-                    PrintUsage();
-                    return 0;
-                }
-                
-                insert_mode = true;
-                label = args[1];
-                name = args[2];
-                xml_file = args[3];
-                break;
-            case "--remove":
-                if(args.Length != 3) {
-                    PrintUsage();
-                    return 0;
-                }
-                
-                insert_mode = false;
-                name = args[1];
-                xml_file = args[2];
-                break;
-            default:
-                PrintUsage();
-                return 0;
-        }
-        
-        document = new XmlDocument();
-        document.Load(xml_file);
-        
-        RemoveNode(name);
-            
-        if(insert_mode) {
-            InsertNode(label, name);
-        }
-        
-        try {
-            document.Save(xml_file);
-        } catch {
-                       Console.WriteLine("Couldn\'t insert node!");
-                       return 1;
-        }
-               return 0;
-    }
-
-    private static void PrintUsage()
-    {
-        Console.WriteLine("Usage is:");
-        Console.WriteLine("MonodocNodeConfig.exe --insert|--remove [options] 
<monodoc XML file>\n");
-        Console.WriteLine("Where [options] for --insert must be:");
-        Console.WriteLine("  <label> <name>\n");
-        Console.WriteLine("Where [options] for --remove must be:");
-        Console.WriteLine("  <name>\n");
-    }
-    
-    private static void RemoveNode(string name)
-    {
-        foreach(XmlNode node in document.DocumentElement) {
-            if(node.Attributes["name"].Value != "various") {
-                continue;
-            }
-            
-            foreach(XmlNode child in node) {
-                if(child.Attributes["name"].Value == name) {
-                    node.RemoveChild(child);
-                    return;
-                }
-            }
-        }
-    }
-    
-    private static void InsertNode(string label, string name)
-    {
-        foreach(XmlNode node in document.DocumentElement) {
-            if(node.Attributes["name"].Value != "various") {
-                continue;
-            }
-            
-            XmlNode insert_node = document.CreateNode(XmlNodeType.Element, 
"node", String.Empty);
-            
-            XmlAttribute label_attr = document.CreateAttribute("label");
-            label_attr.Value = label;
-            insert_node.Attributes.Append(label_attr);
-            
-            XmlAttribute name_attr = document.CreateAttribute("name");
-            name_attr.Value = name;
-            insert_node.Attributes.Append(name_attr);
-            
-            node.AppendChild(insert_node);
-            
-            return;
-        }
-    }
-}

Deleted: trunk/taglib-sharp/docs/Package.en.xml
===================================================================
--- trunk/taglib-sharp/docs/Package.en.xml      2008-01-03 05:27:10 UTC (rev 
92156)
+++ trunk/taglib-sharp/docs/Package.en.xml      2008-01-03 07:59:47 UTC (rev 
92157)
@@ -1,135 +0,0 @@
-<Package>
-       <Overview>
-               <Title>TagLib#</Title>
-               <Remarks>This package provides support for reading and writing
-               the tagging information for a large number of tagging formats,
-               as well as reading media properties for many standard audio and
-               video formats.</Remarks>
-               <Copyright>Copyright (C) 2007-2008 Brian Nickel</Copyright>
-       </Overview>
-       <Namespace Name="TagLib">
-               <Docs>
-                       <summary>TagLib provides a generic interface for reading
-                       media properties and editing tags on different audio and
-                       video files.</summary>
-                       <remarks>The most straightforward way to read a file is
-                       through <see cref="M:TagLib.File.Create(System.String)"
-                       />, which does type detection to create the correct <see
-                       cref="T:TagLib.File" />.</remarks>
-               </Docs>
-       </Namespace>
-       <Namespace Name="TagLib.Ape">
-               <Docs>
-                       <summary><para>The TagLib.Ape namespace contains classes
-                       for handling the reading APE tags.</para></summary>
-                       <remarks><para>See
-                       http://wiki.hydrogenaudio.org/index.php?title=APEv2 for
-                       the complete specification.</para></remarks>
-               </Docs>
-       </Namespace>
-       <Namespace Name="TagLib.Asf">
-               <Docs>
-                       <summary>The TagLib.Asf namespace contains classes for
-                       handling the Microsoft Advanced Systems Format file
-                       format.</summary>
-                       <remarks>See
-                       
http://www.microsoft.com/windows/windowsmedia/forpros/format/asfspec.aspx
-                       for the complete specification.</remarks>
-               </Docs>
-       </Namespace>
-       <Namespace Name="TagLib.Flac">
-               <Docs>
-                       <summary>The TagLib.Flac namespace contains classes for
-                       handling the Xiph FLAC file format.</summary>
-                       <remarks>See http://flac.sourceforge.net/format.html for
-                       the complete specification.</remarks>
-               </Docs>
-       </Namespace>
-       <Namespace Name="TagLib.Id3v1">
-               <Docs>
-                       <summary>The TagLib.Id3v1 namespace contains classes for
-                       handling the ID3v1.1 tagging format.</summary>
-                       <remarks>See http://www.id3.org/ID3v1 for the complete
-                       specification.</remarks>
-               </Docs>
-       </Namespace>
-       <Namespace Name="TagLib.Id3v2">
-               <Docs>
-                       <summary>The TagLib.Id3v2 namespace contains classes for
-                       handling the ID3v2 tagging format.</summary>
-                       <remarks>See http://www.id3.org/Developer_Information
-                       for the complete specification.</remarks>
-               </Docs>
-       </Namespace>
-       <Namespace Name="TagLib.Mpeg4">
-               <Docs>
-               <summary>The TagLib.Mpeg4 namespace contains classes for
-               handling the MPEG-4 file format.</summary>
-               <remarks>See
-               
http://standards.iso.org/ittf/PubliclyAvailableStandards/c041828_ISO_IEC_14496-12_2005(E).zip
-               for the complete specification.</remarks>
-               </Docs>
-       </Namespace>
-       <Namespace Name="TagLib.Mpeg">
-               <Docs>
-               <summary>The TagLib.Mpeg namespace contains classes for handling
-               MPEG-1/2 files and MPEG audio files.</summary>
-               <remarks />
-               </Docs>
-       </Namespace>
-       <Namespace Name="TagLib.MusePack">
-               <Docs>
-               <summary>The TagLib.MusePack namespace contains classes for
-               handling the MusePack file format.</summary>
-               <remarks>See http://www.musepack.net/ for the complete
-               specification.</remarks>
-               </Docs>
-       </Namespace>
-       <Namespace Name="TagLib.NonContainer">
-               <Docs>
-                       <summary>The TagLib.NonContainer namespace provides
-                       classes for dealing with files that do not have a
-                       standardized tagging mechanism and may have any number
-                       of tags at their beginning or end.</summary>
-                       <remarks>The FLAC file format is included in this
-                       because despite having a standard tagging mechanism, ID3
-                       and APE tags are not uncommonly attached to the
-                       file.</remarks>
-               </Docs>
-       </Namespace>
-       <Namespace Name="TagLib.Ogg.Codecs">
-               <Docs>
-                       <summary>The TagLib.Ogg.Codecs namespace contains
-                       standard codecs used in Xiph Ogg files.</summary>
-                       <remarks />
-               </Docs>
-       </Namespace>
-       <Namespace Name="TagLib.Ogg">
-               <Docs>
-                       <summary>The TagLib.Ogg namespace contains classes for
-                       handling the Xiph OGG file format.</summary>
-                       <remarks>See http://www.xiph.org/ogg/ for the complete
-                       specification.</remarks>
-               </Docs>
-       </Namespace>
-       <Namespace Name="TagLib.Riff">
-               <Docs>
-                       <summary>The TagLib.Riff namespace contains all classes
-                       relevant to the reading of Microsoft RIFF files. These
-                       files include namely the WAV and AVI file
-                       formats.</summary>
-                       <remarks>See
-                       http://msdn2.microsoft.com/en-us/library/ms779636.aspx
-                       for information on the RIFF AVI format.</remarks>
-               </Docs>
-       </Namespace>
-       <Namespace Name="TagLib.WavPack">
-               <Docs>
-                       <summary>The TagLib.WavPack namespace contains all
-                       classes relevant to the reading of WavPack
-                       files.</summary>
-                       <remarks>See http://www.wavpack.com/ for the complete
-                       specification.</remarks>
-               </Docs>
-       </Namespace>
-</Package>

Added: trunk/taglib-sharp/docs/Package.en.xml.in
===================================================================
--- trunk/taglib-sharp/docs/Package.en.xml.in   2008-01-03 05:27:10 UTC (rev 
92156)
+++ trunk/taglib-sharp/docs/Package.en.xml.in   2008-01-03 07:59:47 UTC (rev 
92157)
@@ -0,0 +1,197 @@
+<Package>
+       <Overview>
+               <Title>TagLib#</Title>
+               <Remarks>This package provides support for reading and writing
+               the tagging information for a large number of tagging formats,
+               as well as reading media properties for many standard audio and 
video formats.</Remarks>
+               <Copyright>Copyright (C) 2007-2008 Brian Nickel</Copyright>
+       </Overview>
+       <Namespace Name="TagLib">
+               <Docs>
+                       <summary>TagLib provides a generic interface for reading
+                       media properties and editing tags on different audio and
+                       video files.</summary>
+                       <remarks>The most straightforward way to read a file is
+                       through <see cref="M:TagLib.File.Create(System.String)"
+                       />, which does type detection to create the correct <see
+                       cref="T:TagLib.File" />.</remarks>
+               </Docs>
+       </Namespace>
+       <Namespace Name="TagLib.Ape">
+               <Docs>
+                       <summary><para>The TagLib.Ape namespace contains classes
+                       for handling the reading APE tags.</para></summary>
+                       <remarks><para>See
+                       http://wiki.hydrogenaudio.org/index.php?title=APEv2 for
+                       the complete specification.</para></remarks>
+               </Docs>
+       </Namespace>
+       <Namespace Name="TagLib.Asf">
+               <Docs>
+                       <summary>The TagLib.Asf namespace contains classes for
+                       handling the Microsoft Advanced Systems Format file
+                       format.</summary>
+                       <remarks>See
+                       
http://www.microsoft.com/windows/windowsmedia/forpros/format/asfspec.aspx
+                       for the complete specification.</remarks>
+               </Docs>
+       </Namespace>
+       <Namespace Name="TagLib.Flac">
+               <Docs>
+                       <summary>The TagLib.Flac namespace contains classes for
+                       handling the Xiph FLAC file format.</summary>
+                       <remarks>See http://flac.sourceforge.net/format.html for
+                       the complete specification.</remarks>
+               </Docs>
+       </Namespace>
+       <Namespace Name="TagLib.Id3v1">
+               <Docs>
+                       <summary>The TagLib.Id3v1 namespace contains classes for
+                       handling the ID3v1.1 tagging format.</summary>
+                       <remarks>See http://www.id3.org/ID3v1 for the complete
+                       specification.</remarks>
+               </Docs>
+       </Namespace>
+       <Namespace Name="TagLib.Id3v2">
+               <Docs>
+                       <summary>The TagLib.Id3v2 namespace contains classes for
+                       handling the ID3v2 tagging format.</summary>
+                       <remarks>See http://www.id3.org/Developer_Information
+                       for the complete specification.</remarks>
+               </Docs>
+       </Namespace>
+       <Namespace Name="TagLib.Mpeg4">
+               <Docs>
+               <summary>The TagLib.Mpeg4 namespace contains classes for
+               handling the MPEG-4 file format.</summary>
+               <remarks>See
+               
http://standards.iso.org/ittf/PubliclyAvailableStandards/c041828_ISO_IEC_14496-12_2005(E).zip
+               for the complete specification.</remarks>
+               </Docs>
+       </Namespace>
+       <Namespace Name="TagLib.Mpeg">
+               <Docs>
+               <summary>The TagLib.Mpeg namespace contains classes for handling
+               MPEG-1/2 files and MPEG audio files.</summary>
+               <remarks />
+               </Docs>
+       </Namespace>
+       <Namespace Name="TagLib.MusePack">
+               <Docs>
+               <summary>The TagLib.MusePack namespace contains classes for
+               handling the MusePack file format.</summary>
+               <remarks>See http://www.musepack.net/ for the complete
+               specification.</remarks>
+               </Docs>
+       </Namespace>
+       <Namespace Name="TagLib.NonContainer">
+               <Docs>
+                       <summary>The TagLib.NonContainer namespace provides
+                       classes for dealing with files that do not have a
+                       standardized tagging mechanism and may have any number
+                       of tags at their beginning or end.</summary>
+                       <remarks>The FLAC file format is included in this
+                       because despite having a standard tagging mechanism, ID3
+                       and APE tags are not uncommonly attached to the
+                       file.</remarks>
+               </Docs>
+       </Namespace>
+       <Namespace Name="TagLib.Ogg.Codecs">
+               <Docs>
+                       <summary>The TagLib.Ogg.Codecs namespace contains
+                       standard codecs used in Xiph Ogg files.</summary>
+                       <remarks />
+               </Docs>
+       </Namespace>
+       <Namespace Name="TagLib.Ogg">
+               <Docs>
+                       <summary>The TagLib.Ogg namespace contains classes for
+                       handling the Xiph OGG file format.</summary>
+                       <remarks>See http://www.xiph.org/ogg/ for the complete
+                       specification.</remarks>
+               </Docs>
+       </Namespace>
+       <Namespace Name="TagLib.Riff">
+               <Docs>
+                       <summary>The TagLib.Riff namespace contains all classes
+                       relevant to the reading of Microsoft RIFF files. These
+                       files include namely the WAV and AVI file
+                       formats.</summary>
+                       <remarks>See
+                       http://msdn2.microsoft.com/en-us/library/ms779636.aspx
+                       for information on the RIFF AVI format.</remarks>
+               </Docs>
+       </Namespace>
+       <Namespace Name="TagLib.WavPack">
+               <Docs>
+                       <summary>The TagLib.WavPack namespace contains all
+                       classes relevant to the reading of WavPack
+                       files.</summary>
+                       <remarks>See http://www.wavpack.com/ for the complete
+                       specification.</remarks>
+               </Docs>
+       </Namespace>
+       <ActionSet Name="InjectMenuItem">
+               <File Path="@DOCDIR@/../monodoc.xml">
+                       <Insert Target="/node/[EMAIL PROTECTED]'various']" 
IfMissing="//[EMAIL PROTECTED]'classlib-taglib-sharp']">
+                               <node label="TagLib#" 
name="classlib-taglib-sharp" />
+                       </Insert>
+               </File>
+       </ActionSet>
+       
+       <ActionSet Name="RemoveMenuItem">
+               <File Path="@DOCDIR@/../monodoc.xml">
+                       <Remove Target="//[EMAIL 
PROTECTED]'classlib-taglib-sharp']" />
+               </File>
+       </ActionSet>
+       
+       <ActionSet Name="InsertMissingValues">
+               <File Path="en/index.xml">
+                       <Replace Source="/Package/Overview/Title" 
Target="/Overview/Title" />
+                       <Replace Source="/Package/Overview/Copyright" 
Target="/Overview/Copyright" />
+                       <Replace Source="/Package/Overview/Remarks" 
Target="/Overview/Remarks" />
+               </File>
+               <File Path="en/TagLib.xml">
+                       <Replace Source="/Package/[EMAIL 
PROTECTED]'TagLib']/Docs" Target="/Namespace/Docs" />
+               </File>
+               <File Path="en/TagLib.Ape.xml">
+                       <Replace Source="/Package/[EMAIL 
PROTECTED]'TagLib.Ape']/Docs" Target="/Namespace/Docs" />
+               </File>
+               <File Path="en/TagLib.Asf.xml">
+                       <Replace Source="/Package/[EMAIL 
PROTECTED]'TagLib.Asf']/Docs" Target="/Namespace/Docs" />
+               </File>
+               <File Path="en/TagLib.Flac.xml">
+                       <Replace Source="/Package/[EMAIL 
PROTECTED]'TagLib.Flac']/Docs" Target="/Namespace/Docs" />
+               </File>
+               <File Path="en/TagLib.Id3v1.xml">
+                       <Replace Source="/Package/[EMAIL 
PROTECTED]'TagLib.Id3v1']/Docs" Target="/Namespace/Docs" />
+               </File>
+               <File Path="en/TagLib.Id3v2.xml">
+                       <Replace Source="/Package/[EMAIL 
PROTECTED]'TagLib.Id3v2']/Docs" Target="/Namespace/Docs" />
+               </File>
+               <File Path="en/TagLib.Mpeg4.xml">
+                       <Replace Source="/Package/[EMAIL 
PROTECTED]'TagLib.Mpeg4']/Docs" Target="/Namespace/Docs" />
+               </File>
+               <File Path="en/TagLib.Mpeg.xml">
+                       <Replace Source="/Package/[EMAIL 
PROTECTED]'TagLib.Mpeg']/Docs" Target="/Namespace/Docs" />
+               </File>
+               <File Path="en/TagLib.MusePack.xml">
+                       <Replace Source="/Package/[EMAIL 
PROTECTED]'TagLib.MusePack']/Docs" Target="/Namespace/Docs" />
+               </File>
+               <File Path="en/TagLib.NonContainer.xml">
+                       <Replace Source="/Package/[EMAIL 
PROTECTED]'TagLib.NonContainer']/Docs" Target="/Namespace/Docs" />
+               </File>
+               <File Path="en/TagLib.Ogg.Codecs.xml">
+                       <Replace Source="/Package/[EMAIL 
PROTECTED]'TagLib.Ogg.Codecs']/Docs" Target="/Namespace/Docs" />
+               </File>
+               <File Path="en/TagLib.Ogg.xml">
+                       <Replace Source="/Package/[EMAIL 
PROTECTED]'TagLib.Ogg']/Docs" Target="/Namespace/Docs" />
+               </File>
+               <File Path="en/TagLib.Riff.xml">
+                       <Replace Source="/Package/[EMAIL 
PROTECTED]'TagLib.Riff']/Docs" Target="/Namespace/Docs" />
+               </File>
+               <File Path="en/TagLib.WavPack.xml">
+                       <Replace Source="/Package/[EMAIL 
PROTECTED]'TagLib.WavPack']/Docs" Target="/Namespace/Docs" />
+               </File>
+       </ActionSet>
+</Package>

Added: trunk/taglib-sharp/docs/XmlInjector.cs
===================================================================
--- trunk/taglib-sharp/docs/XmlInjector.cs      2008-01-03 05:27:10 UTC (rev 
92156)
+++ trunk/taglib-sharp/docs/XmlInjector.cs      2008-01-03 07:59:47 UTC (rev 
92157)
@@ -0,0 +1,191 @@
+/***************************************************************************
+ *  XmlInjector.cs
+ *
+ *  Copyright (C) 2008 Brian Nickel
+ *  Written by Brian Nickel ([EMAIL PROTECTED])
+ ****************************************************************************/
+
+/*  THIS FILE IS LICENSED UNDER THE MIT LICENSE AS OUTLINED IMMEDIATELY BELOW: 
+ *
+ *  Permission is hereby granted, free of charge, to any person obtaining a
+ *  copy of this software and associated documentation files (the "Software"), 
 
+ *  to deal in the Software without restriction, including without limitation  
+ *  the rights to use, copy, modify, merge, publish, distribute, sublicense,  
+ *  and/or sell copies of the Software, and to permit persons to whom the  
+ *  Software is furnished to do so, subject to the following conditions:
+ *
+ *  The above copyright notice and this permission notice shall be included in 
+ *  all copies or substantial portions of the Software.
+ *
+ *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
+ *  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
+ *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 
THE 
+ *  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
+ *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
+ *  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
+ *  DEALINGS IN THE SOFTWARE.
+ */
+
+using System;
+using System.Xml;
+
+public static class XmlInjector
+{
+       public static int Main (string [] args)
+       {
+               if (args.Length != 2) {
+                       Console.WriteLine ("XmlInjector.exe ACTIONFILE.XML 
ACTION_NAME");
+                       return 1;
+               }
+               
+               XmlDocument doc = new XmlDocument ();
+               try {
+                       doc.Load (args [0]);
+               } catch {
+                       Console.WriteLine ("Could not open {0}.", args [0]);
+                       return 1;
+               }
+               
+               string dir = System.IO.Directory.GetParent (args [0]).FullName;
+               Console.WriteLine ("Setting working directory to {0}.", dir);
+               System.IO.Directory.SetCurrentDirectory (dir);
+               
+               string path = string.Format ("//[EMAIL PROTECTED]'{0}']/[EMAIL 
PROTECTED]", args [1]);
+               foreach (XmlNode node in doc.SelectNodes (path))
+                       if (!RunFileAction (node))
+                               return 1;
+               
+               return 0;
+       }
+       
+       private static bool RunFileAction (XmlNode fileElement)
+       {
+               string path = GetAttribute (fileElement, "Path");
+               XmlDocument doc = new XmlDocument ();
+               try {
+                       doc.Load (path);
+               } catch {
+                       Console.WriteLine ("ERROR: Could not open {0}.", path);
+                       return false;
+               }
+               
+               Console.WriteLine ("Processing {0}...", path);
+               
+               foreach (XmlNode element in fileElement.SelectNodes ("Replace"))
+                       if (!ReplaceNode (fileElement.OwnerDocument, doc, 
element))
+                               return false;
+               
+               foreach (XmlNode element in fileElement.SelectNodes ("Insert"))
+                       if (!InsertNode (fileElement.OwnerDocument, doc, 
element))
+                               return false;
+               
+               foreach (XmlNode element in fileElement.SelectNodes ("Remove"))
+                       if (!RemoveNodes (doc, element))
+                               return false;
+               
+               doc.Save (path);
+               Console.WriteLine ("{0} saved.", path);
+               return true;
+       }
+       
+       private static bool ReplaceNode (XmlDocument sourceDocument,
+                                         XmlDocument targetDocument,
+                                         XmlNode replaceElement)
+       {
+               string sourcePath = GetAttribute (replaceElement, "Source");
+               string targetPath = GetAttribute (replaceElement, "Target");
+               
+               if (OperationNotNeccessary (targetDocument, replaceElement)) {
+                       Console.WriteLine ("   Skipping replacement of {0}.", 
targetPath);
+                       return true;
+               }
+               
+               Console.WriteLine ("   Replacing {0}.", targetPath);
+               XmlNode sourceNode = sourcePath == null ? null : 
sourceDocument.SelectSingleNode (sourcePath);
+               XmlNode targetNode = targetPath == null ? null : 
targetDocument.SelectSingleNode (targetPath);
+               
+               if (sourceNode == null)
+                       sourceNode = replaceElement.FirstChild;
+               
+               if (sourceNode == null) {
+                       Console.WriteLine ("ERROR: Could not find source node: 
{0}", sourcePath);
+                       return false;
+               }
+               
+               if (targetNode == null) {
+                       Console.WriteLine ("ERROR: Could not find target node: 
{0}", targetPath);
+                       return false;
+               }
+               
+               targetNode.ParentNode.ReplaceChild (targetDocument.ImportNode 
(sourceNode, true), targetNode);
+               return true;
+       }
+       
+       private static bool InsertNode (XmlDocument sourceDocument, XmlDocument 
targetDocument, XmlNode insertElement)
+       {
+               string sourcePath = GetAttribute (insertElement, "Source");
+               string targetPath = GetAttribute (insertElement, "Target");
+               
+               if (OperationNotNeccessary (targetDocument, insertElement)) {
+                       Console.WriteLine ("   Skipping insertion into {0}.", 
targetPath);
+                       return true;
+               }
+               
+               Console.WriteLine ("   Inserting into {0}.", targetPath);
+               XmlNode sourceNode = sourcePath == null ? null : 
sourceDocument.SelectSingleNode (sourcePath);
+               XmlNode targetNode = targetPath == null ? null : 
targetDocument.SelectSingleNode (targetPath);
+               
+               if (sourceNode == null)
+                       sourceNode = insertElement.FirstChild;
+               
+               if (sourceNode == null) {
+                       Console.WriteLine ("ERROR: Could not find source node: 
{0}", sourcePath);
+                       return false;
+               }
+               
+               if (targetNode == null) {
+                       Console.WriteLine ("ERROR: Could not find target node: 
{0}", targetPath);
+                       return false;
+               }
+               
+               targetNode.AppendChild (targetDocument.ImportNode (sourceNode, 
true));
+               return true;
+       }
+       
+       private static bool RemoveNodes (XmlDocument targetDocument,
+                                        XmlNode removeElement)
+       {
+               string targetPath = GetAttribute (removeElement, "Target");
+               
+               if (OperationNotNeccessary (targetDocument, removeElement)) {
+                       Console.WriteLine ("   Skipping removal of {0}.", 
targetPath);
+                       return true;
+               }
+               
+               Console.WriteLine ("   Removing {0}.", targetPath);
+               
+               while (true) {
+                       XmlNode targetNode = targetDocument.SelectSingleNode 
(targetPath);
+                       
+                       if (targetNode == null)
+                               return true;
+                       
+                       targetNode.ParentNode.RemoveChild (targetNode);
+               }
+       }
+       
+       private static bool OperationNotNeccessary (XmlDocument targetDocument, 
XmlNode actionElement)
+       {
+               string ifMissingPath = GetAttribute (actionElement, 
"IfMissing");
+               if (ifMissingPath != null && targetDocument.SelectSingleNode 
(ifMissingPath) != null)
+                       return true;
+               
+               return false;
+       }
+       
+       private static string GetAttribute (XmlNode node, string attribute)
+       {
+               XmlAttribute xmlAttr = node.Attributes [attribute];
+               return xmlAttr == null ? null : xmlAttr.Value;
+       }
+}


Property changes on: trunk/taglib-sharp/docs/XmlInjector.cs
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: trunk/taglib-sharp/src/Makefile.am
===================================================================
--- trunk/taglib-sharp/src/Makefile.am  2008-01-03 05:27:10 UTC (rev 92156)
+++ trunk/taglib-sharp/src/Makefile.am  2008-01-03 07:59:47 UTC (rev 92157)
@@ -3,7 +3,7 @@
 TARGET = $(ASSEMBLY)
 
 if BUILD_DOCS
-DOCFILE = taglib-sharp-docs.xml
+DOCFILE = $(ASSEMBLY).xml
 DOCFLAGS = /doc:$(DOCFILE) /warn:4
 else
 DOCFILE =

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to