Exemple #1
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);
        }
 public ModNotFoundException(ModDefinition definition)
     : base(String.Format("Mod not found: {0}", definition.ToString((true))))
 {
 }