Пример #1
0
 public void Add([FromBody] AddStaffUser command)
 {
     _eventEmitter.Emit(Feature, new StaffUserAdded
     {
         Id                = new Guid(),
         FirstName         = command.FirstName,
         LastName          = command.LastName,
         Age               = command.Age,
         Sex               = command.Sex,
         NationalSociety   = command.NationalSociety,
         PreferredLanguage = command.PreferredLanguage,
         MobilePhoneNumber = command.MobilePhoneNumber,
         Email             = command.Email
     });
 }
        public override bool Enter(IObjectDescriptor value)
        {
            var alias = aliasProvider.GetAlias(value.Value);

            if (alias != null && !emittedAliases.Add(alias))
            {
                eventEmitter.Emit(new AliasEventInfo(value)
                {
                    Alias = alias
                });
                return(false);
            }

            return(base.Enter(value));
        }
Пример #3
0
        public static void ProjectInformation(this IEventEmitter emitter,
                                              HashedString projectId,
                                              HashedString sessionId,
                                              int outputKind,
                                              IEnumerable <string> projectCapabilities,
                                              IEnumerable <string> targetFrameworks,
                                              HashedString sdkVersion,
                                              IEnumerable <HashedString> references,
                                              IEnumerable <HashedString> fileExtensions,
                                              IEnumerable <int> fileCounts)
        {
            var projectConfiguration = new ProjectConfigurationMessage()
            {
                ProjectCapabilities = projectCapabilities,
                TargetFrameworks    = targetFrameworks,
                SdkVersion          = sdkVersion.Value,
                OutputKind          = outputKind,
                ProjectId           = projectId.Value,
                SessionId           = sessionId.Value,
                References          = references.Select(hashed => hashed.Value),
                FileExtensions      = fileExtensions.Select(hashed => hashed.Value),
                FileCounts          = fileCounts
            };

            emitter.Emit(
                EventTypes.ProjectConfiguration,
                projectConfiguration);
        }
Пример #4
0
 public void Post([FromBody] CreateProject command)
 {
     _eventEmitter.Emit(Feature, new ProjectCreated
     {
         Name = command.Name,
         Id   = command.Id
     });
 }
Пример #5
0
 public void AddNationalSociety()
 {
     _eventEmitter.Emit(Feature, new NationalSocietyCreated
     {
         Name = Guid.NewGuid().ToString(),
         Id   = Guid.NewGuid()
     });
 }
Пример #6
0
 public static void RestoreStarted(this IEventEmitter emitter, string projectPath)
 {
     emitter.Emit(
         EventTypes.PackageRestoreStarted,
         new PackageRestoreMessage {
         FileName = projectPath
     });
 }
Пример #7
0
 public static void Error(this IEventEmitter emitter, Exception ex, string fileName = null)
 {
     emitter.Emit(
         EventTypes.Error,
         new ErrorMessage {
         FileName = fileName, Text = ex.ToString()
     });
 }
Пример #8
0
 protected void EmitTestMessage(TestMessageLevel messageLevel, string message)
 {
     EventEmitter.Emit(TestMessageEvent.Id,
                       new TestMessageEvent
     {
         MessageLevel = messageLevel.ToString().ToLowerInvariant(),
         Message      = message
     });
 }
 public static void MSBuildProjectDiagnostics(this IEventEmitter eventEmitter, string projectFilePath, ImmutableArray <MSBuildDiagnostic> diagnostics)
 {
     eventEmitter.Emit(MSBuildProjectDiagnosticsEvent.Id, new MSBuildProjectDiagnosticsEvent()
     {
         FileName = projectFilePath,
         Warnings = SelectMessages(diagnostics, MSBuildDiagnosticSeverity.Warning),
         Errors   = SelectMessages(diagnostics, MSBuildDiagnosticSeverity.Error)
     });
 }
