Ejemplo n.º 1
0
        private SourceInfo[] getSourceInfo(FileInfo fileInfo, bool getDetails)
        {
            var sourceInfoList = new List <SourceInfo>();

            sourceInfoList.Add(new SourceInfo());
            sourceInfoList[0].type         = getSourceType(fileInfo);
            sourceInfoList[0].name         = fileInfo.Name;
            sourceInfoList[0].hasDetails   = getDetails;
            sourceInfoList[0].size         = (UInt64)fileInfo.Length;
            sourceInfoList[0].dateModified = fileInfo.LastWriteTime;
            if (sourceInfoList[0].type != String.Empty)
            {
                if (!getDetails)
                {
                    return(sourceInfoList.ToArray());
                }

                try
                {
                    ReaderList readerList   = ReaderList.FullReaderList;
                    var        readerConfig = new ReaderConfig
                    {
                        simAsSpectra = Properties.Settings.Default.SimAsSpectra,
                        srmAsSpectra = Properties.Settings.Default.SrmAsSpectra,
                        combineIonMobilitySpectra = Properties.Settings.Default.CombineIonMobilitySpectra,
                        ignoreZeroIntensityPoints = Properties.Settings.Default.IgnoreZeroIntensityPoints,
                        acceptZeroLengthSpectra   = Properties.Settings.Default.AcceptZeroLengthSpectra,
                        allowMsMsWithoutPrecursor = false
                    };

                    MSDataList msInfo = new MSDataList();
                    readerList.read(fileInfo.FullName, msInfo, readerConfig);

                    foreach (MSData msData in msInfo)
                    {
                        SourceInfo sourceInfo = new SourceInfo();
                        sourceInfo.type = sourceInfoList[0].type;
                        sourceInfo.name = sourceInfoList[0].name;
                        if (msInfo.Count > 1)
                        {
                            sourceInfo.name += " (" + msData.run.id + ")";
                        }
                        sourceInfo.populateFromMSData(msData);
                        sourceInfoList.Add(sourceInfo);
                    }
                } catch
                {
                    sourceInfoList[0].spectra = 0;
                    sourceInfoList[0].type    = "Invalid " + sourceInfoList[0].type;
                }

                foreach (SourceInfo sourceInfo in sourceInfoList)
                {
                    sourceInfo.size         = (UInt64)fileInfo.Length;
                    sourceInfo.dateModified = fileInfo.LastWriteTime;
                }
                return(sourceInfoList.ToArray());
            }
            return(null);
        }
Ejemplo n.º 2
0
        private SourceInfo[] getSourceInfo(FileInfo fileInfo, bool getDetails)
        {
            var sourceInfoList = new List <SourceInfo>();

            sourceInfoList.Add(new SourceInfo());
            sourceInfoList[0].type         = getSourceType(fileInfo);
            sourceInfoList[0].name         = fileInfo.Name;
            sourceInfoList[0].hasDetails   = getDetails;
            sourceInfoList[0].size         = (UInt64)fileInfo.Length;
            sourceInfoList[0].dateModified = fileInfo.LastWriteTime;
            if (sourceInfoList[0].type != String.Empty)
            {
                if (!getDetails)
                {
                    return(sourceInfoList.ToArray());
                }

                try
                {
                    ReaderList readerList   = ReaderList.FullReaderList;
                    var        readerConfig = new ReaderConfig
                    {
                        simAsSpectra = Program.SimAsSpectra,
                        srmAsSpectra = Program.SrmAsSpectra
                    };

                    MSDataList msInfo = new MSDataList();
                    readerList.read(fileInfo.FullName, msInfo, readerConfig);

                    foreach (MSData msData in msInfo)
                    {
                        SourceInfo sourceInfo = new SourceInfo();
                        sourceInfo.type = sourceInfoList[0].type;
                        sourceInfo.name = sourceInfoList[0].name;
                        if (msInfo.Count > 1)
                        {
                            sourceInfo.name += " (" + msData.run.id + ")";
                        }
                        sourceInfo.populateFromMSData(msData);
                        sourceInfoList.Add(sourceInfo);
                    }
                } catch
                {
                    sourceInfoList[0].spectra = 0;
                    sourceInfoList[0].type    = "Invalid " + sourceInfoList[0].type;
                }

                foreach (SourceInfo sourceInfo in sourceInfoList)
                {
                    sourceInfo.size         = (UInt64)fileInfo.Length;
                    sourceInfo.dateModified = fileInfo.LastWriteTime;
                }
                return(sourceInfoList.ToArray());
            }
            return(null);
        }
Ejemplo n.º 3
0
        private SourceInfo[] getSourceInfo( FileInfo fileInfo, bool getDetails )
        {
            var sourceInfoList = new List<SourceInfo>();
            sourceInfoList.Add( new SourceInfo() );
            sourceInfoList[0].type = getSourceType( fileInfo );
            sourceInfoList[0].name = fileInfo.Name;
            sourceInfoList[0].hasDetails = getDetails;
            sourceInfoList[0].size = (UInt64) fileInfo.Length;
            sourceInfoList[0].dateModified = fileInfo.LastWriteTime;
            if( sourceInfoList[0].type != String.Empty )
            {
                if( !getDetails )
                    return sourceInfoList.ToArray();

                try
                {
                    ReaderList readerList = ReaderList.FullReaderList;
                    var readerConfig = new ReaderConfig
                        {
                            simAsSpectra = Program.SimAsSpectra,
                            srmAsSpectra = Program.SrmAsSpectra
                        };

                    MSDataList msInfo = new MSDataList();
                    readerList.read( fileInfo.FullName, msInfo, readerConfig );

                    foreach( MSData msData in msInfo )
                    {
                        SourceInfo sourceInfo = new SourceInfo();
                        sourceInfo.type = sourceInfoList[0].type;
                        sourceInfo.name = sourceInfoList[0].name;
                        if( msInfo.Count > 1 )
                            sourceInfo.name += " (" + msData.run.id + ")";
                        sourceInfo.populateFromMSData( msData );
                        sourceInfoList.Add( sourceInfo );
                    }
                } catch
                {
                    sourceInfoList[0].spectra = 0;
                    sourceInfoList[0].type = "Invalid " + sourceInfoList[0].type;
                }

                foreach( SourceInfo sourceInfo in sourceInfoList )
                {
                    sourceInfo.size = (UInt64) fileInfo.Length;
                    sourceInfo.dateModified = fileInfo.LastWriteTime;
                }
                return sourceInfoList.ToArray();
            }
            return null;
        }