AndroidAppManifest(AndroidVersions versions, XDocument doc) { if (versions == null) { throw new ArgumentNullException(nameof(versions)); } if (doc == null) { throw new ArgumentNullException(nameof(doc)); } this.versions = versions; this.doc = doc; manifest = doc.Root; if (manifest.Name != "manifest") { throw new ArgumentException("App manifest does not have 'manifest' root element", nameof(doc)); } application = manifest.Element("application"); if (application == null) { manifest.Add(application = new XElement("application")); } usesSdk = manifest.Element("uses-sdk"); if (usesSdk == null) { manifest.Add(usesSdk = new XElement("uses-sdk")); } }
public static AndroidAppManifest Load(string filename, AndroidVersions versions) { if (filename == null) { throw new ArgumentNullException(nameof(filename)); } if (versions == null) { throw new ArgumentNullException(nameof(versions)); } return(Load(XDocument.Load(filename), versions)); }
public static AndroidAppManifest Load(XDocument doc, AndroidVersions versions) { if (doc == null) { throw new ArgumentNullException(nameof(doc)); } if (versions == null) { throw new ArgumentNullException(nameof(versions)); } return(new AndroidAppManifest(versions, doc)); }
public static AndroidAppManifest Create(string packageName, string appLabel, AndroidVersions versions) { return(new AndroidAppManifest(versions, XDocument.Parse( @"<?xml version=""1.0"" encoding=""utf-8""?> <manifest xmlns:android=""http://schemas.android.com/apk/res/android"" android:versionCode=""1"" android:versionName=""1.0""> <uses-sdk /> <application android:label=""""> </application> </manifest>")) { PackageName = packageName, ApplicationLabel = appLabel, }); }