Пример #10
0
 private void EmitProject(string eventType, DotNetProjectInformation information)
 {
     _emitter.Emit(
         eventType,
         new ProjectInformationResponse()
     {
         { "DotNetProject", information }
     });
 }
 public static void MSBuildProjectDiagnostics(this IEventEmitter eventEmitter, string projectFilePath, IEnumerable <MSBuildDiagnosticsMessage> diagnostics)
 {
     eventEmitter.Emit(MSBuildProjectDiagnosticsEvent.Id, new MSBuildProjectDiagnosticsEvent()
     {
         FileName = projectFilePath,
         Warnings = diagnostics.Where(d => d.LogLevel == "Warning"),
         Errors   = diagnostics.Where(d => d.LogLevel == "Error"),
     });
 }
Пример #12
0
 public static void RestoreFinished(this IEventEmitter emitter, string projectPath, bool succeeded)
 {
     emitter.Emit(
         EventTypes.PackageRestoreFinished,
         new PackageRestoreMessage
     {
         FileName  = projectPath,
         Succeeded = succeeded
     });
 }
Пример #13
0
 public static void UnresolvedDepdendencies(this IEventEmitter emitter, string projectFilePath, IEnumerable <PackageDependency> unresolvedDependencies)
 {
     emitter.Emit(
         EventTypes.UnresolvedDependencies,
         new UnresolvedDependenciesMessage
     {
         FileName = projectFilePath,
         UnresolvedDependencies = unresolvedDependencies
     });
 }
Пример #14
0
 public void Post([FromBody] CreateProject command)
 {
     _eventEmitter.Emit(Feature, new ProjectCreated
     {
         Name = command.Name,
         Id   = command.Id,
         NationalSocietyId = command.NationalSocietyId,
         OwnerUserId       = command.OwnerUserId
     });
 }
Пример #15
0
        private void UpdateProject(string projectDirectory)
        {
            _logger.LogInformation($"Update project {projectDirectory}");
            var contexts = _workspaceContext.GetProjectContexts(projectDirectory);

            if (!contexts.Any())
            {
                _logger.LogWarning($"Cannot create any {nameof(ProjectContext)} from project {projectDirectory}");
                return;
            }

            var projectFilePath = contexts.First().ProjectFile.ProjectFilePath;

            _emitter.Emit(
                EventTypes.ProjectChanged,
                new ProjectInformationResponse()
            {
                // the key is hard coded in VSCode
                {
                    "DnxProject",
                    new
                    {
                        Path        = projectFilePath,
                        SourceFiles = Enumerable.Empty <string>()
                    }
                }
            });

            _projectStates.Update(projectDirectory, contexts, AddProject, _omnisharpWorkspace.RemoveProject);

            _watcher.Watch(projectFilePath, file =>
            {
                _logger.LogInformation($"Watcher: {file} updated.");
                Update(true);
            });

            _watcher.Watch(Path.ChangeExtension(projectFilePath, "lock.json"), file =>
            {
                _logger.LogInformation($"Watcher: {file} updated.");
                Update(false);
            });
        }
Пример #16
0
        public void CreateDataCollectors()
        {
            var _collection = _database.GetCollection <DataCollector>("DataCollector");

            _collection.DeleteMany(v => true);

            var dataCollectors = JsonConvert.DeserializeObject <DataCollectorAdded[]>(File.ReadAllText("./TestData/DataCollectors.json"));

            foreach (var dataCollector in dataCollectors)
            {
                _eventEmitter.Emit("DataCollectorAdded", dataCollector);
            }
        }
Пример #17
0
        public void Add([FromBody] AddItemToCart command)
        {
            var cartId = _carts.GetCartIdForCurrentUser();
            var price  = _pricing.GetForProduct(command.Product);

            _eventEmitter.Emit(Feature, new ItemAddedToCart
            {
                Cart           = cartId,
                Product        = command.Product,
                Quantity       = command.Quantity,
                NetItemPrice   = price.Net,
                GrossItemPrice = price.Gross
            });
        }
