protected override void LoadFromXml(XDocument xml)
 {
     knownVersions.Clear();
     if (xml.Root == null)
     {
         throw new Exception("missing root node");
     }
     foreach (var element in xml.Root.Elements())
     {
         knownVersions.Add(element.Name.ToString(), VersionShort.Parse(element.Value));
     }
 }
Exemplo n.º 2
0
        public override void ResolveReferences()
        {
            base.ResolveReferences();
            if (defName == null)
            {
                defName = modIdentifier + assemblyVersion;
            }
            if (modIdentifier == null)
            {
                ReportError("UpdateFeatureDef.modIdentifier must be set");
            }
            if (modNameReadable == null)
            {
                ReportError("UpdateFeatureDef.modNameReadable must be set");
            }
            Exception versionFailure = null;

            try {
                if (assemblyVersion == null)
                {
                    throw new Exception("UpdateFeatureDef.assemblyVersion must be defined");
                }
                Version = VersionShort.Parse(assemblyVersion);
            } catch (Exception e) {
                Version        = new VersionShort();
                versionFailure = e;
            }
            if (versionFailure != null)
            {
                ReportError("UpdateFeatureDef.version parsing failed: " + versionFailure);
            }
            if (content == null)
            {
                ReportError("UpdateFeatureDef.content must be set");
            }
        }