Example #1
0
        /// <summary>
        /// Loads an existing project file
        /// </summary>
        internal NAntDocument(string filename, ILogsMessage logger, CommandLineOptions options)
        {
            Assert.NotNull(filename, "filename");
            Assert.NotNull(logger, "logger");
            Assert.NotNull(options, "options");

            _options = options;
            _logger  = logger;
            FullName = filename;

            FileInfo fileInfo = new FileInfo(FullName);

            Name      = fileInfo.Name;
            Directory = fileInfo.DirectoryName;

            Load();

            BuildScript             = ScriptParserFactory.Create(fileInfo);
            _buildRunner            = BuildRunnerFactory.Create(fileInfo, logger, _options);
            _buildRunner.Properties = BuildScript.Properties;
        }
Example #2
0
        internal void SaveAs(string filename, string contents)
        {
            Assert.NotNull(filename, "filename");
            Assert.NotNull(contents, "contents");

            FullName = filename;
            Contents = contents;

            File.WriteAllText(FullName, Contents);

            FileInfo fileInfo = new FileInfo(filename);

            Name         = fileInfo.Name;
            Directory    = fileInfo.DirectoryName;
            LastModified = fileInfo.LastWriteTime;
            FileType     = FileType.Existing;

            BuildScript  = ScriptParserFactory.Create(fileInfo);
            _buildRunner = BuildRunnerFactory.Create(fileInfo, _logger, _options);

            ParseBuildFile();
        }