private static void EditorPlist(string filePath) { XCPlist list = new XCPlist(filePath); string bundle = "com.yusong.momo"; string PlistAdd = @" <key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleTypeRole</key> <string>Editor</string> <key>CFBundleURLIconFile</key> <string>Icon@2x</string> <key>CFBundleURLName</key> <string>" + bundle + @"</string> <key>CFBundleURLSchemes</key> <array> <string>ww123456</string> </array> </dict> </array>"; //在plist里面增加一行 list.AddKey(PlistAdd); //在plist里面替换一行 list.ReplaceKey("<string>com.yusong.${PRODUCT_NAME}</string>", "<string>" + bundle + "</string>"); list.Save(); }
static void WritePlistFile(string path) { if (JoyYouSDKPlugin.PlatformSDK == ProjectPlatform.PP) { XCPlist list =new XCPlist(path); string ppKeyStr = @" <key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleURLName</key> <string></string> <key>CFBundleURLSchemes</key> <array> <string>teiron%appId%</string> </array> </dict> </array>"; string s_appId = ""; foreach (var attr in typeof(JoyYouSDK).GetCustomAttributes(false)) { InitPPSDKParamAttribute ppSDKParams = attr as InitPPSDKParamAttribute; if (ppSDKParams != null) { s_appId = ppSDKParams.appId.ToString(); break; } } ppKeyStr = ppKeyStr.Replace ("%appId%", s_appId); list.AddKey (ppKeyStr); list.Save (); } }