UnityEditor.AndroidXmlDocument.PatchStringRes C# (CSharp) Method

PatchStringRes() public method

public PatchStringRes ( string tag, string attrib, string value ) : void
tag string
attrib string
value string
return void
        public void PatchStringRes(string tag, string attrib, string value)
        {
            XmlNode node = base.SelectSingleNode(string.Format("//{0}[@name='{1}']", tag, attrib), this.nsMgr);
            if (node == null)
            {
                node = base.DocumentElement.AppendChild(base.CreateElement(tag));
                node.Attributes.Append(this.CreateAttribute("", "name", "", attrib));
            }
            value = value.Replace(@"\", @"\\");
            value = value.Replace("'", @"\'");
            value = value.Replace("\"", "\\\"");
            node.InnerText = value;
        }

Usage Example

 public void Execute(PostProcessorContext context)
 {
     if (this.OnProgress != null)
     {
         this.OnProgress(this, "Patching settings file");
     }
     this._stagingArea = context.Get<string>("StagingArea");
     bool flag = context.Get<bool>("UseObb");
     string str = context.Get<string>("AndroidPluginsPath");
     if (Directory.Exists(Path.Combine(str, "assets")))
     {
         FileUtil.CopyDirectoryRecursiveForPostprocess(Path.Combine(str, "assets"), Path.Combine(this._stagingArea, "assets"), true);
     }
     this.PatchStringsXml();
     int num = !PlayerSettings.advancedLicense ? 0 : ((int) PlayerSettings.Android.splashScreenScale);
     AndroidXmlDocument document = new AndroidXmlDocument(Path.Combine(this._stagingArea, "assets/bin/Data/settings.xml"));
     document.PatchStringRes("integer", "splash_mode", num.ToString());
     document.PatchStringRes("bool", "useObb", flag.ToString());
     context.Set<AndroidXmlDocument>("SettingsXml", document);
     document.Save();
 }
All Usage Examples Of UnityEditor.AndroidXmlDocument::PatchStringRes