Inheritance: ReleaseProjectPage
Exemple #1
0
        private IProjectPage RebuildProject(string areaName, PageSummary project)
        {
            Console.WriteLine("Processing page '{0} / {1}'...", areaName, project.Name);

            IProjectPage page;

            try
            {
                ProjectType projectType;
                var         projectName = ResolveProjectName(project.Name, out projectType);

                var existing = m_confluence.GetCachedPage(project);
                var document = new PageDocument(existing.Content);

                switch (projectType)
                {
                case ProjectType.Library:
                    page = new LibraryProjectPage(areaName, projectName, project.Name, document, m_owners);
                    break;

                case ProjectType.Website:
                    page = new WebsiteProjectPage(areaName, projectName, project.Name, document, m_owners);
                    break;

                case ProjectType.Webservice:
                    page = new WebserviceProjectPage(areaName, projectName, project.Name, document, m_owners);
                    break;

                case ProjectType.Service:
                    page = new ServiceProjectPage(areaName, projectName, project.Name, document, m_owners);
                    break;

                case ProjectType.Console:
                    page = new ConsoleProjectPage(areaName, projectName, project.Name, document, m_owners);
                    break;

                case ProjectType.Windows:
                    page = new WindowsProjectPage(areaName, projectName, project.Name, document, m_owners);
                    break;

                case ProjectType.CloudRole:
                    page = new CloudRoleProjectPage(areaName, projectName, project.Name, document, m_owners);
                    break;

                case ProjectType.CloudService:
                    page = new CloudServiceProjectPage(areaName, projectName, project.Name, document, m_owners);
                    break;

                case ProjectType.FabricService:
                    page = new FabricServiceProjectPage(areaName, projectName, project.Name, document, m_owners);
                    break;

                case ProjectType.FabricApplication:
                    page = new FabricApplicationProjectPage(areaName, projectName, project.Name, document, m_owners);
                    break;

                default:
                    throw new InvalidOperationException(
                              $"Unknown how to process project of type '{projectType.ToString().ToLowerInvariant()}'.");
                }

                page.CheckPage(m_tfs);

                var updated = UpdateProjectPage(page, existing);
                if (updated)
                {
                    Console.WriteLine("[{0}] {1} #{2}... UPDATED", areaName, projectName, projectType.ToString().ToLowerInvariant());
                }
                else
                {
                    Console.WriteLine("[{0}] {1} #{2}... not changed", areaName, projectName, projectType.ToString().ToLowerInvariant());
                }
            }
            catch (Exception e)
            {
                throw new InvalidOperationException(
                          $"An error occurred while processing page '{project.Name}' version {project.Version}.",
                          e);
            }

            return(page);
        }
		private IProjectPage RebuildProject(string areaName, PageSummary project)
		{
			Console.WriteLine("Processing page '{0} / {1}'...", areaName, project.Name);

			IProjectPage page;
			try
			{
				ProjectType projectType;
				var projectName = ResolveProjectName(project.Name, out projectType);

				var existing = m_confluence.GetCachedPage(project);
				var document = new PageDocument(existing.Content);

				switch (projectType)
				{
					case ProjectType.Library:
						page = new LibraryProjectPage(areaName, projectName, project.Name, document, m_owners);
						break;

					case ProjectType.Website:
						page = new WebsiteProjectPage(areaName, projectName, project.Name, document, m_owners);
						break;

					case ProjectType.Webservice:
						page = new WebserviceProjectPage(areaName, projectName, project.Name, document, m_owners);
						break;

					case ProjectType.Service:
						page = new ServiceProjectPage(areaName, projectName, project.Name, document, m_owners);
						break;

					case ProjectType.Console:
						page = new ConsoleProjectPage(areaName, projectName, project.Name, document, m_owners);
						break;

					case ProjectType.Windows:
						page = new WindowsProjectPage(areaName, projectName, project.Name, document, m_owners);
						break;

					case ProjectType.CloudRole:
						page = new CloudRoleProjectPage(areaName, projectName, project.Name, document, m_owners);
						break;

					case ProjectType.CloudService:
						page = new CloudServiceProjectPage(areaName, projectName, project.Name, document, m_owners);
						break;

					case ProjectType.FabricService:
						page = new FabricServiceProjectPage(areaName, projectName, project.Name, document, m_owners);
						break;

					case ProjectType.FabricApplication:
						page = new FabricApplicationProjectPage(areaName, projectName, project.Name, document, m_owners);
						break;

					default:
						throw new InvalidOperationException(
							$"Unknown how to process project of type '{projectType.ToString().ToLowerInvariant()}'.");
				}

				page.CheckPage(m_tfs);

				var updated = UpdateProjectPage(page, existing);
				if (updated)
				{
					Console.WriteLine("[{0}] {1} #{2}... UPDATED", areaName, projectName, projectType.ToString().ToLowerInvariant());
				}
				else
				{
					Console.WriteLine("[{0}] {1} #{2}... not changed", areaName, projectName, projectType.ToString().ToLowerInvariant());
				}
			}
			catch (Exception e)
			{
				throw new InvalidOperationException(
					$"An error occurred while processing page '{project.Name}' version {project.Version}.",
					e);
			}

			return page;
		}