Exemplo n.º 1
0
        /// <summary>
        /// Search for templates in the PnP Templates Gallery
        /// </summary>
        /// <param name="searchText"></param>
        /// <param name="platforms"></param>
        /// <param name="scope"></param>
        /// <returns></returns>
        public ProvisioningTemplateInformation[] SearchProvisioningTemplates(string searchText, TargetPlatform platforms, TargetScope scope)
        {
            ProvisioningTemplateInformation[] result = null;

            String targetPlatforms = platforms.ToString();
            String targetScopes    = scope.ToString();

            // Search via HTTP REST
            var jsonSearchResult = HttpHelper.MakeGetRequestForString(
                $"{this._templatesGalleryBaseUrl}api/SearchTemplates?searchText={HttpUtility.UrlEncode(searchText)}&platforms={targetPlatforms}&scope={targetScopes}");

            // If we have any result
            if (!String.IsNullOrEmpty(jsonSearchResult))
            {
                // Convert from JSON to a typed array
                var searchResultItems = JsonConvert.DeserializeObject <PnPTemplatesGalleryResultItem[]>(jsonSearchResult);

                result = (from r in searchResultItems
                          select new ProvisioningTemplateInformation
                {
                    DisplayName = r.Title,
                    Description = r.Abstract,
                    TemplateFileUri = r.TemplatePnPUrl,
                    TemplateImageUrl = r.ImageUrl,
                    Scope = r.Scopes,
                    Platforms = r.Platforms,
                }).ToArray();
            }

            return(result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets an array of all platform folder names
        /// </summary>
        /// <returns>Array of platform folders</returns>
        public static string[] GetPlatformFolderNames()
        {
            if (CachedPlatformFolderNames == null)
            {
                List <string> PlatformFolderNames = new List <string>();

                // Find all the platform folders to exclude from the list of precompiled modules
                foreach (UnrealTargetPlatform TargetPlatform in Enum.GetValues(typeof(UnrealTargetPlatform)))
                {
                    if (TargetPlatform != UnrealTargetPlatform.Unknown)
                    {
                        PlatformFolderNames.Add(TargetPlatform.ToString());
                    }
                }

                // Also exclude all the platform groups that this platform is not a part of
                foreach (UnrealPlatformGroup PlatformGroup in Enum.GetValues(typeof(UnrealPlatformGroup)))
                {
                    PlatformFolderNames.Add(PlatformGroup.ToString());
                }

                // Save off the list as an array
                CachedPlatformFolderNames = PlatformFolderNames.ToArray();
            }
            return(CachedPlatformFolderNames);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Finds a list of folder names to exclude when building for this platform
        /// </summary>
        public FileSystemName[] GetExcludedFolderNames()
        {
            if (CachedExcludedFolderNames == null)
            {
                // Find all the platform folders to exclude from the list of precompiled modules
                List <FileSystemName> Names = new List <FileSystemName>();
                foreach (UnrealTargetPlatform TargetPlatform in Enum.GetValues(typeof(UnrealTargetPlatform)))
                {
                    if (TargetPlatform != UnrealTargetPlatform.Unknown && TargetPlatform != Platform)
                    {
                        Names.Add(new FileSystemName(TargetPlatform.ToString()));
                    }
                }

                // Also exclude all the platform groups that this platform is not a part of
                List <UnrealPlatformGroup> IncludePlatformGroups = new List <UnrealPlatformGroup>(UEBuildPlatform.GetPlatformGroups(Platform));
                foreach (UnrealPlatformGroup PlatformGroup in Enum.GetValues(typeof(UnrealPlatformGroup)))
                {
                    if (!IncludePlatformGroups.Contains(PlatformGroup))
                    {
                        Names.Add(new FileSystemName(PlatformGroup.ToString()));
                    }
                }

                // Save off the list as an array
                CachedExcludedFolderNames = Names.ToArray();
            }
            return(CachedExcludedFolderNames);
        }
Exemplo n.º 4
0
        internal static IEnumerable <ProvisioningTemplateInformation> SearchTemplates(string searchKey, TargetPlatform targetPlatforms, TargetScope targetScopes)
        {
            var targetPlatformsString = targetPlatforms.ToString();
            var targetScopesString    = targetScopes.ToString();

            searchKey = searchKey != null?System.Web.HttpUtility.UrlEncode(searchKey) : "";

            var jsonSearchResult =
                HttpHelper.MakeGetRequestForString(
                    $"{BaseTemplateGalleryUrl}/api/SearchTemplates?searchText={searchKey}&Platform={System.Web.HttpUtility.UrlEncode(targetPlatformsString)}&Scope={System.Web.HttpUtility.UrlEncode(targetScopesString)}");

            if (!string.IsNullOrEmpty(jsonSearchResult))
            {
                // Convert from JSON to a typed array
                var searchResultItems =
                    JsonConvert.DeserializeObject <PnPTemplatesGalleryResultItem[]>(jsonSearchResult);

                var result = (from r in searchResultItems
                              select new ProvisioningTemplateInformation
                {
                    Id = r.Id,
                    DisplayName = r.Title,
                    Description = r.Abstract,
                    TemplateFileUri = r.TemplatePnPUrl,
                    TemplateImageUrl = r.ImageUrl,
                    Scope = r.Scopes,
                    Platforms = r.Platforms,
                }).ToArray();
                return(result);
            }
            return(null);
        }
Exemplo n.º 5
0
            public static void Package(TargetPlatform platform)
            {
                var platformsRoot = Path.Combine(Globals.EngineRoot, "Source", "Platforms");

                Log.Info(string.Empty);
                Log.Info($"Deploy {platform} platform files");
                Log.Info(string.Empty);

                string platformName = platform.ToString();
                string src          = Path.Combine(platformsRoot, platformName);
                string dst          = Path.Combine(Deployer.PackageOutputPath, platformName);

                // Deploy files
                {
                    DeployFolder(platformsRoot, Deployer.PackageOutputPath, platformName);

                    // For Linux don't deploy engine libs used by C++ scripting linking (engine source required)
                    if (platform == TargetPlatform.Linux)
                    {
                        File.Delete(Path.Combine(dst, "Binaries", "Game", "x64", "Debug", "FlaxGame.a"));
                        File.Delete(Path.Combine(dst, "Binaries", "Game", "x64", "Development", "FlaxGame.a"));
                        File.Delete(Path.Combine(dst, "Binaries", "Game", "x64", "Release", "FlaxGame.a"));
                    }

                    // Don't distribute engine deps
                    Utilities.DirectoryDelete(Path.Combine(dst, "Binaries", "ThirdParty"));

                    var filesToRemove = new List <string>();
                    filesToRemove.AddRange(Directory.GetFiles(dst, ".gitignore", SearchOption.AllDirectories));
                    filesToRemove.AddRange(Directory.GetFiles(dst, "*.pdb", SearchOption.AllDirectories));
                    filesToRemove.AddRange(Directory.GetFiles(dst, "*.ilk", SearchOption.AllDirectories));
                    filesToRemove.AddRange(Directory.GetFiles(dst, "*.exp", SearchOption.AllDirectories));
                    filesToRemove.ForEach(File.Delete);
                }

                // Compress
                {
                    Log.Info("Compressing platform files...");

                    var packageZipPath = Path.Combine(Deployer.PackageOutputPath, platformName + ".zip");
                    using (ZipFile zip = new ZipFile())
                    {
                        zip.AddDirectory(dst);

                        zip.CompressionLevel = CompressionLevel.BestCompression;
                        zip.Comment          = string.Format("Flax Engine {0}.{1}.{2}\nPlatform: {4}\nDate: {3}", Deployer.VersionMajor, Deployer.VersionMinor, Deployer.VersionBuild, DateTime.UtcNow, platformName);

                        zip.Save(packageZipPath);
                    }

                    Log.Info(string.Format("Compressed {0} package size: {1}", platformName, Utilities.GetFileSize(packageZipPath)));
                }

                // Remove files (only zip package is used)
                Utilities.DirectoryDelete(dst);

                Log.Info(string.Empty);
            }
Exemplo n.º 6
0
 string ReplaceSymbols(string parameter)
 {
     if (string.IsNullOrWhiteSpace(parameter))
     {
         return(parameter);
     }
     return(parameter
            .Replace("$(Platform)", Platform.ToString())
            .Replace("$(Configuration)", Config)
            .Replace("$(Config)", Config)
            .Replace("$(Profile)", this.Profile.ToString()));
 }
        /// <summary>
        /// Saves this object's property values to current project.
        /// </summary>
        /// <returns>VSConstants.S_OK if success.</returns>
        protected override int ApplyChanges()
        {
            //TODO
            ProjectMgr.SetProjectProperty(PropertyTag.AssemblyName.ToString(), AssemblyName);
            ProjectMgr.SetProjectProperty(PropertyTag.DefaultNamespace.ToString(), DefaultNamespace);
            ProjectMgr.SetProjectProperty(PropertyTag.TargetPlatform.ToString(), TargetPlatform.ToString());
            ProjectMgr.SetProjectProperty(PropertyTag.DynVarOption.ToString(), DynVarOption.ToString());

            IsDirty = false;

            return(VSConstants.S_OK);
        }
Exemplo n.º 8
0
        //MUST BE IN SYNC : MonoUE.Core.props, ConfigurationHelpers.cs, MonoMainDomain.cpp, MonoRuntimeStagingRules.cs, MonoScriptCodeGenerator.cpp, and IDE extensions
        public static string GetAssemblyDirectory(TargetConfiguration targetConfiguration, TargetPlatform targetPlatform, TargetType targetType, string rootDirectory = null)
        {
            string ConfigSuffix = null;

            switch (targetConfiguration)
            {
            case TargetConfiguration.Debug:
                ConfigSuffix = "-Debug";
                break;

            case TargetConfiguration.DebugGame:
                ConfigSuffix = "-DebugGame";
                break;

            case TargetConfiguration.Development:
                ConfigSuffix = null;
                break;

            case TargetConfiguration.Test:
                ConfigSuffix = "-Test";
                break;

            case TargetConfiguration.Shipping:
                ConfigSuffix = "-Shipping";
                break;
            }

            string Name = "Mono";

            switch (targetType)
            {
            case TargetType.Editor:
                Name = Name + "Editor";
                break;

            case TargetType.Client:
                Name = Name + "Client";
                break;

            case TargetType.Server:
                Name = Name + "Server";
                break;

            case TargetType.Program:
                throw new ArgumentException(nameof(targetType));
            }

            var dir = Path.Combine("Binaries", targetPlatform.ToString(), Name + ConfigSuffix);

            return(rootDirectory == null ? dir : Path.Combine(rootDirectory, dir));
        }
Exemplo n.º 9
0
 public static UpdateInformation?GetUpdateInformation(TargetPlatform targetPlatform)
 {
     try
     {
         var webRequest  = WebRequest.CreateHttp("https://raw.githubusercontent.com/daramkun/UpdateBank/master/DaramRenamer.ini");
         var webResponse = webRequest.GetResponse();
         using var stream = webResponse.GetResponseStream();
         return(BlockarObject.DeserializeFromIni(stream, targetPlatform.ToString()).ToObject <UpdateInformation>());
     }
     catch
     {
         return(null);
     }
 }
Exemplo n.º 10
0
        /// <summary>
        /// If format is TextureProcessorOutputFormat.Compressed, the appropriate compressed texture format for the target
        /// platform is returned. Otherwise the format is returned unchanged.
        /// </summary>
        /// <param name="format">The supplied texture format.</param>
        /// <param name="platform">The target platform.</param>
        /// <returns>The texture format.</returns>
        public static TextureProcessorOutputFormat GetTextureFormatForPlatform(TextureProcessorOutputFormat format, TargetPlatform platform)
        {
            // Select the default texture compression format for the target platform
            if (format == TextureProcessorOutputFormat.Compressed)
            {
                switch (platform)
                {
                case TargetPlatform.iOS:
                    format = TextureProcessorOutputFormat.PvrCompressed;
                    break;

                case TargetPlatform.Android:
                    format = TextureProcessorOutputFormat.Etc1Compressed;
                    break;

                default:
                    format = TextureProcessorOutputFormat.DxtCompressed;
                    break;
                }
            }

            if (IsCompressedTextureFormat(format))
            {
                // Make sure the target platform supports the selected texture compression format
                switch (platform)
                {
                case TargetPlatform.iOS:
                    if (format != TextureProcessorOutputFormat.PvrCompressed)
                    {
                        throw new PlatformNotSupportedException("iOS platform only supports PVR texture compression");
                    }
                    break;

                case TargetPlatform.Windows:
                case TargetPlatform.WindowsPhone8:
                case TargetPlatform.WindowsStoreApp:
                case TargetPlatform.DesktopGL:
                case TargetPlatform.MacOSX:
                case TargetPlatform.NativeClient:
                    if (format != TextureProcessorOutputFormat.DxtCompressed)
                    {
                        throw new PlatformNotSupportedException(platform.ToString() + " platform only supports DXT texture compression");
                    }
                    break;
                }
            }

            return(format);
        }
Exemplo n.º 11
0
        public static async Task <UpdateInformation?> GetUpdateInformationAsync(TargetPlatform targetPlatform)
        {
            try
            {
                await using var stream = await SharedHttpClient.GetStreamAsync(
                                "https://raw.githubusercontent.com/daramkun/UpdateBank/master/DaramRenamer.ini");

                return(BlockarObject.DeserializeFromIni(stream, targetPlatform.ToString())
                       .ToObject <UpdateInformation>());
            }
            catch
            {
                return(null);
            }
        }
Exemplo n.º 12
0
        public ProcessArgumentBuilder GetProcessArguments(ICakeContext context)
        {
            var builder = new ProcessArgumentBuilder();

            builder.Append("-batchmode");
            builder.Append("-quit");

            builder.Append(TargetPlatform.ToString());
            builder.AppendQuoted(Target.MakeAbsolute(context.Environment).FullPath);

            builder.Append("-projectPath");
            builder.AppendQuoted(Project.MakeAbsolute(context.Environment).FullPath);

            return(builder);
        }
Exemplo n.º 13
0
        private string GetTargetPlatform()
        {
            if (TargetPlatform == null)
            {
                return(null);
            }

            if (Equals(TargetPlatform, MSBuildTargetPlatform.MSIL))
            {
                return(TargetPath == null || TargetPath.EndsWithOrdinalIgnoreCase(".sln")
                    ? "Any CPU".DoubleQuote()
                    : "AnyCPU");
            }

            return(TargetPlatform.ToString());
        }
    static void CallBuildWindow()
    {
        window              = EditorWindow.GetWindow <AssetsBundleTool>();
        window.maxSize      = new Vector2(805f, 1000f);
        window.minSize      = new Vector2(805f, 500f);
        window.titleContent = new GUIContent("资源打包工具");

        window.autoRepaintOnSceneChange = true;
        m_TargetPlatform = TargetPlatform.StandaloneWindow;

        if (string.IsNullOrEmpty(m_RootDirectory))
        {
            m_RootDirectory = Application.persistentDataPath + "/AssetBundle/" + m_TargetPlatform.ToString();//强制资源的输出路径
        }
        //m_RootUnforce = Application.dataPath + "/../../AssetBundle/unforce/" +m_TargetPlatform.ToString();//非强制资源的输出路径

        //XMLName = "UnforceStandaloneWindowXML.xml";
        GetSVNResversion();
    }
Exemplo n.º 15
0
        private string GetProfileForPlatform(TargetPlatform platform)
        {
            switch (platform)
            {
            case TargetPlatform.Windows:
            case TargetPlatform.WindowsPhone8:
            case TargetPlatform.WindowsStoreApp:
                return("DirectX_11");

            case TargetPlatform.iOS:
            case TargetPlatform.Android:
            case TargetPlatform.DesktopGL:
            case TargetPlatform.MacOSX:
            case TargetPlatform.RaspberryPi:
            case TargetPlatform.Web:
                return("OpenGL");
            }

            return(platform.ToString());
        }
Exemplo n.º 16
0
 public ContentBuilder(string contentProjectFile, GraphicsProfile graphicsProfile = GraphicsProfile.HiDef, TargetPlatform targetPlatform = TargetPlatform.Windows, bool compressContent = true, LoggerVerbosity loggerVerbosity = LoggerVerbosity.Normal, bool rebuildContent = false)
 {
     FileInfo fileInfo = new FileInfo(contentProjectFile);
     _contentProjectFile = Path.GetFullPath(fileInfo.FullName);
     if (fileInfo.Extension != ".contentproj")
         throw new NotSupportedException(string.Format("The file '{0}' is not a XNA content project.", _contentProjectFile));
     if (!fileInfo.Exists)
         throw new FileNotFoundException(String.Format("The file '{0}' does not exist.", _contentProjectFile, _contentProjectFile));
     GraphicsProfile = graphicsProfile;
     TargetPlatform = targetPlatform;
     CompressContent = compressContent;
     LoggerVerbosity = loggerVerbosity;
     RebuildContent = rebuildContent;
     if (!_globalProperties.ContainsKey("XnaProfile"))
         _globalProperties.Add("XnaProfile", GraphicsProfile.ToString());
     if (!_globalProperties.ContainsKey("XNAContentPipelineTargetPlatform"))
         _globalProperties.Add("XNAContentPipelineTargetPlatform", TargetPlatform.ToString());
     if (!_globalProperties.ContainsKey("XnaCompressContent"))
         _globalProperties.Add("XnaCompressContent", CompressContent.ToString());
     if (!_globalProperties.ContainsKey("OutputhPath"))
         _globalProperties.Add("OutputPath", OutputPath);
     if (!_globalProperties.ContainsKey("ContentRootDirectory"))
         _globalProperties.Add("ContentRootDirectory", ContentRootDirectory);
 }
Exemplo n.º 17
0
 /// <summary>
 /// Gets the dependency packages binaries folder.
 /// </summary>
 /// <param name="options">The options.</param>
 /// <param name="platform">The target platform.</param>
 /// <returns>The absolute path to the deps folder for the given platform and architecture configuration.</returns>
 public static string GetBinariesFolder(BuildOptions options, TargetPlatform platform)
 {
     return(Path.Combine(options.PlatformsFolder, platform.ToString(), "Binaries"));
 }
Exemplo n.º 18
0
 /// <summary>
 /// Gets the dependency third-party packages binaries folder.
 /// </summary>
 /// <param name="options">The options.</param>
 /// <param name="platform">The target platform.</param>
 /// <param name="architecture">The target architecture.</param>
 /// <returns>The absolute path to the deps folder for the given platform and architecture configuration.</returns>
 public static string GetThirdPartyFolder(BuildOptions options, TargetPlatform platform, TargetArchitecture architecture)
 {
     return(Path.Combine(options.PlatformsFolder, platform.ToString(), "Binaries", "ThirdParty", architecture.ToString()));
 }
    /// <summary>
    /// 差异化打包
    /// </summary>
    static void BuildAll()
    {
        //如果不满足打包条件
        if (!BuildCondition())
        {
            return;
        }

        ClearAll();

        //不存在路径则创建
        if (!Directory.Exists(m_RootDirectory))
        {
            Directory.CreateDirectory(m_RootDirectory);
        }

        var stopwatch = new System.Diagnostics.Stopwatch();

        stopwatch.Start(); // 开始监视代码运行时间

        //这个是当前需要被打包的资源
        SetAllBuilds();

        stopwatch.Stop();                                     // 停止监视
        TimeSpan timespan = stopwatch.Elapsed;                // 获取当前实例测量得出的总时间
        string   seconds  = timespan.TotalSeconds.ToString(); // 总秒数

        Debug.Log("===============SetAllBuilds Cost Seconds  =>" + seconds + "======================");

        stopwatch = new System.Diagnostics.Stopwatch();
        stopwatch.Start(); // 开始监视代码运行时间

        //生成资源依赖
        MakeIAssetBundleManifest();

        stopwatch.Stop();                            // 停止监视
        timespan = stopwatch.Elapsed;                // 获取当前实例测量得出的总时间
        seconds  = timespan.TotalSeconds.ToString(); // 总秒数
        Debug.Log("===============MakeIAssetBundleManifest Cost Seconds  =>" + seconds + "======================");

        stopwatch = new System.Diagnostics.Stopwatch();
        stopwatch.Start(); // 开始监视代码运行时间

        //生成资源缓存
        MakeCacheData();

        stopwatch.Stop();                            // 停止监视
        timespan = stopwatch.Elapsed;                // 获取当前实例测量得出的总时间
        seconds  = timespan.TotalSeconds.ToString(); // 总秒数
        Debug.Log("===============MakeCacheData Cost Seconds  =>" + seconds + "======================");

        stopwatch = new System.Diagnostics.Stopwatch();
        stopwatch.Start(); // 开始监视代码运行时间
        Debug.Log(" 开始打包所有资源 Count => " + mBuildsList.Count + " Platform" + m_TargetPlatform.ToString());
        mAssetBundleManifest = BuildPipeline.BuildAssetBundles(m_RootDirectory, mBuildsList.ToArray(), BuildAssetBundleOptions.ChunkBasedCompression | BuildAssetBundleOptions.ForceRebuildAssetBundle, (BuildTarget)((int)m_TargetPlatform));
        stopwatch.Stop();                            // 停止监视
        timespan = stopwatch.Elapsed;                // 获取当前实例测量得出的总时间
        seconds  = timespan.TotalSeconds.ToString(); // 总秒数
        Debug.Log("===============BuildAssetBundles Cost Seconds  =>" + seconds + "======================");

        if (mAssetBundleManifest != null)
        {
            string[] arr = mAssetBundleManifest.GetAllAssetBundles();
            Debug.Log(" 打包完成!!完成数量 Count => " + arr.Length);

            //清理打包生产的依赖信息文件
            ClearDpFiles();
            //给打包的AB用MD5重命名
            NameMD5Files();

            mAssetBundleManifest = null;
        }
    }
Exemplo n.º 20
0
 protected override void OnCompileStart(IAssetFsFile assetFile, TargetPlatform targetPlatform)
 {
     Console.WriteLine("Compiling " + assetFile.Name + " for " + targetPlatform.ToString() + "...");
 }
Exemplo n.º 21
0
 public static string GetCheckAppVersionUrl(TargetPlatform platform)
 {
     return(GetBaseApiURL() + "/api/v1/get-app-version?platform=" + platform.ToString());
 }
Exemplo n.º 22
0
 protected override void OnCompileFinish(IAssetFsFile assetFile, IAssetFsFile compiledAssetFile, TargetPlatform targetPlatform)
 {
     Console.WriteLine("Compiled " + assetFile.Name + " for " + targetPlatform.ToString());
 }
Exemplo n.º 23
0
        private HttpStatusCode DeployAppx(string outputAppx, string outputCer, ReadOnlyCollection <FileStreamInfo> dependencies, string dependencyFolder, string identityName)
        {
            OutputMessage(string.Format(CultureInfo.InvariantCulture, Resource.DeploymentWorker_StartDeploy, targetName));

            // Create list of all APPX and CER files for deployment
            var files = new List <FileInfo>()
            {
                new FileInfo(outputAppx),
                new FileInfo(outputCer),
            };

            foreach (var dependency in dependencies)
            {
                files.Add(new FileInfo(dependencyFolder + @"\" + dependency.AppxRelativePath));
            }

            // Call WEBB Rest APIs to deploy
            var packageFullName = string.Format(CultureInfo.InvariantCulture, packageFullNameFormat, identityName, targetType.ToString());

            using (var webbHelper = new WebbHelper())
            {
                OutputMessage(Resource.DeploymentWorker_DeployAppx_starting_to_deploy_certificate_APPX_and_dependencies);
                // Attempt to uninstall existing package if found
                var uninstallTask = webbHelper.UninstallAppAsync(packageFullName, targetName, credentials);
                if (uninstallTask.Result == HttpStatusCode.OK)
                {
                    // result == OK means the package was uninstalled.
                    OutputMessage(string.Format(CultureInfo.InvariantCulture, Resource.DeploymentWorker_PreviousDeployUninstalled, packageFullName));
                }
                else if (uninstallTask.Result == HttpStatusCode.Unauthorized)
                {
                    // result == Unauthorized means the credentials were not accepted.
                    return(uninstallTask.Result);
                }
                else
                {
                    // result != OK could mean that the package wasn't already installed
                    //           or it could mean that there was a problem with the uninstall
                    //           request.
                    OutputMessage(string.Format(CultureInfo.InvariantCulture, Resource.DeploymentWorker_PreviousDeployNotUninstalled, packageFullName));
                }
                // Deploy new APPX, cert, and dependency files
                var deployTask = webbHelper.DeployAppAsync(files, targetName, credentials);
                if (deployTask.Result == HttpStatusCode.Accepted)
                {
                    var result = webbHelper.PollInstallStateAsync(targetName, credentials).Result;
                    OutputMessage(string.Format(CultureInfo.InvariantCulture, Resource.DeploymentWorker_DeployFinished, packageFullName));

                    OutputMessage("\r\n\r\n***");
                    OutputMessage(string.Format(CultureInfo.InvariantCulture, "*** PackageFullName = {0}", packageFullName));
                    OutputMessage("***\r\n\r\n");

                    if (!result)
                    {
                        return(HttpStatusCode.BadRequest);
                    }
                }
                else
                {
                    OutputMessage(string.Format(CultureInfo.InvariantCulture, Resource.DeploymentWorker_DeployFailed, packageFullName));
                }
                return(deployTask.Result);
            }
        }
Exemplo n.º 24
0
        public string GetFileName(TargetPlatform targetPlatform)
        {
            switch (targetPlatform)
            {
            case TargetPlatform.Windows:
                return(WindowsFile);

            case TargetPlatform.Xbox360:
                return(XboxFile);

            //case TargetPlatform.Unknown:
            default:
                throw new InvalidOperationException("Can't convert global settings for " + targetPlatform.ToString());
            }
        }
Exemplo n.º 25
0
 public string GetPlatformSuffix(TargetPlatform platform)
 {
     return("." + platform.ToString());
 }
Exemplo n.º 26
0
 public string GetMainBundlePath(TargetPlatform platform)
 {
     return(Path.ChangeExtension(AssetsDirectory, platform.ToString()));
 }
Exemplo n.º 27
0
        private void ReadSettings()
        {
            XmlDocument doc = new XmlDocument();

            doc.Load(_settingsFile);

            foreach (XmlNode curNode in doc.DocumentElement.ChildNodes)
            {
                XmlElement curElem = curNode as XmlElement;
                if (curElem == null)
                {
                    continue;
                }

                switch (curElem.Name)
                {
                case "scriptInfoDir":
                    SIsFSGameFolder = curElem.InnerText;
                    break;

                case "sourceRaw":
                    SourceRaw = curElem.GetAttribute("path");
                    if (!String.IsNullOrEmpty(SourceRaw))
                    {
                        _sourceRawFoldersSettings = curElem;
                        BuildSourceRawFolders(SourceRaw, _sourceRawFolders, curElem);
                    }
                    break;

                case "sourceFSGame":
                    SourceFSGame = curElem.GetAttribute("path");
                    if (!String.IsNullOrEmpty(SourceFSGame))
                    {
                        _sourceFSGameFoldersSettings = curElem;
                        BuildSourceRawFolders(SourceFSGame, _sourceFSGameFolders, curElem);
                    }
                    break;

                case "outputRaw":
                    _outputRaws.Add(OutputSetting.ParseFromXML(curElem, this));
                    break;

                case "outputFSGame":
                    _outputFSGames.Add(OutputSetting.ParseFromXML(curElem, this));
                    break;

                case "targetPlatform":
                    _targetPlatform = (TargetPlatform)Enum.Parse(typeof(TargetPlatform), curElem.InnerText);
                    break;

                case "targetConfiguration":
                    _targetConfiguration = (TargetConfiguration)Enum.Parse(typeof(TargetConfiguration), curElem.InnerText);
                    break;

                case "isVersionIntFromDate":
                    _isVersionIntFromDate = Boolean.Parse(curElem.InnerText);
                    break;

                case "versionInt":
                    _versionInt = String.IsNullOrEmpty(curElem.InnerText) ? 0 : Int32.Parse(curElem.InnerText);
                    break;

                case "versionStr":
                    _versionStr = curElem.InnerText;
                    break;

                default:
                    throw new XmlException("Unknown settings node '" + curElem.Name + "'");
                }
            }

            _scrManager.Trace.TraceEvent(TraceEventType.Verbose, 0, "Settings");
            _scrManager.Trace.TraceEvent(TraceEventType.Verbose, 0, "=========================");
            _scrManager.Trace.TraceEvent(TraceEventType.Verbose, 0, "WorkingPath: " + WorkingPath);
            _scrManager.Trace.TraceEvent(TraceEventType.Verbose, 0, "SIs' Path: " + SIsPath);
            _scrManager.Trace.TraceEvent(TraceEventType.Verbose, 0, "SIs' FSGame folder: " + SIsFSGameFolder);
            _scrManager.Trace.TraceEvent(TraceEventType.Verbose, 0, "GamePath: " + GamePath);

            _scrManager.Trace.TraceEvent(TraceEventType.Verbose, 0, "SourceFSGame Path: " + SourceFSGame);

            foreach (string curFolder in _sourceFSGameFolders)
            {
                _scrManager.Trace.TraceEvent(TraceEventType.Verbose, 0, "SourceFSGame: " + curFolder);
            }

            _scrManager.Trace.TraceEvent(TraceEventType.Verbose, 0, "SourceRaw Path: " + SourceRaw);

            foreach (string curFolder in _sourceRawFolders)
            {
                _scrManager.Trace.TraceEvent(TraceEventType.Verbose, 0, "SourceRaw: " + curFolder);
            }

            _scrManager.Trace.TraceEvent(TraceEventType.Verbose, 0, "TargetPlatform: " + TargetPlatform.ToString());
            _scrManager.Trace.TraceEvent(TraceEventType.Verbose, 0, "TargetConfiguration: " + TargetConfiguration.ToString());
            _scrManager.Trace.TraceEvent(TraceEventType.Verbose, 0, "IsVersionIntFromDate: " + IsVersionIntFromDate.ToString());
            _scrManager.Trace.TraceEvent(TraceEventType.Verbose, 0, "VersionInt: " + VersionInt.ToString());
            _scrManager.Trace.TraceEvent(TraceEventType.Verbose, 0, "VersionStr: " + VersionStr);

            _scrManager.Trace.TraceEvent(TraceEventType.Verbose, 0, "=========================");

            _scrManager.Trace.Flush();
        }
Exemplo n.º 28
0
 public string GetPlatformSuffix(TargetPlatform?platform = null)
 {
     return("." + (platform?.ToString() ?? ActivePlatform.ToString()));
 }
Exemplo n.º 29
0
        /// <summary>
        /// If format is TextureProcessorOutputFormat.Compressed, the appropriate compressed texture format for the target
        /// platform is returned. Otherwise the format is returned unchanged.
        /// </summary>
        /// <param name="format">The supplied texture format.</param>
        /// <param name="platform">The target platform.</param>
        /// <returns>The texture format.</returns>
        public static TextureProcessorOutputFormat GetTextureFormatForPlatform(TextureProcessorOutputFormat format, TargetPlatform platform)
        {
            // Select the default texture compression format for the target platform
            if (format == TextureProcessorOutputFormat.Compressed)
            {
                switch (platform)
                {
                    case TargetPlatform.iOS:
                        format = TextureProcessorOutputFormat.PvrCompressed;
                        break;

                    case TargetPlatform.Android:
                        format = TextureProcessorOutputFormat.Etc1Compressed;
                        break;

                    default:
                        format = TextureProcessorOutputFormat.DxtCompressed;
                        break;
                }
            }

            if (IsCompressedTextureFormat(format))
            {
                // Make sure the target platform supports the selected texture compression format
                switch (platform)
                {
                    case TargetPlatform.iOS:
                        if (format != TextureProcessorOutputFormat.PvrCompressed)
                            throw new PlatformNotSupportedException("iOS platform only supports PVR texture compression");
                        break;

                    case TargetPlatform.Windows:
                    case TargetPlatform.WindowsPhone8:
                    case TargetPlatform.WindowsStoreApp:
                    case TargetPlatform.DesktopGL:
                    case TargetPlatform.MacOSX:
                    case TargetPlatform.NativeClient:
                        if (format != TextureProcessorOutputFormat.DxtCompressed)
                            throw new PlatformNotSupportedException(platform.ToString() + " platform only supports DXT texture compression");
                        break;
                }
            }

            return format;
        }
Exemplo n.º 30
0
 public static String Name(this TargetPlatform type)
 {
     return(((DescriptionAttribute)type.GetType().GetField(type.ToString())
             .GetCustomAttributes(typeof(DesignerAttribute), false)[0]).Description);
 }
Exemplo n.º 31
0
        internal static IEnumerable<ProvisioningTemplateInformation> SearchTemplates(string searchKey, TargetPlatform targetPlatforms, TargetScope targetScopes)
        {
            var targetPlatformsString = targetPlatforms.ToString();
            var targetScopesString = targetScopes.ToString();
            searchKey = searchKey != null ? System.Web.HttpUtility.UrlEncode(searchKey) : "";
            var jsonSearchResult =
                HttpHelper.MakeGetRequestForString(
                    $"{BaseTemplateGalleryUrl}/api/SearchTemplates?searchText={searchKey}&Platform={System.Web.HttpUtility.UrlEncode(targetPlatformsString)}&Scope={System.Web.HttpUtility.UrlEncode(targetScopesString)}");

            if (!string.IsNullOrEmpty(jsonSearchResult))
            {
                // Convert from JSON to a typed array
                var searchResultItems =
                    JsonConvert.DeserializeObject<PnPTemplatesGalleryResultItem[]>(jsonSearchResult);

                var result = (from r in searchResultItems
                              select new ProvisioningTemplateInformation
                              {
                                  Id = r.Id,
                                  DisplayName = r.Title,
                                  Description = r.Abstract,
                                  TemplateFileUri = r.TemplatePnPUrl,
                                  TemplateImageUrl = r.ImageUrl,
                                  Scope = r.Scopes,
                                  Platforms = r.Platforms,
                              }).ToArray();
                return result;
            }
            return null;
        }
Exemplo n.º 32
0
            public static void Package(TargetPlatform platform)
            {
                var platformsRoot = Path.Combine(Globals.EngineRoot, "Source", "Platforms");

                Log.Info(string.Empty);
                Log.Info($"Deploy {platform} platform files");
                Log.Info(string.Empty);

                string platformName = platform.ToString();
                string src          = Path.Combine(platformsRoot, platformName);
                string dst          = Path.Combine(Deployer.PackageOutputPath, platformName);

                Utilities.DirectoryDelete(dst);

                // Deploy files
                {
                    DeployFolder(platformsRoot, Deployer.PackageOutputPath, platformName);

                    // For Linux don't deploy engine libs used by C++ scripting linking (engine source required)
                    if (platform == TargetPlatform.Linux)
                    {
                        File.Delete(Path.Combine(dst, "Binaries", "Game", "x64", "Debug", "FlaxGame.a"));
                        File.Delete(Path.Combine(dst, "Binaries", "Game", "x64", "Development", "FlaxGame.a"));
                        File.Delete(Path.Combine(dst, "Binaries", "Game", "x64", "Release", "FlaxGame.a"));
                    }

                    // Sign binaries
                    if (platform == TargetPlatform.Windows && !string.IsNullOrEmpty(Configuration.DeployCert))
                    {
                        var binaries = Path.Combine(dst, "Binaries", "Game", "x64", "Debug");
                        CodeSign(Path.Combine(binaries, "FlaxGame.exe"));
                        CodeSign(Path.Combine(binaries, "FlaxEngine.CSharp.dll"));

                        binaries = Path.Combine(dst, "Binaries", "Game", "x64", "Development");
                        CodeSign(Path.Combine(binaries, "FlaxGame.exe"));
                        CodeSign(Path.Combine(binaries, "FlaxEngine.CSharp.dll"));

                        binaries = Path.Combine(dst, "Binaries", "Game", "x64", "Release");
                        CodeSign(Path.Combine(binaries, "FlaxGame.exe"));
                        CodeSign(Path.Combine(binaries, "FlaxEngine.CSharp.dll"));
                    }

                    // Don't distribute engine deps
                    Utilities.DirectoryDelete(Path.Combine(dst, "Binaries", "ThirdParty"));

                    var filesToRemove = new List <string>();
                    filesToRemove.AddRange(Directory.GetFiles(dst, ".gitignore", SearchOption.AllDirectories));
                    filesToRemove.AddRange(Directory.GetFiles(dst, "*.pdb", SearchOption.AllDirectories));
                    filesToRemove.AddRange(Directory.GetFiles(dst, "*.ilk", SearchOption.AllDirectories));
                    filesToRemove.AddRange(Directory.GetFiles(dst, "*.exp", SearchOption.AllDirectories));
                    filesToRemove.ForEach(File.Delete);
                }

                // Compress
                {
                    Log.Info("Compressing platform files...");

                    var packageZipPath = Path.Combine(Deployer.PackageOutputPath, platformName + ".zip");
                    Utilities.FileDelete(packageZipPath);
#if true
                    using (var zip = new Ionic.Zip.ZipFile())
                    {
                        zip.AddDirectory(dst);

                        zip.CompressionLevel         = Ionic.Zlib.CompressionLevel.BestCompression;
                        zip.ParallelDeflateThreshold = -1;
                        zip.Comment = string.Format("Flax Engine {0}.{1}.{2}\nPlatform: {4}\nDate: {3}", Deployer.VersionMajor, Deployer.VersionMinor, Deployer.VersionBuild, System.DateTime.UtcNow, platformName);

                        zip.Save(packageZipPath);
                    }
#else
                    System.IO.Compression.ZipFile.CreateFromDirectory(dst, packageZipPath);
#endif

                    Log.Info(string.Format("Compressed {0} package size: {1}", platformName, Utilities.GetFileSize(packageZipPath)));
                }

                // Remove files (only zip package is used)
                Utilities.DirectoryDelete(dst);

                Log.Info(string.Empty);
            }
Exemplo n.º 33
0
        public string GetFileName(TargetPlatform targetPlatform)
        {
            switch (targetPlatform)
            {
            case TargetPlatform.Windows:
                return(m_windowsFileName);

            case TargetPlatform.Xbox360:
                return(m_xboxFileName);

            //case TargetPlatform.Unknown:
            default:
                throw new InvalidOperationException("Can't convert soundbank '" + m_name + "' for " + targetPlatform.ToString());
            }
        }