Пример #18
0
        public R EmitHandlingFailed(T message)
        {
            var eventToEmit = default(R);

            try
            {
                eventToEmit = _handlingFailedEventEmitter.Emit(message);
                _bus.Publish(eventToEmit);
            }
            catch (Exception e)
            {
                throw new EmitterException();
            }
            return(eventToEmit);
        }
Пример #19
0
        public E EmitValidationFailed(T message)
        {
            var eventToEmit = default(E);

            try
            {
                eventToEmit = _validationFailedEventEmitter.Emit(message);
                _bus.Publish(eventToEmit);
            }
            catch (Exception e)
            {
                throw new EmitterException();
            }
            return(eventToEmit);
        }
Пример #20
0
        public E Emit(T command)
        {
            var eventToEmit = default(E);

            try
            {
                eventToEmit = _eventEmitter.Emit(command);
                _bus.Publish(eventToEmit);
            }
            catch (Exception e)
            {
                _logger.Log("Exception while emitting event: ", e.StackTrace);
                throw new EmitterException();
            }
            return(eventToEmit);
        }
        public override bool Enter(object value, Type type)
        {
            if (value != null)
            {
                var alias = aliasProvider.GetAlias(value);
                if (alias != null)
                {
                    eventEmitter.Emit(new AliasEventInfo(value, type)
                    {
                        Alias = alias
                    });
                    return(false);
                }
            }

            return(base.Enter(value, type));
        }
        public static void ProjectInformation(this IEventEmitter emitter,
                                              HashedString projectId,
                                              IEnumerable <string> targetFrameworks,
                                              IEnumerable <HashedString> references,
                                              IEnumerable <HashedString> fileExtensions)
        {
            var projectConfiguration = new ProjectConfigurationMessage()
            {
                TargetFrameworks = targetFrameworks,
                ProjectId        = projectId.Value,
                References       = references.Select(hashed => hashed.Value),
                FileExtensions   = fileExtensions.Select(hashed => hashed.Value)
            };

            emitter.Emit(
                EventTypes.ProjectConfiguration,
                projectConfiguration);
        }
Пример #23
0
        public async void Handle(T command)
        {
            try
            {
                _validator.Validate(command);
                await Task.Run(() => _handler.Handle(command));

                _eventEmitter.Emit(command);
            }
            catch (CommandValidationException e)
            {
                _errorEventEmitter.EmitValidationFailed(command);
            }
            catch (CommandHandlerException e)
            {
                _errorEventEmitter.EmitHandlingFailed(command);
            }
            catch (Exception e)
            {
                _logger.Log("Exception while handling command[" + e.GetType() + "]: "
                            + e.StackTrace, command);
                throw new CommandHandlerException();
            }
        }
