Esempio n. 1
0
        public KeyValuePair <string, MsDataFileUri[]>[] GetDataSourcePathsFileReplicates(IEnumerable <MsDataFileUri> dataSources)
        {
            var listNamedPaths = new List <KeyValuePair <string, MsDataFileUri[]> >();

            foreach (var dataSource in dataSources)
            {
                MsDataFilePath msDataFilePath = dataSource as MsDataFilePath;
                // Only .wiff files currently support multiple samples per file.
                // Keep from doing the extra work on other types.
                if (null != msDataFilePath && DataSourceUtil.IsWiffFile(msDataFilePath.FilePath))
                {
                    var paths = GetWiffSubPaths(msDataFilePath.FilePath);
                    if (paths == null)
                    {
                        return(null);    // An error or user cancelation occurred
                    }
                    // Multiple paths then add as samples
                    if (paths.Length > 1 ||
                        // If just one, make sure it has a sample part.  Otherwise,
                        // drop through to add the entire file.
                        (paths.Length == 1 && paths[0].SampleName != null))
                    {
                        foreach (var path in paths)
                        {
                            listNamedPaths.Add(new KeyValuePair <string, MsDataFileUri[]>(
                                                   path.SampleName, new MsDataFileUri[] { path }));
                        }
                        continue;
                    }
                }
                listNamedPaths.Add(new KeyValuePair <string, MsDataFileUri[]>(
                                       dataSource.GetFileNameWithoutExtension(), new[] { dataSource }));
            }
            return(listNamedPaths.ToArray());
        }
Esempio n. 2
0
        public KeyValuePair <string, MsDataFileUri[]>[] GetDataSourcePathsFileSingle(string name, IEnumerable <MsDataFileUri> dataSources)
        {
            var listPaths = new List <MsDataFileUri>();

            foreach (var dataSource in dataSources)
            {
                MsDataFilePath msDataFilePath = dataSource as MsDataFilePath;
                // Only .wiff files currently support multiple samples per file.
                // Keep from doing the extra work on other types.
                if (null != msDataFilePath && DataSourceUtil.IsWiffFile(msDataFilePath.FilePath))
                {
                    var paths = GetWiffSubPaths(msDataFilePath.FilePath);
                    if (paths == null)
                    {
                        return(null);    // An error or user cancelation occurred
                    }
                    listPaths.AddRange(paths);
                }
                else
                {
                    listPaths.Add(dataSource);
                }
            }
            return(new[] { new KeyValuePair <string, MsDataFileUri[]>(name, listPaths.ToArray()) });
        }