/// <summary>
 /// Initializes a new instance of the <see cref="ProjectInfo" /> class.
 /// </summary>
 /// <param name="file">The file.</param>
 /// <param name="name">The name.</param>
 /// <param name="assemblyInfoVersion">The assembly information version.</param>
 /// <param name="nuspecVersion">The nuspec version.</param>
 public ProjectInfo(FileInfo file, string name, AssemblyInfoVersion assemblyInfoVersion, NuspecVersion nuspecVersion)
 {
     File = file;
     Name = name;
     AssemblyInfoVersion = assemblyInfoVersion;
     NuspecVersion       = nuspecVersion;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Gets the project.
        /// </summary>
        /// <param name="project">The project.</param>
        /// <returns></returns>
        private ProjectInfo GetProject(Project project)
        {
            var nuspecLocalizer = _localizerRegistry.CreateLocalizer <NuspecInfo>();

            var projectFile = new FileInfo(project.FilePath);

            var nuspec        = nuspecLocalizer.GetItems(projectFile.Directory).FirstOrDefault();
            var nuspecVersion = nuspec != null ? new NuspecVersion(nuspec.File) : null;

            var assemblyInfoVersion =
                new AssemblyInfoVersion(new FileInfo(projectFile.Directory + @"\Properties\AssemblyInfo.cs"));

            return(new ProjectInfo(projectFile, project.Name, assemblyInfoVersion, nuspecVersion));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Handles the PropertyChanged event of the AssemblyInfoViewModel control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.ComponentModel.PropertyChangedEventArgs"/> instance containing the event data.</param>
        private void AssemblyInfoViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            if (string.IsNullOrEmpty(File))
            {
                return;
            }

            var file = new FileInfo(File);

            if (!file.Exists)
            {
                return;
            }

            var version = new AssemblyInfoVersion(file)
            {
                Version = Version
            };

            version.Write();
        }