public DiaIconFinder()
{
icons = new DiaIcons();
objecticons = new Dictionary <string, string> ();
objectsheets = new Dictionary <string, string> ();
System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo("sheets");
foreach (System.IO.FileInfo f in dir.GetFiles("*.sheet"))
{
string sheet = f.Name.Replace(".sheet", "");
XPathDocument document = new XPathDocument(f.FullName);
XPathNavigator nav = document.CreateNavigator();
XmlNamespaceManager manager = new XmlNamespaceManager(nav.NameTable);
manager.AddNamespace("dia",
"http://www.lysator.liu.se/~alla/dia/dia-sheet-ns");
XPathExpression query =
nav.Compile("/dia:sheet/dia:contents/dia:object");
query.SetContext(manager);
XPathNodeIterator links = nav.Select(query);
while (links.MoveNext())
{
try
{
string objectname = links.Current.GetAttribute("name", "");
string iconpath =
DiaIconFinder.GetPathFromNode(sheet, objectname, nav);
if ("" != iconpath)
{
objecticons.Add(objectname, iconpath);
}
objectsheets.Add(objectname, sheet);
}
catch
{
}
}
}
System.IO.DirectoryInfo sdir = new System.IO.DirectoryInfo("shapes");
foreach (System.IO.DirectoryInfo idir in sdir.GetDirectories())
{
GetShapesInDir(idir);
foreach (System.IO.DirectoryInfo jdir in idir.GetDirectories())
{
GetShapesInDir(jdir);
}
}
}