Пример #1
0
					// ignore xml doctype + header
					reader.MoveToContent();
					doc.Load(reader);
					// create root node
					XmlNode root = doc.DocumentElement;
					foreach(XmlAttribute att in root.Attributes)
					{
						if (att.Name == "trackname")
						{
							control.buffer_trackname = att.Value;
						}
						if (att.Name == "trainnumber")
						{
Пример #2
0
						{
Пример #3
0
						{
							trainnumber = att.Value;
						}
						if (att.Name == "traintype")
						{
							traintype = att.Value;
						}
					}
					// create node list (below root)
					XmlNodeList xnl = root.ChildNodes;
					if (xnl.Count < 3)
					{
						System.Windows.Forms.MessageBox.Show("Fehler im Fahrplan "+filename+" !");
						doc = null;
						reader.Close();
						reader = null;
						return "";
					}
					foreach(XmlNode node in xnl)
					{
						if (node.Name == "properties")
						{
							foreach(XmlAttribute att in node.Attributes)
Пример #4
0
					// ignore xml doctype + header
Пример #5
0
				// create XmlDocument
				XmlDocument doc = new XmlDocument();
				try
				{
					// ignore xml doctype + header
Пример #6
0
 public XMLReader()
 {
     route = new Route("", "");
     trains = new ArrayList();
 }
Пример #7
0
								if (att.Name == "from")
								{
									from = att.Value;
									break;
								}
							}
						}
						if (node.Name == "description")
						{
							description = node.InnerText;
						}
						if (description != "" && from != "")
						{
							break;
						}
					}
				}
				catch (Exception)
				{
				}
				tr_num = trainnumber;
				tr_type = traintype;
				return (trainnumber+" ["+traintype+"] ab "+from+" "+description);
				doc = null;
				reader.Close();
				//reader = null;
			}
			else
Пример #8
0
        }

        public bool LoadTrain(string number)
        {
            return false;
        }

        public void LoadTrainDEBUG()
        {
            char c = new char();

            gnt = false;

            route = new Route("3313", "ab Saarbrücken Hbf 14.12.03 - 12.06.04 (Sa) (außer 25.12.03, 26.12.03, 31.12.03, 01.01.04, 10.02.04, 01.05.04, 26.05.04, 27.05.04)");

            Entry e1 = new Entry(EntryType.RADIO_MARKER, "141,9", "60", "60", "- ZF A 66 -", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "141,9", "", "", "Bft Saarbrücken Hbf", "", "13:04", '0', "13:04", '0');
            route.Entrys.Add(e1);
            /*marker = e1;
            route.Position = 1;*/
            marker = null;
            route.Position = -1;

            gnt = true;

            e1 = new Entry(EntryType.OPS_MARKER, "141,8", "", "", "Asig", "A60", "", c, "", c);
            route.Entrys.Add(e1);

            e1 = new Entry(EntryType.OPS_MARKER, "140,8", "", "", "Abzw Saarbrücken Hbf Srg", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.GNT_BEGINNING, "140,6", "90", "120", "", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "138,4", "110", "", "Jägersfreude Hp", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "137,1", "", "", "Esig", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "136,3", "", "", "Dudweiler", "", "", c, "", c);
            route.Entrys.Add(e1);
            //e1 = new Entry(EntryType.OPS_MARKER, "136,0", "90", "", "", "", "", c, "", c);
            //route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "135,9", "", "", "Asig", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "133,9", "", "", "Esig", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "133,8", "", "100", "", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "133,6", "110", "120", "", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "133,1", "", "", "Sulzbach (Saar)", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "132,9", "", "", "Asig", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "130,9", "", "", "Sulzbach (Saar) Altenwald Hp", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "130,3", "", "", "Esig", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "129,6", "", "", "Friedrichsthal (Saar)", "", "", c, "", c);
            route.Entrys.Add(e1);
            //e1 = new Entry(EntryType.OPS_MARKER, "129,4", "90", "", "", "", "", c, "", c);
            //route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "129,2", "", "", "Asig", "A50", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "128,8", "", "130", "", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "128,7", "", "", "Friedr. Mitte Hp", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.TUNNEL_BEGINNING, "128,4", "", "", "Bildstock-T", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "128,2", "", "", "", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.POSITION_JUMP, "+0,3", "", "", "", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.TUNNEL_ENDING, "127,9", "", "", "", "", "", c, "", c);
            route.Entrys.Add(e1);
            //e1 = new Entry(EntryType.OPS_MARKER, "127,8", "100", "", "", "", "", c, "", c);
            //route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "127,5", "", "", "Bildstock Hp", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "125,9", "", "", "Esig", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "125,6", "", "120", "", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "124,9", "", "", "Landsweiler-Reden", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "124,5", "", "", "Asig", "A50", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "123,4", "", "", "Esig", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "122,0", "", "", "Abzw Neunkirchen", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "", "", "", "(Saar) Hbf", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "121,8", "", "", "Zsig", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "121,8", "70", "70", "Zsig", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "120,8", "", "80", "", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.RADIO_MARKER, "120,6", "", "", "- ZF A 73 -", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "120,6", "", "", "Neunkirchen", "", "13:18", '0', "13:19", '0');
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "", "", "", "(Saar) Hbf", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "120,5", "", "", "Asig", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "120,2", "90", "120", "", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "118,5", "", "", "Wiebelskirchen Hp", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "115,7", "", "", "Esig", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "114,8", "", "", "Ottweiler (Saar)", "", "13:23", '0', "13:23", '5');
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "114,6", "", "", "Asig", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "114,5", "", "100", "", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "114,3", "", "120", "", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "113,9", "100", "130", "", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "111,6", "", "", "Sbk 34", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "113,3", "110", "140", "", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "113,2", "", "", "Niederlinxweiler Hp", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "106,8", "", "", "Oberlinxweiler Hp", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "107,6", "", "", "Esig", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "106,3", "", "", "St Wendel", "", "13:29", '0', "13:30", '0');
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "106,2", "90", "130", "Asig", "", "", c, "", c);
            route.Entrys.Add(e1);
            //e1 = new Entry(EntryType.OPS_MARKER, "105,7", "100", "", "", "", "", c, "", c);
            //route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "103,1", "", "100", "", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "103,0", "", "", "Baltersweiler Hp", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "103,0", "", "", "Sbk 30", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "102,5", "", "110", "", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "101,9", "", "", "El 1", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "101,8", "", "", "El 2", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "100,9", "", "", "Hofeld Hp", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "99,0", "", "", "Sbk 28", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "98,8", "", "", "Namborn Hp", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "97,0", "", "100", "", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "96,4", "110", "120", "", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "96,0", "", "", "Sbk 26", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "94,4", "", "", "Walhausen (Saar) Hp", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "92,5", "80", "90", "Esig", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "91,9", "", "100", "", "", "", c, "", c);
            route.Entrys.Add(e1);
            //e1 = new Entry(EntryType.OPS_MARKER, "91,8", "90", "", "", "", "", c, "", c);
            //route.Entrys.Add(e1);
            e1 = new Entry(EntryType.RADIO_MARKER, "91,8", "", "", "- ZF A 78 -", "", "", c, "", c);
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "91,8", "", "", "Türkismühle", "", "13:39", '0', "13:39", '5');
            route.Entrys.Add(e1);
            e1 = new Entry(EntryType.OPS_MARKER, "91,3", "", "", "Asig", "", "", c, "", c);
            route.Entrys.Add(e1);
Пример #9
0
            {
                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;