using System.IO;
using System.Runtime.InteropServices.WindowsRuntime;
using UnityEditor;
using UnityEditor.Callbacks;
#if UNITY_IOS
using UnityEditor.iOS.Xcode;
#endif
using UnityEngine;
#if UNITY_IOS
public partial class ToukaAdsBuildPostProcessor
{
	[PostProcessBuild]
	public static void OnPostprocessBuild (BuildTarget buildTarget, string path) {
		if (buildTarget != BuildTarget.iOS) return;

#if UNITY_IOS
		ModifyURLTypes (path);
		ModifyCode(path);
#endif
	}

#if UNITY_IOS
	private static void ModifyURLTypes (string _path) {
		var plistPath = Path.Combine (_path, "Info.plist");
		var plist = new PlistDocument ();
		plist.ReadFromFile (plistPath);

        plist.root.SetString("GADApplicationIdentifier", StaticStringsKey.GADValue);
        plist.root.SetBoolean("GADIsAdManagerApp", true);

#if IOS_CN
		plist.root.SetString("AppId", StaticStringsKey.TOUKA_SDK_APPID);
		plist.root.SetString("AppKey", StaticStringsKey.TOUKA_SDK_APPKEY);
		plist.root.SetString("splashPlacement", StaticStringsKey.TOUKA_SDK_ORIGINSPLASHID);
		plist.root.SetString("nativeSplashPlacement", StaticStringsKey.TOUKA_SDK_SPLASHID);
		plist.root.SetString("splashStatus", StaticStringsKey.SplashSwitch ? "1" : "0");
#endif

		plist.root.SetString("AppLovinSdkKey", StaticStringsKey.MAX_AppLovinSdkKey);

		plist.root.SetBoolean("ITSAppUsesNonExemptEncryption", false);

		//NSAppTransportSecurity set yes
		PlistElementDict atf = plist.root["NSAppTransportSecurity"].AsDict();
		atf.SetBoolean("NSAllowsArbitraryLoads", true);

		#region iOS 14
		//SKAdnetwork追加
		PlistElementArray URLWhiteListArr2 = plist.root.CreateArray("SKAdNetworkItems");

		//admob （1）
		PlistElementDict dic01;
		dic01 = URLWhiteListArr2.AddDict();
		dic01.SetString("SKAdNetworkIdentifier", "cstr6suwn9.skadnetwork");

		//ironsource（1）
		PlistElementDict dic02;
		dic02 = URLWhiteListArr2.AddDict();
		dic02.SetString("SKAdNetworkIdentifier", "su67r6k2v3.skadnetwork");

		//mintegral  （19）
		PlistElementDict dic03;
		dic03 = URLWhiteListArr2.AddDict();
		dic03.SetString("SKAdNetworkIdentifier", "kbd757ywx3.skadnetwork");

		PlistElementDict dic04;
		dic04 = URLWhiteListArr2.AddDict();
		dic04.SetString("SKAdNetworkIdentifier", "wg4vff78zm.skadnetwork");

		PlistElementDict dic05;
		dic05 = URLWhiteListArr2.AddDict();
		dic05.SetString("SKAdNetworkIdentifier", "737z793b9f.skadnetwork");

		PlistElementDict dic06;
		dic06 = URLWhiteListArr2.AddDict();
		dic06.SetString("SKAdNetworkIdentifier", "ydx93a7ass.skadnetwork");

		PlistElementDict dic07;
		dic07 = URLWhiteListArr2.AddDict();
		dic07.SetString("SKAdNetworkIdentifier", "prcb7njmu6.skadnetwork");

		PlistElementDict dic08;
		dic08 = URLWhiteListArr2.AddDict();
		dic08.SetString("SKAdNetworkIdentifier", "7ug5zh24hu.skadnetwork");

		PlistElementDict dic09;
		dic09 = URLWhiteListArr2.AddDict();
		dic09.SetString("SKAdNetworkIdentifier", "44jx6755aq.skadnetwork");


		PlistElementDict dic10;
		dic10 = URLWhiteListArr2.AddDict();
		dic10.SetString("SKAdNetworkIdentifier", "w9q455wk68.skadnetwork");



		PlistElementDict dic11;
		dic11 = URLWhiteListArr2.AddDict();
		dic11.SetString("SKAdNetworkIdentifier", "8s468mfl3y.skadnetwork");

		PlistElementDict dic12;
		dic12 = URLWhiteListArr2.AddDict();
		dic12.SetString("SKAdNetworkIdentifier", "glqzh8vgby.skadnetwork");

		PlistElementDict dic13;
		dic13 = URLWhiteListArr2.AddDict();
		dic13.SetString("SKAdNetworkIdentifier", "c6k4g5qg8m.skadnetwork");

		PlistElementDict dic14;
		dic14 = URLWhiteListArr2.AddDict();
		dic14.SetString("SKAdNetworkIdentifier", "mlmmfzh3r3.skadnetwork");

		PlistElementDict dic15;
		dic15 = URLWhiteListArr2.AddDict();
		dic15.SetString("SKAdNetworkIdentifier", "4pfyvq9l8r.skadnetwork");

		PlistElementDict dic16;
		dic16 = URLWhiteListArr2.AddDict();
		dic16.SetString("SKAdNetworkIdentifier", "av6w8kgt66.skadnetwork");

		PlistElementDict dic17;
		dic17 = URLWhiteListArr2.AddDict();
		dic17.SetString("SKAdNetworkIdentifier", "6xzpu9s2p8.skadnetwork");

		PlistElementDict dic18;
		dic18 = URLWhiteListArr2.AddDict();
		dic18.SetString("SKAdNetworkIdentifier", "hs6bdukanm.skadnetwork");


		//adcolony   （19）
		PlistElementDict dic19;
		dic19 = URLWhiteListArr2.AddDict();
		dic19.SetString("SKAdNetworkIdentifier", "v72qych5uu.skadnetwork");



		PlistElementDict dic20;
		dic20 = URLWhiteListArr2.AddDict();
		dic20.SetString("SKAdNetworkIdentifier", "ppxm28t8ap.skadnetwork");



		PlistElementDict dic21;
		dic21 = URLWhiteListArr2.AddDict();
		dic21.SetString("SKAdNetworkIdentifier", "klf5c3l5u5.skadnetwork");



		PlistElementDict dic22;
		dic22 = URLWhiteListArr2.AddDict();
		dic22.SetString("SKAdNetworkIdentifier", "4468km3ulz.skadnetwork");

		PlistElementDict dic23;
		dic23 = URLWhiteListArr2.AddDict();
		dic23.SetString("SKAdNetworkIdentifier", "3rd42ekr43.skadnetwork");

		//unity ads (2)
		PlistElementDict dic24;
		dic24 = URLWhiteListArr2.AddDict();
		dic24.SetString("SKAdNetworkIdentifier", "4dzt52r2t5.skadnetwork");

		PlistElementDict dic25;
		dic25 = URLWhiteListArr2.AddDict();
		dic25.SetString("SKAdNetworkIdentifier", "bvpn9ufa9b.skadnetwork");

		//maio (1)
		PlistElementDict dic26;
		dic26 = URLWhiteListArr2.AddDict();
		dic26.SetString("SKAdNetworkIdentifier", "V4NXQHLYQP.skadnetwork");

		//facebook(2)
		PlistElementDict dic27;
		dic27 = URLWhiteListArr2.AddDict();
		dic27.SetString("SKAdNetworkIdentifier", "v9wttpbfk9.skadnetwork");

		PlistElementDict dic28;
		dic28 = URLWhiteListArr2.AddDict();
		dic28.SetString("SKAdNetworkIdentifier", "n38lu8286q.skadnetwork");
		//vungle (1)
		PlistElementDict dic29;
		dic29 = URLWhiteListArr2.AddDict();
		dic29.SetString("SKAdNetworkIdentifier", "gta9lk7p23.skadnetwork");

		//pangle (2)
		PlistElementDict dic30;
		dic30 = URLWhiteListArr2.AddDict();
		dic30.SetString("SKAdNetworkIdentifier", "238da6jt44.skadnetwork");

		PlistElementDict dic31;
		dic31 = URLWhiteListArr2.AddDict();
		dic31.SetString("SKAdNetworkIdentifier", "22mmun2rn5.skadnetwork");

		//applovin(19)

		PlistElementDict dic32;
		dic32 = URLWhiteListArr2.AddDict();
		dic32.SetString("SKAdNetworkIdentifier", "2u9pt9hc89.skadnetwork");

		PlistElementDict dic33;
		dic33 = URLWhiteListArr2.AddDict();
		dic33.SetString("SKAdNetworkIdentifier", "275upjj5gd.skadnetwork");

		PlistElementDict dic34;
		dic34 = URLWhiteListArr2.AddDict();
		dic34.SetString("SKAdNetworkIdentifier", "4fzdc2evr5.skadnetwork");


		PlistElementDict dic35;
		dic35 = URLWhiteListArr2.AddDict();
		dic35.SetString("SKAdNetworkIdentifier", "9rd848q2bz.skadnetwork");

		PlistElementDict dic36;
		dic36 = URLWhiteListArr2.AddDict();
		dic36.SetString("SKAdNetworkIdentifier", "9t245vhmpl.skadnetwork");



		PlistElementDict dic37;
		dic37 = URLWhiteListArr2.AddDict();
		dic37.SetString("SKAdNetworkIdentifier", "f38h382jlk.skadnetwork");

		PlistElementDict dic38;
		dic38 = URLWhiteListArr2.AddDict();
		dic38.SetString("SKAdNetworkIdentifier", "ludvb6z3bs.skadnetwork");

		PlistElementDict dic39;
		dic39 = URLWhiteListArr2.AddDict();
		dic39.SetString("SKAdNetworkIdentifier", "m8dbw4sv7c.skadnetwork");

		PlistElementDict dic40;
		dic40 = URLWhiteListArr2.AddDict();
		dic40.SetString("SKAdNetworkIdentifier", "t38b2kh725.skadnetwork");

		PlistElementDict dic41;
		dic41 = URLWhiteListArr2.AddDict();
		dic41.SetString("SKAdNetworkIdentifier", "tl55sbb4fm.skadnetwork");

		PlistElementDict dic42;
		dic42 = URLWhiteListArr2.AddDict();
		dic42.SetString("SKAdNetworkIdentifier", "wzmmz9fp6w.skadnetwork");

		PlistElementDict dic43;
		dic43 = URLWhiteListArr2.AddDict();
		dic43.SetString("SKAdNetworkIdentifier", "yclnxrl5pm.skadnetwork");

		PlistElementDict dic44;
		dic44 = URLWhiteListArr2.AddDict();
		dic44.SetString("SKAdNetworkIdentifier", "2fnua5tdw4.skadnetwork");

		PlistElementDict dic45;
		dic45 = URLWhiteListArr2.AddDict();
		dic45.SetString("SKAdNetworkIdentifier", "3qcr597p9d.skadnetwork");

		PlistElementDict dic46;
		dic46 = URLWhiteListArr2.AddDict();
		dic46.SetString("SKAdNetworkIdentifier", "3qy4746246.skadnetwork");

		PlistElementDict dic47;
		dic47 = URLWhiteListArr2.AddDict();
		dic47.SetString("SKAdNetworkIdentifier", "3sh42y64q3.skadnetwork");

		PlistElementDict dic48;
		dic48 = URLWhiteListArr2.AddDict();
		dic48.SetString("SKAdNetworkIdentifier", "424m5254lk.skadnetwork");

		PlistElementDict dic49;
		dic49 = URLWhiteListArr2.AddDict();
		dic49.SetString("SKAdNetworkIdentifier", "5a6flpkh64.skadnetwork");

		PlistElementDict dic50;
		dic50 = URLWhiteListArr2.AddDict();
		dic50.SetString("SKAdNetworkIdentifier", "e5fvkxwrpn.skadnetwork");

		PlistElementDict dic51;
		dic51 = URLWhiteListArr2.AddDict();
		dic51.SetString("SKAdNetworkIdentifier", "ecpz2srf59.skadnetwork");

		PlistElementDict dic52;
		dic52 = URLWhiteListArr2.AddDict();
		dic52.SetString("SKAdNetworkIdentifier", "hjevpa356n.skadnetwork");
		PlistElementDict dic53;
		dic53 = URLWhiteListArr2.AddDict();
		dic53.SetString("SKAdNetworkIdentifier", "k674qkevps.skadnetwork");


		PlistElementDict dic54;
		dic54 = URLWhiteListArr2.AddDict();
		dic54.SetString("SKAdNetworkIdentifier", "n6fk4nfna4.skadnetwork");

		PlistElementDict dic55;
		dic55 = URLWhiteListArr2.AddDict();
		dic55.SetString("SKAdNetworkIdentifier", "p78axxw29g.skadnetwork");

		PlistElementDict dic56;
		dic56 = URLWhiteListArr2.AddDict();
		dic56.SetString("SKAdNetworkIdentifier", "s39g8k73mm.skadnetwork");
		PlistElementDict dic57;
		dic57 = URLWhiteListArr2.AddDict();
		dic57.SetString("SKAdNetworkIdentifier", "uw77j35x4d.skadnetwork");

		PlistElementDict dic58;
		dic58 = URLWhiteListArr2.AddDict();
		dic58.SetString("SKAdNetworkIdentifier", "y2ed4ez56y.skadnetwork");

		PlistElementDict dic59;
		dic59 = URLWhiteListArr2.AddDict();
		dic59.SetString("SKAdNetworkIdentifier", "zq492l623r.skadnetwork");

		PlistElementDict dic60;
		dic60 = URLWhiteListArr2.AddDict();
		dic60.SetString("SKAdNetworkIdentifier", "24t9a8vw3c.skadnetwork");

		PlistElementDict dic61;
		dic61 = URLWhiteListArr2.AddDict();
		dic61.SetString("SKAdNetworkIdentifier", "32z4fx6l9h.skadnetwork");

		PlistElementDict dic62;
		dic62 = URLWhiteListArr2.AddDict();
		dic62.SetString("SKAdNetworkIdentifier", "523jb4fst2.skadnetwork");

		PlistElementDict dic63;
		dic63 = URLWhiteListArr2.AddDict();
		dic63.SetString("SKAdNetworkIdentifier", "54nzkqm89y.skadnetwork");

		PlistElementDict dic64;
		dic64 = URLWhiteListArr2.AddDict();
		dic64.SetString("SKAdNetworkIdentifier", "578prtvx9j.skadnetwork");

		PlistElementDict dic65;
		dic65 = URLWhiteListArr2.AddDict();
		dic65.SetString("SKAdNetworkIdentifier", "5l3tpt7t6e.skadnetwork");

		PlistElementDict dic66;
		dic66 = URLWhiteListArr2.AddDict();
		dic66.SetString("SKAdNetworkIdentifier", "5lm9lj6jb7.skadnetwork");

		PlistElementDict dic67;
		dic67 = URLWhiteListArr2.AddDict();
		dic67.SetString("SKAdNetworkIdentifier", "79pbpufp6p.skadnetwork");

		PlistElementDict dic68;
		dic68 = URLWhiteListArr2.AddDict();
		dic68.SetString("SKAdNetworkIdentifier", "7rz58n8ntl.skadnetwork");

		PlistElementDict dic69;
		dic69 = URLWhiteListArr2.AddDict();
		dic69.SetString("SKAdNetworkIdentifier", "n66cz3y3bx.skadnetwork");

		PlistElementDict dic70;
		dic70 = URLWhiteListArr2.AddDict();
		dic70.SetString("SKAdNetworkIdentifier", "9b89h5y424.skadnetwork");

		PlistElementDict dic71;
		dic71 = URLWhiteListArr2.AddDict();
		dic71.SetString("SKAdNetworkIdentifier", "9nlqeag3gk.skadnetwork");

		PlistElementDict dic72;
		dic72 = URLWhiteListArr2.AddDict();
		dic72.SetString("SKAdNetworkIdentifier", "cg4yq2srnc.skadnetwork");

		PlistElementDict dic73;
		dic73 = URLWhiteListArr2.AddDict();
		dic73.SetString("SKAdNetworkIdentifier", "cj5566h2ga.skadnetwork");

		PlistElementDict dic74;
		dic74 = URLWhiteListArr2.AddDict();
		dic74.SetString("SKAdNetworkIdentifier", "5tjdwbrq8w.skadnetwork");
		PlistElementDict dic75;
		dic75 = URLWhiteListArr2.AddDict();
		dic75.SetString("SKAdNetworkIdentifier", "ejvt5qm6ak.skadnetwork");

		PlistElementDict dic76;
		dic76 = URLWhiteListArr2.AddDict();
		dic76.SetString("SKAdNetworkIdentifier", "feyaarzu9v.skadnetwork");

		PlistElementDict dic77;
		dic77 = URLWhiteListArr2.AddDict();
		dic77.SetString("SKAdNetworkIdentifier", "g28c52eehv.skadnetwork");

		PlistElementDict dic78;
		dic78 = URLWhiteListArr2.AddDict();
		dic78.SetString("SKAdNetworkIdentifier", "ggvn48r87g.skadnetwork");

		PlistElementDict dic79;
		dic79 = URLWhiteListArr2.AddDict();
		dic79.SetString("SKAdNetworkIdentifier", "mtkv5xtk9e.skadnetwork");

		PlistElementDict dic80;
		dic80 = URLWhiteListArr2.AddDict();
		dic80.SetString("SKAdNetworkIdentifier", "n9x2a789qt.skadnetwork");

		PlistElementDict dic81;
		dic81 = URLWhiteListArr2.AddDict();
		dic81.SetString("SKAdNetworkIdentifier", "pwa73g5rt2.skadnetwork");

		PlistElementDict dic82;
		dic82 = URLWhiteListArr2.AddDict();
		dic82.SetString("SKAdNetworkIdentifier", "xy9t38ct57.skadnetwork");

		PlistElementDict dic83;
		dic83 = URLWhiteListArr2.AddDict();
		dic83.SetString("SKAdNetworkIdentifier", "zmvfpc5aq8.skadnetwork");

		PlistElementDict dic84;
		dic84 = URLWhiteListArr2.AddDict();
		dic84.SetString("SKAdNetworkIdentifier", "44n7hlldy6.skadnetwork");

		PlistElementDict dic85;
		dic85 = URLWhiteListArr2.AddDict();
		dic85.SetString("SKAdNetworkIdentifier", "488r3q3dtq.skadnetwork");

		PlistElementDict dic86;
		dic86 = URLWhiteListArr2.AddDict();
		dic86.SetString("SKAdNetworkIdentifier", "f73kdq92p3.skadnetwork");

		PlistElementDict dic87;
		dic87 = URLWhiteListArr2.AddDict();
		dic87.SetString("SKAdNetworkIdentifier", "f7s53z58qe.skadnetwork");

		PlistElementDict dic88;
		dic88 = URLWhiteListArr2.AddDict();
		dic88.SetString("SKAdNetworkIdentifier", "lr83yxwka7.skadnetwork");

		PlistElementDict dic89;
		dic89 = URLWhiteListArr2.AddDict();
		dic89.SetString("SKAdNetworkIdentifier", "v79kvwwj4g.skadnetwork");

		PlistElementDict dic90;
		dic90 = URLWhiteListArr2.AddDict();
		dic90.SetString("SKAdNetworkIdentifier", "7953jerfzd.skadnetwork");

		PlistElementDict dic91;
		dic91 = URLWhiteListArr2.AddDict();
		dic91.SetString("SKAdNetworkIdentifier", "9yg77x724h.skadnetwork");

		PlistElementDict dic92;
		dic92 = URLWhiteListArr2.AddDict();
		dic92.SetString("SKAdNetworkIdentifier", "mls7yz5dvl.skadnetwork");

		PlistElementDict dic93;
		dic93 = URLWhiteListArr2.AddDict();
		dic93.SetString("SKAdNetworkIdentifier", "x8jxxk4ff5.skadnetwork");

		PlistElementDict dic94;
		dic94 = URLWhiteListArr2.AddDict();
		dic94.SetString("SKAdNetworkIdentifier", "mp6xlyr22a.skadnetwork");

		PlistElementDict dic95;
		dic95 = URLWhiteListArr2.AddDict();
		dic95.SetString("SKAdNetworkIdentifier", "x44k69ngh6.skadnetwork");

		PlistElementDict dic96;
		dic96 = URLWhiteListArr2.AddDict();
		dic96.SetString("SKAdNetworkIdentifier", "6g9af3uyq4.skadnetwork");

		PlistElementDict dic97;
		dic97 = URLWhiteListArr2.AddDict();
		dic97.SetString("SKAdNetworkIdentifier", "qqp299437r.skadnetwork");

		PlistElementDict dic98;
		dic98 = URLWhiteListArr2.AddDict();
		dic98.SetString("SKAdNetworkIdentifier", "252b5q8x7y.skadnetwork");

		PlistElementDict dic99;
		dic99 = URLWhiteListArr2.AddDict();
		dic99.SetString("SKAdNetworkIdentifier", "rx5hdcabgc.skadnetwork");

		PlistElementDict dic100;
		dic100 = URLWhiteListArr2.AddDict();
		dic100.SetString("SKAdNetworkIdentifier", "294l99pt4k.skadnetwork");

		PlistElementDict dic101;
		dic101 = URLWhiteListArr2.AddDict();
		dic101.SetString("SKAdNetworkIdentifier", "kbmxgpxpgc.skadnetwork");

		PlistElementDict dic102;
		dic102 = URLWhiteListArr2.AddDict();
		dic102.SetString("SKAdNetworkIdentifier", "52fl2v3hgk.skadnetwork");

		PlistElementDict dic103;
		dic103 = URLWhiteListArr2.AddDict();
		dic103.SetString("SKAdNetworkIdentifier", "r45fhb6rf7.skadnetwork");

		PlistElementDict dic104;
		dic104 = URLWhiteListArr2.AddDict();
		dic104.SetString("SKAdNetworkIdentifier", "rvh3l7un93.skadnetwork");

		PlistElementDict dic105;
		dic105 = URLWhiteListArr2.AddDict();
		dic105.SetString("SKAdNetworkIdentifier", "97r2b46745.skadnetwork");

		PlistElementDict dic106;
		dic106 = URLWhiteListArr2.AddDict();
		dic106.SetString("SKAdNetworkIdentifier", "9g2aggbj52.skadnetwork");

		PlistElementDict dic107;
		dic107 = URLWhiteListArr2.AddDict();
		dic107.SetString("SKAdNetworkIdentifier", "dzg6xy7pwj.skadnetwork");

		PlistElementDict dic108;
		dic108 = URLWhiteListArr2.AddDict();
		dic108.SetString("SKAdNetworkIdentifier", "x8uqf25wch.skadnetwork");

		PlistElementDict dic109;
		dic109 = URLWhiteListArr2.AddDict();
		dic109.SetString("SKAdNetworkIdentifier", "58922nb4gd.skadnetwork");

		PlistElementDict dic110;
		dic110 = URLWhiteListArr2.AddDict();
		dic110.SetString("SKAdNetworkIdentifier", "gvmwg8q7h5.skadnetwork");

		PlistElementDict dic111;
		dic111 = URLWhiteListArr2.AddDict();
		dic111.SetString("SKAdNetworkIdentifier", "hdw39hrw9y.skadnetwork");

		PlistElementDict dic112;
		dic112 = URLWhiteListArr2.AddDict();
		dic112.SetString("SKAdNetworkIdentifier", "8c4e2ghe7u.skadnetwork");

		PlistElementDict dic113;
		dic113 = URLWhiteListArr2.AddDict();
		dic113.SetString("SKAdNetworkIdentifier", "v4nxqhlyqp.skadnetwork");

		PlistElementDict dic114;
		dic114 = URLWhiteListArr2.AddDict();
		dic114.SetString("SKAdNetworkIdentifier", "c3frkrj4fj.skadnetwork");

		PlistElementDict dic115;
		dic115 = URLWhiteListArr2.AddDict();
		dic115.SetString("SKAdNetworkIdentifier", "nzq8sh4pbs.skadnetwork");

		PlistElementDict dic116;
		dic116 = URLWhiteListArr2.AddDict();
		dic116.SetString("SKAdNetworkIdentifier", "pu4na253f3.skadnetwork");

		PlistElementDict dic117;
		dic117 = URLWhiteListArr2.AddDict();
		dic117.SetString("SKAdNetworkIdentifier", "6964rsfnh4.skadnetwork");

		PlistElementDict dic118;
		dic118 = URLWhiteListArr2.AddDict();
		dic118.SetString("SKAdNetworkIdentifier", "74b6s63p6l.skadnetwork");

		PlistElementDict dic119;
		dic119 = URLWhiteListArr2.AddDict();
		dic119.SetString("SKAdNetworkIdentifier", "84993kbrcf.skadnetwork");

		PlistElementDict dic120;
		dic120 = URLWhiteListArr2.AddDict();
		dic120.SetString("SKAdNetworkIdentifier", "y45688jllp.skadnetwork");

		PlistElementDict dic121;
		dic121 = URLWhiteListArr2.AddDict();
		dic121.SetString("SKAdNetworkIdentifier", "yrqqpx2mcb.skadnetwork");

		PlistElementDict dic122;
		dic122 = URLWhiteListArr2.AddDict();
		dic122.SetString("SKAdNetworkIdentifier", "z4gj7hsk7h.skadnetwork");

		PlistElementDict dic123;
		dic123 = URLWhiteListArr2.AddDict();
		dic123.SetString("SKAdNetworkIdentifier", "u679fj5vs4.skadnetwork");

		PlistElementDict dic124;
		dic124 = URLWhiteListArr2.AddDict();
		dic124.SetString("SKAdNetworkIdentifier", "a7xqa6mtl2.skadnetwork");

		PlistElementDict dic125;
		dic125 = URLWhiteListArr2.AddDict();
		dic125.SetString("SKAdNetworkIdentifier", "g2y4y55b64.skadnetwork");

		PlistElementDict dic126;
		dic126 = URLWhiteListArr2.AddDict();
		dic126.SetString("SKAdNetworkIdentifier", "pwdxu55a5a.skadnetwork");
		#endregion

		PlistElementArray urlTypes = plist.root.CreateArray ("CFBundleURLTypes");

		PlistElementDict dict = urlTypes.AddDict();
		dict.SetString("CFBundleURLName", Application.identifier);
		PlistElementArray schemesArray = dict.CreateArray("CFBundleURLSchemes");
		schemesArray.AddString(Application.identifier);

		File.WriteAllText (plistPath, plist.WriteToString ());
	}

