コード例 #1
0
        private static void CreateManifest(string manifestPath, string companyName, string productName, string normalizedProductName, string id, AssemblyReferenceChecker checker)
        {
            string     validVersionString = GetValidVersionString();
            TextWriter writer             = new StreamWriter(manifestPath);

            writer.WriteLine("<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>");
            writer.WriteLine("<manifest xmlns=\"http://tizen.org/ns/packages\" api-version=\"" + TizenUtilities.StringFromMinOSVersion() + "\" package=\"" + id + "\" version=\"" + validVersionString + "\">");
            writer.WriteLine("    <author href=\"" + PlayerSettings.Tizen.productURL + "\">" + companyName + "</author>");
            writer.WriteLine("   <profile name=\"mobile\" />");
            writer.WriteLine("\t<description>" + SecurityElement.Escape(PlayerSettings.Tizen.productDescription) + "</description>");
            writer.WriteLine("\t<ui-application appid=\"" + id + "\" exec=\"" + normalizedProductName + "\" type=\"capp\" multiple=\"false\" taskmanage=\"true\" nodisplay=\"false\">");
            writer.WriteLine("\t\t<icon>app_icon.png</icon>");
            writer.WriteLine("\t\t<label>" + productName + "</label>");
            writer.WriteLine("\t</ui-application>");
            writer.WriteLine("\t<feature name=\"http://tizen.org/feature/screen.size.all\">true</feature>");
            writer.WriteLine("\t<privileges>");
            if (checker.HasReferenceToMethod("UnityEngine.Handheld::Vibrate") || checker.HasReferenceToMethod("UnityEngine.iPhoneUtils::Vibrate"))
            {
                writer.WriteLine("\t\t<privilege>http://tizen.org/privilege/haptic</privilege>");
            }
            if (checker.HasReferenceToType("UnityEngine.WebCamTexture"))
            {
                writer.WriteLine("\t\t<privilege>http://tizen.org/privilege/camera</privilege>");
            }
            if (checker.HasReferenceToMethod("UnityEngine.Application::OpenURL") || checker.HasReferenceToType("UnityEngine.Purchasing"))
            {
                writer.WriteLine("\t\t<privilege>http://tizen.org/privilege/appmanager.launch</privilege>");
            }
            if (checker.HasReferenceToMethod("UnityEngine.Screen::set_sleepTimeout"))
            {
                writer.WriteLine("\t\t<privilege>http://tizen.org/privilege/display</privilege>");
            }
            if (((checker.HasReferenceToType("UnityEngine.Networking") || checker.HasReferenceToType("System.Net.Sockets")) || (checker.HasReferenceToType("UnityEngine.Network") || checker.HasReferenceToType("UnityEngine.RPC"))) || (((checker.HasReferenceToType("UnityEngine.WWW") || checker.HasReferenceToType("UnityEngine.Video")) || (checker.HasReferenceToType(typeof(Ping).FullName) || checker.HasReferenceToType(typeof(UnityWebRequest).FullName))) || (EditorUserBuildSettings.allowDebugging || EditorUserBuildSettings.connectProfiler)))
            {
                writer.WriteLine("\t\t<privilege>http://tizen.org/privilege/internet</privilege>");
            }
            if (checker.HasReferenceToType("UnityEngine.Video"))
            {
                writer.WriteLine("\t\t<privilege>http://tizen.org/privilege/mediastorage</privilege>");
            }
            if (checker.HasReferenceToType("UnityEngine.Video"))
            {
                writer.WriteLine("\t\t<privilege>http://tizen.org/privilege/externalstorage</privilege>");
            }
            if (TizenUtilities.ThisIsAUnityTestProject())
            {
                writer.WriteLine("\t\t<privilege>http://tizen.org/privilege/internet</privilege>");
            }
            TizenUtilities.WriteCapabilitiesToManifest(writer);
            writer.WriteLine("\t</privileges>");
            writer.WriteLine("</manifest>");
            writer.Close();
            string[] source = File.ReadAllLines(manifestPath);
            File.WriteAllLines(manifestPath, source.Distinct <string>().ToArray <string>());
        }
