using System.IO;
private void LoadIPFile(string fpath)
{
var AllLines = (string[])null;
var numberOfLines = 0;
var readLines = 0;
var ipList = new List<Point>();
if (!File.Exists(fpath))
return;
if (Path.GetExtension(fpath) != ".ip")
return;
numberOfLines = File.ReadLines(fpath).Count();
AllLines = new string[numberOfLines];
using (var sr = File.OpenText(fpath))
{
sr.BaseStream.Position = 0;
readLines = 0;
while (!sr.EndOfStream)
{
AllLines[readLines] = sr.ReadLine();
++readLines;
}
}
for (int i = 0; i < readLines; ++i)
{
var words = AllLines[i].Split(new Char[] { '\t', ' ' });
if (words.Length == 4)
{
var ip = new Point();
ip.x = Convert.ToSingle(words[2]);
ip.y = Convert.ToSingle(words[3]);
ipList.Add(ip);
}
else
{
Console.WriteLine("Error : ip 파일 형식이 잘못되었습니다. {0}, 줄 {1}", Path.GetFileName(fpath), readLines);
}
}
this.originGCPs = ipList;
}