internal static SealDirectory InternalDeserializeSealDirectory(PipReader reader) { DirectoryArtifact artifact = reader.ReadDirectoryArtifact(); var directory = new SealDirectory( artifact.Path, reader.ReadSortedReadOnlyArray(reader1 => reader1.ReadFileArtifact(), OrdinalFileArtifactComparer.Instance), (SealDirectoryKind)reader.ReadByte(), reader.ReadPipProvenance(), reader.ReadReadOnlyArray(reader1 => reader1.ReadStringId()), reader.ReadReadOnlyArray(reader1 => reader1.ReadStringId()), reader.ReadBoolean()); directory.SetDirectoryArtifact(artifact); Contract.Assume(directory.IsInitialized && directory.Directory == artifact); return(directory); }
/// <nodoc /> public static Xldb.Proto.SealDirectory ToSealDirectory(this SealDirectory pip, PathTable pathTable, Xldb.Proto.Pip parentPip, NameExpander nameExpander) { var xldbSealDirectory = new Xldb.Proto.SealDirectory { GraphInfo = parentPip, Kind = (SealDirectoryKind)(pip.Kind + 1), IsComposite = pip.IsComposite, Scrub = pip.Scrub, Directory = pip.Directory.ToDirectoryArtifact(pathTable, nameExpander), IsSealSourceDirectory = pip.IsSealSourceDirectory, Provenance = pip.Provenance.ToPipProvenance(pathTable), }; xldbSealDirectory.Patterns.AddRange(pip.Patterns.Select(key => key.ToString(pathTable))); xldbSealDirectory.Contents.AddRange(pip.Contents.Select(file => file.ToFileArtifact(pathTable, nameExpander))); xldbSealDirectory.ComposedDirectories.AddRange(pip.ComposedDirectories.Select(dir => dir.ToDirectoryArtifact(pathTable, nameExpander))); if (pip.Tags.IsValid) { xldbSealDirectory.Tags.AddRange(pip.Tags.Select(key => key.ToString(pathTable))); } return(xldbSealDirectory); }