/// <summary> /// Reads FileOrDirectoryArtifact /// </summary> public FileOrDirectoryArtifact ReadFileOrDirectoryArtifact() { Start <FileOrDirectoryArtifact>(); var isFileArtifact = ReadBoolean(); var value = isFileArtifact ? FileOrDirectoryArtifact.Create(ReadFileArtifact()) : FileOrDirectoryArtifact.Create(ReadDirectoryArtifact()); End(); return(value); }
/// <summary> /// Writes a FileOrDirectoryArtifact /// </summary> public void Write(FileOrDirectoryArtifact value) { Start <FileOrDirectoryArtifact>(); Write(value.IsFile); if (value.IsFile) { Write(value.FileArtifact); } else { Write(value.DirectoryArtifact); } End(); }
/// <nodoc /> public static Xldb.Proto.FileOrDirectoryArtifact ToFileOrDirectoryArtifact(this FileOrDirectoryArtifact artifact, PathTable pathTable, NameExpander nameExpander) { if (!artifact.IsValid) { return(null); } var xldbFileOrDirectoryArtifact = new Xldb.Proto.FileOrDirectoryArtifact(); if (artifact.IsDirectory) { xldbFileOrDirectoryArtifact.IsDirectory = true; xldbFileOrDirectoryArtifact.DirectoryArtifact = artifact.DirectoryArtifact.ToDirectoryArtifact(pathTable, nameExpander); } else { xldbFileOrDirectoryArtifact.IsFile = true; xldbFileOrDirectoryArtifact.FileArtifact = artifact.FileArtifact.ToFileArtifact(pathTable, nameExpander); } return(xldbFileOrDirectoryArtifact); }