Beispiel #1
0
		/// <summary>
		/// Performs initial cleanup of target rules folder
		/// </summary>
		public static void CleanupFolders()
		{
			CommandUtils.LogVerbose("Cleaning up project rules folder");
			var RulesFolder = GetRulesAssemblyFolder();
			if (CommandUtils.DirectoryExists(RulesFolder))
			{
				CommandUtils.DeleteDirectoryContents(RulesFolder);
			}
		}
 /// <summary>
 /// Checks whether a path exists
 /// </summary>
 /// <param name="Scalar">The path to check for</param>
 /// <returns>True if the path exists, false otherwise.</returns>
 static bool Exists(string Scalar)
 {
     try
     {
         string FullPath = Path.Combine(CommandUtils.RootDirectory.FullName, Scalar);
         return(CommandUtils.FileExists(FullPath) || CommandUtils.DirectoryExists(FullPath));
     }
     catch
     {
         return(false);
     }
 }
        /// <summary>
        /// Loads all precompiled assemblies (DLLs that end with *Scripts.dll).
        /// </summary>
        /// <param name="OutScriptAssemblies">List to store all loaded assemblies.</param>
        private static void LoadPreCompiledScriptAssemblies(List <Assembly> OutScriptAssemblies)
        {
            CommandUtils.LogVerbose("Loading precompiled script DLLs");

            bool DefaultScriptsDLLFound = false;
            var  ScriptsLocation        = GetScriptAssemblyFolder();

            if (CommandUtils.DirectoryExists(ScriptsLocation))
            {
                var ScriptDLLFiles = Directory.GetFiles(ScriptsLocation, "*.Automation.dll", SearchOption.AllDirectories);

                CommandUtils.LogVerbose("Found {0} script DLL(s).", ScriptDLLFiles.Length);
                foreach (var ScriptsDLLFilename in ScriptDLLFiles)
                {
                    if (!HostPlatform.Current.IsScriptModuleSupported(CommandUtils.GetFilenameWithoutAnyExtensions(ScriptsDLLFilename)))
                    {
                        CommandUtils.LogVerbose("Script module {0} filtered by the Host Platform and will not be loaded.", ScriptsDLLFilename);
                        continue;
                    }
                    // Load the assembly into our app domain
                    CommandUtils.LogVerbose("Loading script DLL: {0}", ScriptsDLLFilename);
                    try
                    {
                        var Dll = AppDomain.CurrentDomain.Load(AssemblyName.GetAssemblyName(ScriptsDLLFilename));
                        OutScriptAssemblies.Add(Dll);
                        // Check if this is the default scripts DLL.
                        if (!DefaultScriptsDLLFound && String.Compare(Path.GetFileName(ScriptsDLLFilename), DefaultScriptsDLLName, true) == 0)
                        {
                            DefaultScriptsDLLFound = true;
                        }
                    }
                    catch (Exception Ex)
                    {
                        throw new AutomationException("Failed to load script DLL: {0}: {1}", ScriptsDLLFilename, Ex.Message);
                    }
                }
            }
            else
            {
                CommandUtils.LogError("Scripts folder {0} does not exist!", ScriptsLocation);
            }

            // The default scripts DLL is required!
            if (!DefaultScriptsDLLFound)
            {
                throw new AutomationException("{0} was not found or could not be loaded, can't run scripts.", DefaultScriptsDLLName);
            }
        }
Beispiel #4
0
        private static void UnpakBuild(string SourceDirectory, List <string> PakFiles, string TargetDirectory, string CryptoFilename, string AdditionalArgs)
        {
            if (!CommandUtils.DirectoryExists(SourceDirectory))
            {
                CommandUtils.LogError("Pak file directory {0} doesn't exist.", SourceDirectory);
                return;
            }

            string UnrealPakExe = CommandUtils.CombinePaths(CommandUtils.CmdEnv.LocalRoot, "Engine/Binaries/Win64/UnrealPak.exe");

            CommandUtils.CreateDirectory(TargetDirectory);

            Parallel.ForEach(PakFiles, pakFile =>
            {
                string PathFileFullPath     = CommandUtils.CombinePaths(SourceDirectory, pakFile);
                string UnrealPakCommandLine = string.Format("{0} -Extract {1} -ExtractToMountPoint -cryptokeys=\"{2}\" {3}",
                                                            PathFileFullPath, TargetDirectory, CryptoFilename, AdditionalArgs);
                CommandUtils.RunAndLog(CommandUtils.CmdEnv, UnrealPakExe, UnrealPakCommandLine, Options: CommandUtils.ERunOptions.Default | CommandUtils.ERunOptions.UTF8Output | CommandUtils.ERunOptions.SpewIsVerbose);
                //CommandUtils.Log(UnrealPakCommandLine);
            });
        }