Ejemplo n.º 1
0
 public ModPrototype(ModDefinition definition, ReadOnlyFileSystem fileSystem,
                     ModManifest manifest)
 {
     Definition = definition;
     FileSystem = fileSystem;
     Manifest = manifest;
 }
Ejemplo n.º 2
0
        public ModManifest GetManifest(ModDefinition definition, ReadOnlyFileSystem fileSystem)
        {
            var manifestFile = FileSystemPath.Root.AppendFile("manifest.xml");

            if (fileSystem.Exists(manifestFile) == false)
            {
                throw new FileNotFoundException("Could not find manifest file for {0}.",
                    definition.ToString(false));
            }

            String input = fileSystem.OpenFile(manifestFile, FileAccess.Read).ReadAllText();

            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.LoadXml(input);

            XmlElement node = xmlDoc["mod"];

            if (node == null)
            {
                throw new InvalidDataException("No 'mod' element found in manifest.xml.");
            }

            return ModManifest.FromXml(node);
        }