Ejemplo n.º 1
0
        private MessageBoxResult CheckForNewerDynamoVersion(List <Tuple <dynamic, dynamic> > packageVersionData)
        {
            // Determine if there are any dependencies that are made with a newer version
            // of Dynamo (this includes the root package)
            var dynamoVersion       = Model.Version;
            var dynamoVersionParsed = VersionUtilities.PartialParse(dynamoVersion, 3);
            var futureDeps          = FilterFuturePackages(packageVersionData, dynamoVersionParsed);

            // If any of the required packages use a newer version of Dynamo, show a dialog to the user
            // allowing them to cancel the package download
            if (futureDeps.Any())
            {
                var versionList = FormatPackageVersionList(futureDeps.ToList());

                if (MessageBox.Show(String.Format(Resources.MessagePackageNewerDynamo,
                                                  ProductName,
                                                  versionList),

                                    string.Format(Resources.PackageUseNewerDynamoMessageBoxTitle,
                                                  ProductName),
                                    MessageBoxButton.OKCancel,
                                    MessageBoxImage.Warning) == MessageBoxResult.Cancel)
                {
                    return(MessageBoxResult.Cancel);
                }
            }
            return(MessageBoxResult.OK);
        }
        protected override void Invoking(MessageReceivedEventArgs e, ComplexMessage elements)
        {
            var    version    = VersionUtilities.GetVersion();
            string sdkVersion = SdkInfo.Version;

#if DEBUG
            string versionStr = version + " (Debug)";
#else
            string versionStr = VersionUtilities.GetTagVersion() + " (Release)";
#endif
            string ricky = "Ricky8955555";
            string syc   = "SYC";

            if (e.Source is IGroup group)
            {
                var rickyMember = Member(RickyNumber, group);
                var sycMember   = Member(SYCNumber, group);

                try
                {
                    rickyMember.Request();
                    ricky = rickyMember.Mention().ToSendableString();
                }
                catch { }

                try
                {
                    sycMember.Request();
                    syc = sycMember.Mention().ToSendableString();
                }
                catch { }
            }

            e.Source.Send(string.Format(Resources.About, ricky, syc, Resources.ProjectURL, Resources.CommunityURL, Resources.SDKProjectURL, Resources.CoolQURL, Resources.HomepageURL) + $"\n\n插件版本:{versionStr}\nSDK版本:{sdkVersion}\n编译时间:{VersionUtilities.ToDateTime(version)}");
        }
        protected override void Invoking(MessageReceivedEventArgs e, ComplexMessage elements)
        {
            var version = VersionUtilities.GetTagVersion();

            e.Reply(Resources.Processing);

            if (VersionUtilities.GetLatestVersion(out Version latestVersion, out _))
            {
                if (version < latestVersion)
                {
                    e.Source.Send($"有新版本更新哦!(ૢ˃ꌂ˂⁎)\n当前版本:{version}\n最新 Release 版本:{latestVersion}\n\n如果需要更新,请发送 {Configuration.Prefix}update run");
                }
                else if (version == latestVersion)
                {
                    e.Source.Send($"当前版本已是最新版本!(ૢ˃ꌂ˂⁎)\n当前版本:{version}");
                }
                else
                {
                    e.Source.Send($"当前版本较最新 Release 版本新,可能你正在使用内测版本 (ノ´▽`)ノ♪\n当前版本:{version}\n最新 Release 版本:{latestVersion}");
                }
            }
            else
            {
                e.Reply("获取最新版本信息失败了 (;´д`)ゞ");
            }
        }
Ejemplo n.º 4
0
        private void InitializeFilter()
        {
            Filter.SolutionFilter = AllSolutions.FirstOrDefault();
            Filter.AnalyzeProjectsAndSolutions(AllProjects, AllSolutions);

            UsedProjectReferences.Initialize(AllProjects
                                             .SelectMany(p => p.ProjectReferences)
                                             .DistinctBy(p => p.Path)
                                             .OrderBy(p => p.Name));

            Filter.ProjectReferenceFilter = UsedProjectReferences.FirstOrDefault();

            UsedNuGetPackages.Initialize(AllProjects
                                         .SelectMany(p => p.NuGetReferences)
                                         .DistinctBy(n => n.Name + "-" + n.Version)
                                         .OrderByThenBy(p => p.Name, p => VersionUtilities.FromString(p.Version)));

            UsedNuGetPackageNames.Initialize(UsedNuGetPackages
                                             .OrderByThenBy(p => p.Name, p => p.Version)
                                             .GroupBy(p => p.Name)
                                             .Select(g => new NuGetPackageVersionGroup
            {
                Name     = g.Key,
                Versions = g.Count() == 1 ? g.First().Version : g.First().Version + " - " + g.Last().Version
            }));

            Filter.NuGetPackageFilter     = UsedNuGetPackages.FirstOrDefault();
            Filter.NuGetPackageNameFilter = UsedNuGetPackageNames.FirstOrDefault();
        }
Ejemplo n.º 5
0
 private void LoadAssemblyReferences()
 {
     _assemblyReferences = Project.Items
                           .Where(i => i.ItemType == "Reference")
                           .Select(reference => new AssemblyReference(reference))
                           .OrderByThenBy(r => r.Name, r => VersionUtilities.FromString(r.Version))
                           .ToList();
 }
Ejemplo n.º 6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        bool isValidVersion = false;

        try
        {
            isValidVersion = VersionUtilities.AppIsValidVersion();
        }
        catch (Exception ex)
        {
            Session["ErrorMessage"] = ex.Message;
            Response.Redirect("~/Error.aspx");
        }

        if (!isValidVersion)
        {
            Session["ErrorMessage"] = "La version de la Aplicacion no es la misma que la version de la Base de Datos.";
            Response.Redirect("~/Error.aspx");
            return;
        }
        if (Session["UserId"] == null)
        {
            Response.Redirect("~/Login.aspx");
            return;
        }

        if (!IsPostBack)
        {
//            string scripts = "<script type='text/javascript' src='" +
//                ResolveUrl("~/Assets/Scripts/jquery.min.js") +
//                "'></script>";

//            scripts += "<script type='text/javascript' src='" +
//                ResolveUrl("~/Assets/Scripts/popper.min.js") +
//                "'></script>";

//            scripts += "<script type='text/javascript' src='" +
//                ResolveUrl("~/Assets/Scripts/bootstrap.min.js") +
//                "'></script>";

//            scripts += "<script type='text/javascript' src='" +
//ResolveUrl("~/Assets/Scripts/perfect-scrollbar.jquery.min.js") +
//"'></script>";


//            scripts += "<script type='text/javascript' src='" +
//              ResolveUrl("~/Assets/Scripts/now-ui-dashboard.min.js") +
//              "'></script>";

//            scripts += "<script type='text/javascript' src='" +
//              ResolveUrl("~/Assets/Scripts/demo.js") +
//              "'></script>";



//            ScriptsLiteral.Text = scripts;
        }
    }
