Ejemplo n.º 1
0
        public CopyFromFilesComponent(BuildAssembler assembler, XPathNavigator configuration) : base(assembler, configuration)
        {
            XPathNodeIterator copy_nodes = configuration.Select("copy");

            foreach (XPathNavigator copy_node in copy_nodes)
            {
                string root_value = copy_node.GetAttribute("base", String.Empty);
                if (String.IsNullOrEmpty(root_value))
                {
                    root_value = Environment.CurrentDirectory;
                }
                root_value = Environment.ExpandEnvironmentVariables(root_value);
                if (!Directory.Exists(root_value))
                {
                    WriteMessage(MessageLevel.Error, String.Format("The base directory '{0}' does not exist.", root_value));
                }

                string file_value = copy_node.GetAttribute("file", String.Empty);
                if (String.IsNullOrEmpty(file_value))
                {
                    WriteMessage(MessageLevel.Error, "Each copy element must have a file attribute specifying the file to copy from.");
                }

                string source_value = copy_node.GetAttribute("source", String.Empty);
                string target_value = copy_node.GetAttribute("target", String.Empty);

                CopyFromFilesCommand copy_command = new CopyFromFilesCommand(root_value, file_value, source_value, target_value);
                copy_commands.Add(copy_command);
            }

            WriteMessage(MessageLevel.Info, String.Format("Loaded {0} copy commands.", copy_commands.Count));
        }
Ejemplo n.º 2
0
        public CopyFromFilesComponent (BuildAssembler assembler, XPathNavigator configuration) : base(assembler, configuration) {
            XPathNodeIterator copy_nodes = configuration.Select("copy");
            foreach (XPathNavigator copy_node in copy_nodes) {

                string root_value = copy_node.GetAttribute("base", String.Empty);
                if (String.IsNullOrEmpty(root_value)) root_value = Environment.CurrentDirectory;
                root_value = Environment.ExpandEnvironmentVariables(root_value);
                if (!Directory.Exists(root_value)) WriteMessage(MessageLevel.Error, String.Format("The base directory '{0}' does not exist.", root_value));

                string file_value = copy_node.GetAttribute("file", String.Empty);
                if (String.IsNullOrEmpty(file_value)) WriteMessage(MessageLevel.Error, "Each copy element must have a file attribute specifying the file to copy from.");

                string source_value = copy_node.GetAttribute("source", String.Empty);
                string target_value = copy_node.GetAttribute("target", String.Empty);

                CopyFromFilesCommand copy_command = new CopyFromFilesCommand(root_value, file_value, source_value, target_value);
                copy_commands.Add(copy_command);
            }

            WriteMessage(MessageLevel.Info, String.Format("Loaded {0} copy commands.", copy_commands.Count));
        }