private SolutionId DeserializeSolutionId(ObjectReader reader, CancellationToken cancellationToken) { var guid = new Guid(reader.ReadArray <byte>()); var debugName = reader.ReadString(); return(SolutionId.CreateFromSerialized(guid, debugName)); }
public async Task Init(SolutionModel solutionModel) { IList <ProjectInfo> projectInfos = new List <ProjectInfo>(solutionModel.Projects.Count); foreach (var projectModel in solutionModel.Projects) { var projectId = ProjectId.CreateFromSerialized(projectModel.Id); var documentInfos = new List <DocumentInfo>(projectModel.Documents.Count); var projectReferences = new List <ProjectReference>(projectModel.ProjectToProjectReferences.Count); var metadataReferences = new List <MetadataReference>(projectModel.ProjectAssemblyReferences.Count); foreach (var documentModel in projectModel.Documents) { documentInfos.Add(DocumentInfo.Create(DocumentId.CreateNewId(projectId), documentModel.Name, null, SourceCodeKind.Regular, null, documentModel.Path)); } foreach (var projectReference in projectModel.ProjectToProjectReferences) { projectReferences.Add(new ProjectReference(ProjectId.CreateFromSerialized(projectReference.Id))); } foreach (var projectAssemblyReference in projectModel.ProjectAssemblyReferences) { metadataReferences.Add(MetadataReference.CreateFromFile(projectAssemblyReference.LibraryPath)); } var projectInfo = ProjectInfo.Create(projectId, VersionStamp.Default, projectModel.Name, projectModel.AssemblyName, LanguageNames.CSharp, projectModel.FilePath, null, null, null, documentInfos, projectReferences, metadataReferences, null); projectInfos.Add(projectInfo); } _adhocWorkspace.AddSolution(SolutionInfo.Create(SolutionId.CreateFromSerialized(solutionModel.Id), VersionStamp.Default, solutionModel.FilePath, projectInfos)); }
public SolutionId?Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) { try { if (reader.TryReadNil()) { return(null); } Contract.ThrowIfFalse(reader.ReadArrayHeader() == 2); var id = GuidFormatter.Instance.Deserialize(ref reader, options); var debugName = reader.ReadString(); return(SolutionId.CreateFromSerialized(id, debugName)); } catch (Exception e) when(e is not MessagePackSerializationException) { throw new MessagePackSerializationException(e.Message, e); } }
public KordueneWorkspace(SlnFile sln) : this() { SlnFile = sln; var guidSection = sln.Sections.GetSection("ExtensibilityGlobals", SlnSectionType.PostProcess); var id = SolutionId.CreateFromSerialized(new Guid(guidSection.Properties.GetValue("SolutionGuid"))); var solution = this.CreateSolution(SolutionInfo.Create(id, VersionStamp.Default, sln.FullPath)); foreach (var item in sln.Projects) { var proj = ProjectInfo.Create(ProjectId.CreateFromSerialized(new Guid(item.Id)), VersionStamp.Default, item.Name, item.Name, LanguageNames.CSharp, Path.Combine(sln.BaseDirectory, item.FilePath)); proj = AddProjectDocuments(proj); proj = AddDefaultReferences(proj); solution = solution.AddProject(proj); } var configs = sln.Sections.GetSection("SolutionConfigurationPlatforms"); Configurations.Clear(); foreach (var item in configs.Properties) { var configPlat = item.Value.Split("|"); if (!Configurations.Contains(configPlat[0].Replace(" ", string.Empty))) { Configurations.Add(configPlat[0]); } if (!Platforms.Contains(configPlat[1].Replace(" ", string.Empty))) { Platforms.Add(configPlat[1].Replace(" ", string.Empty)); } } this.SetCurrentSolution(solution); LoadProjectSymbols(); }
private static SolutionId CreateSolutionId(byte[] solutionIdGuidBytes, string solutionIdDebugName) { return(SolutionId.CreateFromSerialized(new Guid(solutionIdGuidBytes), solutionIdDebugName)); }
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { var(id, debugName) = ReadFromJsonObject(reader); return(SolutionId.CreateFromSerialized(id, debugName)); }