Exemplo n.º 1
0
        public IProjectContent AddAssemblyReferences(params IAssemblyReference[] references)
        {
            CSharpProjectContent pc = Clone();

            pc.assemblyReferences.AddRange(references);
            return(pc);
        }
Exemplo n.º 2
0
        public IProjectContent UpdateProjectContent(IUnresolvedFile oldFile, IUnresolvedFile newFile)
        {
            if (oldFile == null && newFile == null)
            {
                return(this);
            }
            if (oldFile != null && newFile != null)
            {
                if (!Platform.FileNameComparer.Equals(oldFile.FileName, newFile.FileName))
                {
                    throw new ArgumentException("When both oldFile and newFile are specified, they must use the same file name.");
                }
            }
            CSharpProjectContent pc = Clone();

            if (newFile == null)
            {
                pc.unresolvedFiles.Remove(oldFile.FileName);
            }
            else
            {
                pc.unresolvedFiles[newFile.FileName] = newFile;
            }
            return(pc);
        }
Exemplo n.º 3
0
        public IProjectContent SetLocation(string newLocation)
        {
            CSharpProjectContent pc = Clone();

            pc.location = newLocation;
            return(pc);
        }
Exemplo n.º 4
0
        public IProjectContent SetProjectFileName(string newProjectFileName)
        {
            CSharpProjectContent pc = Clone();

            pc.projectFileName = newProjectFileName;
            return(pc);
        }
		protected CSharpProjectContent(CSharpProjectContent pc)
		{
			this.assemblyName = pc.assemblyName;
			this.fullAssemblyName = pc.fullAssemblyName;
			this.projectFileName = pc.projectFileName;
			this.location = pc.location;
			this.unresolvedFiles = new Dictionary<string, IUnresolvedFile>(pc.unresolvedFiles, Platform.FileNameComparer);
			this.assemblyReferences = new List<IAssemblyReference>(pc.assemblyReferences);
			this.compilerSettings = pc.compilerSettings;
		}
Exemplo n.º 6
0
 protected CSharpProjectContent(CSharpProjectContent pc)
 {
     this.assemblyName       = pc.assemblyName;
     this.fullAssemblyName   = pc.fullAssemblyName;
     this.projectFileName    = pc.projectFileName;
     this.location           = pc.location;
     this.unresolvedFiles    = new Dictionary <string, IUnresolvedFile>(pc.unresolvedFiles, Platform.FileNameComparer);
     this.assemblyReferences = new List <IAssemblyReference>(pc.assemblyReferences);
     this.compilerSettings   = pc.compilerSettings;
 }
Exemplo n.º 7
0
        /// <summary>
        /// Removes the files with the specified names.
        /// </summary>
        public IProjectContent RemoveFiles(IEnumerable <string> fileNames)
        {
            CSharpProjectContent pc = Clone();

            foreach (var fileName in fileNames)
            {
                pc.unresolvedFiles.Remove(fileName);
            }
            return(pc);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Adds the specified files to the project content.
        /// If a file with the same name already exists, updated the existing file.
        /// </summary>
        public IProjectContent AddOrUpdateFiles(IEnumerable <IUnresolvedFile> newFiles)
        {
            CSharpProjectContent pc = Clone();

            foreach (var file in newFiles)
            {
                pc.unresolvedFiles[file.FileName] = file;
            }
            return(pc);
        }
Exemplo n.º 9
0
        public IProjectContent RemoveAssemblyReferences(params IAssemblyReference[] references)
        {
            CSharpProjectContent pc = Clone();

            foreach (var r in references)
            {
                pc.assemblyReferences.Remove(r);
            }
            return(pc);
        }
Exemplo n.º 10
0
        /// <summary>
        /// Sets both the short and the full assembly names.
        /// </summary>
        /// <param name="newAssemblyName">New full assembly name.</param>
        public IProjectContent SetAssemblyName(string newAssemblyName)
        {
            CSharpProjectContent pc = Clone();

            pc.fullAssemblyName = newAssemblyName;
            int pos = newAssemblyName != null?newAssemblyName.IndexOf(',') : -1;

            pc.assemblyName = pos < 0 ? newAssemblyName : newAssemblyName.Substring(0, pos);
            return(pc);
        }
Exemplo n.º 11
0
        public IProjectContent SetCompilerSettings(object compilerSettings)
        {
            if (!(compilerSettings is CompilerSettings))
            {
                throw new ArgumentException("Settings must be an instance of " + typeof(CompilerSettings).FullName, "compilerSettings");
            }
            CSharpProjectContent pc = Clone();

            pc.compilerSettings = (CompilerSettings)compilerSettings;
            pc.compilerSettings.Freeze();
            return(pc);
        }
Exemplo n.º 12
0
        public IProjectContent UpdateProjectContent(IEnumerable <IUnresolvedFile> oldFiles, IEnumerable <IUnresolvedFile> newFiles)
        {
            CSharpProjectContent pc = Clone();

            if (oldFiles != null)
            {
                foreach (var oldFile in oldFiles)
                {
                    pc.unresolvedFiles.Remove(oldFile.FileName);
                }
            }
            if (newFiles != null)
            {
                foreach (var newFile in newFiles)
                {
                    pc.unresolvedFiles.Add(newFile.FileName, newFile);
                }
            }
            return(pc);
        }