Witam jestem bardzo początkującym programistą i mam napisać program który posłuży do odczytywania z pliku danych GPS oraz pokaże je na mapie i mam plik odczytany teraz problem z usunięciem znaków tak zeby dodać to do GMap,np "$RATLL,01,5422.057,N,01552.127,E,,101554.00,T,*2B" gdzie żeby odczytać lokalizacje musi by 54.22057 N oraz 15.552127E mam nadzieje że rozumiecie o co chodzi.
private void button6_Click(object sender, EventArgs e)
{ listBox1.Items.Clear();
int y = 0;
try
{
//using (StreamReader sr = new StreamReader("ARPA.txt"))
// odczytaj.Filter = "Dokumenty tekstowe (*.txt)|*.txt";
// odczytaj.ShowDialog();
FileStream fsR = new FileStream("ARPA.txt", FileMode.Open, FileAccess.Read);
StreamReader sr = new StreamReader(fsR);
while (!sr.EndOfStream)
{
string linia = sr.ReadLine();
string[] cz = linia.Split(new char[] { ',', '*' });
int ile_kom = cz.Count();
if (cz[0] == "$RATLL" )
{
listBox1.Items.Add(linia);
y++;
listBox1.Refresh();
//Console.WriteLine(linia.Remove(9, 31));
// string tekst;
if (cz[0] == "$RATLL")
{
// char[] usun = { '$', 'R', 'A', 'T', 'L', ',' };
// linia.Remove(0, 9);
// linia.Remove(31, 50);
// linia.TrimStart(usun);
string szerokosc = linia;
string dlugosc = linia;
szerokosc.Remove(0, 9);
szerokosc.Remove(19, 50);
dlugosc.Remove(0, 21);
dlugosc.Remove(21, 50);
//double x = Convert.ToDouble(szerokosc);
// double yi = Convert.ToDouble(dlugosc);
//Console.WriteLine(linia);
// MessageBox.Show(linia);
GMapOverlay routes = new GMapOverlay("routes");
List<PointLatLng> points = new List<PointLatLng>();
// points.Add(new PointLatLng(x, yi));
GMapRoute route = new GMapRoute(points, "Droga do roboty");
route.Stroke = new Pen(Color.Red, 3);
routes.Routes.Add(route);
gMapControl1.Overlays.Add(routes);
gMapControl1.Update();
gMapControl1.Refresh();
listBox1.Refresh();
}
}
}
sr.Close();
}
catch (Exception ko)
{
Console.WriteLine(ko.ToString());
}
}