Exemple #1
0
        public void load(string filename)
        {
            if (File.Exists(filename))
            {
                Translator tr = new Translator();
                List<ClassContainer> list = tr.readData(filename);

                if (list.Count > 0)
                {
                    ClassContainer container = list[0];

                    if (container.type == ClassType.Map)
                    {
                        Map map = (Map)container.objekt;

                        setMap(map);

                    }
                }
                if (list.Count > 1)
                {
                    ClassContainer container = list[1];

                    if (container.objekt is List<Route>)
                    {
                        List<Route> routelist = (List<Route>)container.objekt;

                    }

                }

                handleData();

            }
            else
            {
                throw new GameException("Datei exsistiert nicht");
            }
        }
Exemple #2
0
        private void ladenToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog open = new OpenFileDialog();
            open.Filter = "Map-File | *.map";
            if (open.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                Translator tr = new Translator();
                List<ClassContainer> list = tr.readData(open.FileName);

                ClassContainer container = list[0];
                try
                {
                    Map map = (Map)container.objekt;

                    loadMap(map);

                }
                catch
                {
                    MessageBox.Show("Fehler beim Parsen der Map-Datei");
                }

            }
        }