	private static void ModifyCode(string _path)
	{
#if IOS_CN
		ToukaClassHelper SplashScreenController = new ToukaClassHelper(_path + "/Classes/UI/SplashScreen.mm");

		if (!SplashScreenController.HasBolow("#import <TGATUNITYSDK/TONativeSplashHelper.h>"))
		{

			SplashScreenController.WriteBelow("#include \"SplashScreen.h\"", "#import <TGATUNITYSDK/TONativeSplashHelper.h>");
			SplashScreenController.WriteBelow("void HideSplashScreen()\n{", "[[TONativeSplashHelper helper]showSplashInLaunch];");

		}
#endif

	}
#endif
}

public partial class ToukaClassHelper
{

	private string filePath;

	public ToukaClassHelper(string fPath)
	{
		filePath = fPath;
		if (!System.IO.File.Exists(filePath))
		{
			Debug.LogError(filePath + "路径下文件不存在");
			return;
		}
	}

	public void WriteBelow(string below, string text)
	{
		StreamReader streamReader = new StreamReader(filePath);
		string text_all = streamReader.ReadToEnd();
		streamReader.Close();

		int beginIndex = text_all.IndexOf(below);
		if (beginIndex == -1)
		{
			Debug.LogError(filePath + "中没有找到标致" + below);
			return;
		}

		int endIndex = text_all.LastIndexOf("\n", beginIndex + below.Length);

		text_all = text_all.Substring(0, endIndex) + "\n" + text + "\n" + text_all.Substring(endIndex);

		StreamWriter streamWriter = new StreamWriter(filePath);
		streamWriter.Write(text_all);
		streamWriter.Close();
	}

	public void Replace(string below, string newText)
	{
		StreamReader streamReader = new StreamReader(filePath);
		string text_all = streamReader.ReadToEnd();
		streamReader.Close();

		int beginIndex = text_all.IndexOf(below);
		if (beginIndex == -1)
		{
			Debug.LogError(filePath + "中没有找到标致" + below);
			return;
		}

		text_all = text_all.Replace(below, newText);
		StreamWriter streamWriter = new StreamWriter(filePath);
		streamWriter.Write(text_all);
		streamWriter.Close();

	}

	public bool HasBolow(string below)
	{
		StreamReader streamReader = new StreamReader(filePath);
		string text_all = streamReader.ReadToEnd();
		streamReader.Close();

		int beginIndex = text_all.IndexOf(below);
		if (beginIndex == -1)
		{
			Debug.Log("[" + GetType() + "]" + filePath + "中没有找到标致" + below);
			return false;
		}
		return true;
	}
}

#endif