示例#1
0
        protected override bool OnExecute()
        {
            if (ExoEngine.ActiveWorld != null)
            {
                if (ExoEngine.Commands.Execute(typeof(FileClose)) != true)
                {
                    return(false);
                }
            }

            string strFileName = null;

            if (this.Params != null)
            {
                if (this.Params[0] is string)
                {
                    strFileName = (string)this.Params[0];
                }
            }
            else
            {
                OpenFileDialog ofd = new OpenFileDialog();
                ofd.Multiselect      = false;
                ofd.Title            = "Import Worldcraft Map";
                ofd.Filter           = ExoEngine.sWorldcraftMapFileFilter;
                ofd.InitialDirectory = ExoEngine.sWorldcraftMapPath;

                DialogResult result = ofd.ShowDialog();
                if (result != DialogResult.OK)
                {
                    return(false);
                }
                strFileName = ofd.FileName;
            }

            if (strFileName == null || File.Exists(strFileName) == false)
            {
                return(false);
            }

            ExoEngine.MainForm.Update();

            ImportProcess ip = new ImportProcess();

            ip.WorldcraftFileName = strFileName;
            //Debug2.Push();
            if (ip.Execute(ExoEngine.MainForm) != true)
            {
                return(false);
            }
            //Debug2.Pop();

            ip.World.Reset();
            ip.World.Dirty = true;

            ExoEngine.ActiveWorld = ip.World;
            ExoEngine.UpdateAll();

            return(true);
        }
示例#2
0
        protected override bool OnExecute()
        {
            if (ExoEngine.ActiveWorld.Dirty == true)
            {
                DialogResult result = ExoEngine.MessageBox("Current world has been modified.  Do you want to save your changes to '" + ExoEngine.ActiveWorld.FileName + "'?",
                                                           "Close World", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
                switch (result)
                {
                case DialogResult.Yes:
                    if (ExoEngine.Commands.Execute(typeof(FileSave)) != true)
                    {
                        return(false);
                    }
                    break;

                case DialogResult.No:
                    break;

                case DialogResult.Cancel:
                    return(false);
                }
            }

            World world = ExoEngine.ActiveWorld;

            ExoEngine.ActiveWorld = null;
            world.Dispose();
            ExoEngine.UpdateAll();

            return(true);
        }
示例#3
0
        protected override bool OnExecute()
        {
            World world = ExoEngine.ActiveWorld;

            // serialize World -> XML
            //Debug2.Push( "XmlSerializer.Serialize( world )" );
            try {
                StreamWriter  sOut   = new StreamWriter(world.FileName, false, System.Text.Encoding.Default, 1);
                XmlSerializer xmlOut = new System.Xml.Serialization.XmlSerializer(typeof(World));
                xmlOut.Serialize(sOut, world, new XmlSerializerNamespaces());
                sOut.Close();
            }
            catch (Exception e) {
                string fileName = BugTracking.WriteExceptionRecord(e);
                ExoEngine.Error("Error save World to file '" + world.FileName + "'.\n" +
                                "Please send this bug report to [email protected]:\n" +
                                fileName);
                return(false);
            }
            //Debug2.Pop();

            ExoEngine.ActiveWorld.Dirty = false;
            ExoEngine.UpdateAll();

            return(true);
        }
示例#4
0
 protected override bool OnExecute()
 {
     this.Checked = true;
     ExoEngine.Viewer.Renderer = ExoEngine.Viewer.AvailableRenderers.FindByType(this._typeRenderer);
     ExoEngine.UpdateAll();
     return(true);
 }
示例#5
0
 protected override bool OnExecute()
 {
     ExoEngine.MessageBox(
         "Copyright (c) 2001, 2002, Ben Houston\n" +
         "Questions, comments, bugs?  Send them to [email protected]",
         "About " + Application.ProductName,
         MessageBoxButtons.OK,
         MessageBoxIcon.Information);
     return(true);
 }
示例#6
0
 protected override bool OnExecute()
 {
     Water.IsUpdateNormals = !this.Checked;
     ExoEngine.UpdateAll();
     return(true);
 }
示例#7
0
 protected override bool OnExecute()
 {
     ExoEngine.MainForm.Viewer.IsGrid = !this.Checked;
     ExoEngine.UpdateAll();
     return(true);
 }
示例#8
0
 protected override bool OnExecute()
 {
     ExoEngine.ActiveWorld.Textures.OverideTextureQuality(_bMipmap, _minFilter, _maxFilter);
     ExoEngine.UpdateAll();
     return(true);
 }
示例#9
0
 protected override bool OnExecute()
 {
     ExoEngine.Viewer.RenderSettings.FaceColors = !this.Checked;
     ExoEngine.UpdateAll();
     return(true);
 }
示例#10
0
 protected override bool OnExecute()
 {
     Duck.IsRender = !this.Checked;
     ExoEngine.UpdateAll();
     return(true);
 }
示例#11
0
        protected override bool OnExecute()
        {
            if (ExoEngine.ActiveWorld != null)
            {
                if (ExoEngine.Commands.Execute(typeof(FileClose)) != true)
                {
                    return(false);
                }
            }

            string strFileName = null;

            if (this.Params != null)
            {
                if (this.Params[0] is string)
                {
                    strFileName = (string)this.Params[0];
                }
            }
            else
            {
                OpenFileDialog ofd = new OpenFileDialog();
                ofd.Multiselect      = false;
                ofd.Title            = "Open World";
                ofd.Filter           = ExoEngine.sWorldFileFilter;
                ofd.InitialDirectory = ExoEngine.sWorldPath;

                DialogResult result = ofd.ShowDialog();
                if (result != DialogResult.OK)
                {
                    return(false);
                }

                strFileName = ofd.FileName;
            }

            if (strFileName == null || File.Exists(strFileName) == false)
            {
                return(false);
            }

            // deserialize XML -> World
            //Debug2.Push( "XmlSerializer.Deserialize( world )" );
            World world = null;

            try {
                FileStream    sIn   = new FileStream(strFileName, FileMode.Open);
                XmlSerializer xmlIn = new System.Xml.Serialization.XmlSerializer(typeof(World));
                world = (World)xmlIn.Deserialize(sIn);
                sIn.Close();
            }
            catch (Exception e) {
                string fileName = BugTracking.WriteExceptionRecord(e);
                ExoEngine.Error("Error loading World from file '" + strFileName + "'.\n" +
                                "Please send this bug report to [email protected]:\n" +
                                fileName);
                return(false);
            }
            //Debug2.Pop();

            world.FileName = strFileName;
            world.Dirty    = false;
            world.Reset();

            ExoEngine.ActiveWorld = world;
            ExoEngine.UpdateAll();

            return(true);
        }