private bool DoSettingsNeedUpdate() { if (File.Exists(Application.dataPath + "/FuseSDK/FuseSDK_UnityEditor.cs") || File.Exists(Application.dataPath + "/Plugins/FuseSDK.NET-Stub.dll") || File.Exists(Application.dataPath + "/Plugins/FuseSDK.NET.dll")) { return(true); } #if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7) string currentVersion, metaVersion, bundleId; if (!FuseSDKUpdater.ReadVersionFile(out currentVersion, out metaVersion)) { return(true); } var versionMeta = AssetImporter.GetAtPath(VERSION_PATH); var sp = (versionMeta.userData ?? string.Empty).Split('#'); metaVersion = (sp.Length < 1) ? string.Empty : sp[0]; bundleId = (sp.Length < 2) ? string.Empty : sp[1]; string _ = null; int[] actualVer = FuseSDKUpdater.ParseVersion(currentVersion, ref _); int[] metaVer = FuseSDKUpdater.ParseVersion(metaVersion, ref _); if (metaVer == null || bundleId != PlayerSettings.bundleIdentifier || FuseSDKUpdater.HowOldIsVersion(metaVer, actualVer) >= 0) { return(true); } List <PluginImporter> iosPlugins = Directory.GetFiles(Application.dataPath + "/Plugins/iOS") .Select(file => file.Substring(file.LastIndexOfAny(new char[] { '\\', '/' }) + 1)) .Where(file => !file.EndsWith(".meta")) .Where(file => file.Contains("FuseSDK") || file.Contains("libFuse") || file.Contains("FuseUnity") || file.Contains("NSData-Base64")) .Select(file => PluginImporter.GetAtPath("Assets/Plugins/iOS/" + file) as PluginImporter) .Where(plugin => plugin != null) .ToList(); foreach (var plugin in iosPlugins) { if (plugin.assetPath.EndsWith(".m")) { string flags = plugin.GetPlatformData(BuildTarget.iOS, "CompileFlags"); if (!flags.Contains(IOS_PLUGIN_M_FLAGS)) { return(true); } } else if (plugin.assetPath.EndsWith(".a")) { string flags = plugin.GetPlatformData(BuildTarget.iOS, "CompileFlags"); var frameworks = plugin.GetPlatformData(BuildTarget.iOS, "FrameworkDependencies").Split(';').Where(f => !string.IsNullOrEmpty(f)); if (!flags.Contains(IOS_PLUGIN_A_FLAGS) || frameworks.Intersect(IOS_PLUGIN_A_FRAMEWORKS).Count() != IOS_PLUGIN_A_FRAMEWORKS.Length) { return(true); } } } List <PluginImporter> androidPlugins = Directory.GetFiles(Application.dataPath + "/Plugins/Android") .Union(Directory.GetDirectories(Application.dataPath + "/Plugins/Android", "res")) .Select(file => file.Substring(file.LastIndexOfAny(new char[] { '\\', '/' }) + 1)) .Where(file => !file.EndsWith(".meta")) .Where(file => file.Contains("FuseSDK") || file.Contains("FuseUnity") || file.Contains("android-support-v4.jar") || file.Contains("google-play-services.jar") || file == "res") .Select(file => PluginImporter.GetAtPath("Assets/Plugins/Android/" + file) as PluginImporter) .Where(plugin => plugin != null) .ToList(); foreach (var plugin in androidPlugins) { if (!plugin.GetCompatibleWithPlatform(BuildTarget.Android)) { return(true); } } #endif return(false); }
private bool DoSettingsNeedUpdate() { foreach (var file in DELETED_FILES) { if (File.Exists(Application.dataPath + file)) { return(true); } } if (Directory.GetDirectories(Application.dataPath + IOS_NATIVE_LIBS).Length > 1) { return(true); } if (Directory.GetDirectories(Application.dataPath + ANDROID_NATIVE_LIBS).Length > 1) { return(true); } if (!PlayerSettings.Android.forceSDCardPermission || !PlayerSettings.Android.forceInternetPermission) { return(true); } string currentVersion, metaVersion, bundleId; if (!FuseSDKUpdater.ReadVersionFile(out currentVersion, out metaVersion)) { return(true); } var versionMeta = AssetImporter.GetAtPath(VERSION_PATH); var sp = (versionMeta.userData ?? string.Empty).Split('#'); metaVersion = (sp.Length < 1) ? string.Empty : sp[0]; bundleId = (sp.Length < 2) ? string.Empty : sp[1]; string _ = null; int[] actualVer = FuseSDKUpdater.ParseVersion(currentVersion, ref _); int[] metaVer = FuseSDKUpdater.ParseVersion(metaVersion, ref _); //If there are different bundleIds for Android and iOS this will cause settings to update everytime the target is changed string currentBundleId = #if UNITY_5_6_OR_NEWER PlayerSettings.applicationIdentifier; #else PlayerSettings.bundleIdentifier; #endif if (metaVer == null || bundleId != currentBundleId || FuseSDKUpdater.HowOldIsVersion(metaVer, actualVer) >= 0) { return(true); } List <PluginImporter> iosPlugins = Directory.GetFiles(Application.dataPath + IOS_NATIVE_LIBS, "*", SearchOption.AllDirectories) .Where(file => !file.EndsWith(".meta")) .Select(file => PluginImporter.GetAtPath("Assets" + file.Substring(Application.dataPath.Length)) as PluginImporter) .Where(plugin => plugin != null) .ToList(); iosPlugins.AddRange( Directory.GetDirectories(Application.dataPath + IOS_NATIVE_LIBS, "*.framework", SearchOption.AllDirectories) .Select(path => PluginImporter.GetAtPath("Assets" + path.Substring(Application.dataPath.Length)) as PluginImporter) .Where(plugin => plugin != null) ); foreach (var plugin in iosPlugins) { if (!plugin.GetCompatibleWithPlatform(BuildTarget.iOS)) { return(true); } if (plugin.assetPath.EndsWith(".m")) { string flags = plugin.GetPlatformData(BuildTarget.iOS, "CompileFlags"); if (!flags.Contains(IOS_PLUGIN_M_FLAGS)) { return(true); } } else if (plugin.assetPath.EndsWith(".a")) { string flags = plugin.GetPlatformData(BuildTarget.iOS, "CompileFlags"); var frameworks = plugin.GetPlatformData(BuildTarget.iOS, "FrameworkDependencies").Split(';').Where(f => !string.IsNullOrEmpty(f)); if (!flags.Contains(IOS_PLUGIN_A_FLAGS) || frameworks.Intersect(IOS_PLUGIN_A_FRAMEWORKS).Count() != IOS_PLUGIN_A_FRAMEWORKS.Length) { return(true); } } } return(false); }