示例#1
0
        /// <summary>
        /// Reads FileOrDirectoryArtifact
        /// </summary>
        public FileOrDirectoryArtifact ReadFileOrDirectoryArtifact()
        {
            Start <FileOrDirectoryArtifact>();
            var isFileArtifact = ReadBoolean();
            var value          = isFileArtifact
                ? FileOrDirectoryArtifact.Create(ReadFileArtifact())
                : FileOrDirectoryArtifact.Create(ReadDirectoryArtifact());

            End();
            return(value);
        }
示例#2
0
 /// <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();
 }
示例#3
0
        /// <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);
        }