예제 #1
0
        /// <summary>
        ///		Exporta los archivos
        /// </summary>
        internal void Export(DeploymentModel deployment)
        {
            using (BlockLogModel block = Manager.Logger.Default.CreateBlock(LogModel.LogType.Info, $"Start deployment '{deployment.Name}'"))
            {
                (NormalizedDictionary <object> constants, string error) = GetParameters(deployment.JsonParameters);

                if (!string.IsNullOrWhiteSpace(error))
                {
                    block.Error(error);
                }
                else
                {
                    ExporterOptions options = new ExporterOptions(deployment.SourcePath, deployment.TargetPath);

                    // Asigna las propiedades
                    options.WriteComments    = deployment.WriteComments;
                    options.LowcaseFileNames = deployment.LowcaseFileNames;
                    options.ReplaceArguments = deployment.ReplaceArguments;
                    // Añade los parámetros
                    foreach ((string key, object value) in constants.Enumerate())
                    {
                        options.AddParameter(key, value);
                    }
                    // Exporta los archivos
                    new DatabrickExporter(Manager.Logger, options).Export();
                }
            }
        }
예제 #2
0
        /// <summary>
        ///		Asigna el resto de parámetros
        /// </summary>
        private static void AssignParameters(ExporterOptions options, string[] args)
        {
            for (int index = 0; index < args.Length; index++)
            {
                string name = GetParameterName(args[index]);

                if (!string.IsNullOrWhiteSpace(name) &&
                    !name.Equals(SourceParameter, StringComparison.CurrentCultureIgnoreCase) &&
                    !name.Equals(TargetParameter, StringComparison.CurrentCultureIgnoreCase) &&
                    index < args.Length - 1)
                {
                    options.AddParameter(name, args[index + 1]);
                }
            }
        }