コード例 #2
0
        internal static void PostProcess(BuildTarget target, string stagingAreaDataUpperCase, string stagingArea, string stagingAreaDataManaged, string playerPackage, string installPath, string companyName, string productName, BuildOptions options)
        {
            bool  flag = (options & BuildOptions.AutoRunPlayer) != BuildOptions.CompressTextures;
            bool  developmentPlayer = (options & BuildOptions.Development) != BuildOptions.CompressTextures;
            float numSteps          = !flag ? ((float)2) : ((float)5);

            progress.Reset(numSteps);
            if (PlayerSettings.Tizen.deploymentTargetType == 2)
            {
                flag = false;
            }
            Regex  regex = new Regex("[^a-zA-Z_-]");
            string normalizedProductName = regex.Replace(productName, "").ToLower();
            string str2 = Path.Combine(playerPackage, "assets");

            if (!IsValidTizenBundleIdentifier(PlayerSettings.bundleIdentifier))
            {
                string message = "Please set the Bundle Identifier in the Player Settings.";
                message = (message + " The value must follow the convention 'com.YourCompanyName.YourProductName'") + " and can contain alphanumeric characters and underscore." + "\nEach segment must not start with a numeric character or underscore.";
                Selection.activeObject = Unsupported.GetSerializedAssetInterfaceSingleton("PlayerSettings");
                TizenUtilities.ShowErrDlgAndThrow("Bundle Identifier has not been set up correctly", message);
            }
            if (TizenUtilities.ThisIsAUnityTestProject())
            {
                PlayerSettings.Tizen.deploymentTargetType = 0;
            }
            if (PlayerSettings.Tizen.deploymentTargetType < 0)
            {
                string str4 = "Please select a Tizen deployment target.";
                str4 = str4 + " Press the Discover button in the Publishing section of Player Settings." + " Then select a type of target to get a list of available targets to select.";
                Selection.activeObject = Unsupported.GetSerializedAssetInterfaceSingleton("PlayerSettings");
                TizenUtilities.ShowErrDlgAndThrow("Tizen Deployment Target has not been selected.", str4);
            }
            TizenUtilities.PrepareToolPaths();
            TizenUtilities.ValidateSigningProfile(stagingArea);
            if (flag)
            {
                TizenUtilities.AssertAnyDeviceReady(new Command.WaitingForProcessToExit(new Progress("Tizen Device Detection", "Detecting attached devices", progress.Get()).Show));
            }
            Directory.CreateDirectory(Path.Combine(stagingArea, "lib"));
            Directory.CreateDirectory(Path.Combine(stagingArea, "res"));
            Directory.CreateDirectory(Path.Combine(stagingArea, "setting"));
            string path = Path.Combine(stagingArea, "shared");

            Directory.CreateDirectory(path);
            string str9 = Path.Combine(path, "res");

            Directory.CreateDirectory(str9);
            string destDirName = Path.Combine(str9, "data");
            string dst         = Path.Combine(str9, "app_icon.png");

            FileUtil.MoveFileIfExists(Path.Combine(stagingArea, "app_icon.png"), dst);
            if (!PlayerSettings.SplashScreen.show)
            {
                string str12 = Path.Combine(str9, "app_splash.png");
                FileUtil.MoveFileIfExists(Path.Combine(stagingArea, "app_splash.png"), str12);
                if (!File.Exists(str12))
                {
                    FileUtil.CopyFileOrDirectory(playerPackage + "/assets/splash.png", str12);
                }
            }
            Directory.CreateDirectory(Path.Combine(path, "trusted"));
            Directory.Move(stagingAreaDataUpperCase, destDirName + "2");
            Directory.Move(destDirName + "2", destDirName);
            if (!File.Exists(dst))
            {
                FileUtil.CopyFileOrDirectory(str2 + "/icon.png", dst);
            }
            Directory.CreateDirectory(Path.Combine(destDirName, "Managed/mono/2.0"));
            FileUtil.CopyFileOrDirectory(playerPackage + "/Data/Resources/unity default resources", destDirName + "/unity default resources");
            Directory.CreateDirectory(Path.Combine(stagingArea, "data"));
            string str15 = Path.Combine(stagingArea, "lib");

            Directory.CreateDirectory(str15);
            foreach (PluginImporter importer in PluginImporter.GetImporters(target))
            {
                string fileName = Path.GetFileName(importer.assetPath);
                FileUtil.UnityFileCopy(importer.assetPath, Path.Combine(str15, fileName));
            }
            if (Directory.Exists("Assets/StreamingAssets"))
            {
                FileUtil.CopyDirectoryRecursive("Assets/StreamingAssets", Path.Combine(destDirName, "Raw"), true, true);
            }
            AssemblyReferenceChecker checker = new AssemblyReferenceChecker();
            bool collectMethods   = true;
            bool ignoreSystemDlls = true;

            string[] components = new string[] { destDirName, "Managed" };
            string   str17      = Paths.Combine(components);

            checker.CollectReferences(str17, collectMethods, 0f, ignoreSystemDlls);
            string bundleIdentifier = PlayerSettings.bundleIdentifier;

            CreateManifest(Path.Combine(stagingArea, "tizen-manifest.xml"), companyName, productName, normalizedProductName, bundleIdentifier, checker);
            CreateProject(stagingArea);
            PackageTargets(PlayerSettings.Tizen.deploymentTargetType, installPath, playerPackage, stagingArea, developmentPlayer, normalizedProductName);
            if (flag)
            {
                progress.Step("Installing", EditorGUIUtility.TextContent("Installing application on " + TizenUtilities.SelectedDeploymentTarget() + "...").text);
                if (TizenUtilities.InstallTpkPackage(installPath))
                {
                    if (developmentPlayer)
                    {
                        progress.Step("Port Forwarding", EditorGUIUtility.TextContent("Setting up profiler tunnel...").text);
                        TizenUtilities.ForwardPort(ProfilerDriver.directConnectionPort, "55000");
                    }
                    progress.Step("Launching", EditorGUIUtility.TextContent("Launching application on " + TizenUtilities.SelectedDeploymentTarget() + "...").text);
                    TizenUtilities.LaunchTpkPackage(bundleIdentifier, stagingArea);
                }
            }
        }