{ return; } m_filename = XMLConf.File; m_path = XMLConf.Path; } public void LoadTimeTableFromZusi() { string file = ""; string path = m_path; string trainnumber = ""; string traintype = ""; RegistryKey rk = null; rk = Registry.CurrentUser.OpenSubKey("Software").OpenSubKey("Zusi"); if (rk == null) { if (XMLConf.Path=="") { MessageBox.Show("Weder Zusi noch Pfadangabe gefunden!"); } else { path = XMLConf.Path+"\\Temp\\"; } } if (buffer_trainnumber != "" /*&& buffer_traintype != ""*/) { trainnumber = buffer_trainnumber; traintype = buffer_traintype; if (rk != null) { path = rk.GetValue("ZusiDir").ToString(); //if (!use_DB) path += "\\Temp\\"; if (path.ToLower().IndexOf("path") < 0) path += "\\Temp\\"; } else if (path == m_path) { MessageBox.Show("FEHLER! Zusi nicht in Registry gefunden!"); return; } } /* else { if (rk != null) { if (path == "") { path = rk.GetValue("ZusiDir").ToString(); if (!use_DB) path += "\\Temp\\"; } else { path = path+"\\"; } trainnumber = rk.OpenSubKey("Zusi").GetValue("Zugnummer").ToString(); traintype = rk.OpenSubKey("Zusi").GetValue("Gattung").ToString(); } else { System.Windows.Forms.MessageBox.Show("Zusi nicht gefunden! (Dieser Fehler dürfte nie auftreten)"); return; } } */ int bb = trainnumber.IndexOf("/"); if (bb == -1) bb = trainnumber.IndexOf("+"); if (bb != -1) { trainnumber = trainnumber.Remove(bb,1); } if (trainnumber[trainnumber.Length-1] == 'e') { trainnumber = trainnumber.Remove(trainnumber.Length-1,1); } m_filename = XMLConf.File; //file = m_filename; //path = m_path; //System.Console.WriteLine("Path: "+path+" MPath:"+m_path+" File: "+file+" MFilename:"+m_filename+" Type: "+traintype+trainnumber+".txt"); string [] files_org = new string[0]; /*if (XMLConf.UseDB) { string schedule = ""; string trackName = ""; buffer_trackname = (string)track_ht[traintype+trainnumber]; trackName = buffer_trainpath + @"\" + buffer_trackname + ".str";//getTrackName(); Route help_route = XMLReader.ReadTackFromDB(trackName, !left, gnt, false); if (help_route != null) { route = help_route; } else { route = null; return; } schedule = buffer_trainpath; schedule += @"\EBuLa\train_"+buffer_trainschedule+"_"+traintype+trainnumber+".xml"; route = XMLReader.AddTimetableToRoute(route, schedule); route = XMLReader.RemoveHighSpeed(route, this); } else // no useDB*/ { if (m_filename == "") { try { if (searchInTrackPath) { files_org = System.IO.Directory.GetFiles(getTrackPath(), "*"+getTrainName()+".txt"); } else { //files_org = System.IO.Directory.GetFiles(path, "*"+traintype+trainnumber+".txt"); files_org = System.IO.Directory.GetFiles(path, traintype+trainnumber+".txt"); if (files_org.Length < 1 && current_Train != null) files_org = System.IO.Directory.GetFiles(path, current_Train.File); } } catch (Exception e) { MessageBox.Show("Datei nicht im Pfad: "+path+" gefunden! ("+e.Message.ToString()+")"); } } else { try { files_org = System.IO.Directory.GetFiles(path, "*"+m_filename); } catch (Exception e) { MessageBox.Show("Datei ("+m_filename+") nicht im Pfad: "+path+" gefunden! ("+e.Message.ToString()+")"); } } bb = trainnumber.IndexOf("_"); if ( bb != -1 ) { trainnumber = trainnumber.Remove(bb,1); } if (files_org.Length > 1) { System.Windows.Forms.MessageBox.Show("Zu viele Dateien zur Zugnummer gefunden! Zusi Temp Ordner löschen!"); return; } if (files_org.Length < 1) { System.Windows.Forms.MessageBox.Show("Keine Datei zur Zugnummer gefunden!"); return; } file = files_org[0]; // <DEBUG> foreach (string s in files_org) { //Console.WriteLine(s); } //Console.WriteLine("File found: " + file); // </DEBUG> */ /*else // gotfilename != null { file = gotfilename; trainnumber = System.IO.Path.GetFileNameWithoutExtension(file); trainnumber = RemoveChars(trainnumber); }*/ route = new Route(trainnumber.ToString(), "EMTPY"); ParseFile(file); } if (route == null) { System.Windows.Forms.MessageBox.Show("Fehler! Fahrplan nicht gefunden!"); m_filename = ""; path = ""; return; } route.Position = -1;