/XSpriterPipelineExtensions/SCMLImporter.cs

https://bitbucket.org/dylanwolf/xspriter · C# · 24 lines · 22 code · 2 blank · 0 comment · 0 complexity · 4a0521e216e3e006f1b2a5afc3539d62 MD5 · raw file

  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Xml.Linq;
  7. using Microsoft.Xna.Framework.Content.Pipeline;
  8. namespace FuncWorks.XNA.XSpriter
  9. {
  10. [ContentImporter(".scml", DisplayName = "XSpriter - SCML Importer", DefaultProcessor = "SCMLProcessor")]
  11. public class SCMLImporter : ContentImporter<XDocument>
  12. {
  13. public override XDocument Import(string filename, ContentImporterContext context)
  14. {
  15. XDocument doc = XDocument.Load(filename);
  16. doc.Document.Root.Add(new XElement("File",
  17. new XAttribute("name", Path.GetFileName(filename)),
  18. new XAttribute("path", Path.GetDirectoryName(filename))));
  19. return doc;
  20. }
  21. }
  22. }