本文整理汇总了C#中CsvFileReader.ReadCorrData方法的典型用法代码示例。如果您正苦于以下问题:C# CsvFileReader.ReadCorrData方法的具体用法?C# CsvFileReader.ReadCorrData怎么用?C# CsvFileReader.ReadCorrData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CsvFileReader
的用法示例。
在下文中一共展示了CsvFileReader.ReadCorrData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: fileInit
private void fileInit(string _filename)
{
try
{
using (CsvFileReader myFileReader = new CsvFileReader(_filename))
{
CorrDataFileName = _filename;
// seperate out pure filename
string[] split = _filename.Split(new char[] { '\\' });
split = split[split.Length - 1].Split(new char[] { '.' });
FrameImgFolderPath = ParrentFolderPath + '\\' + split[0];
if (!System.IO.Directory.Exists(FrameImgFolderPath))
{
System.IO.Directory.CreateDirectory(FrameImgFolderPath);
}
// read file
CorrData myCorrData;
myFileReader.ReadCorrData(out myCorrData);
int newFrameStart = 0;
DateTime newFrameStartTime = myCorrData.datatime;
double lastAngle = myCorrData.angle;
myFileReader.ReadCorrData(out myCorrData);
bool movingRight = (myCorrData.angle > lastAngle) ? true : false;
lastAngle = myCorrData.angle;
DateTime lastTime = myCorrData.datatime;
normalizeConstant = myCorrData.distance[myCorrData.distance.Length - 1] - 15.0;
int dataNumber = 2;
while (myFileReader.ReadCorrData(out myCorrData))
{
dataNumber++;
if (movingRight ^ (myCorrData.angle > lastAngle))
{
movingRight = !movingRight;
IntervalList.AddLast(
new MyInterval(newFrameStart, dataNumber - 2,
newFrameStartTime, lastTime,
FrameImgFolderPath + '\\' + (IntervalList.Count + 1).ToString()));
newFrameStart = dataNumber - 1;
newFrameStartTime = myCorrData.datatime;
}
lastAngle = myCorrData.angle;
lastTime = myCorrData.datatime;
}
if (newFrameStart < dataNumber - 1)
IntervalList.AddLast(
new MyInterval(newFrameStart, dataNumber - 1,
newFrameStartTime, lastTime,
FrameImgFolderPath + '\\' + (IntervalList.Count + 1).ToString()));
CurrentInterval = IntervalList.First;
}
}
catch (IOException)
{
CorrDataFileName = null;
FrameImgFolderPath = null;
IntervalList.Clear();
CurrentInterval = null;
throw;
}
}
示例2: createAndSaveFrameImg
void createAndSaveFrameImg()
{
try
{
using (CsvFileReader myFileReader = new CsvFileReader(CorrDataFileName))
{
for (int i = 0; i < CurrentInterval.Value.start - 1; i++)
{
myFileReader.ReadLine();
myFileReader.ReadLine();
}
Bitmap myBitmap = new Bitmap(ImWidth, ImHeight);
for (int i = CurrentInterval.Value.start; i <= CurrentInterval.Value.end; i++)
{
CorrData myCorrData;
myFileReader.ReadCorrData(out myCorrData);
for (int j = 0; j < myCorrData.Corrout_abs.Length && j < myCorrData.distance.Length; j++)
{
double theta = myCorrData.angle / 360.0 * 2 * Math.PI;
double r = ImHeight * (myCorrData.distance[j] - 15.0) / normalizeConstant; // subtract local leakage offset and normalize to image size
if (r < 0)
{
continue;
}
Int32 nx = clipIndex(r * Math.Sin(theta) + 0.5 * ImWidth, ImWidth - 1);
Int32 ny = clipIndex(ImHeight - r * Math.Cos(theta), ImHeight - 1);
int intensity = (int)(255.0 * myCorrData.Corrout_abs[j]);
myBitmap.SetPixel(nx, ny, Color.FromArgb(intensity, intensity, intensity));
}
}
myBitmap.Save(CurrentInterval.Value.imgFileName,ImageFormat.Bmp);
}
}
catch (IOException)
{
throw;
}
}