Exemple #1
0
        static void Main(string[] args)
        {
            var opt = new OptionXml(args);

            var manifest = opt.PlatformXml.SelectSingleNode("/manifest");

            if (null == manifest)
            {
                throw new Exception("AndroidManifest.xmlの形式が正しくありません");
            }
            var androidNs = manifest.Attributes.GetNamedItem("xmlns:android")?.Value;

            if (null == androidNs)
            {
                throw new Exception("xmlns:android の値の取得に失敗しました");
            }
            var application = opt.PlatformXml.SelectSingleNode("/manifest/application");

            if (null == application)
            {
                throw new Exception("AndroidManifest/applicationが取得できません");
            }

            XmlNode node;

            // パッケージの書き換え
            node = opt.SettingXml.SelectSingleNode("config/package");
            if (node != null)
            {
                var attr = opt.PlatformXml.CreateAttribute("package");
                attr.Value = node.InnerText;
                manifest.Attributes.SetNamedItem(attr);
            }

            // ラベル名の書き換え
            node = opt.SettingXml.SelectSingleNode("config/application/label");
            if (node != null)
            {
                var attr = opt.PlatformXml.CreateAttribute("android:label", androidNs);
                attr.Value = node.InnerText;
                application.Attributes.SetNamedItem(attr);
            }

            opt.WriteXml();
        }
Exemple #2
0
        static void Main(string[] args)
        {
            var opt  = new OptionXml(args);
            var dict = opt.PlatformXml.SelectSingleNode("/plist/dict");

            if (null == dict)
            {
                throw new Exception("Info.plistの形式が正しくありません");
            }
            var dictMap = new DictMap(dict);

            XmlNode node;

            // CFBundleDisplayName
            node = opt.SettingXml.SelectSingleNode("config/CFBundleDisplayName");
            if (node != null)
            {
                dictMap.SetStringValue("CFBundleDisplayName", node.InnerText);
            }

            // CFBundleIdentifier
            node = opt.SettingXml.SelectSingleNode("config/CFBundleIdentifier");
            if (node != null)
            {
                dictMap.SetStringValue("CFBundleIdentifier", node.InnerText);
            }

            // MinimumOSVersion
            node = opt.SettingXml.SelectSingleNode("config/MinimumOSVersion");
            if (node != null)
            {
                dictMap.SetStringValue("MinimumOSVersion", node.InnerText);
            }

            dictMap.save();

            opt.WriteXml();
        }