mirror of
https://github.com/claunia/cuetools.net.git
synced 2025-12-16 18:14:25 +00:00
taglib-sharp initial import (r553)
This commit is contained in:
66
taglib-sharp/docs/Makefile.am
Normal file
66
taglib-sharp/docs/Makefile.am
Normal file
@@ -0,0 +1,66 @@
|
||||
DOC_UPDATER = @MONODOCER@ -delete -pretty
|
||||
DOC_ASSEMBLER = @MDASSEMBLER@ --out taglib-sharp-docs --ecma
|
||||
|
||||
ASSEMBLY = $(top_builddir)/src/$(ASSEMBLY_NAME).dll
|
||||
SLASHDOC = $(ASSEMBLY).xml
|
||||
|
||||
if BUILD_DOCS
|
||||
all: XmlInjector.exe
|
||||
|
||||
XmlInjector.exe: XmlInjector.cs
|
||||
$(MCS) -out:$@ -r:System.Xml $<
|
||||
|
||||
monodocdir = $(DOCDIR)
|
||||
monodoc_DATA = \
|
||||
taglib-sharp-docs.zip \
|
||||
taglib-sharp-docs.tree \
|
||||
taglib-sharp-docs.source
|
||||
|
||||
en/index.xml: $(ASSEMBLY) $(SLASHDOC) XmlInjector.exe Package.en.xml
|
||||
# monodocer will create duplicate tags if run multiple times. Delete the whole
|
||||
# directory and start over.
|
||||
if [ -d en ]; then \
|
||||
rm -rf en; \
|
||||
fi
|
||||
$(DOC_UPDATER) -assembly:$(ASSEMBLY) -importslashdoc:$(SLASHDOC) -path:en > /dev/null
|
||||
$(MONO) XmlInjector.exe Package.en.xml InsertMissingValues
|
||||
|
||||
update-html: en
|
||||
if [ -d taglib-sharp-web-docs ]; then \
|
||||
rm -rf taglib-sharp-web-docs; \
|
||||
fi; \
|
||||
mkdir taglib-sharp-web-docs; \
|
||||
monodocs2html -o taglib-sharp-web-docs en;
|
||||
|
||||
taglib-sharp-docs.tree: taglib-sharp-docs.zip
|
||||
|
||||
taglib-sharp-docs.zip: en/index.xml
|
||||
$(DOC_ASSEMBLER) en
|
||||
|
||||
install-data-hook: XmlInjector.exe Package.en.xml
|
||||
$(MONO) XmlInjector.exe Package.en.xml InjectMenuItem
|
||||
|
||||
uninstall-hook: XmlInjector.exe Package.en.xml
|
||||
$(MONO) XmlInjector.exe Package.en.xml RemoveMenuItem
|
||||
|
||||
clean-local:
|
||||
if [ -d en ]; then \
|
||||
rm -rf en; \
|
||||
fi
|
||||
|
||||
endif
|
||||
|
||||
EXTRA_DIST = \
|
||||
taglib-sharp-docs.source \
|
||||
XmlInjector.cs \
|
||||
Package.en.xml.in
|
||||
|
||||
DISTCLEANFILES = \
|
||||
taglib-sharp-docs.zip \
|
||||
taglib-sharp-docs.tree
|
||||
|
||||
MAINTAINERCLEANFILES = \
|
||||
Makefile.in
|
||||
|
||||
CLEANFILES = \
|
||||
XmlInjector.exe
|
||||
221
taglib-sharp/docs/Package.en.xml.in
Normal file
221
taglib-sharp/docs/Package.en.xml.in
Normal file
@@ -0,0 +1,221 @@
|
||||
<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.Aac">
|
||||
<Docs>
|
||||
<summary><para>The TagLib.Aac namespace contains classes
|
||||
for handling the AAC file format.</para></summary>
|
||||
<remarks><para>See
|
||||
http://www.hydrogenaudio.org/forums/lofiversion/index.php/t21617.html
|
||||
for the complete specification.</para></remarks>
|
||||
</Docs>
|
||||
</Namespace>
|
||||
<Namespace Name="TagLib.Aiff">
|
||||
<Docs>
|
||||
<summary><para>The TagLib.Aiff namespace contains classes
|
||||
for handling the AIFF file format.</para></summary>
|
||||
<remarks><para>See
|
||||
http://en.wikipedia.org/wiki/Audio_Interchange_File_Format for
|
||||
the complete specification.</para></remarks>
|
||||
</Docs>
|
||||
</Namespace>
|
||||
<Namespace Name="TagLib.Ape">
|
||||
<Docs>
|
||||
<summary><para>The TagLib.Ape namespace contains classes
|
||||
for 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/node[@name='various']" IfMissing="//node[@name='classlib-taglib-sharp']">
|
||||
<node label="TagLib#" name="classlib-taglib-sharp" />
|
||||
</Insert>
|
||||
</File>
|
||||
</ActionSet>
|
||||
|
||||
<ActionSet Name="RemoveMenuItem">
|
||||
<File Path="@DOCDIR@/../monodoc.xml">
|
||||
<Remove Target="//node[@name='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/ns-TagLib.xml">
|
||||
<Replace Source="/Package/Namespace[@Name='TagLib']/Docs" Target="/Namespace/Docs" />
|
||||
</File>
|
||||
<File Path="en/ns-TagLib.Aac.xml">
|
||||
<Replace Source="/Package/Namespace[@Name='TagLib.Aac']/Docs" Target="/Namespace/Docs" />
|
||||
</File>
|
||||
<File Path="en/ns-TagLib.Aiff.xml">
|
||||
<Replace Source="/Package/Namespace[@Name='TagLib.Aiff']/Docs" Target="/Namespace/Docs" />
|
||||
</File>
|
||||
<File Path="en/ns-TagLib.Ape.xml">
|
||||
<Replace Source="/Package/Namespace[@Name='TagLib.Ape']/Docs" Target="/Namespace/Docs" />
|
||||
</File>
|
||||
<File Path="en/ns-TagLib.Asf.xml">
|
||||
<Replace Source="/Package/Namespace[@Name='TagLib.Asf']/Docs" Target="/Namespace/Docs" />
|
||||
</File>
|
||||
<File Path="en/ns-TagLib.Flac.xml">
|
||||
<Replace Source="/Package/Namespace[@Name='TagLib.Flac']/Docs" Target="/Namespace/Docs" />
|
||||
</File>
|
||||
<File Path="en/ns-TagLib.Id3v1.xml">
|
||||
<Replace Source="/Package/Namespace[@Name='TagLib.Id3v1']/Docs" Target="/Namespace/Docs" />
|
||||
</File>
|
||||
<File Path="en/ns-TagLib.Id3v2.xml">
|
||||
<Replace Source="/Package/Namespace[@Name='TagLib.Id3v2']/Docs" Target="/Namespace/Docs" />
|
||||
</File>
|
||||
<File Path="en/ns-TagLib.Mpeg4.xml">
|
||||
<Replace Source="/Package/Namespace[@Name='TagLib.Mpeg4']/Docs" Target="/Namespace/Docs" />
|
||||
</File>
|
||||
<File Path="en/ns-TagLib.Mpeg.xml">
|
||||
<Replace Source="/Package/Namespace[@Name='TagLib.Mpeg']/Docs" Target="/Namespace/Docs" />
|
||||
</File>
|
||||
<File Path="en/ns-TagLib.MusePack.xml">
|
||||
<Replace Source="/Package/Namespace[@Name='TagLib.MusePack']/Docs" Target="/Namespace/Docs" />
|
||||
</File>
|
||||
<File Path="en/ns-TagLib.NonContainer.xml">
|
||||
<Replace Source="/Package/Namespace[@Name='TagLib.NonContainer']/Docs" Target="/Namespace/Docs" />
|
||||
</File>
|
||||
<File Path="en/ns-TagLib.Ogg.Codecs.xml">
|
||||
<Replace Source="/Package/Namespace[@Name='TagLib.Ogg.Codecs']/Docs" Target="/Namespace/Docs" />
|
||||
</File>
|
||||
<File Path="en/ns-TagLib.Ogg.xml">
|
||||
<Replace Source="/Package/Namespace[@Name='TagLib.Ogg']/Docs" Target="/Namespace/Docs" />
|
||||
</File>
|
||||
<File Path="en/ns-TagLib.Riff.xml">
|
||||
<Replace Source="/Package/Namespace[@Name='TagLib.Riff']/Docs" Target="/Namespace/Docs" />
|
||||
</File>
|
||||
<File Path="en/ns-TagLib.WavPack.xml">
|
||||
<Replace Source="/Package/Namespace[@Name='TagLib.WavPack']/Docs" Target="/Namespace/Docs" />
|
||||
</File>
|
||||
</ActionSet>
|
||||
</Package>
|
||||
191
taglib-sharp/docs/XmlInjector.cs
Normal file
191
taglib-sharp/docs/XmlInjector.cs
Normal file
@@ -0,0 +1,191 @@
|
||||
/***************************************************************************
|
||||
* XmlInjector.cs
|
||||
*
|
||||
* Copyright (C) 2008 Brian Nickel
|
||||
* Written by Brian Nickel (brian.nickel@gmail.com)
|
||||
****************************************************************************/
|
||||
|
||||
/* 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 ("//ActionSet[@Name='{0}']/File[@Path]", 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;
|
||||
}
|
||||
}
|
||||
4
taglib-sharp/docs/taglib-sharp-docs.source
Normal file
4
taglib-sharp/docs/taglib-sharp-docs.source
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<monodoc>
|
||||
<source provider="ecma" basefile="taglib-sharp-docs" path="classlib-taglib-sharp" />
|
||||
</monodoc>
|
||||
Reference in New Issue
Block a user