예제 #1
0
파일: App.cs 프로젝트: petkahl/aimtool
        /// <summary>
        /// Sets the options.
        /// </summary>
        /// <param name="options">The command line options.</param>
        private void SetOptions(IAppOptionsService options)
        {
            // Set working path (and reset current directory to working path)
            options.Options.WorkingPath  = new DirectoryInfo(BuildWorkingPath(options.Options.WorkingPath.FullName));
            Environment.CurrentDirectory = options.Options.WorkingPath.FullName;

            _logger.LogDebug(TraceMessages.SetWorkingPath, options.Options.WorkingPath);

            // Set state path
            if (options.Options.StatePath == null)
            {
                options.Options.StatePath = new DirectoryInfo(Path.Join(options.Options.WorkingPath.FullName, "state")).FullName;
            }
            else
            {
                options.Options.StatePath = new DirectoryInfo(BuildWorkingPath(options.Options.StatePath)).FullName;
            }

            _logger.LogDebug(TraceMessages.SetStatePath, options.Options.StatePath);

            if (options.Verb == CommandVerb.Assess)
            {
                // Set output model path if specified
                if (options.Options.OutputModel != null)
                {
                    options.Options.OutputModel = new FileInfo(Path.Combine(options.Options.WorkingPath.FullName, options.Options.OutputModel)).FullName;

                    _logger.LogDebug(TraceMessages.SetOutputModelPath, options.Options.OutputModel);
                }
            }

            if (options.Verb == CommandVerb.Migrate || options.Verb == CommandVerb.Convert)
            {
                // Set the conversion path
                if (options.Options.ConversionPath == null)
                {
                    options.Options.ConversionPath = new DirectoryInfo(Path.Join(options.Options.WorkingPath.FullName, "conversion")).FullName;
                }
                else
                {
                    options.Options.ConversionPath = new DirectoryInfo(BuildWorkingPath(options.Options.ConversionPath)).FullName;
                }

                _logger.LogDebug(TraceMessages.SetConversionPath, options.Options.ConversionPath);
            }

            // Generate unique ID to be used for Azure deployments
            if (string.IsNullOrWhiteSpace(options.Options.UniqueDeploymentId))
            {
                options.Options.UniqueDeploymentId = _generator.Generate(truncate: AppOptionsService.UniqueDeploymentIdLengthLimit);
            }
        }
예제 #2
0
 public void Generate() => Generator.Generate();
 private string GetTraceId(ICarrier carrier)
 {
     return(carrier.HasValue ? carrier.TraceId : _uniqueIdGenerator.Generate());
 }