public static void UpdateScripts(string responseFile, string sourceExtension, string pathMappingsFilePath)
        {
            if (!APIUpdaterManager.WaitForVCSServerConnection(true))
            {
                return;
            }

            var tempOutputPath = "Library/Temp/ScriptUpdater/" + new System.Random().Next() + "/";

            try
            {
                RunUpdatingProgram(
                    "ScriptUpdater.exe",
                    sourceExtension
                    + " "
                    + CommandLineFormatter.PrepareFileName(MonoInstallationFinder.GetFrameWorksFolder())
                    + " "
                    + tempOutputPath
                    + " "
                    + APIUpdaterManager.ConfigurationSourcesFilter
                    + " "
                    + pathMappingsFilePath
                    + " "
                    + responseFile,
                    tempOutputPath);
            }
            catch (Exception ex) when(!(ex is StackOverflowException) && !(ex is ExecutionEngineException))
            {
                Debug.LogError("[API Updater] ScriptUpdater threw an exception. Check the following message in the log.");
                Debug.LogException(ex);

                APIUpdaterManager.ReportExpectedUpdateFailure();
            }
        }
        public static void UpdateScripts(string responseFile, string sourceExtension, string[] sourceFiles)
        {
            if (!APIUpdaterManager.WaitForVCSServerConnection(true))
            {
                return;
            }

            var pathMappingsFilePath = Path.GetTempFileName();

            var filePathMappings = new List <string>(sourceFiles.Length);

            foreach (var source in sourceFiles)
            {
                var f = CommandLineFormatter.PrepareFileName(source);
                f = Paths.UnifyDirectorySeparator(f);

                if (f != source)
                {
                    filePathMappings.Add(f + " => " + source);
                }
            }

            File.WriteAllLines(pathMappingsFilePath, filePathMappings.ToArray());

            var tempOutputPath = "Library/Temp/ScriptUpdater/" + new System.Random().Next() + "/";

            try
            {
                RunUpdatingProgram(
                    "ScriptUpdater.exe",
                    sourceExtension
                    + " "
                    + CommandLineFormatter.PrepareFileName(MonoInstallationFinder.GetFrameWorksFolder())
                    + " "
                    + tempOutputPath
                    + " \"" // Quote the filer (regex) to avoid issues when passing through command line arg.
                    + APIUpdaterManager.ConfigurationSourcesFilter
                    + "\" "
                    + pathMappingsFilePath
                    + " "
                    + responseFile,
                    tempOutputPath);
            }
#pragma warning disable CS0618 // Type or member is obsolete
            catch (Exception ex) when(!(ex is StackOverflowException) && !(ex is ExecutionEngineException))
#pragma warning restore CS0618 // Type or member is obsolete
            {
                Debug.LogError("[API Updater] ScriptUpdater threw an exception. Check the following message in the log.");
                Debug.LogException(ex);

                APIUpdaterManager.ReportExpectedUpdateFailure();
            }
        }
 public static string ArgumentsForScriptUpdater(string sourceExtension, string tempOutputPath, string pathMappingsFilePath, string responseFile)
 {
     return(sourceExtension
            + " "
            + CommandLineFormatter.PrepareFileName(MonoInstallationFinder.GetFrameWorksFolder())
            + " "
            + CommandLineFormatter.PrepareFileName(tempOutputPath)
            + " \"" + APIUpdaterManager.ConfigurationSourcesFilter + "\" " // Quote the filter (regex) to avoid issues when passing through command line arg.)
            + CommandLineFormatter.PrepareFileName(pathMappingsFilePath)
            + " "
            + responseFile); // Response file is always relative and without spaces, no need to quote.
 }
        public static void UpdateScripts(string responseFile, string sourceExtension, string[] sourceFiles)
        {
            bool anyFileInAssetsFolder = false;
            var  pathMappingsFilePath  = Path.GetTempFileName();
            var  filePathMappings      = new List <string>(sourceFiles.Length);

            foreach (var source in sourceFiles)
            {
                anyFileInAssetsFolder |= (source.IndexOf("Assets/", StringComparison.OrdinalIgnoreCase) != -1);

                var f = CommandLineFormatter.PrepareFileName(source);
                if (f != source) // assume path represents a virtual path and needs to be mapped.
                {
                    f = Paths.UnifyDirectorySeparator(f);
                    filePathMappings.Add(f + " => " + source);
                }
            }

            // Only try to connect to VCS if there are files under VCS that need to be updated
            if (anyFileInAssetsFolder && !APIUpdaterManager.WaitForVCSServerConnection(true))
            {
                return;
            }

            File.WriteAllLines(pathMappingsFilePath, filePathMappings.ToArray());

            var tempOutputPath = "Library/Temp/ScriptUpdater/" + new System.Random().Next() + "/";

            try
            {
                var arguments = ArgumentsForScriptUpdater(
                    sourceExtension,
                    tempOutputPath,
                    pathMappingsFilePath,
                    responseFile);

                RunUpdatingProgram("ScriptUpdater.exe", arguments, tempOutputPath, anyFileInAssetsFolder);
            }
#pragma warning disable CS0618 // Type or member is obsolete
            catch (Exception ex) when(!(ex is StackOverflowException) && !(ex is ExecutionEngineException))
#pragma warning restore CS0618 // Type or member is obsolete
            {
                Debug.LogError("[API Updater] ScriptUpdater threw an exception. Check the following message in the log.");
                Debug.LogException(ex);

                APIUpdaterManager.ReportExpectedUpdateFailure();
            }
        }
 public static void UpdateScripts(string responseFile, string sourceExtension)
 {
     if (ScriptUpdatingManager.WaitForVCSServerConnection(true))
     {
         string text = (!Provider.enabled) ? "." : "Temp/ScriptUpdater/";
         APIUpdaterHelper.RunUpdatingProgram("ScriptUpdater.exe", string.Concat(new string[]
         {
             sourceExtension,
             " ",
             CommandLineFormatter.PrepareFileName(MonoInstallationFinder.GetFrameWorksFolder()),
             " ",
             text,
             " ",
             responseFile
         }));
     }
 }
        public static void UpdateScripts(string responseFile, string sourceExtension)
        {
            if (!ScriptUpdatingManager.WaitForVCSServerConnection(true))
            {
                return;
            }

            var outputPath = Provider.enabled ? tempOutputPath : ".";

            RunUpdatingProgram(
                "ScriptUpdater.exe",
                sourceExtension
                + " "
                + CommandLineFormatter.PrepareFileName(MonoInstallationFinder.GetFrameWorksFolder())
                + " "
                + outputPath
                + " "
                + responseFile);
        }
 protected static string PrepareFileName(string fileName)
 {
     return(CommandLineFormatter.PrepareFileName(fileName));
 }
 protected static string PrepareFileName(string fileName) =>
 CommandLineFormatter.PrepareFileName(fileName);
Example #9
0
        public static void UpdateScripts(string responseFile, string sourceExtension)
        {
            if (!ScriptUpdatingManager.WaitForVCSServerConnection(true))
            {
                return;
            }
            string str = !Provider.enabled ? "." : "Temp/ScriptUpdater/";

            APIUpdaterHelper.RunUpdatingProgram("ScriptUpdater.exe", sourceExtension + " " + CommandLineFormatter.PrepareFileName(MonoInstallationFinder.GetFrameWorksFolder()) + " " + str + " " + responseFile);
        }