コード例 #1
0
        private void AddAFile(string draggedFilePath)
        {
            // this line is NOT used because .xml.gz (extensions with two dots) mess up with Path.GetExtension
            //var theExtension = Path.GetExtension(draggedFilePath).ToLowerInvariant();

            // we need to get the filename before parsing out the extension because if we assume that everything after the dot
            // is the extension and there are dots in the file path (i.e. in a folder name), this will mess up
            var filename     = Path.GetFileName(draggedFilePath);
            var theExtension = filename.Substring(filename.IndexOf(".")).ToLowerInvariant();

            switch (theExtension)
            {
            case ".raw":
            case ".mzml":
                RawDataForDataGrid zz = new RawDataForDataGrid(draggedFilePath);
                if (!SpectraFileExists(spectraFilesObservableCollection, zz))
                {
                    spectraFilesObservableCollection.Add(zz);
                }
                break;

            case ".pep.XML":
            case ".pep.xml":
                break;

            case ".psmtsv":
            case ".tsv":
                RawDataForDataGrid resultFileDataGrid = new RawDataForDataGrid(draggedFilePath);
                if (!SpectraFileExists(resultFilesObservableCollection, resultFileDataGrid))
                {
                    resultFilesObservableCollection.Add(resultFileDataGrid);
                }
                break;

            default:
                break;
            }
        }
コード例 #2
0
 private bool SpectraFileExists(ObservableCollection <RawDataForDataGrid> rDOC, RawDataForDataGrid zzz)
 {
     foreach (RawDataForDataGrid rdoc in rDOC)
     {
         if (rdoc.FileName == zzz.FileName)
         {
             return(true);
         }
     }
     return(false);
 }