Exemplo n.º 1
0
        public int Run(string projectDir, string targetDir, string settingFile = "CopySettings.json")
        {
            try
            {
                var trimedProjectDir = TrimInput(projectDir);
                var trimedTargetdir  = TrimInput(targetDir);

                var copyer      = new Copyer(trimedProjectDir);
                var settings    = copyer.GetSettings(settingFile);
                var excludes    = copyer.GetExcludes(settings.Excludes !, settings.ExcludeFolders !);
                var destination = Path.Combine(trimedProjectDir, settings.Destination !);

                copyer.CopyDlls(trimedTargetdir, destination, settings.Pattern, excludes);
                return(0);
            }
            catch (Exception ex)
            {
                logger.LogError($"Failed run Copy DLLs. {ex.Message} ({ex.GetType().FullName})");
                logger.LogCritical($"{ex.StackTrace}"); // output detail every time.
                logger.LogInformationIfNotDebug("NOTE: Set Environment variable COPYDLLS_LOGLEVEL=Debug or Trace to see more detail logs.");
                return(1);
            }
        }
Exemplo n.º 2
0
        public int Validate(string projectDir = ".", string settingFile = "CopySettings.json")
        {
            try
            {
                var trimedProjectDir = TrimInput(projectDir);
                var copyer           = new Copyer(trimedProjectDir);
                var settings         = copyer.GetSettings(settingFile);
                if (settings == null)
                {
                    throw new NullReferenceException("Tried load setting, but was null.");
                }

                logger.LogInformation($"Successfully load settings.");
                logger.LogInformation(settings.ToString());
                return(0);
            }
            catch (Exception ex)
            {
                logger.LogError($"Failed load settings. {ex.Message} ({ex.GetType().FullName})");
                logger.LogDebug($"{ex.StackTrace}");
                logger.LogInformationIfNotDebug("NOTE: Set Environment variable COPYDLLS_LOGLEVEL=Debug or Trace to see more detail logs.");
                return(1);
            }
        }