private IEnumerable <RemoteItem> ListItems(ChorusUrl chorusUrl, ChorusContents chorusContents) { IEnumerable <RemoteItem> items = new RemoteItem[0]; if (null != chorusContents.experiments) { items = items.Concat(chorusContents.experiments.Select(experiment => new RemoteItem(chorusUrl.SetExperimentId(experiment.id).AddPathPart(experiment.GetName()), experiment.GetName(), DataSourceUtil.FOLDER_TYPE, null, 0))); } if (null != chorusContents.files) { items = items.Concat(chorusContents.files.Select( file => { ChorusUrl fileUrl = (ChorusUrl)chorusUrl.SetFileId(file.id) .AddPathPart(file.GetName()) .ChangeRunStartTime(file.GetAcquisitionDateTime()) .ChangeModifiedTime(file.GetModifiedDateTime()); return(new RemoteItem(fileUrl, file.GetName(), GetFileType(file), file.GetModifiedDateTime(), file.fileSizeBytes)); } )); } if (null != chorusContents.projects) { items = items.Concat(chorusContents.projects.Select(project => new RemoteItem(chorusUrl.SetProjectId(project.id).AddPathPart(project.GetName()), project.GetName(), DataSourceUtil.FOLDER_TYPE, null, project.GetSize()))); } return(items); }
public ChorusContents Merge(ChorusContents chorusContents) { return(new ChorusContents { myProjects = myProjects ?? chorusContents.myProjects, sharedProjects = sharedProjects ?? chorusContents.sharedProjects, publicProjects = publicProjects ?? chorusContents.publicProjects, myExperiments = myExperiments ?? chorusContents.myExperiments, sharedExperiments = sharedExperiments ?? chorusContents.sharedExperiments, publicExperiments = publicExperiments ?? chorusContents.publicExperiments, myFiles = myFiles ?? chorusContents.myFiles, sharedFiles = sharedFiles ?? chorusContents.sharedFiles, publicFiles = publicFiles ?? chorusContents.publicFiles, }); }