dotnet-installer/src/Microsoft.DotNet.ProjectModel.Server/Messengers/ProjectDiagnosticsMessenger.cs
David Fowler 4b07b2d034 Project model server cleanup
- Removed unused message types
- Removed intermediate ProjectInfo and ProjectState types
- Renamed Snapshot to ProjectSnapshot and ProjectSnapshot to ProjectContextSnapshot
- Exposed Project on ProjectContextCollection
- Removed AllDiagnostics message since it won't be used
- Renamed ProjectContextManager to ProjectManager
- Create project context snapshot in one pass
- Create project contexts lookup inline
- Consistent naming of payloads
2016-01-03 00:34:00 -08:00

32 lines
1.1 KiB
C#

// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Linq;
using Microsoft.DotNet.ProjectModel.Server.Models;
namespace Microsoft.DotNet.ProjectModel.Server.Messengers
{
internal class ProjectDiagnosticsMessenger : Messenger<ProjectSnapshot>
{
public ProjectDiagnosticsMessenger(Action<string, object> transmit)
: base(MessageTypes.Diagnostics, transmit)
{ }
protected override bool CheckDifference(ProjectSnapshot local, ProjectSnapshot remote)
{
return remote.ProjectDiagnostics != null &&
Enumerable.SequenceEqual(local.ProjectDiagnostics, remote.ProjectDiagnostics);
}
protected override object CreatePayload(ProjectSnapshot local)
{
return new DiagnosticsListMessage(local.ProjectDiagnostics);
}
protected override void SetValue(ProjectSnapshot local, ProjectSnapshot remote)
{
remote.ProjectDiagnostics = local.ProjectDiagnostics;
}
}
}