Editor.Level.SetFileName C# (CSharp) Method

SetFileName() public method

public SetFileName ( string filename ) : void
filename string
return void
        public void SetFileName(string filename)
        {
            this.FileName = filename;
        }

Usage Example

Beispiel #1
0
        private void ReadLevel()
        {
            this.updating = true;

            var d = new OpenFileDialog();

            if (d.ShowDialog() == DialogResult.OK)
            {
                this.ClearLevel();


                var level = new Level();
                level.SetFileName(d.FileName);
                this.lstLevel.Items.Add(level);

                XmlDocument xml = new XmlDocument();
                xml.Load(d.FileName);
                level.Read(xml["level"]);
                foreach (XmlElement el in xml["level"]["actors"])
                {
                    Actor actor = new Actor();
                    actor.Read(el);
                }
                foreach (XmlElement el in xml["level"]["physics"])
                {
                    Physic p;
                    if (el.Name == "circle")
                    {
                        p = new Circle();
                    }
                    else if (el.Name == "polygon")
                    {
                        p = new Polygon();
                    }
                    else
                    {
                        MessageBox.Show(string.Format("unsupported physic '{0}'. Element skipped.", el.Name));
                        continue;
                    }
                    p.Read(el);
                }
            }

            this.updating = false;
            this.UpdateControls();
            this.GetCurrent().SelectedItem = this.GetCurrent().Items[0];
        }
All Usage Examples Of Editor.Level::SetFileName