Пример #24
0
        //TODO: Add a test that ensure that the right count is put in the right property
        //TODO: This should possibly be process once, since it should only happen the first time a text message is recieved
        public void Process(TextMessageReceived @event)
        {
            var caseReportContent = TextMessageContentParser.Parse(@event.Message);
            var dataCollector     = _dataCollectors.GetByPhoneNumber(@event.OriginNumber);

            if (caseReportContent.GetType() == typeof(InvalidCaseReportContent))
            {
                //TODO: Handle if datacollector is unknown also. Different event?
                var invalidCaseReport = caseReportContent as InvalidCaseReportContent;
                _eventEmitter.Emit(Feature, new TextMessageParsingFailed
                {
                    Id = Guid.NewGuid(),
                    DataCollectorId     = dataCollector.Id,
                    Message             = @event.Message,
                    ParsingErrorMessage = invalidCaseReport.ErrorMessage
                });
            }
            else if (caseReportContent.GetType() == typeof(SingleCaseReportContent))
            {
                var singlecaseReport = caseReportContent as SingleCaseReportContent;
                var healthRisk       = _healthRisks.GetByReadableId(singlecaseReport.HealthRiskId);
                if (dataCollector == null)
                {
                    _eventEmitter.Emit(Feature, new AnonymousCaseReportRecieved
                    {
                        Id                    = Guid.NewGuid(),
                        PhoneNumber           = @event.OriginNumber,
                        HealthRiskId          = healthRisk.Id,
                        NumberOfFemalesUnder5 =
                            singlecaseReport.Age <= 5 && singlecaseReport.Sex == Sex.Female ? 1 : 0,
                        NumberOfFemalesOver5 =
                            singlecaseReport.Age > 5 && singlecaseReport.Sex == Sex.Female ? 1 : 0,
                        NumberOfMalesUnder5 =
                            singlecaseReport.Age <= 5 && singlecaseReport.Sex == Sex.Male ? 1 : 0,
                        NumberOfMalesOver5 =
                            singlecaseReport.Age > 5 && singlecaseReport.Sex == Sex.Male ? 1 : 0,
                        Latitude  = @event.Latitude,
                        Longitude = @event.Longitude,
                        Timestamp = @event.Sent
                    });
                    return;
                }
                _eventEmitter.Emit(Feature, new CaseReportReceived
                {
                    Id = Guid.NewGuid(),
                    DataCollectorId       = dataCollector.Id,
                    HealthRiskId          = healthRisk.Id,
                    NumberOfFemalesUnder5 =
                        singlecaseReport.Age <= 5 && singlecaseReport.Sex == Sex.Female ? 1 : 0,
                    NumberOfFemalesOver5 =
                        singlecaseReport.Age > 5 && singlecaseReport.Sex == Sex.Female ? 1 : 0,
                    NumberOfMalesUnder5 =
                        singlecaseReport.Age <= 5 && singlecaseReport.Sex == Sex.Male ? 1 : 0,
                    NumberOfMalesOver5 =
                        singlecaseReport.Age > 5 && singlecaseReport.Sex == Sex.Male ? 1 : 0,
                    Latitude  = @event.Latitude,
                    Longitude = @event.Longitude,
                    Timestamp = @event.Sent
                });
            }
            else
            {
                var report     = caseReportContent as MultipleCaseReportContent;
                var healthRisk = _healthRisks.GetByReadableId(report.HealthRiskId);
                if (dataCollector == null)
                {
                    _eventEmitter.Emit(Feature, new AnonymousCaseReportRecieved
                    {
                        Id                    = Guid.NewGuid(),
                        PhoneNumber           = @event.OriginNumber,
                        HealthRiskId          = healthRisk.Id,
                        NumberOfFemalesUnder5 = report.FemalesUnder5,
                        NumberOfFemalesOver5  = report.FemalesOver5,
                        NumberOfMalesUnder5   = report.MalesUnder5,
                        NumberOfMalesOver5    = report.MalesOver5,
                        Latitude              = @event.Latitude,
                        Longitude             = @event.Longitude,
                        Timestamp             = @event.Sent
                    });
                    return;
                }
                _eventEmitter.Emit(Feature, new CaseReportReceived
                {
                    Id = Guid.NewGuid(),
                    DataCollectorId       = dataCollector.Id,
                    HealthRiskId          = healthRisk.Id,
                    NumberOfFemalesUnder5 = report.FemalesUnder5,
                    NumberOfFemalesOver5  = report.FemalesOver5,
                    NumberOfMalesUnder5   = report.MalesUnder5,
                    NumberOfMalesOver5    = report.MalesOver5,
                    Latitude  = @event.Latitude,
                    Longitude = @event.Longitude,
                    Timestamp = @event.Sent
                });
            }
        }
Пример #25
0
 public virtual void Emit(AliasEventInfo eventInfo)
 {
     nextEmitter.Emit(eventInfo);
 }