Ejemplo n.º 7
0
 private static List <AssemblyFolderItem> GatherVersionStrings(string targetRuntimeVersion, AssemblyFolderCollection collection)
 {
     return
         ((from folder in collection.AssemblyFolders
           let targetVersion = VersionUtilities.ConvertToVersion(targetRuntimeVersion)
                               let replacementVersion = GetFrameworkVersion(folder.FrameworkVersion)
                                                        where targetVersion != null && targetVersion >= replacementVersion
                                                        orderby folder.FrameworkVersion descending
                                                        select folder).ToList());
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Enumerate the gac and generate a list of assemblies which match the strongname by runtime.
        /// </summary>
        private static SortedDictionary <Version, SortedDictionary <AssemblyNameExtension, string> > GenerateListOfAssembliesByRuntime(string strongName, GetAssemblyRuntimeVersion getRuntimeVersion, Version targetedRuntime, FileExists fileExists, GetPathFromFusionName getPathFromFusionName, GetGacEnumerator getGacEnumerator, bool specificVersion)
        {
            ErrorUtilities.VerifyThrowArgumentNull(targetedRuntime, nameof(targetedRuntime));

            IEnumerable <AssemblyNameExtension> gacEnum = getGacEnumerator(strongName);

            // Dictionary of Runtime version (sorted in reverse order) to a list of assemblies which are part of that runtime. This will allow us to pick the highest runtime and version first.
            SortedDictionary <Version, SortedDictionary <AssemblyNameExtension, string> > assembliesWithValidRuntimes = new SortedDictionary <Version, SortedDictionary <AssemblyNameExtension, string> >(ReverseVersionGenericComparer.Comparer);

            // Enumerate the gac values returned based on the partial or full fusion name.
            if (gacEnum != null)
            {
                foreach (AssemblyNameExtension gacAssembly in gacEnum)
                {
                    // We only have a fusion name from the IAssemblyName interface we need to get the path to the assembly to resolve it and to check its runtime.
                    string assemblyPath = getPathFromFusionName(gacAssembly.FullName);

                    // Make sure we could get the path from the Fusion name and make sure the file actually exists.
                    if (!String.IsNullOrEmpty(assemblyPath) && fileExists(assemblyPath))
                    {
                        // Get the runtime version from the found assembly.
                        string runtimeVersionRaw = getRuntimeVersion(assemblyPath);

                        // Convert the runtime string to a version so we can properly compare them as per version object comparison rules.
                        // We will accept version which are less than or equal to the targeted runtime.
                        Version runtimeVersion = VersionUtilities.ConvertToVersion(runtimeVersionRaw);

                        // Make sure the targeted runtime is greater than or equal to the runtime version of the assembly we got from the gac.
                        if (runtimeVersion != null)
                        {
                            if (targetedRuntime.CompareTo(runtimeVersion) >= 0 || specificVersion)
                            {
                                SortedDictionary <AssemblyNameExtension, string> assembliesWithRuntime = null;
                                assembliesWithValidRuntimes.TryGetValue(runtimeVersion, out assembliesWithRuntime);

                                // Create a new list if one does not exist.
                                if (assembliesWithRuntime == null)
                                {
                                    assembliesWithRuntime = new SortedDictionary <AssemblyNameExtension, string>(AssemblyNameReverseVersionComparer.GenericComparer);
                                    assembliesWithValidRuntimes.Add(runtimeVersion, assembliesWithRuntime);
                                }

                                if (!assembliesWithRuntime.ContainsKey(gacAssembly))
                                {
                                    // Add the assembly to the list
                                    assembliesWithRuntime.Add(gacAssembly, assemblyPath);
                                }
                            }
                        }
                    }
                }
            }

            return(assembliesWithValidRuntimes);
        }
Ejemplo n.º 9
0
 /// <summary>
 /// Check and get the version from the version string. Throw a library load exception if anything is wrong with the version
 /// </summary>
 /// <param name="version">the version string</param>
 /// <param name="name">name of the package</param>
 /// <param name="directory">package directory</param>
 /// <returns>Returns a valid Version</returns>
 private Version CheckAndGetPackageVersion(string version, string name, string directory)
 {
     try
     {
         return(VersionUtilities.PartialParse(version));
     }
     catch (Exception e) when(e is ArgumentException || e is FormatException || e is OverflowException)
     {
         throw new LibraryLoadFailedException(directory, String.Format(Properties.Resources.InvalidPackageVersion, name, directory, version));
     }
 }
Ejemplo n.º 10
0
        private IEnumerable <Tuple <dynamic, dynamic> > FilterFuturePackages(List <Tuple <dynamic, dynamic> > pkgVersions, Version currentAppVersion, int numberOfFieldsToCompare = 3)
        {
            foreach (Tuple <dynamic, dynamic> version in pkgVersions)
            {
                var depAppVersion = VersionUtilities.PartialParse(version.Item2.engine_version.ToString(), numberOfFieldsToCompare);

                if (depAppVersion > currentAppVersion)
                {
                    yield return(version);
                }
            }
        }
Ejemplo n.º 11
0
        protected Version GetLegacyVersion()
        {
            Version legacyVersion = new Version(0, 0, 0, 1);

            // Use a wildcard to get the Version.number file (and also match Version.local.number and Version.staging.number)
            foreach (string versionFilePath in Directory.GetFiles(LegacyDirectoryPath, "Version*number"))
            {
                LogWriter.Debug("Version file path: " + versionFilePath);

                legacyVersion = VersionUtilities.LoadVersionFromFile(versionFilePath);
            }

            return(legacyVersion);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Backs up the version file.
        /// </summary>
        private void BackupVersion()
        {
            string filePath = DataDirectoryPath + Path.DirectorySeparatorChar +
                              VersionUtilities.GetVersionFileName();

            if (!File.Exists(filePath))
            {
                throw new InvalidOperationException("Version.number file not found at: " + filePath);
            }

            string toFile = ExportDirectoryPath + Path.DirectorySeparatorChar +
                            Path.GetFileName(filePath);

            File.Copy(filePath, toFile, true);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Obtain the packages from a list of packages that were created using a newer version
        /// of Dynamo than this one.
        /// </summary>
        internal static IEnumerable <Tuple <PackageHeader, PackageVersion> > FilterFuturePackages(
            this IEnumerable <Tuple <PackageHeader, PackageVersion> > headerVersionPairs,
            Version currentAppVersion, int numberOfFieldsToCompare = 3)
        {
            foreach (var pair in headerVersionPairs)
            {
                var version       = pair.Item2;
                var depAppVersion = VersionUtilities.PartialParse(version.engine_version, numberOfFieldsToCompare);

                if (depAppVersion > currentAppVersion)
                {
                    yield return(pair);
                }
            }
        }
        static public void CreateDummyVersion(string directoryPath, string pathVariation)
        {
            string versionFile = directoryPath + Path.DirectorySeparatorChar + VersionUtilities.GetVersionFileName(pathVariation);

            if (!Directory.Exists(Path.GetDirectoryName(versionFile)))
            {
                Directory.CreateDirectory(Path.GetDirectoryName(versionFile));
            }

            using (StreamWriter writer = File.CreateText(versionFile))
            {
                writer.Write("1.0.0.0");
                writer.Close();
            }
        }
Ejemplo n.º 15
0
        public void PartialParse_String_ReturnsCorrectResults()
        {
            Assert.IsTrue(VersionUtilities.PartialParse("0.7.0.9") > VersionUtilities.PartialParse("0.0.5"));
            Assert.IsTrue(VersionUtilities.PartialParse("0.7.0") > VersionUtilities.PartialParse("0.0.5"));
            Assert.IsTrue(VersionUtilities.PartialParse("0.7.0") > VersionUtilities.PartialParse("0.0.5"));
            Assert.IsTrue(VersionUtilities.PartialParse("0.7.0") > VersionUtilities.PartialParse("0.0.5"));
            Assert.IsTrue(VersionUtilities.PartialParse("0.7.1") > VersionUtilities.PartialParse("0.0.5"));

            Assert.IsFalse(VersionUtilities.PartialParse("0.7.0.123") > VersionUtilities.PartialParse("0.7.0.467"));
            Assert.IsFalse(VersionUtilities.PartialParse("0.7.0") > VersionUtilities.PartialParse("0.7.0"));
            Assert.IsFalse(VersionUtilities.PartialParse("0.0.5") > VersionUtilities.PartialParse("0.7.0"));
            Assert.IsFalse(VersionUtilities.PartialParse("0.7.5") > VersionUtilities.PartialParse("1.7.0"));
            Assert.IsFalse(VersionUtilities.PartialParse("0.0.5") > VersionUtilities.PartialParse("0.0.7"));
            Assert.IsFalse(VersionUtilities.PartialParse("1.0.5") > VersionUtilities.PartialParse("2.7.0"));
            Assert.IsFalse(VersionUtilities.PartialParse("0.7.0") > VersionUtilities.PartialParse("0.7.1"));
        }
Ejemplo n.º 16
0
        private string GetReportIssueUrl()
        {
            string path = String.Empty;

            // If running on localhost use the test page
            if (WebUtilities.GetLocationVariation(Page.Request.Url) == "local")
            {
                path = new UrlConverter().ToAbsolute(Page.Request.ApplicationPath) + "/Admin/Tests/TestReportIssue.aspx?ProjectID=${Project.ID}&amp;ProjectVersion=${Project.Version}";
            }
            else
            {
                path = ConfigurationSettings.AppSettings["ReportIssueUrl"];
            }

            path = path.Replace("${Project.ID}", ProjectID);

            path = path.Replace("${Project.Version}", VersionUtilities.GetCurrentVersion().ToString());

            return(path);
        }
Ejemplo n.º 17
0
        protected override void Invoking(MessageReceivedEventArgs e, PlainText plainText, ComplexMessage elements)
        {
            e.Reply(Resources.Processing);

            var version = VersionUtilities.GetTagVersion();

            string str = plainText.Content.ToLower();

            if (str == "run")
            {
                if (VersionUtilities.GetLatestVersion(out Version latestVersion, out string downloadUri))
                {
                    if (version < latestVersion)
                    {
                        try
                        {
                            if (HttpUtilities.HttpDownload(downloadUri, $"app\\{Constants.AppId}.cpk"))
                            {
                                e.Reply("更新完毕,请手动重载应用 (*๓´╰╯`๓)");
                            }
                            else
                            {
                                e.Reply($"更新失败,发送 {Configuration.Prefix}update run 重试 (;´д`)ゞ");
                            }
                        }
                        catch
                        {
                            e.Reply("下载插件失败了 (;´д`)ゞ");
                        }
                    }
                    else
                    {
                        e.Source.Send("目前版本无需更新 (ノ´▽`)ノ♪");
                    }
                }
                else
                {
                    e.Reply("获取最新版本信息失败了 (;´д`)ゞ");
                }
            }
        }
Ejemplo n.º 18
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack)
        {
            return;
        }
        bool isValidVersion = false;

        try
        {
            isValidVersion = VersionUtilities.VerificarVersion();
        }
        catch (Exception ex)
        {
            Session["ErrorMessage"] = ex.Message;
            Response.Redirect("~/Error.aspx");
        }
        if (!isValidVersion)
        {
            Session["ErrorMessage"] = "La Version No es la Misma que la Base de Datos. Por Favor Actualizar";
            Response.Redirect("~/Error.aspx");
        }
    }
Ejemplo n.º 19
0
    protected void Page_Load(object sender, EventArgs e)
    {
        bool isValidVersion = false;

        try
        {
            isValidVersion = VersionUtilities.AppIsValidVersion();
        }
        catch (Exception ex)
        {
            Session["ErrorMessage"] = ex.Message;
            Response.Redirect("~/Error.aspx");
        }

        if (!isValidVersion)
        {
            Session["ErrorMessage"] = "La version de la Aplicacion no es la misma que la version de la Base de Datos.";
            Response.Redirect("~/Error.aspx");
        }
        if (Session["UserId"] != null)
        {
            Response.Redirect("Index.aspx");
        }
    }
Ejemplo n.º 20
0
        private static Version GetFrameworkVersion(string version)
        {
            var candidateVersion = VersionUtilities.ConvertToVersion(version);

            return(new Version(candidateVersion.Major, candidateVersion.Minor));
        }
Ejemplo n.º 21
0
        public static bool GenerateIOSPList(string ProjectDirectory, bool bIsUE4Game, string GameName, string ProjectName, string InEngineDir, string AppDirectory, UEDeployIOS InThis = null)
        {
            // generate the Info.plist for future use
            string BuildDirectory        = ProjectDirectory + "/Build/IOS";
            bool   bSkipDefaultPNGs      = false;
            string IntermediateDirectory = (bIsUE4Game ? InEngineDir : ProjectDirectory) + "/Intermediate/IOS";
            string PListFile             = IntermediateDirectory + "/" + GameName + "-Info.plist";

            ProjectName = !String.IsNullOrEmpty(ProjectName) ? ProjectName : GameName;
            VersionUtilities.BuildDirectory = BuildDirectory;
            VersionUtilities.GameName       = GameName;

            // read the old file
            string OldPListData = File.Exists(PListFile) ? File.ReadAllText(PListFile) : "";

            // determine if there is a launch.xib
            string LaunchXib = InEngineDir + "/Build/IOS/Resources/Interface/LaunchScreen.xib";

            if (File.Exists(BuildDirectory + "/Resources/Interface/LaunchScreen.xib"))
            {
                LaunchXib = BuildDirectory + "/Resources/Interface/LaunchScreen.xib";
            }

            // get the settings from the ini file
            // plist replacements
            DirectoryReference DirRef = bIsUE4Game ? (!string.IsNullOrEmpty(UnrealBuildTool.GetRemoteIniPath()) ? new DirectoryReference(UnrealBuildTool.GetRemoteIniPath()) : null) : new DirectoryReference(ProjectDirectory);
            ConfigCacheIni     Ini    = ConfigCacheIni.CreateConfigCacheIni(UnrealTargetPlatform.IOS, "Engine", DirRef);

            // orientations
            string SupportedOrientations = "";
            bool   bSupported            = true;

            Ini.GetBool("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "bSupportsPortraitOrientation", out bSupported);
            SupportedOrientations += bSupported ? "\t\t<string>UIInterfaceOrientationPortrait</string>\n" : "";
            Ini.GetBool("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "bSupportsUpsideDownOrientation", out bSupported);
            SupportedOrientations += bSupported ? "\t\t<string>UIInterfaceOrientationPortraitUpsideDown</string>\n" : "";
            Ini.GetBool("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "bSupportsLandscapeLeftOrientation", out bSupported);
            SupportedOrientations += bSupported ? "\t\t<string>UIInterfaceOrientationLandscapeLeft</string>\n" : "";
            Ini.GetBool("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "bSupportsLandscapeRightOrientation", out bSupported);
            SupportedOrientations += bSupported ? "\t\t<string>UIInterfaceOrientationLandscapeRight</string>\n" : "";

            // bundle display name
            string BundleDisplayName;

            Ini.GetString("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "BundleDisplayName", out BundleDisplayName);

            // bundle identifier
            string BundleIdentifier;

            Ini.GetString("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "BundleIdentifier", out BundleIdentifier);

            // bundle name
            string BundleName;

            Ini.GetString("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "BundleName", out BundleName);

            // disable https requirement
            bool bDisableHTTPS;

            Ini.GetBool("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "bDisableHTTPS", out bDisableHTTPS);

            // short version string
            string BundleShortVersion;

            Ini.GetString("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "VersionInfo", out BundleShortVersion);

            // required capabilities
            string RequiredCaps = "";

            if (InThis != null)
            {
                // required capabilities
                RequiredCaps += InThis.IOSPlatformContext.GetRequiredCapabilities();
            }

            Ini.GetBool("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "bSupportsOpenGLES2", out bSupported);
            RequiredCaps += bSupported ? "\t\t<string>opengles-2</string>\n" : "";
            if (!bSupported)
            {
                Ini.GetBool("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "bSupportsMetal", out bSupported);
                RequiredCaps += bSupported ? "\t\t<string>metal</string>\n" : "";
            }

            // minimum iOS version
            string MinVersion;

            if (Ini.GetString("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "MinimumiOSVersion", out MinVersion))
            {
                switch (MinVersion)
                {
                case "IOS_61":
                    Log.TraceWarning("IOS 6 is no longer supported in UE4 as 4.11");
                    MinVersion = "7.0";
                    break;

                case "IOS_7":
                    MinVersion = "7.0";
                    break;

                case "IOS_8":
                    MinVersion = "8.0";
                    break;

                case "IOS_9":
                    MinVersion = "9.0";
                    break;
                }
            }
            else
            {
                MinVersion = "7.0";
            }

            // Get Facebook Support details
            bool bEnableFacebookSupport = true;

            Ini.GetBool("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "bEnableFacebookSupport", out bEnableFacebookSupport);

            // Write the Facebook App ID if we need it.
            string FacebookAppID = "";

            Ini.GetString("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "FacebookAppID", out FacebookAppID);
            bEnableFacebookSupport = bEnableFacebookSupport && !string.IsNullOrWhiteSpace(FacebookAppID);

            // Add remote-notifications as background mode
            bool bRemoteNotificationsSupported = false;

            Ini.GetBool("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "bEnableRemoteNotificationsSupport", out bRemoteNotificationsSupported);

            // extra plist data
            string ExtraData = "";

            Ini.GetString("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "AdditionalPlistData", out ExtraData);

            // generate the plist file
            StringBuilder Text = new StringBuilder();

            Text.AppendLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
            Text.AppendLine("<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">");
            Text.AppendLine("<plist version=\"1.0\">");
            Text.AppendLine("<dict>");
            Text.AppendLine("\t<key>CFBundleURLTypes</key>");
            Text.AppendLine("\t<array>");
            Text.AppendLine("\t\t<dict>");
            Text.AppendLine("\t\t\t<key>CFBundleURLName</key>");
            Text.AppendLine("\t\t\t<string>com.Epic.Unreal</string>");
            Text.AppendLine("\t\t\t<key>CFBundleURLSchemes</key>");
            Text.AppendLine("\t\t\t<array>");
            Text.AppendLine(string.Format("\t\t\t\t<string>{0}</string>", bIsUE4Game ? "UE4Game" : GameName));
            if (bEnableFacebookSupport)
            {
                // This is needed for facebook login to redirect back to the app after completion.
                Text.AppendLine(string.Format("\t\t\t\t<string>fb{0}</string>", FacebookAppID));
            }
            Text.AppendLine("\t\t\t</array>");
            Text.AppendLine("\t\t</dict>");
            Text.AppendLine("\t</array>");
            Text.AppendLine("\t<key>CFBundleDevelopmentRegion</key>");
            Text.AppendLine("\t<string>English</string>");
            Text.AppendLine("\t<key>CFBundleDisplayName</key>");
            Text.AppendLine(string.Format("\t<string>{0}</string>", EncodeBundleName(BundleDisplayName, ProjectName)));
            Text.AppendLine("\t<key>CFBundleExecutable</key>");
            Text.AppendLine(string.Format("\t<string>{0}</string>", bIsUE4Game ? "UE4Game" : GameName));
            Text.AppendLine("\t<key>CFBundleIdentifier</key>");
            Text.AppendLine(string.Format("\t<string>{0}</string>", BundleIdentifier.Replace("[PROJECT_NAME]", ProjectName).Replace("_", "")));
            Text.AppendLine("\t<key>CFBundleInfoDictionaryVersion</key>");
            Text.AppendLine("\t<string>6.0</string>");
            Text.AppendLine("\t<key>CFBundleName</key>");
            Text.AppendLine(string.Format("\t<string>{0}</string>", EncodeBundleName(BundleName, ProjectName)));
            Text.AppendLine("\t<key>CFBundlePackageType</key>");
            Text.AppendLine("\t<string>APPL</string>");
            Text.AppendLine("\t<key>CFBundleSignature</key>");
            Text.AppendLine("\t<string>????</string>");
            Text.AppendLine("\t<key>CFBundleVersion</key>");
            Text.AppendLine(string.Format("\t<string>{0}</string>", VersionUtilities.UpdateBundleVersion(OldPListData)));
            Text.AppendLine("\t<key>CFBundleShortVersionString</key>");
            Text.AppendLine(string.Format("\t<string>{0}</string>", BundleShortVersion));
            Text.AppendLine("\t<key>LSRequiresIPhoneOS</key>");
            Text.AppendLine("\t<true/>");
            Text.AppendLine("\t<key>UIStatusBarHidden</key>");
            Text.AppendLine("\t<true/>");
            Text.AppendLine("\t<key>UIRequiresFullScreen</key>");
            Text.AppendLine("\t<true/>");
            Text.AppendLine("\t<key>UIViewControllerBasedStatusBarAppearance</key>");
            Text.AppendLine("\t<false/>");
            Text.AppendLine("\t<key>UISupportedInterfaceOrientations</key>");
            Text.AppendLine("\t<array>");
            foreach (string Line in SupportedOrientations.Split("\r\n".ToCharArray()))
            {
                if (!string.IsNullOrWhiteSpace(Line))
                {
                    Text.AppendLine(Line);
                }
            }
            Text.AppendLine("\t</array>");
            Text.AppendLine("\t<key>UIRequiredDeviceCapabilities</key>");
            Text.AppendLine("\t<array>");
            foreach (string Line in RequiredCaps.Split("\r\n".ToCharArray()))
            {
                if (!string.IsNullOrWhiteSpace(Line))
                {
                    Text.AppendLine(Line);
                }
            }
            Text.AppendLine("\t</array>");
            Text.AppendLine("\t<key>CFBundleIcons</key>");
            Text.AppendLine("\t<dict>");
            Text.AppendLine("\t\t<key>CFBundlePrimaryIcon</key>");
            Text.AppendLine("\t\t<dict>");
            Text.AppendLine("\t\t\t<key>CFBundleIconFiles</key>");
            Text.AppendLine("\t\t\t<array>");
            Text.AppendLine("\t\t\t\t<string>Icon29.png</string>");
            Text.AppendLine("\t\t\t\t<string>[email protected]</string>");
            Text.AppendLine("\t\t\t\t<string>Icon40.png</string>");
            Text.AppendLine("\t\t\t\t<string>[email protected]</string>");
            Text.AppendLine("\t\t\t\t<string>Icon57.png</string>");
            Text.AppendLine("\t\t\t\t<string>[email protected]</string>");
            Text.AppendLine("\t\t\t\t<string>[email protected]</string>");
            Text.AppendLine("\t\t\t\t<string>[email protected]</string>");
            Text.AppendLine("\t\t\t</array>");
            Text.AppendLine("\t\t\t<key>UIPrerenderedIcon</key>");
            Text.AppendLine("\t\t\t<true/>");
            Text.AppendLine("\t\t</dict>");
            Text.AppendLine("\t</dict>");
            Text.AppendLine("\t<key>CFBundleIcons~ipad</key>");
            Text.AppendLine("\t<dict>");
            Text.AppendLine("\t\t<key>CFBundlePrimaryIcon</key>");
            Text.AppendLine("\t\t<dict>");
            Text.AppendLine("\t\t\t<key>CFBundleIconFiles</key>");
            Text.AppendLine("\t\t\t<array>");
            Text.AppendLine("\t\t\t\t<string>Icon29.png</string>");
            Text.AppendLine("\t\t\t\t<string>[email protected]</string>");
            Text.AppendLine("\t\t\t\t<string>Icon40.png</string>");
            Text.AppendLine("\t\t\t\t<string>[email protected]</string>");
            Text.AppendLine("\t\t\t\t<string>Icon50.png</string>");
            Text.AppendLine("\t\t\t\t<string>[email protected]</string>");
            Text.AppendLine("\t\t\t\t<string>Icon72.png</string>");
            Text.AppendLine("\t\t\t\t<string>[email protected]</string>");
            Text.AppendLine("\t\t\t\t<string>Icon76.png</string>");
            Text.AppendLine("\t\t\t\t<string>[email protected]</string>");
            Text.AppendLine("\t\t\t\t<string>[email protected]</string>");
            Text.AppendLine("\t\t\t</array>");
            Text.AppendLine("\t\t\t<key>UIPrerenderedIcon</key>");
            Text.AppendLine("\t\t\t<true/>");
            Text.AppendLine("\t\t</dict>");
            Text.AppendLine("\t</dict>");
            if (File.Exists(LaunchXib))
            {
                // TODO: compile the xib via remote tool
                Text.AppendLine("\t<key>UILaunchStoryboardName</key>");
                Text.AppendLine("\t<string>LaunchScreen</string>");
                bSkipDefaultPNGs = true;
            }
            else
            {
                // this is a temp way to inject the iphone 6 images without needing to upgrade everyone's plist
                // eventually we want to generate this based on what the user has set in the project settings
                string[] IPhoneConfigs =
                {
                    "Default-IPhone6-Landscape",     "Landscape", "{375, 667}", "8.0",
                    "Default-IPhone6",               "Portrait",  "{375, 667}", "8.0",
                    "Default-IPhone6Plus-Landscape", "Landscape", "{414, 736}", "8.0",
                    "Default-IPhone6Plus-Portrait",  "Portrait",  "{414, 736}", "8.0",
                    "Default",                       "Landscape", "{320, 480}", "7.0",
                    "Default",                       "Portrait",  "{320, 480}", "7.0",
                    "Default-568h",                  "Landscape", "{320, 568}", "7.0",
                    "Default-568h",                  "Portrait",  "{320, 568}", "7.0",
                };

                Text.AppendLine("\t<key>UILaunchImages~iphone</key>");
                Text.AppendLine("\t<array>");
                for (int ConfigIndex = 0; ConfigIndex < IPhoneConfigs.Length; ConfigIndex += 4)
                {
                    Text.AppendLine("\t\t<dict>");
                    Text.AppendLine("\t\t\t<key>UILaunchImageMinimumOSVersion</key>");
                    Text.AppendLine(string.Format("\t\t\t<string>{0}</string>", IPhoneConfigs[ConfigIndex + 3]));
                    Text.AppendLine("\t\t\t<key>UILaunchImageName</key>");
                    Text.AppendLine(string.Format("\t\t\t<string>{0}</string>", IPhoneConfigs[ConfigIndex + 0]));
                    Text.AppendLine("\t\t\t<key>UILaunchImageOrientation</key>");
                    Text.AppendLine(string.Format("\t\t\t<string>{0}</string>", IPhoneConfigs[ConfigIndex + 1]));
                    Text.AppendLine("\t\t\t<key>UILaunchImageSize</key>");
                    Text.AppendLine(string.Format("\t\t\t<string>{0}</string>", IPhoneConfigs[ConfigIndex + 2]));
                    Text.AppendLine("\t\t</dict>");
                }

                // close it out
                Text.AppendLine("\t</array>");

                // this is a temp way to inject the iPad Pro without needing to upgrade everyone's plist
                // eventually we want to generate this based on what the user has set in the project settings
                string[] IPadConfigs =
                {
                    "Default-Landscape",      "Landscape", "{768, 1024}",  "7.0",
                    "Default-Portrait",       "Portrait",  "{768, 1024}",  "7.0",
                    "Default-Landscape-1336", "Landscape", "{1024, 1366}", "9.0",
                    "Default-Portrait-1336",  "Portrait",  "{1024, 1366}", "9.0",
                };

                Text.AppendLine("\t<key>UILaunchImages~ipad</key>");
                Text.AppendLine("\t<array>");
                for (int ConfigIndex = 0; ConfigIndex < IPadConfigs.Length; ConfigIndex += 4)
                {
                    Text.AppendLine("\t\t<dict>");
                    Text.AppendLine("\t\t\t<key>UILaunchImageMinimumOSVersion</key>");
                    Text.AppendLine(string.Format("\t\t\t<string>{0}</string>", IPadConfigs[ConfigIndex + 3]));
                    Text.AppendLine("\t\t\t<key>UILaunchImageName</key>");
                    Text.AppendLine(string.Format("\t\t\t<string>{0}</string>", IPadConfigs[ConfigIndex + 0]));
                    Text.AppendLine("\t\t\t<key>UILaunchImageOrientation</key>");
                    Text.AppendLine(string.Format("\t\t\t<string>{0}</string>", IPadConfigs[ConfigIndex + 1]));
                    Text.AppendLine("\t\t\t<key>UILaunchImageSize</key>");
                    Text.AppendLine(string.Format("\t\t\t<string>{0}</string>", IPadConfigs[ConfigIndex + 2]));
                    Text.AppendLine("\t\t</dict>");
                }
                Text.AppendLine("\t</array>");
            }
            Text.AppendLine("\t<key>CFBundleSupportedPlatforms</key>");
            Text.AppendLine("\t<array>");
            Text.AppendLine("\t\t<string>iPhoneOS</string>");
            Text.AppendLine("\t</array>");
            Text.AppendLine("\t<key>MinimumOSVersion</key>");
            Text.AppendLine(string.Format("\t<string>{0}</string>", MinVersion));
            // disable exempt encryption
            Text.AppendLine("\t<key>ITSAppUsesNonExemptEncryption</key>");
            Text.AppendLine("\t<false/>");

            // disable HTTPS requirement
            if (bDisableHTTPS)
            {
                Text.AppendLine("\t<key>NSAppTransportSecurity</key>");
                Text.AppendLine("\t\t<dict>");
                Text.AppendLine("\t\t\t<key>NSAllowsArbitraryLoads</key><true/>");
                Text.AppendLine("\t\t</dict>");
            }

            if (bEnableFacebookSupport)
            {
                Text.AppendLine("\t<key>FacebookAppID</key>");
                Text.AppendLine(string.Format("\t<string>{0}</string>", FacebookAppID));
            }
            if (!string.IsNullOrEmpty(ExtraData))
            {
                ExtraData = ExtraData.Replace("\\n", "\n");
                foreach (string Line in ExtraData.Split("\r\n".ToCharArray()))
                {
                    if (!string.IsNullOrWhiteSpace(Line))
                    {
                        Text.AppendLine("\t" + Line);
                    }
                }
            }

            // Add remote-notifications as background mode
            if (bRemoteNotificationsSupported)
            {
                Text.AppendLine("\t<key>UIBackgroundModes</key>");
                Text.AppendLine("\t<array>");
                Text.AppendLine("\t\t<string>remote-notification</string>");
                Text.AppendLine("\t</array>");
            }

            Text.AppendLine("</dict>");
            Text.AppendLine("</plist>");

            // Create the intermediate directory if needed
            if (!Directory.Exists(IntermediateDirectory))
            {
                Directory.CreateDirectory(IntermediateDirectory);
            }

            if (InThis != null && InThis.UPL != null)
            {
                // Allow UPL to modify the plist here
                XDocument XDoc;
                try
                {
                    XDoc = XDocument.Parse(Text.ToString());
                }
                catch (Exception e)
                {
                    throw new BuildException("plist is invalid {0}\n{1}", e, Text.ToString());
                }

                XDoc.DocumentType.InternalSubset = "";
                InThis.UPL.ProcessPluginNode("None", "iosPListUpdates", "", ref XDoc);
                string result = XDoc.Declaration.ToString() + "\n" + XDoc.ToString().Replace("<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"[]>", "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">");
                File.WriteAllText(PListFile, result);
            }
            else
            {
                File.WriteAllText(PListFile, Text.ToString());
            }

            if (BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Mac)
            {
                if (!Directory.Exists(AppDirectory))
                {
                    Directory.CreateDirectory(AppDirectory);
                }
                File.WriteAllText(AppDirectory + "/Info.plist", Text.ToString());
            }

            return(bSkipDefaultPNGs);
        }
Ejemplo n.º 22
0
        public void PackageManagerConflictsWithStdLib()
        {
            var pkgLoader = GetPackageLoader();

            pkgLoader.StandardLibraryDirectory = StandardLibraryTestDirectory;

            // Load a std lib package
            var stdPackageLocation = Path.Combine(StandardLibraryTestDirectory, "SignedPackage2");

            pkgLoader.ScanPackageDirectory(stdPackageLocation);

            var stdLibPkg = pkgLoader.LocalPackages.Where(x => x.Name == "SignedPackage").FirstOrDefault();

            Assert.IsNotNull(stdLibPkg);

            // Simulate the user downloading the same package from PM
            var mockGreg = new Mock <IGregClient>();

            mockGreg.Setup(x => x.Execute(It.IsAny <PackageDownload>())).Throws(new Exception("Failed to get your package!"));

            var client = new Dynamo.PackageManager.PackageManagerClient(mockGreg.Object, MockMaker.Empty <IPackageUploadBuilder>(), string.Empty);
            var pmVm   = new PackageManagerClientViewModel(ViewModel, client);

            var dlgMock = new Mock <MessageBoxService.IMessageBox>();

            dlgMock.Setup(m => m.Show(It.IsAny <string>(), It.IsAny <string>(), It.Is <MessageBoxButton>(x => x == MessageBoxButton.OKCancel || x == MessageBoxButton.OK), It.IsAny <MessageBoxImage>()))
            .Returns(MessageBoxResult.OK);
            MessageBoxService.OverrideMessageBoxDuringTests(dlgMock.Object);

            //
            // 1. User downloads the exact version of a std lib package
            //
            {
                var id   = "test-123";
                var deps = new List <Dependency>()
                {
                    new Dependency()
                    {
                        _id = id, name = stdLibPkg.Name
                    }
                };
                var depVers = new List <string>()
                {
                    stdLibPkg.VersionName
                };

                mockGreg.Setup(m => m.ExecuteAndDeserializeWithContent <PackageVersion>(It.IsAny <Request>()))
                .Returns(new ResponseWithContentBody <PackageVersion>()
                {
                    content = new PackageVersion()
                    {
                        version                  = stdLibPkg.VersionName,
                        engine_version           = stdLibPkg.EngineVersion,
                        name                     = stdLibPkg.Name,
                        id                       = id,
                        full_dependency_ids      = deps,
                        full_dependency_versions = depVers
                    },
                    success = true
                });

                var pkgInfo = new Dynamo.Graph.Workspaces.PackageInfo(stdLibPkg.Name, VersionUtilities.PartialParse(stdLibPkg.VersionName));
                pmVm.DownloadAndInstallPackage(pkgInfo);

                // Users should get 2 warnings :
                // 1. To confirm that they want to download the specified package.
                // 2. That a package with the same name and version already exists as part of the Standard Library.
                dlgMock.Verify(x => x.Show(It.IsAny <string>(), It.IsAny <string>(),
                                           It.IsAny <MessageBoxButton>(), It.IsAny <MessageBoxImage>()), Times.Exactly(2));
                dlgMock.ResetCalls();
            }

            //
            // 2. User downloads a different version of a std lib package
            //
            {
                var id   = "test-234";
                var deps = new List <Dependency>()
                {
                    new Dependency()
                    {
                        _id = id, name = stdLibPkg.Name
                    }
                };
                var stdLibPkgVers = VersionUtilities.PartialParse(stdLibPkg.VersionName);
                var newPkgVers    = new Version(stdLibPkgVers.Major + 1, stdLibPkgVers.Minor, stdLibPkgVers.Build);

                var depVers = new List <string>()
                {
                    newPkgVers.ToString()
                };

                mockGreg.Setup(m => m.ExecuteAndDeserializeWithContent <PackageVersion>(It.IsAny <Request>()))
                .Returns(new ResponseWithContentBody <PackageVersion>()
                {
                    content = new PackageVersion()
                    {
                        version                  = newPkgVers.ToString(),
                        engine_version           = stdLibPkg.EngineVersion,
                        name                     = stdLibPkg.Name,
                        id                       = id,
                        full_dependency_ids      = deps,
                        full_dependency_versions = depVers
                    },
                    success = true
                });

                var pkgInfo = new Dynamo.Graph.Workspaces.PackageInfo(stdLibPkg.Name, newPkgVers);
                pmVm.DownloadAndInstallPackage(pkgInfo);

                // Users should get 2 warnings :
                // 1. To confirm that they want to download the specified package.
                // 2. That a package with a different version already exists as part of the Standard Library.
                dlgMock.Verify(x => x.Show(It.IsAny <string>(), It.IsAny <string>(),
                                           It.IsAny <MessageBoxButton>(), It.IsAny <MessageBoxImage>()), Times.Exactly(2));
                dlgMock.ResetCalls();
            }

            //
            // 3. User downloads a package that is not part of a std lib package
            //
            {
                var id   = "test-345";
                var deps = new List <Dependency>()
                {
                    new Dependency()
                    {
                        _id = id, name = "non-std-libg"
                    }
                };
                var pkgVersion = new Version(1, 0, 0);
                var depVers    = new List <string>()
                {
                    pkgVersion.ToString()
                };

                mockGreg.Setup(m => m.ExecuteAndDeserializeWithContent <PackageVersion>(It.IsAny <Request>()))
                .Returns(new ResponseWithContentBody <PackageVersion>()
                {
                    content = new PackageVersion()
                    {
                        version                  = pkgVersion.ToString(),
                        engine_version           = stdLibPkg.EngineVersion,
                        name                     = "non-std-libg",
                        id                       = id,
                        full_dependency_ids      = deps,
                        full_dependency_versions = depVers
                    },
                    success = true
                });

                var pkgInfo = new Dynamo.Graph.Workspaces.PackageInfo("Non-stdlib-package", new Version(1, 0, 0));
                pmVm.DownloadAndInstallPackage(pkgInfo);

                // Users should get 1 warning :
                // 1. To confirm that they want to download the specified package.
                dlgMock.Verify(x => x.Show(It.IsAny <string>(), It.IsAny <string>(),
                                           It.IsAny <MessageBoxButton>(), It.IsAny <MessageBoxImage>()), Times.Exactly(1));
                dlgMock.ResetCalls();
            }
        }
        internal async void ExecutePackageDownload(string name, PackageVersion package, string installPath)
        {
            string msg = String.IsNullOrEmpty(installPath) ?
                         String.Format(Resources.MessageConfirmToInstallPackage, name, package.version) :
                         String.Format(Resources.MessageConfirmToInstallPackageToFolder, name, package.version, installPath);

            var result = MessageBoxService.Show(Owner, msg,
                                                Resources.PackageDownloadConfirmMessageBoxTitle,
                                                MessageBoxButton.OKCancel, MessageBoxImage.Question);

            var pmExt = DynamoViewModel.Model.GetPackageManagerExtension();

            if (result == MessageBoxResult.OK)
            {
                if (string.IsNullOrEmpty(package.name))
                {// package.name is not set sometimes
                    package.name = name;
                }

                Debug.Assert(package.full_dependency_ids.Count == package.full_dependency_versions.Count);
                // get all of the dependency version headers
                // we reverse these arrays because the package manager returns dependencies in topological order starting at
                // the current package - and we want to install the dependencies first!.
                var reversedVersions         = package.full_dependency_versions.Select(x => x).Reverse().ToList();
                var dependencyVersionHeaders = package.full_dependency_ids.Select(x => x).Reverse().Select((dep, i) =>
                {
                    var depVersion = reversedVersions[i];
                    try
                    {
                        return(Model.GetPackageVersionHeader(dep._id, depVersion));
                    }
                    catch
                    {
                        MessageBoxService.Show(
                            Owner,
                            String.Format(Resources.MessageFailedToDownloadPackageVersion, depVersion, dep._id),
                            Resources.PackageDownloadErrorMessageBoxTitle,
                            MessageBoxButton.OK, MessageBoxImage.Error);
                        return(null);
                    }
                }).ToList();

                // if any header download fails, abort
                if (dependencyVersionHeaders.Any(x => x == null))
                {
                    return;
                }

                if (!dependencyVersionHeaders.Any(x => x.name == name))
                {// Add the main package if it does not exist
                    dependencyVersionHeaders.Add(package);
                }

                var localPkgs = pmExt.PackageLoader.LocalPackages;
                // if the new package has one or more dependencies that are already installed
                // we need to either first uninstall them, or allow the user to forcibly install the package,
                // or cancel the installation if they do not want either of the first two options.

                // local package that conflicts with package itself.
                Package duplicatePackage = null;

                // list of local packages that conflict (have different versions) with package dependencies.
                // Does not contain the main package since it is handled separately by duplicatePackage
                var localPkgsConflictingWithPkgDeps = new List <Package>();
                var newPackageHeaders = new List <PackageVersion>();

                foreach (var dependencyHeader in dependencyVersionHeaders)
                {
                    var localPkgWithSameName = localPkgs.FirstOrDefault(x =>
                                                                        (x.LoadState.State == PackageLoadState.StateTypes.Loaded ||
                                                                         x.LoadState.State == PackageLoadState.StateTypes.Error) &&
                                                                        x.Name.Equals(dependencyHeader.name));

                    bool exactMatch = false;
                    if (localPkgWithSameName != null)
                    {
                        // Packages with same name and same version
                        exactMatch = localPkgWithSameName.VersionName.Equals(dependencyHeader.version);

                        if (name.Equals(localPkgWithSameName.Name))
                        {// Handle the main package duplicate
                            // Main package has a duplicate in local packages
                            duplicatePackage = localPkgWithSameName;
                        }
                        else
                        {// Handle the dependency duplicates here
                            // exclude dependencies that exactly match existing local packages
                            if (!exactMatch)
                            {
                                // Local packages that have the same name but different versions
                                localPkgsConflictingWithPkgDeps.Add(localPkgWithSameName);
                            }
                        }
                    }

                    if (!exactMatch)
                    {
                        // Package headers that do not match by name or version with existing local packages
                        newPackageHeaders.Add(dependencyHeader);
                    }
                }

                if (!WarnAboutDuplicatePackageConflicts(package, duplicatePackage, localPkgsConflictingWithPkgDeps))
                {
                    // User chose to cancel because of conflicts.
                    return;
                }

                // determine if any of the packages contain binaries or python scripts.
                var containsBinariesOrPythonScripts = newPackageHeaders.Any(x =>
                {
                    // The contents (string) property of the PackageVersion object can be null for an empty package
                    // like LunchBox.
                    var are_contents_empty = string.IsNullOrEmpty(x.contents);
                    var contains_binaries  = x.contains_binaries ||
                                             !are_contents_empty && x.contents.Contains(PackageManagerClient.PackageContainsBinariesConstant);
                    var contains_python =
                        !are_contents_empty && x.contents.Contains(PackageManagerClient.PackageContainsPythonScriptsConstant);
                    return(contains_binaries || contains_python);
                });

                // if any do, notify user and allow cancellation
                if (containsBinariesOrPythonScripts)
                {
                    var res = MessageBoxService.Show(Owner,
                                                     Resources.MessagePackageContainPythonScript,
                                                     Resources.PackageDownloadMessageBoxTitle,
                                                     MessageBoxButton.OKCancel, MessageBoxImage.Exclamation);

                    if (res == MessageBoxResult.Cancel || res == MessageBoxResult.None)
                    {
                        return;
                    }
                }

                // Determine if there are any dependencies that are made with a newer version
                // of Dynamo (this includes the root package)
                var dynamoVersion = VersionUtilities.PartialParse(DynamoViewModel.Model.Version);
                var futureDeps    = newPackageHeaders.Where(dep => VersionUtilities.PartialParse(dep.engine_version) > dynamoVersion);

                // If any of the required packages use a newer version of Dynamo, show a dialog to the user
                // allowing them to cancel the package download
                if (futureDeps.Any())
                {
                    var res = MessageBoxService.Show(Owner,
                                                     string.Format(Resources.MessagePackageNewerDynamo, DynamoViewModel.BrandingResourceProvider.ProductName),
                                                     string.Format(Resources.PackageUseNewerDynamoMessageBoxTitle, DynamoViewModel.BrandingResourceProvider.ProductName),
                                                     MessageBoxButton.OKCancel,
                                                     MessageBoxImage.Warning);
                    if (res == MessageBoxResult.Cancel || res == MessageBoxResult.None)
                    {
                        return;
                    }
                }

                // add custom path to custom package folder list
                if (!String.IsNullOrEmpty(installPath))
                {
                    var settings = DynamoViewModel.Model.PreferenceSettings;
                    if (!settings.CustomPackageFolders.Contains(installPath))
                    {
                        settings.CustomPackageFolders.Add(installPath);
                    }
                }

                // form header version pairs and download and install all packages
                var downloadTasks = newPackageHeaders
                                    .Select((dep) => {
                    return(new PackageDownloadHandle()
                    {
                        Id = dep.id,
                        VersionName = dep.version,
                        Name = dep.name
                    });
                })
                                    .Select(x => Download(x)).ToArray();
                //wait for all downloads.
                await Task.WhenAll(downloadTasks);

                // When above downloads complete, start installing packages in dependency order.
                // The downloads have completed in a random order, but the dependencyVersionHeaders list is in correct topological
                // install order.
                foreach (var dep in newPackageHeaders)
                {
                    var matchingDownload = downloadTasks.Where(x => x.Result.handle.Id == dep.id).FirstOrDefault();
                    if (matchingDownload != null)
                    {
                        InstallPackage(matchingDownload.Result.handle, matchingDownload.Result.downloadPath, installPath);
                    }
                }
            }
        }
Ejemplo n.º 24
0
        public static bool GenerateTVOSPList(string ProjectDirectory, bool bIsUE4Game, string GameName, bool bIsClient, string ProjectName, string InEngineDir, string AppDirectory, UnrealPluginLanguage UPL, string BundleID)
        {
            // @todo tvos: THIS!


            // generate the Info.plist for future use
            string BuildDirectory        = ProjectDirectory + "/Build/TVOS";
            bool   bSkipDefaultPNGs      = false;
            string IntermediateDirectory = (bIsUE4Game ? InEngineDir : ProjectDirectory) + "/Intermediate/TVOS";
            string PListFile             = IntermediateDirectory + "/" + GameName + "-Info.plist";

            // @todo tvos: This is really nasty - both IOS and TVOS are setting static vars
            VersionUtilities.BuildDirectory = BuildDirectory;
            VersionUtilities.GameName       = GameName;

            // read the old file
            string OldPListData = File.Exists(PListFile) ? File.ReadAllText(PListFile) : "";

            // determine if there is a launch.xib
            //string LaunchXib = InEngineDir + "/Build/IOS/Resources/Interface/LaunchScreen.xib";
            //if (File.Exists(BuildDirectory + "/Resources/Interface/LaunchScreen.xib"))
            //{
            //	LaunchXib = BuildDirectory + "/Resources/Interface/LaunchScreen.xib";
            //}

            // get the settings from the ini file
            // plist replacements
            // @todo tvos: Are we going to make TVOS specific .ini files?
            DirectoryReference DirRef = bIsUE4Game ? (!string.IsNullOrEmpty(UnrealBuildTool.GetRemoteIniPath()) ? new DirectoryReference(UnrealBuildTool.GetRemoteIniPath()) : null) : new DirectoryReference(ProjectDirectory);
            ConfigHierarchy    Ini    = ConfigCache.ReadHierarchy(ConfigHierarchyType.Engine, DirRef, UnrealTargetPlatform.IOS);

            // bundle display name
            string BundleDisplayName;

            Ini.GetString("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "BundleDisplayName", out BundleDisplayName);

            // bundle identifier
            string BundleIdentifier;

            Ini.GetString("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "BundleIdentifier", out BundleIdentifier);
            if (!string.IsNullOrEmpty(BundleID))
            {
                BundleIdentifier = BundleID;
            }

            // bundle name
            string BundleName;

            Ini.GetString("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "BundleName", out BundleName);

            // short version string
            string BundleShortVersion;

            Ini.GetString("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "VersionInfo", out BundleShortVersion);

            // required capabilities
            string RequiredCaps = "\t\t<string>arm64</string>\n";

            // minimum iOS version
            string MinVersion;

            if (Ini.GetString("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "MinimumTVOSVersion", out MinVersion))
            {
                switch (MinVersion)
                {
                case "TVOS_9":
                    MinVersion = "9.0";
                    break;
                }
            }
            else
            {
                MinVersion = "9.0";
            }

            // extra plist data
            string ExtraData = "";

            Ini.GetString("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "AdditionalPlistData", out ExtraData);

            // create the final display name, including converting all entities for XML use
            string FinalDisplayName = BundleDisplayName.Replace("[PROJECT_NAME]", ProjectName).Replace("_", "");

            FinalDisplayName = FinalDisplayName.Replace("&", "&amp;");
            FinalDisplayName = FinalDisplayName.Replace("\"", "&quot;");
            FinalDisplayName = FinalDisplayName.Replace("\'", "&apos;");
            FinalDisplayName = FinalDisplayName.Replace("<", "&lt;");
            FinalDisplayName = FinalDisplayName.Replace(">", "&gt;");

            // generate the plist file
            StringBuilder Text = new StringBuilder();

            Text.AppendLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
            Text.AppendLine("<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">");
            Text.AppendLine("<plist version=\"1.0\">");
            Text.AppendLine("<dict>");
            Text.AppendLine("\t<key>CFBundleDevelopmentRegion</key>");
            Text.AppendLine("\t<string>en</string>");
            Text.AppendLine("\t<key>CFBundleDisplayName</key>");
            Text.AppendLine(string.Format("\t<string>{0}</string>", EncodeBundleName(BundleDisplayName, ProjectName)));
            Text.AppendLine("\t<key>CFBundleExecutable</key>");
            string BundleExecutable = bIsUE4Game ?
                                      (bIsClient ? "UE4Client" : "UE4Game") :
                                      (bIsClient ? GameName + "Client" : GameName);

            Text.AppendLine(string.Format("\t<string>{0}</string>", BundleExecutable));
            Text.AppendLine("\t<key>CFBundleIdentifier</key>");
            Text.AppendLine(string.Format("\t<string>{0}</string>", BundleIdentifier.Replace("[PROJECT_NAME]", ProjectName).Replace("_", "")));
            Text.AppendLine("\t<key>CFBundleInfoDictionaryVersion</key>");
            Text.AppendLine("\t<string>6.0</string>");
            Text.AppendLine("\t<key>CFBundleName</key>");
            Text.AppendLine(string.Format("\t<string>{0}</string>", EncodeBundleName(BundleName, ProjectName)));
            Text.AppendLine("\t<key>CFBundlePackageType</key>");
            Text.AppendLine("\t<string>APPL</string>");
            Text.AppendLine("\t<key>CFBundleSignature</key>");
            Text.AppendLine("\t<string>????</string>");
            Text.AppendLine("\t<key>CFBundleVersion</key>");
            Text.AppendLine(string.Format("\t<string>{0}</string>", VersionUtilities.UpdateBundleVersion(OldPListData, InEngineDir)));
            Text.AppendLine("\t<key>CFBundleShortVersionString</key>");
            Text.AppendLine(string.Format("\t<string>{0}</string>", BundleShortVersion));
            Text.AppendLine("\t<key>LSRequiresIPhoneOS</key>");
            Text.AppendLine("\t<true/>");
            Text.AppendLine("\t<key>UIRequiredDeviceCapabilities</key>");
            Text.AppendLine("\t<array>");
            foreach (string Line in RequiredCaps.Split("\r\n".ToCharArray()))
            {
                if (!string.IsNullOrWhiteSpace(Line))
                {
                    Text.AppendLine(Line);
                }
            }
            Text.AppendLine("\t</array>");

            Text.AppendLine("\t<key>TVTopShelfImage</key>");
            Text.AppendLine("\t<dict>");
            Text.AppendLine("\t\t<key>TVTopShelfPrimaryImage</key>");
            Text.AppendLine("\t\t<string>Top Shelf Image</string>");
            Text.AppendLine("\t\t<key>TVTopShelfPrimaryImageWide</key>");
            Text.AppendLine("\t\t<string>Top Shelf Image Wide</string>");
            Text.AppendLine("\t</dict>");
            Text.AppendLine("\t<key>UILaunchImages</key>");
            Text.AppendLine("\t<array>");
            Text.AppendLine("\t\t<dict>");
            Text.AppendLine("\t\t\t<key>UILaunchImageSize</key>");
            Text.AppendLine("\t\t\t<string>{1920, 1080}</string>");
            Text.AppendLine("\t\t\t<key>UILaunchImageName</key>");
            Text.AppendLine("\t\t\t<string>Launch Image</string>");
            Text.AppendLine("\t\t\t<key>UILaunchImageMinimumOSVersion</key>");
            Text.AppendLine("\t\t\t<string>9.0</string>");
            Text.AppendLine("\t\t\t<key>UILaunchImageOrientation</key>");
            Text.AppendLine("\t\t\t<string>Landscape</string>");
            Text.AppendLine("\t\t</dict>");
            Text.AppendLine("\t</array>");
            Text.AppendLine("\t<key>CFBundleIcons</key>");
            Text.AppendLine("\t<dict>");
            Text.AppendLine("\t\t<key>CFBundlePrimaryIcon</key>");
            Text.AppendLine("\t\t<string>App Icon</string>");
            Text.AppendLine("\t</dict>");

            /*			Text.AppendLine("\t<key>CFBundleIcons</key>");
             *          Text.AppendLine("\t<dict>");
             *          Text.AppendLine("\t\t<key>CFBundlePrimaryIcon</key>");
             *          Text.AppendLine("\t\t<dict>");
             *          Text.AppendLine("\t\t\t<key>CFBundleIconFiles</key>");
             *          Text.AppendLine("\t\t\t<array>");
             *          Text.AppendLine("\t\t\t\t<string>Icon29.png</string>");
             *          Text.AppendLine("\t\t\t\t<string>[email protected]</string>");
             *          Text.AppendLine("\t\t\t\t<string>Icon40.png</string>");
             *          Text.AppendLine("\t\t\t\t<string>[email protected]</string>");
             *          Text.AppendLine("\t\t\t\t<string>Icon57.png</string>");
             *          Text.AppendLine("\t\t\t\t<string>[email protected]</string>");
             *          Text.AppendLine("\t\t\t\t<string>[email protected]</string>");
             *          Text.AppendLine("\t\t\t</array>");
             *          Text.AppendLine("\t\t\t<key>UIPrerenderedIcon</key>");
             *          Text.AppendLine("\t\t\t<true/>");
             *          Text.AppendLine("\t\t</dict>");
             *          Text.AppendLine("\t</dict>");
             *          Text.AppendLine("\t<key>CFBundleIcons~ipad</key>");
             *          Text.AppendLine("\t<dict>");
             *          Text.AppendLine("\t\t<key>CFBundlePrimaryIcon</key>");
             *          Text.AppendLine("\t\t<dict>");
             *          Text.AppendLine("\t\t\t<key>CFBundleIconFiles</key>");
             *          Text.AppendLine("\t\t\t<array>");
             *          Text.AppendLine("\t\t\t\t<string>Icon29.png</string>");
             *          Text.AppendLine("\t\t\t\t<string>[email protected]</string>");
             *          Text.AppendLine("\t\t\t\t<string>Icon40.png</string>");
             *          Text.AppendLine("\t\t\t\t<string>[email protected]</string>");
             *          Text.AppendLine("\t\t\t\t<string>Icon50.png</string>");
             *          Text.AppendLine("\t\t\t\t<string>[email protected]</string>");
             *          Text.AppendLine("\t\t\t\t<string>Icon72.png</string>");
             *          Text.AppendLine("\t\t\t\t<string>[email protected]</string>");
             *          Text.AppendLine("\t\t\t\t<string>Icon76.png</string>");
             *          Text.AppendLine("\t\t\t\t<string>[email protected]</string>");
             *          Text.AppendLine("\t\t\t</array>");
             *          Text.AppendLine("\t\t\t<key>UIPrerenderedIcon</key>");
             *          Text.AppendLine("\t\t\t<true/>");
             *          Text.AppendLine("\t\t</dict>");
             *          Text.AppendLine("\t</dict>");
             *          if (File.Exists(LaunchXib))
             *          {
             *              // TODO: compile the xib via remote tool
             *              Text.AppendLine("\t<key>UILaunchStoryboardName</key>");
             *              Text.AppendLine("\t<string>LaunchScreen</string>");
             *              bSkipDefaultPNGs = true;
             *          }
             *          else
             *          {
             *              // this is a temp way to inject the iphone 6 images without needing to upgrade everyone's plist
             *              // eventually we want to generate this based on what the user has set in the project settings
             *              string[] IPhoneConfigs =
             *                  {
             *                      "Default-IPhone6", "Landscape", "{375, 667}",
             *                      "Default-IPhone6", "Portrait", "{375, 667}",
             *                      "Default-IPhone6Plus-Landscape", "Landscape", "{414, 736}",
             *                      "Default-IPhone6Plus-Portrait", "Portrait", "{414, 736}",
             *                      "Default", "Landscape", "{320, 480}",
             *                      "Default", "Portrait", "{320, 480}",
             *                      "Default-568h", "Landscape", "{320, 568}",
             *                      "Default-568h", "Portrait", "{320, 568}",
             *                  };
             *
             *              Text.AppendLine("\t<key>UILaunchImages~iphone</key>");
             *              Text.AppendLine("\t<array>");
             *              for (int ConfigIndex = 0; ConfigIndex < IPhoneConfigs.Length; ConfigIndex += 3)
             *              {
             *                  Text.AppendLine("\t\t<dict>");
             *                  Text.AppendLine("\t\t\t<key>UILaunchImageMinimumOSVersion</key>");
             *                  Text.AppendLine("\t\t\t<string>8.0</string>");
             *                  Text.AppendLine("\t\t\t<key>UILaunchImageName</key>");
             *                  Text.AppendLine(string.Format("\t\t\t<string>{0}</string>", IPhoneConfigs[ConfigIndex + 0]));
             *                  Text.AppendLine("\t\t\t<key>UILaunchImageOrientation</key>");
             *                  Text.AppendLine(string.Format("\t\t\t<string>{0}</string>", IPhoneConfigs[ConfigIndex + 1]));
             *                  Text.AppendLine("\t\t\t<key>UILaunchImageSize</key>");
             *                  Text.AppendLine(string.Format("\t\t\t<string>{0}</string>", IPhoneConfigs[ConfigIndex + 2]));
             *                  Text.AppendLine("\t\t</dict>");
             *              }
             *
             *              // close it out
             *              Text.AppendLine("\t</array>");
             *          }
             *          Text.AppendLine("\t<key>UILaunchImages~ipad</key>");
             *          Text.AppendLine("\t<array>");
             *          Text.AppendLine("\t\t<dict>");
             *          Text.AppendLine("\t\t\t<key>UILaunchImageMinimumOSVersion</key>");
             *          Text.AppendLine("\t\t\t<string>7.0</string>");
             *          Text.AppendLine("\t\t\t<key>UILaunchImageName</key>");
             *          Text.AppendLine("\t\t\t<string>Default-Landscape</string>");
             *          Text.AppendLine("\t\t\t<key>UILaunchImageOrientation</key>");
             *          Text.AppendLine("\t\t\t<string>Landscape</string>");
             *          Text.AppendLine("\t\t\t<key>UILaunchImageSize</key>");
             *          Text.AppendLine("\t\t\t<string>{768, 1024}</string>");
             *          Text.AppendLine("\t\t</dict>");
             *          Text.AppendLine("\t\t<dict>");
             *          Text.AppendLine("\t\t\t<key>UILaunchImageMinimumOSVersion</key>");
             *          Text.AppendLine("\t\t\t<string>7.0</string>");
             *          Text.AppendLine("\t\t\t<key>UILaunchImageName</key>");
             *          Text.AppendLine("\t\t\t<string>Default-Portrait</string>");
             *          Text.AppendLine("\t\t\t<key>UILaunchImageOrientation</key>");
             *          Text.AppendLine("\t\t\t<string>Portrait</string>");
             *          Text.AppendLine("\t\t\t<key>UILaunchImageSize</key>");
             *          Text.AppendLine("\t\t\t<string>{768, 1024}</string>");
             *          Text.AppendLine("\t\t</dict>");
             *          Text.AppendLine("\t</array>");
             *          Text.AppendLine("\t<key>CFBundleSupportedPlatforms</key>");
             *          Text.AppendLine("\t<array>");
             *          Text.AppendLine("\t\t<string>iPhoneOS</string>");
             *          Text.AppendLine("\t</array>");
             *          Text.AppendLine("\t<key>MinimumOSVersion</key>");
             *          Text.AppendLine(string.Format("\t<string>{0}</string>", MinVersion));
             *          if (!string.IsNullOrEmpty(ExtraData))
             *          {
             *              ExtraData = ExtraData.Replace("\\n", "\n");
             *              foreach (string Line in ExtraData.Split("\r\n".ToCharArray()))
             *              {
             *                  if (!string.IsNullOrWhiteSpace(Line))
             *                  {
             *                      Text.AppendLine("\t" + Line);
             *                  }
             *              }
             *          }*/
            // write the iCloud container identifier, if present in the old file
            if (!string.IsNullOrEmpty(OldPListData))
            {
                int index = OldPListData.IndexOf("ICloudContainerIdentifier");
                if (index > 0)
                {
                    index = OldPListData.IndexOf("<string>", index) + 8;
                    int    length = OldPListData.IndexOf("</string>", index) - index;
                    string ICloudContainerIdentifier = OldPListData.Substring(index, length);
                    Text.AppendLine("\t<key>ICloudContainerIdentifier</key>");
                    Text.AppendLine(string.Format("\t<string>{0}</string>", ICloudContainerIdentifier));
                }
            }

            Text.AppendLine("</dict>");
            Text.AppendLine("</plist>");

            // Create the intermediate directory if needed
            if (!Directory.Exists(IntermediateDirectory))
            {
                Directory.CreateDirectory(IntermediateDirectory);
            }

            if (UPL != null)
            {
                // Allow UPL to modify the plist here
                XDocument XDoc;
                try
                {
                    XDoc = XDocument.Parse(Text.ToString());
                }
                catch (Exception e)
                {
                    throw new BuildException("plist is invalid {0}\n{1}", e, Text.ToString());
                }

                XDoc.DocumentType.InternalSubset = "";
                UPL.ProcessPluginNode("None", "iosPListUpdates", "", ref XDoc);
                string result = XDoc.Declaration.ToString() + "\n" + XDoc.ToString().Replace("<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"[]>", "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">");
                File.WriteAllText(PListFile, result);
            }
            else
            {
                File.WriteAllText(PListFile, Text.ToString());
            }

            if (BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Mac)
            {
                if (!Directory.Exists(AppDirectory))
                {
                    Directory.CreateDirectory(AppDirectory);
                }
                File.WriteAllText(AppDirectory + "/Info.plist", Text.ToString());
            }

            return(bSkipDefaultPNGs);
        }
Ejemplo n.º 25
0
 public void PartialParse_String_ThrowsAnExceptionWhenPassedAMalformedString()
 {
     Assert.Throws(typeof(FormatException), () => VersionUtilities.PartialParse("0.0.a"));
     Assert.Throws(typeof(FormatException), () => VersionUtilities.PartialParse("0.0"));
     Assert.Throws(typeof(FormatException), () => VersionUtilities.PartialParse(""));
 }
 static string GetVersion() => VersionUtilities.GetVersion(typeof(AppyOnePasswordToolCli).Assembly);
Ejemplo n.º 27
0
        internal void ExecutePackageDownload(string name, PackageVersion package, string downloadPath)
        {
            string msg = String.IsNullOrEmpty(downloadPath) ?
                         String.Format(Resources.MessageConfirmToInstallPackage, name, package.version) :
                         String.Format(Resources.MessageConfirmToInstallPackageToFolder, name, package.version, downloadPath);

            var result = MessageBoxService.Show(msg,
                                                Resources.PackageDownloadConfirmMessageBoxTitle,
                                                MessageBoxButton.OKCancel, MessageBoxImage.Question);

            var pmExt = DynamoViewModel.Model.GetPackageManagerExtension();

            if (result == MessageBoxResult.OK)
            {
                // get all of the dependency version headers
                var dependencyVersionHeaders = package.full_dependency_ids.Select((dep, i) =>
                {
                    try
                    {
                        var depVersion = package.full_dependency_versions[i];
                        return(Model.GetPackageVersionHeader(dep._id, depVersion));
                    }
                    catch
                    {
                        MessageBoxService.Show(
                            String.Format(Resources.MessageFailedToDownloadPackageVersion, dep._id),
                            Resources.PackageDownloadErrorMessageBoxTitle,
                            MessageBoxButton.OK, MessageBoxImage.Error);
                        return(null);
                    }
                }).ToList();

                // if any header download fails, abort
                if (dependencyVersionHeaders.Any(x => x == null))
                {
                    return;
                }

                var localPkgs = pmExt.PackageLoader.LocalPackages;

                var uninstallsRequiringRestart          = new List <Package>();
                var uninstallRequiringUserModifications = new List <Package>();
                var immediateUninstalls = new List <Package>();
                var stdLibPackages      = new List <Package>();

                // if a package is already installed we need to uninstall it, allowing
                // the user to cancel if they do not want to uninstall the package
                var duplicateLocalPackages = dependencyVersionHeaders.Select(dep => localPkgs.FirstOrDefault(v => v.Name == dep.name));
                foreach (var localPkg in duplicateLocalPackages)
                {
                    if (localPkg == null)
                    {
                        continue;
                    }

                    if (localPkg.RootDirectory.Contains(pmExt.PackageLoader.StandardLibraryDirectory))
                    {
                        stdLibPackages.Add(localPkg);
                        continue;
                    }

                    if (localPkg.LoadedAssemblies.Any())
                    {
                        uninstallsRequiringRestart.Add(localPkg);
                        continue;
                    }

                    if (localPkg.InUse(DynamoViewModel.Model))
                    {
                        uninstallRequiringUserModifications.Add(localPkg);
                        continue;
                    }

                    immediateUninstalls.Add(localPkg);
                }

                if (stdLibPackages.Any())
                {// Conflicts with standard library packages
                    string message = "";
                    if (duplicateLocalPackages.Count() == 1 &&
                        duplicateLocalPackages.First().Name == name)
                    {
                        message = duplicateLocalPackages.First().VersionName == package.version ?
                                  String.Format(Resources.MessageSamePackageInStdLib,
                                                DynamoViewModel.BrandingResourceProvider.ProductName,
                                                JoinPackageNames(stdLibPackages))
                                    :
                                  String.Format(Resources.MessageSamePackageDiffVersInStdLib,
                                                DynamoViewModel.BrandingResourceProvider.ProductName,
                                                JoinPackageNames(stdLibPackages));
                    }
                    else
                    {
                        message = String.Format(Resources.MessagePackageDepsInStdLib,
                                                DynamoViewModel.BrandingResourceProvider.ProductName,
                                                name + " " + package.version,
                                                JoinPackageNames(stdLibPackages));
                    }

                    MessageBoxService.Show(message,
                                           Resources.CannotDownloadPackageMessageBoxTitle,
                                           MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }

                // determine if any of the packages contain binaries or python scripts.
                var containsBinariesOrPythonScripts = dependencyVersionHeaders.Any(x =>
                {
                    // The contents (string) property of the PackageVersion object can be null for an empty package
                    // like LunchBox.
                    var are_contents_empty = string.IsNullOrEmpty(x.contents);
                    var contains_binaries  = x.contains_binaries ||
                                             !are_contents_empty && x.contents.Contains(PackageManagerClient.PackageContainsBinariesConstant);
                    var contains_python =
                        !are_contents_empty && x.contents.Contains(PackageManagerClient.PackageContainsPythonScriptsConstant);
                    return(contains_binaries || contains_python);
                });

                // if any do, notify user and allow cancellation
                if (containsBinariesOrPythonScripts)
                {
                    var res = MessageBoxService.Show(Resources.MessagePackageContainPythonScript,
                                                     Resources.PackageDownloadMessageBoxTitle,
                                                     MessageBoxButton.OKCancel, MessageBoxImage.Exclamation);

                    if (res == MessageBoxResult.Cancel)
                    {
                        return;
                    }
                }

                // Determine if there are any dependencies that are made with a newer version
                // of Dynamo (this includes the root package)
                var dynamoVersion = VersionUtilities.PartialParse(DynamoViewModel.Model.Version);
                var futureDeps    = dependencyVersionHeaders.Where(dep => VersionUtilities.PartialParse(dep.engine_version) > dynamoVersion);

                // If any of the required packages use a newer version of Dynamo, show a dialog to the user
                // allowing them to cancel the package download
                if (futureDeps.Any())
                {
                    if (MessageBoxService.Show(string.Format(Resources.MessagePackageNewerDynamo, DynamoViewModel.BrandingResourceProvider.ProductName),
                                               string.Format(Resources.PackageUseNewerDynamoMessageBoxTitle, DynamoViewModel.BrandingResourceProvider.ProductName),
                                               MessageBoxButton.OKCancel,
                                               MessageBoxImage.Warning) == MessageBoxResult.Cancel)
                    {
                        return;
                    }
                }

                if (uninstallRequiringUserModifications.Any())
                {
                    MessageBoxService.Show(String.Format(Resources.MessageUninstallToContinue,
                                                         DynamoViewModel.BrandingResourceProvider.ProductName,
                                                         JoinPackageNames(uninstallRequiringUserModifications)),
                                           Resources.CannotDownloadPackageMessageBoxTitle,
                                           MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }

                var settings = DynamoViewModel.Model.PreferenceSettings;

                if (uninstallsRequiringRestart.Any())
                {
                    var message = string.Format(Resources.MessageUninstallToContinue2,
                                                DynamoViewModel.BrandingResourceProvider.ProductName,
                                                JoinPackageNames(uninstallsRequiringRestart),
                                                name + " " + package.version);
                    // different message for the case that the user is
                    // trying to install the same package/version they already have installed.
                    if (uninstallsRequiringRestart.Count == 1 &&
                        uninstallsRequiringRestart.First().Name == name &&
                        uninstallsRequiringRestart.First().VersionName == package.version)
                    {
                        message = String.Format(Resources.MessageUninstallSamePackage, name + " " + package.version);
                    }
                    var dialogResult = MessageBoxService.Show(message,
                                                              Resources.CannotDownloadPackageMessageBoxTitle,
                                                              MessageBoxButton.YesNo, MessageBoxImage.Error);

                    if (dialogResult == MessageBoxResult.Yes)
                    {
                        // mark for uninstallation
                        uninstallsRequiringRestart.ForEach(x => x.MarkForUninstall(settings));
                    }
                    return;
                }

                if (immediateUninstalls.Any())
                {
                    // if the package is not in use, tell the user we will be uninstall it and give them the opportunity to cancel
                    if (MessageBoxService.Show(String.Format(Resources.MessageAlreadyInstallDynamo,
                                                             DynamoViewModel.BrandingResourceProvider.ProductName,
                                                             JoinPackageNames(immediateUninstalls)),
                                               Resources.DownloadWarningMessageBoxTitle,
                                               MessageBoxButton.OKCancel, MessageBoxImage.Warning) == MessageBoxResult.Cancel)
                    {
                        return;
                    }
                }

                // add custom path to custom package folder list
                if (!String.IsNullOrEmpty(downloadPath))
                {
                    if (!settings.CustomPackageFolders.Contains(downloadPath))
                    {
                        settings.CustomPackageFolders.Add(downloadPath);
                    }
                }

                // form header version pairs and download and install all packages
                dependencyVersionHeaders
                .Select((dep, i) => {
                    return(new PackageDownloadHandle()
                    {
                        Id = dep.id,
                        VersionName = dep.version,
                        Name = dep.name
                    });
                })
                .ToList()
                .ForEach(x => DownloadAndInstall(x, downloadPath));
            }
        }
        public override void Execute()
        {
            var version = versionNumberToDownload ?? this.Header.versions.Last();

            string message = "Are you sure you want to install " + this.Name + " " + version.version + "?";

            var result = MessageBox.Show(message, "Package Download Confirmation",
                                         MessageBoxButton.OKCancel, MessageBoxImage.Question);

            if (result == MessageBoxResult.OK)
            {
                // get all of the headers
                var headers = version.full_dependency_ids.Select(dep => dep._id).Select((id) =>
                {
                    PackageHeader pkgHeader;
                    var res = dynamoViewModel.Model.PackageManagerClient.DownloadPackageHeader(id, out pkgHeader);

                    if (!res.Success)
                    {
                        MessageBox.Show("Failed to download package with id: " + id + ".  Please try again and report the package if you continue to have problems.", "Package Download Error",
                                        MessageBoxButton.OK, MessageBoxImage.Error);
                    }

                    return(pkgHeader);
                }).ToList();

                // if any header download fails, abort
                if (headers.Any(x => x == null))
                {
                    return;
                }

                var allPackageVersions = ListRequiredPackageVersions(headers, version);

                // Determine if there are any dependencies that are made with a newer version
                // of Dynamo (this includes the root package)
                var dynamoVersion       = dynamoViewModel.Model.Version;
                var dynamoVersionParsed = VersionUtilities.PartialParse(dynamoVersion, 3);
                var futureDeps          = allPackageVersions.FilterFuturePackages(dynamoVersionParsed);

                // If any of the required packages use a newer version of Dynamo, show a dialog to the user
                // allowing them to cancel the package download
                if (futureDeps.Any())
                {
                    var sb = new StringBuilder();

                    sb.AppendLine(
                        "The following packages use a newer version of Dynamo than you are currently using: ");
                    sb.AppendLine();

                    foreach (var elem in futureDeps)
                    {
                        sb.AppendLine(elem.Item1.name + " " + elem.Item2);
                    }

                    sb.AppendLine();
                    sb.AppendLine("Do you want to continue?");

                    // If the user
                    if (MessageBox.Show(
                            sb.ToString(),
                            "Package Uses Newer Version of Dynamo!",
                            MessageBoxButton.OKCancel,
                            MessageBoxImage.Warning) == MessageBoxResult.Cancel)
                    {
                        return;
                    }
                }

                var localPkgs = dynamoViewModel.Model.Loader.PackageLoader.LocalPackages;

                // if a package is already installed we need to uninstall it, allowing
                // the user to cancel if they do not want to uninstall the package
                foreach (var localPkg in headers.Select(x => localPkgs.FirstOrDefault(v => v.Name == x.name)))
                {
                    if (localPkg == null)
                    {
                        continue;
                    }
                    string msg;

                    // if the package is in use, we will not be able to uninstall it.
                    if (localPkg.InUse())
                    {
                        msg = "Dynamo needs to uninstall " + this.Name + " to continue, but cannot as one of its types appears to be in use.  Try restarting Dynamo.";
                        MessageBox.Show(msg, "Cannot Download Package", MessageBoxButton.OK,
                                        MessageBoxImage.Error);
                        return;
                    }

                    // if the package is not in use, tell the user we will be uninstall it and give them the opportunity to cancel
                    msg = "Dynamo has already installed " + this.Name + ".  \n\nDynamo will attempt to uninstall this package before installing.  ";
                    if (MessageBox.Show(msg, "Download Warning", MessageBoxButton.OKCancel, MessageBoxImage.Warning) == MessageBoxResult.Cancel)
                    {
                        return;
                    }
                }

                // form header version pairs and download and install all packages
                allPackageVersions
                .Select(x => new PackageDownloadHandle(this.dynamoViewModel, x.Item1, x.Item2))
                .ToList()
                .ForEach(x => x.Start());
            }
        }
        private void PackageOnExecuted(PackageManagerSearchElement element, PackageVersion version, string downloadPath)
        {
            string msg = String.IsNullOrEmpty(downloadPath) ?
                         String.Format(Resources.MessageConfirmToInstallPackage, element.Name, version.version) :
                         String.Format(Resources.MessageConfirmToInstallPackageToFolder, element.Name, version.version, downloadPath);

            var result = MessageBox.Show(msg,
                                         Resources.PackageDownloadConfirmMessageBoxTitle,
                                         MessageBoxButton.OKCancel, MessageBoxImage.Question);

            var pmExt = PackageManagerClientViewModel.DynamoViewModel.Model.GetPackageManagerExtension();

            if (result == MessageBoxResult.OK)
            {
                // get all of the headers
                var headers = version.full_dependency_ids.Select(dep => dep._id).Select((id) =>
                {
                    PackageHeader pkgHeader;
                    var res = pmExt.PackageManagerClient.DownloadPackageHeader(id, out pkgHeader);

                    if (!res.Success)
                    {
                        MessageBox.Show(String.Format(Resources.MessageFailedToDownloadPackage, id),
                                        Resources.PackageDownloadErrorMessageBoxTitle,
                                        MessageBoxButton.OK, MessageBoxImage.Error);
                    }

                    return(pkgHeader);
                }).ToList();

                // if any header download fails, abort
                if (headers.Any(x => x == null))
                {
                    return;
                }

                var allPackageVersions = PackageManagerSearchElement.ListRequiredPackageVersions(headers, version);

                // determine if any of the packages contain binaries or python scripts.
                var containsBinaries =
                    allPackageVersions.Any(
                        x => x.Item2.contents.Contains(PackageManagerClient.PackageContainsBinariesConstant) || x.Item2.contains_binaries);

                var containsPythonScripts =
                    allPackageVersions.Any(
                        x => x.Item2.contents.Contains(PackageManagerClient.PackageContainsPythonScriptsConstant));

                // if any do, notify user and allow cancellation
                if (containsBinaries || containsPythonScripts)
                {
                    var res = MessageBox.Show(Resources.MessagePackageContainPythonScript,
                                              Resources.PackageDownloadMessageBoxTitle,
                                              MessageBoxButton.OKCancel, MessageBoxImage.Exclamation);

                    if (res == MessageBoxResult.Cancel)
                    {
                        return;
                    }
                }

                // Determine if there are any dependencies that are made with a newer version
                // of Dynamo (this includes the root package)
                var dynamoVersion       = this.PackageManagerClientViewModel.DynamoViewModel.Model.Version;
                var dynamoVersionParsed = VersionUtilities.PartialParse(dynamoVersion, 3);
                var futureDeps          = allPackageVersions.FilterFuturePackages(dynamoVersionParsed);

                // If any of the required packages use a newer version of Dynamo, show a dialog to the user
                // allowing them to cancel the package download
                if (futureDeps.Any())
                {
                    var versionList = FormatPackageVersionList(futureDeps);

                    if (MessageBox.Show(String.Format(Resources.MessagePackageNewerDynamo,
                                                      PackageManagerClientViewModel.DynamoViewModel.BrandingResourceProvider.ProductName,
                                                      versionList),
                                        string.Format(Resources.PackageUseNewerDynamoMessageBoxTitle,
                                                      PackageManagerClientViewModel.DynamoViewModel.BrandingResourceProvider.ProductName),
                                        MessageBoxButton.OKCancel,
                                        MessageBoxImage.Warning) == MessageBoxResult.Cancel)
                    {
                        return;
                    }
                }

                var localPkgs = pmExt.PackageLoader.LocalPackages;

                var uninstallsRequiringRestart          = new List <Package>();
                var uninstallRequiringUserModifications = new List <Package>();
                var immediateUninstalls = new List <Package>();

                // if a package is already installed we need to uninstall it, allowing
                // the user to cancel if they do not want to uninstall the package
                foreach (var localPkg in headers.Select(x => localPkgs.FirstOrDefault(v => v.Name == x.name)))
                {
                    if (localPkg == null)
                    {
                        continue;
                    }

                    if (localPkg.LoadedAssemblies.Any())
                    {
                        uninstallsRequiringRestart.Add(localPkg);
                        continue;
                    }

                    if (localPkg.InUse(this.PackageManagerClientViewModel.DynamoViewModel.Model))
                    {
                        uninstallRequiringUserModifications.Add(localPkg);
                        continue;
                    }

                    immediateUninstalls.Add(localPkg);
                }

                if (uninstallRequiringUserModifications.Any())
                {
                    MessageBox.Show(String.Format(Resources.MessageUninstallToContinue,
                                                  PackageManagerClientViewModel.DynamoViewModel.BrandingResourceProvider.ProductName,
                                                  JoinPackageNames(uninstallRequiringUserModifications)),
                                    Resources.CannotDownloadPackageMessageBoxTitle,
                                    MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }

                var settings = PackageManagerClientViewModel.DynamoViewModel.Model.PreferenceSettings;

                if (uninstallsRequiringRestart.Any())
                {
                    var message = string.Format(Resources.MessageUninstallToContinue2,
                                                PackageManagerClientViewModel.DynamoViewModel.BrandingResourceProvider.ProductName,
                                                JoinPackageNames(uninstallsRequiringRestart),
                                                element.Name + " " + version.version);
                    var dialogResult = MessageBox.Show(message,
                                                       Resources.CannotDownloadPackageMessageBoxTitle,
                                                       MessageBoxButton.YesNo, MessageBoxImage.Error);

                    if (dialogResult == MessageBoxResult.Yes)
                    {
                        // mark for uninstallation
                        uninstallsRequiringRestart.ForEach(x => x.MarkForUninstall(settings));
                    }
                    return;
                }

                if (immediateUninstalls.Any())
                {
                    // if the package is not in use, tell the user we will be uninstall it and give them the opportunity to cancel
                    if (MessageBox.Show(String.Format(Resources.MessageAlreadyInstallDynamo,
                                                      PackageManagerClientViewModel.DynamoViewModel.BrandingResourceProvider.ProductName,
                                                      JoinPackageNames(immediateUninstalls)),
                                        Resources.DownloadWarningMessageBoxTitle,
                                        MessageBoxButton.OKCancel, MessageBoxImage.Warning) == MessageBoxResult.Cancel)
                    {
                        return;
                    }
                }

                // add custom path to custom package folder list
                if (!String.IsNullOrEmpty(downloadPath))
                {
                    if (!settings.CustomPackageFolders.Contains(downloadPath))
                    {
                        settings.CustomPackageFolders.Add(downloadPath);
                    }
                }

                // form header version pairs and download and install all packages
                allPackageVersions
                .Select(x => new PackageDownloadHandle(x.Item1, x.Item2))
                .ToList()
                .ForEach(x => this.PackageManagerClientViewModel.DownloadAndInstall(x, downloadPath));
            }
        }
Ejemplo n.º 30
0
        public static bool GeneratePList(string ProjectDirectory, bool bIsUE4Game, string GameName, string ProjectName, string InEngineDir, string AppDirectory)
        {
            // generate the Info.plist for future use
            string BuildDirectory        = ProjectDirectory + "/Build/IOS";
            bool   bSkipDefaultPNGs      = false;
            string IntermediateDirectory = (bIsUE4Game ? InEngineDir : ProjectDirectory) + "/Intermediate/IOS";
            string PListFile             = IntermediateDirectory + "/" + GameName + "-Info.plist";

            VersionUtilities.BuildDirectory = BuildDirectory;
            VersionUtilities.GameName       = GameName;

            // read the old file
            string OldPListData = File.Exists(PListFile) ? File.ReadAllText(PListFile) : "";

            // determine if there is a launch.xib
            string LaunchXib = InEngineDir + "/Build/IOS/Resources/Interface/LaunchScreen.xib";

            if (File.Exists(BuildDirectory + "/Resources/Interface/LaunchScreen.xib"))
            {
                LaunchXib = BuildDirectory + "/Resources/Interface/LaunchScreen.xib";
            }

            // get the settings from the ini file
            // plist replacements
            ConfigCacheIni Ini = new ConfigCacheIni(UnrealTargetPlatform.IOS, "Engine", UnrealBuildTool.GetUProjectPath());

            // orientations
            string SupportedOrientations = "";
            bool   bSupported            = true;

            Ini.GetBool("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "bSupportsPortraitOrientation", out bSupported);
            SupportedOrientations += bSupported ? "\t\t<string>UIInterfaceOrientationPortrait</string>\n" : "";
            Ini.GetBool("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "bSupportsUpsideDownOrientation", out bSupported);
            SupportedOrientations += bSupported ? "\t\t<string>UIInterfaceOrientationPortraitUpsideDown</string>\n" : "";
            Ini.GetBool("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "bSupportsLandscapeLeftOrientation", out bSupported);
            SupportedOrientations += bSupported ? "\t\t<string>UIInterfaceOrientationLandscapeLeft</string>\n" : "";
            Ini.GetBool("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "bSupportsLandscapeRightOrientation", out bSupported);
            SupportedOrientations += bSupported ? "\t\t<string>UIInterfaceOrientationLandscapeRight</string>\n" : "";

            // bundle display name
            string BundleDisplayName;

            Ini.GetString("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "BundleDisplayName", out BundleDisplayName);

            // bundle identifier
            string BundleIdentifier;

            Ini.GetString("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "BundleIdentifier", out BundleIdentifier);

            // bundle name
            string BundleName;

            Ini.GetString("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "BundleName", out BundleName);

            // short version string
            string BundleShortVersion;

            Ini.GetString("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "VersionInfo", out BundleShortVersion);

            // required capabilities
            string RequiredCaps = "\t\t<string>armv7</string>\n";

            Ini.GetBool("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "bSupportsOpenGLES2", out bSupported);
            RequiredCaps += bSupported ? "\t\t<string>opengles-2</string>\n" : "";
            if (!bSupported)
            {
                Ini.GetBool("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "bSupportsMetal", out bSupported);
                RequiredCaps += bSupported ? "\t\t<string>metal</string>\n" : "";
            }

            // minimum iOS version
            string MinVersion;

            if (Ini.GetString("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "MinimumiOSVersion", out MinVersion))
            {
                switch (MinVersion)
                {
                case "IOS_61":
                    MinVersion = "6.1";
                    break;

                case "IOS_7":
                    MinVersion = "7.0";
                    break;

                case "IOS_8":
                    MinVersion = "8.0";
                    break;
                }
            }
            else
            {
                MinVersion = "6.1";
            }

            // Get Facebook Support details
            bool bEnableFacebookSupport = true;

            Ini.GetBool("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "bEnableFacebookSupport", out bEnableFacebookSupport);

            // Write the Facebook App ID if we need it.
            string FacebookAppID = "";

            Ini.GetString("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "FacebookAppID", out FacebookAppID);
            bEnableFacebookSupport = bEnableFacebookSupport && !string.IsNullOrWhiteSpace(FacebookAppID);

            // extra plist data
            string ExtraData = "";

            Ini.GetString("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "AdditionalPlistData", out ExtraData);

            // generate the plist file
            StringBuilder Text = new StringBuilder();

            Text.AppendLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
            Text.AppendLine("<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">");
            Text.AppendLine("<plist version=\"1.0\">");
            Text.AppendLine("<dict>");
            Text.AppendLine("\t<key>CFBundleURLTypes</key>");
            Text.AppendLine("\t<array>");
            Text.AppendLine("\t\t<dict>");
            Text.AppendLine("\t\t\t<key>CFBundleURLName</key>");
            Text.AppendLine("\t\t\t<string>com.Epic.Unreal</string>");
            Text.AppendLine("\t\t\t<key>CFBundleURLSchemes</key>");
            Text.AppendLine("\t\t\t<array>");
            Text.AppendLine(string.Format("\t\t\t\t<string>{0}</string>", bIsUE4Game ? "UE4Game" : GameName));
            if (bEnableFacebookSupport)
            {
                // This is needed for facebook login to redirect back to the app after completion.
                Text.AppendLine(string.Format("\t\t\t\t<string>fb{0}</string>", FacebookAppID));
            }
            Text.AppendLine("\t\t\t</array>");
            Text.AppendLine("\t\t</dict>");
            Text.AppendLine("\t</array>");
            Text.AppendLine("\t<key>CFBundleDevelopmentRegion</key>");
            Text.AppendLine("\t<string>English</string>");
            Text.AppendLine("\t<key>CFBundleDisplayName</key>");
            Text.AppendLine(string.Format("\t<string>{0}</string>", BundleDisplayName.Replace("[PROJECT_NAME]", ProjectName).Replace("_", "")));
            Text.AppendLine("\t<key>CFBundleExecutable</key>");
            Text.AppendLine(string.Format("\t<string>{0}</string>", bIsUE4Game ? "UE4Game" : GameName));
            Text.AppendLine("\t<key>CFBundleIdentifier</key>");
            Text.AppendLine(string.Format("\t<string>{0}</string>", BundleIdentifier.Replace("[PROJECT_NAME]", ProjectName).Replace("_", "")));
            Text.AppendLine("\t<key>CFBundleInfoDictionaryVersion</key>");
            Text.AppendLine("\t<string>6.0</string>");
            Text.AppendLine("\t<key>CFBundleName</key>");
            Text.AppendLine(string.Format("\t<string>{0}</string>", BundleName.Replace("[PROJECT_NAME]", ProjectName).Replace("_", "")));
            Text.AppendLine("\t<key>CFBundlePackageType</key>");
            Text.AppendLine("\t<string>APPL</string>");
            Text.AppendLine("\t<key>CFBundleSignature</key>");
            Text.AppendLine("\t<string>????</string>");
            Text.AppendLine("\t<key>CFBundleVersion</key>");
            Text.AppendLine(string.Format("\t<string>{0}</string>", VersionUtilities.UpdateBundleVersion(OldPListData)));
            Text.AppendLine("\t<key>CFBundleShortVersionString</key>");
            Text.AppendLine(string.Format("\t<string>{0}</string>", BundleShortVersion));
            Text.AppendLine("\t<key>LSRequiresIPhoneOS</key>");
            Text.AppendLine("\t<true/>");
            Text.AppendLine("\t<key>UIStatusBarHidden</key>");
            Text.AppendLine("\t<true/>");
            Text.AppendLine("\t<key>UIViewControllerBasedStatusBarAppearance</key>");
            Text.AppendLine("\t<false/>");
            Text.AppendLine("\t<key>UISupportedInterfaceOrientations</key>");
            Text.AppendLine("\t<array>");
            foreach (string Line in SupportedOrientations.Split("\r\n".ToCharArray()))
            {
                if (!string.IsNullOrWhiteSpace(Line))
                {
                    Text.AppendLine(Line);
                }
            }
            Text.AppendLine("\t</array>");
            Text.AppendLine("\t<key>UIRequiredDeviceCapabilities</key>");
            Text.AppendLine("\t<array>");
            foreach (string Line in RequiredCaps.Split("\r\n".ToCharArray()))
            {
                if (!string.IsNullOrWhiteSpace(Line))
                {
                    Text.AppendLine(Line);
                }
            }
            Text.AppendLine("\t</array>");
            Text.AppendLine("\t<key>CFBundleIcons</key>");
            Text.AppendLine("\t<dict>");
            Text.AppendLine("\t\t<key>CFBundlePrimaryIcon</key>");
            Text.AppendLine("\t\t<dict>");
            Text.AppendLine("\t\t\t<key>CFBundleIconFiles</key>");
            Text.AppendLine("\t\t\t<array>");
            Text.AppendLine("\t\t\t\t<string>Icon29.png</string>");
            Text.AppendLine("\t\t\t\t<string>[email protected]</string>");
            Text.AppendLine("\t\t\t\t<string>Icon40.png</string>");
            Text.AppendLine("\t\t\t\t<string>[email protected]</string>");
            Text.AppendLine("\t\t\t\t<string>Icon57.png</string>");
            Text.AppendLine("\t\t\t\t<string>[email protected]</string>");
            Text.AppendLine("\t\t\t\t<string>[email protected]</string>");
            Text.AppendLine("\t\t\t</array>");
            Text.AppendLine("\t\t\t<key>UIPrerenderedIcon</key>");
            Text.AppendLine("\t\t\t<true/>");
            Text.AppendLine("\t\t</dict>");
            Text.AppendLine("\t</dict>");
            Text.AppendLine("\t<key>CFBundleIcons~ipad</key>");
            Text.AppendLine("\t<dict>");
            Text.AppendLine("\t\t<key>CFBundlePrimaryIcon</key>");
            Text.AppendLine("\t\t<dict>");
            Text.AppendLine("\t\t\t<key>CFBundleIconFiles</key>");
            Text.AppendLine("\t\t\t<array>");
            Text.AppendLine("\t\t\t\t<string>Icon29.png</string>");
            Text.AppendLine("\t\t\t\t<string>[email protected]</string>");
            Text.AppendLine("\t\t\t\t<string>Icon40.png</string>");
            Text.AppendLine("\t\t\t\t<string>[email protected]</string>");
            Text.AppendLine("\t\t\t\t<string>Icon50.png</string>");
            Text.AppendLine("\t\t\t\t<string>[email protected]</string>");
            Text.AppendLine("\t\t\t\t<string>Icon72.png</string>");
            Text.AppendLine("\t\t\t\t<string>[email protected]</string>");
            Text.AppendLine("\t\t\t\t<string>Icon76.png</string>");
            Text.AppendLine("\t\t\t\t<string>[email protected]</string>");
            Text.AppendLine("\t\t\t</array>");
            Text.AppendLine("\t\t\t<key>UIPrerenderedIcon</key>");
            Text.AppendLine("\t\t\t<true/>");
            Text.AppendLine("\t\t</dict>");
            Text.AppendLine("\t</dict>");
            if (File.Exists(LaunchXib))
            {
                // TODO: compile the xib via remote tool
                Text.AppendLine("\t<key>UILaunchStoryboardName</key>");
                Text.AppendLine("\t<string>LaunchScreen</string>");
                bSkipDefaultPNGs = true;
            }
            else
            {
                // this is a temp way to inject the iphone 6 images without needing to upgrade everyone's plist
                // eventually we want to generate this based on what the user has set in the project settings
                string[] IPhoneConfigs =
                {
                    "Default-IPhone6",               "Landscape", "{375, 667}",
                    "Default-IPhone6",               "Portrait",  "{375, 667}",
                    "Default-IPhone6Plus-Landscape", "Landscape", "{414, 736}",
                    "Default-IPhone6Plus-Portrait",  "Portrait",  "{414, 736}",
                    "Default",                       "Landscape", "{320, 480}",
                    "Default",                       "Portrait",  "{320, 480}",
                    "Default-568h",                  "Landscape", "{320, 568}",
                    "Default-568h",                  "Portrait",  "{320, 568}",
                };

                Text.AppendLine("\t<key>UILaunchImages~iphone</key>");
                Text.AppendLine("\t<array>");
                for (int ConfigIndex = 0; ConfigIndex < IPhoneConfigs.Length; ConfigIndex += 3)
                {
                    Text.AppendLine("\t\t<dict>");
                    Text.AppendLine("\t\t\t<key>UILaunchImageMinimumOSVersion</key>");
                    Text.AppendLine("\t\t\t<string>8.0</string>");
                    Text.AppendLine("\t\t\t<key>UILaunchImageName</key>");
                    Text.AppendLine(string.Format("\t\t\t<string>{0}</string>", IPhoneConfigs[ConfigIndex + 0]));
                    Text.AppendLine("\t\t\t<key>UILaunchImageOrientation</key>");
                    Text.AppendLine(string.Format("\t\t\t<string>{0}</string>", IPhoneConfigs[ConfigIndex + 1]));
                    Text.AppendLine("\t\t\t<key>UILaunchImageSize</key>");
                    Text.AppendLine(string.Format("\t\t\t<string>{0}</string>", IPhoneConfigs[ConfigIndex + 2]));
                    Text.AppendLine("\t\t</dict>");
                }

                // close it out
                Text.AppendLine("\t</array>");
            }
            Text.AppendLine("\t<key>UILaunchImages~ipad</key>");
            Text.AppendLine("\t<array>");
            Text.AppendLine("\t\t<dict>");
            Text.AppendLine("\t\t\t<key>UILaunchImageMinimumOSVersion</key>");
            Text.AppendLine("\t\t\t<string>7.0</string>");
            Text.AppendLine("\t\t\t<key>UILaunchImageName</key>");
            Text.AppendLine("\t\t\t<string>Default-Landscape</string>");
            Text.AppendLine("\t\t\t<key>UILaunchImageOrientation</key>");
            Text.AppendLine("\t\t\t<string>Landscape</string>");
            Text.AppendLine("\t\t\t<key>UILaunchImageSize</key>");
            Text.AppendLine("\t\t\t<string>{768, 1024}</string>");
            Text.AppendLine("\t\t</dict>");
            Text.AppendLine("\t\t<dict>");
            Text.AppendLine("\t\t\t<key>UILaunchImageMinimumOSVersion</key>");
            Text.AppendLine("\t\t\t<string>7.0</string>");
            Text.AppendLine("\t\t\t<key>UILaunchImageName</key>");
            Text.AppendLine("\t\t\t<string>Default-Portrait</string>");
            Text.AppendLine("\t\t\t<key>UILaunchImageOrientation</key>");
            Text.AppendLine("\t\t\t<string>Portrait</string>");
            Text.AppendLine("\t\t\t<key>UILaunchImageSize</key>");
            Text.AppendLine("\t\t\t<string>{768, 1024}</string>");
            Text.AppendLine("\t\t</dict>");
            Text.AppendLine("\t</array>");
            Text.AppendLine("\t<key>CFBundleSupportedPlatforms</key>");
            Text.AppendLine("\t<array>");
            Text.AppendLine("\t\t<string>iPhoneOS</string>");
            Text.AppendLine("\t</array>");
            Text.AppendLine("\t<key>MinimumOSVersion</key>");
            Text.AppendLine(string.Format("\t<string>{0}</string>", MinVersion));
            if (bEnableFacebookSupport)
            {
                Text.AppendLine("\t<key>FacebookAppID</key>");
                Text.AppendLine(string.Format("\t<string>{0}</string>", FacebookAppID));
            }
            if (!string.IsNullOrEmpty(ExtraData))
            {
                ExtraData = ExtraData.Replace("\\n", "\n");
                foreach (string Line in ExtraData.Split("\r\n".ToCharArray()))
                {
                    if (!string.IsNullOrWhiteSpace(Line))
                    {
                        Text.AppendLine("\t" + Line);
                    }
                }
            }
            Text.AppendLine("</dict>");
            Text.AppendLine("</plist>");

            // write the file out
            if (!Directory.Exists(IntermediateDirectory))
            {
                Directory.CreateDirectory(IntermediateDirectory);
            }
            File.WriteAllText(PListFile, Text.ToString());
            if (BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Mac)
            {
                if (!Directory.Exists(AppDirectory))
                {
                    Directory.CreateDirectory(AppDirectory);
                }
                File.WriteAllText(AppDirectory + "/Info.plist", Text.ToString());
            }

            return(bSkipDefaultPNGs);
        }