UnityEditor.FacebookEditor.ManifestMod.UpdateManifest C# (CSharp) Method

UpdateManifest() public static method

public static UpdateManifest ( string fullPath ) : void
fullPath string
return void
        public static void UpdateManifest(string fullPath)
        {
            string appId = FBSettings.AppId;

            if (!FBSettings.IsValidAppId)
            {
                Debug.LogError("You didn't specify a Facebook app ID.  Please add one using the Facebook menu in the main Unity editor.");
                return;
            }

            XmlDocument doc = new XmlDocument();
            doc.Load(fullPath);

            if (doc == null)
            {
                Debug.LogError("Couldn't load " + fullPath);
                return;
            }

            XmlNode manNode = FindChildNode(doc, "manifest");
            XmlNode dict = FindChildNode(manNode, "application");

            if (dict == null)
            {
                Debug.LogError("Error parsing " + fullPath);
                return;
            }

            string ns = dict.GetNamespaceOfPrefix("android");

            //add the unity login activity
            XmlElement unityLoginElement = FindElementWithAndroidName("activity", "name", ns, UnityLoginActivityName, dict);
            if (unityLoginElement == null)
            {
                unityLoginElement = CreateUnityLoginElement(doc, ns);
                dict.AppendChild(unityLoginElement);
            }


            //add the login activity
            XmlElement loginElement = FindElementWithAndroidName("activity", "name", ns, LoginActivityName, dict);
            if (loginElement == null)
            {
                loginElement = CreateLoginElement(doc, ns);
                dict.AppendChild(loginElement);
            }

            //add deep linking activity
            XmlElement deepLinkingElement = FindElementWithAndroidName("activity", "name", ns, DeepLinkingActivityName, dict);
            if (deepLinkingElement == null)
            {
                deepLinkingElement = CreateDeepLinkingElement(doc, ns);
                dict.AppendChild(deepLinkingElement);
            }

            //add the app id
            //<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="\ 409682555812308" />
            XmlElement appIdElement = FindElementWithAndroidName("meta-data", "name", ns, ApplicationIdMetaDataName, dict);
            if (appIdElement == null)
            {
                appIdElement = doc.CreateElement("meta-data");
                appIdElement.SetAttribute("name", ns, ApplicationIdMetaDataName);
                dict.AppendChild(appIdElement);
            }
            appIdElement.SetAttribute("value", ns, "\\ " + appId); //stupid hack so that the id comes out as a string

            doc.Save(fullPath);
        }