Пример #26
0
        public void Initalize()
        {
            var runtimePath = _aspNet5Paths.RuntimePath;

            _context.RuntimePath = runtimePath.Value;

            if (!ScanForProjects())
            {
                // No ASP.NET 5 projects found so do nothing
                _logger.WriteInformation("No project.json based projects found");
                return;
            }

            if (_context.RuntimePath == null)
            {
                // There is no default k found so do nothing
                _logger.WriteInformation("No default runtime found");
                _emitter.Emit(EventTypes.Error, runtimePath.Error);
                return;
            }

            var wh = new ManualResetEventSlim();

            _designTimeHostManager.Start(_context.HostId, port =>
            {
                var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                socket.Connect(new IPEndPoint(IPAddress.Loopback, port));

                var networkStream = new NetworkStream(socket);

                _logger.WriteInformation("Connected");

                _context.DesignTimeHostPort = port;

                _context.Connection = new ProcessingQueue(networkStream, _logger);

                _context.Connection.OnReceive += m =>
                {
                    var project = _context.Projects[m.ContextId];

                    if (m.MessageType == "ProjectInformation")
                    {
                        var val = m.Payload.ToObject <ProjectMessage>();

                        project.Name               = val.Name;
                        project.GlobalJsonPath     = val.GlobalJsonPath;
                        project.Configurations     = val.Configurations;
                        project.Commands           = val.Commands;
                        project.ProjectSearchPaths = val.ProjectSearchPaths;

                        this._emitter.Emit(EventTypes.ProjectChanged, new ProjectInformationResponse()
                        {
                            AspNet5Project = new AspNet5Project(project)
                        });

                        var unprocessed = project.ProjectsByFramework.Keys.ToList();

                        foreach (var frameworkData in val.Frameworks)
                        {
                            unprocessed.Remove(frameworkData.FrameworkName);

                            var frameworkProject = project.ProjectsByFramework.GetOrAdd(frameworkData.FrameworkName, framework =>
                            {
                                return(new FrameworkProject(project, framework));
                            });

                            var id = frameworkProject.ProjectId;

                            if (_workspace.CurrentSolution.ContainsProject(id))
                            {
                                continue;
                            }
                            else
                            {
                                var projectInfo = ProjectInfo.Create(
                                    id,
                                    VersionStamp.Create(),
                                    val.Name + "+" + frameworkData.ShortName,
                                    val.Name,
                                    LanguageNames.CSharp,
                                    project.Path);

                                _workspace.AddProject(projectInfo);
                                _context.WorkspaceMapping[id] = frameworkProject;
                            }

                            lock (frameworkProject.PendingProjectReferences)
                            {
                                var reference = new Microsoft.CodeAnalysis.ProjectReference(id);

                                foreach (var referenceId in frameworkProject.PendingProjectReferences)
                                {
                                    _workspace.AddProjectReference(referenceId, reference);
                                }

                                frameworkProject.PendingProjectReferences.Clear();
                            }
                        }

                        // Remove old projects
                        foreach (var frameworkName in unprocessed)
                        {
                            FrameworkProject frameworkProject;
                            project.ProjectsByFramework.TryRemove(frameworkName, out frameworkProject);
                            _workspace.RemoveProject(frameworkProject.ProjectId);
                        }
                    }
                    // This is where we can handle messages and update the
                    // language service
                    else if (m.MessageType == "References")
                    {
                        // References as well as the dependency graph information
                        var val = m.Payload.ToObject <ReferencesMessage>();

                        var frameworkProject = project.ProjectsByFramework[val.Framework.FrameworkName];
                        var projectId        = frameworkProject.ProjectId;

                        var metadataReferences = new List <MetadataReference>();
                        var projectReferences  = new List <Microsoft.CodeAnalysis.ProjectReference>();

                        var removedFileReferences    = frameworkProject.FileReferences.ToDictionary(p => p.Key, p => p.Value);
                        var removedRawReferences     = frameworkProject.RawReferences.ToDictionary(p => p.Key, p => p.Value);
                        var removedProjectReferences = frameworkProject.ProjectReferences.ToDictionary(p => p.Key, p => p.Value);

                        foreach (var file in val.FileReferences)
                        {
                            if (removedFileReferences.Remove(file))
                            {
                                continue;
                            }

                            var metadataReference = _metadataFileReferenceCache.GetMetadataReference(file);
                            frameworkProject.FileReferences[file] = metadataReference;
                            metadataReferences.Add(metadataReference);
                        }

                        foreach (var rawReference in val.RawReferences)
                        {
                            if (removedRawReferences.Remove(rawReference.Key))
                            {
                                continue;
                            }

                            var metadataReference = MetadataReference.CreateFromImage(rawReference.Value);
                            frameworkProject.RawReferences[rawReference.Key] = metadataReference;
                            metadataReferences.Add(metadataReference);
                        }

                        foreach (var projectReference in val.ProjectReferences)
                        {
                            if (removedProjectReferences.Remove(projectReference.Path))
                            {
                                continue;
                            }

                            int projectReferenceContextId;
                            if (!_context.ProjectContextMapping.TryGetValue(projectReference.Path, out projectReferenceContextId))
                            {
                                projectReferenceContextId = AddProject(projectReference.Path);
                            }

                            var referencedProject = _context.Projects[projectReferenceContextId];

                            var referencedFrameworkProject = referencedProject.ProjectsByFramework.GetOrAdd(projectReference.Framework.FrameworkName,
                                                                                                            framework =>
                            {
                                return(new FrameworkProject(referencedProject, framework));
                            });

                            var projectReferenceId = referencedFrameworkProject.ProjectId;

                            if (_workspace.CurrentSolution.ContainsProject(projectReferenceId))
                            {
                                projectReferences.Add(new Microsoft.CodeAnalysis.ProjectReference(projectReferenceId));
                            }
                            else
                            {
                                lock (referencedFrameworkProject.PendingProjectReferences)
                                {
                                    referencedFrameworkProject.PendingProjectReferences.Add(projectId);
                                }
                            }

                            referencedFrameworkProject.ProjectDependeees[project.Path] = projectId;

                            frameworkProject.ProjectReferences[projectReference.Path] = projectReferenceId;
                        }

                        foreach (var reference in metadataReferences)
                        {
                            _workspace.AddMetadataReference(projectId, reference);
                        }

                        foreach (var projectReference in projectReferences)
                        {
                            _workspace.AddProjectReference(projectId, projectReference);
                        }

                        foreach (var pair in removedProjectReferences)
                        {
                            _workspace.RemoveProjectReference(projectId, new Microsoft.CodeAnalysis.ProjectReference(pair.Value));
                            frameworkProject.ProjectReferences.Remove(pair.Key);

                            // TODO: Update the dependee's list
                        }

                        foreach (var pair in removedFileReferences)
                        {
                            _workspace.RemoveMetadataReference(projectId, pair.Value);
                            frameworkProject.FileReferences.Remove(pair.Key);
                        }

                        foreach (var pair in removedRawReferences)
                        {
                            _workspace.RemoveMetadataReference(projectId, pair.Value);
                            frameworkProject.RawReferences.Remove(pair.Key);
                        }
                    }
                    else if (m.MessageType == "Dependencies")
                    {
                        var val = m.Payload.ToObject <DependenciesMessage>();
                        var unresolvedDependencies = val.Dependencies.Values
                                                     .Where(dep => dep.Type == "Unresolved");

                        if (unresolvedDependencies.Any())
                        {
                            _logger.WriteInformation("Project {0} has these unresolved references: {1}", project.Path, string.Join(", ", unresolvedDependencies.Select(d => d.Name)));
                            _emitter.Emit(EventTypes.UnresolvedDependencies, new UnresolvedDependenciesMessage()
                            {
                                FileName = project.Path,
                                UnresolvedDependencies = unresolvedDependencies.Select(d => new PackageDependency()
                                {
                                    Name = d.Name, Version = d.Version
                                })
                            });
                            _packagesRestoreTool.Run(project);
                        }
                    }
                    else if (m.MessageType == "CompilerOptions")
                    {
                        // Configuration and compiler options
                        var val = m.Payload.ToObject <CompilationOptionsMessage>();

                        var projectId = project.ProjectsByFramework[val.Framework.FrameworkName].ProjectId;

                        var options = val.CompilationOptions.CompilationOptions;

                        var specificDiagnosticOptions = options.SpecificDiagnosticOptions
                                                        .ToDictionary(p => p.Key, p => (ReportDiagnostic)p.Value);

                        var csharpOptions = new CSharpCompilationOptions(
                            outputKind: (OutputKind)options.OutputKind,
                            optimizationLevel: (OptimizationLevel)options.OptimizationLevel,
                            platform: (Platform)options.Platform,
                            generalDiagnosticOption: (ReportDiagnostic)options.GeneralDiagnosticOption,
                            warningLevel: options.WarningLevel,
                            allowUnsafe: options.AllowUnsafe,
                            concurrentBuild: options.ConcurrentBuild,
                            specificDiagnosticOptions: specificDiagnosticOptions
                            );

                        var parseOptions = new CSharpParseOptions(val.CompilationOptions.LanguageVersion,
                                                                  preprocessorSymbols: val.CompilationOptions.Defines);

                        _workspace.SetCompilationOptions(projectId, csharpOptions);
                        _workspace.SetParseOptions(projectId, parseOptions);
                    }
                    else if (m.MessageType == "Sources")
                    {
                        // The sources to feed to the language service
                        var val = m.Payload.ToObject <SourcesMessage>();

                        project.SourceFiles = val.Files;

                        var frameworkProject = project.ProjectsByFramework[val.Framework.FrameworkName];
                        var projectId        = frameworkProject.ProjectId;

                        var unprocessed = new HashSet <string>(frameworkProject.Documents.Keys);

                        foreach (var file in val.Files)
                        {
                            if (unprocessed.Remove(file))
                            {
                                continue;
                            }

                            using (var stream = File.OpenRead(file))
                            {
                                var sourceText = SourceText.From(stream, encoding: Encoding.UTF8);
                                var id         = DocumentId.CreateNewId(projectId);
                                var version    = VersionStamp.Create();

                                frameworkProject.Documents[file] = id;

                                var loader = TextLoader.From(TextAndVersion.Create(sourceText, version));
                                _workspace.AddDocument(DocumentInfo.Create(id, file, filePath: file, loader: loader));
                            }
                        }

                        foreach (var file in unprocessed)
                        {
                            var docId = frameworkProject.Documents[file];
                            frameworkProject.Documents.Remove(file);
                            _workspace.RemoveDocument(docId);
                        }

                        frameworkProject.Loaded = true;
                    }
                    else if (m.MessageType == "Error")
                    {
                        var val = m.Payload.ToObject <Microsoft.Framework.DesignTimeHost.Models.OutgoingMessages.ErrorMessage>();
                        _logger.WriteError(val.Message);
                    }

                    if (project.ProjectsByFramework.Values.All(p => p.Loaded))
                    {
                        wh.Set();
                    }
                };

                // Start the message channel
                _context.Connection.Start();

                // Initialize the ASP.NET 5 projects
                Initialize();
            });

            wh.Wait();
        }
 void IObjectGraphVisitor.VisitScalar(IObjectDescriptor scalar)
 {
     eventEmitter.Emit(new ScalarEventInfo(scalar));
 }
Пример #28
0
 public virtual void Emit(AliasEventInfo eventInfo, IEmitter emitter)
 {
     nextEmitter.Emit(eventInfo, emitter);
 }
Пример #29
0
 public void Forward(DiagnosticMessage message)
 {
     _emitter.Emit(EventTypes.Diagnostic, message);
 }
 void IObjectGraphVisitor <IEmitter> .VisitScalar(IObjectDescriptor scalar, IEmitter context)
 {
     eventEmitter.Emit(new ScalarEventInfo(scalar), context);
 }