public void Pack(string sourcePath, string destinationPath)
        {
            var isFile = File.Exists(sourcePath);
            var unpackedFiles = isFile ? new[] { sourcePath } : Directory.GetFiles(sourcePath, "*.xnb.js", SearchOption.AllDirectories);
            var tempDir = Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), "Gnomoria.ContentExtractor", Guid.NewGuid().ToString())).FullName;

            foreach (var file in unpackedFiles)
            {
                logger.Info("Creating intermediate file for {0}", Path.GetFileNameWithoutExtension(file));
                var doc = JsonConvert.DeserializeXmlNode(File.ReadAllText(file));
                var assetPath = (isFile ? Path.GetFileName(file) : file.Substring(sourcePath.Length)).Split('.')[0] + ".xml";
                Directory.CreateDirectory(Path.GetDirectoryName(Path.Combine(tempDir, assetPath)));
                doc.Save(Path.Combine(tempDir, assetPath));
            }

            logger.Info("Packing files");
            var filesToBePacked = Directory.GetFiles(tempDir, "*.xml", SearchOption.AllDirectories);
            var libPath = Path.Combine(tempDir, "gnomorialib.dll");
            var preppedLibrary = false;
            
            try
            {
                var startInfo = new ProcessStartInfo()
                {
                    FileName = "lib\\de4dot",
                    Arguments = "gnomorialib.dll -o {0} --keep-names ef".FormatWith(libPath),
                    RedirectStandardOutput = true,
                    CreateNoWindow = true,
                    UseShellExecute = false,
                    WorkingDirectory = "lib"
                };

                using (var process = new Process { StartInfo = startInfo })
                {
                    process.Start();
                    process.StandardOutput.ReadToEnd();

                    preppedLibrary = process.ExitCode == 0;
                }
            }
            catch (Exception e)
            {
                logger.Debug(e);
            }

            if (!preppedLibrary)
            {
                logger.Error("Couldn't prep library");
                Cleanup(tempDir);
                return;
            }

            var project = new ContentProject(destinationPath, tempDir);
            project.AddReference("gnomorialib", libPath);

            foreach (var file in filesToBePacked)
                project.AddItem(file, "XmlImporter", Path.GetFileName(file), Path.GetFileNameWithoutExtension(file));

            if (!project.Build())
                logger.Error("Error while packing data. See log for details");

            Cleanup(tempDir);
        }
        private void PackSkinImages(string[] images, string imagesDir, string destination, string tempDir)
        {
            var project = new ContentProject(destination, tempDir);
            project.AddReference("Microsoft.Xna.Framework.Content.Pipeline.TextureImporter, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=MSIL");

            foreach (var file in images)
                project.AddItem(file, "TextureImporter", Path.GetFileName(file), Path.GetFileNameWithoutExtension(file), "TextureProcessor");

            if (!project.Build())
                logger.Error("Error while packing images. See log for details");
        }