.RawファイルからTIC,XICを取得する
MSfileReader3.2から仕様が変わったため備忘録
MSレンジの指定方法が特徴的でStartMS1, StartMS2には
"195.1-195.3"のような開始MS-終了MSをstringで入力する必要がある。
intChroOperatorは0:処理なし、1:StartMS1+StartMS2, 2:StartMS1-StartMS2の処理を行う。
測定時間はdouble型の測定開始からの秒数が得られるので、通常のキャストだとエラーが発生する。
private async void textBox1_DragDrop(object sender, DragEventArgs e)
{
string[] fileName =(string[])e.Data.GetData(DataFormats.FileDrop, false);
Series tic = await ticdraw(fileName[]);
chart.Series.Add(tic);
}
async private Task<Series> ticdraw(string[] fileName)
{
chart.Series.Clear();
MSFileReader_XRawfile rawfile = new MSFileReader_XRawfile();
rawfile.Open(fileName[0]);
rawfile.SetCurrentController(0, 1);
double lowmass = 0;
double highmass = 0;
rawfile.GetLowMass(ref lowmass);//ここを開始MSとして指定する
rawfile.GetHighMass(ref highmass);//ここを終了MSとして指定する
int intChrotype = 0;// (0=MSrange,1=TIC,2=BasePeak)
int intChroOperator = 0; //
int intChroType2 = 0; //
string stringBstrFilter = null;
string stringMSrange1 = null;
stringMSrange1 = lowmass.ToString() + "-" + highmass.ToString();
string stringMSrange2 = null;/
double DoubleDelay = 0.0;
Series tic = new Series();
double DoubleStartTime = 0.0;
double DoubleEndTime = 0.0;
int intSommthingType = 0;
int intSmoothingValue = 0;
object varChrodata = null;
object varPeakFlags = null;
int intArraySize2 = 0;
await Task.Run(() =>
{
rawfile.GetChroData(intChrotype, intChroOperator, intChroType2, stringBstrFilter, stringMSrange1, stringMSrange2, DoubleDelay, ref DoubleStartTime, ref DoubleEndTime, intSommthingType, intSmoothingValue, ref varChrodata, ref varPeakFlags, ref intArraySize2);
double[,] Chrodata = (double[,])varChrodata;
for (long l = 1; l < intArraySize2; l++)
{
TimeSpan time = TimeSpan.FromMinutes(Chrodata[0, l]);//測定時間を取得する場合
tic.Points.AddXY(l, Chrodata[1, l]);
}
});
rawfile.Close();
return tic;
}