コード例 #1
0
ファイル: MainWindow.cs プロジェクト: elitak/NoxTools
 private void menuItem18_Click(object sender, EventArgs e)
 {
     UpdateList list = new UpdateList();
     list.ShowDialog();
 }
コード例 #2
0
ファイル: MainWindow.cs プロジェクト: elitak/NoxTools
        public MainWindow()
        {
            Splash spl = new Splash();
            spl.Show();
            spl.Refresh();

            //BEGIN COMPILATION
            Compiler com = new Compiler();
            ArrayList list = new ArrayList();
            string error = "Script function compilation failed!\n\n";
            results = com.CompileCDir("scripts", "ScriptFuncs.dll");
            if (results.Errors.Count > 0)
            {
                MessageBox.Show(error + com.errors, "ERROR");
            }
            //END COMPILATION

                if (Directory.Exists(Application.StartupPath + "\\updated"))
                {
                    Directory.Delete(Application.StartupPath + "\\updated", true);
                    JustUpdated = true;
                }
                AutoUpdate.UpdateFileName = "Update.txt";

                if (AutoUpdate.IsUpdatable("http://www.noxhub.net/updates/MapEditor",""))
                {
                    if (MessageBox.Show(null, "NoxMapEditor updates are available, do you wish to update now?", "Update Report", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                    {
                        AutoUpdate.UpdateFiles("http://www.noxhub.net/updates/MapEditor","");
                        if (AutoUpdate.IsUpdatable("http://www.noxhub.net/updates/MapEditor/Files", ""))
                        {
                                AutoUpdate.UpdateFiles("http://www.noxhub.net/updates/MapEditor/Files", "");
                        }
                        MessageBox.Show("Update Complete, Please restart the program!\nUse the Help-Updates menu to view changes");
                        Environment.Exit(1);
                        return;
                    }
                }
                else if (AutoUpdate.IsUpdatable("http://www.noxhub.net/updates/MapEditor/Files", ""))
                {
                    if (MessageBox.Show(null, "NoxMapEditor updates are available, do you wish to update now?", "Update Report", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                    {
                        AutoUpdate.UpdateFiles("http://www.noxhub.net/updates/MapEditor/Files", "");
                        MessageBox.Show("Update Complete, Please restart the program!\nUse the Help-Updates menu to view changes");
                        Environment.Exit(1);
                        return;
                    }
                }
                if (AutoUpdate.IsUpdatable("http://www.noxhub.net/updates/MapEditor/scripts/defaults","scripts\\objects\\defaultmods\\"))
                {
                    if (MessageBox.Show(null, "New default mods are available, do you wish to update now?", "Update Report", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                    {
                        //Directory.Delete("scripts\\objects\\defaultmods\\",true);
                        AutoUpdate.UpdateFiles("http://www.noxhub.net/updates/MapEditor/scripts/defaults","scripts\\objects\\defaultmods\\");
                        MessageBox.Show("Update Complete, please use the Help-Updates menu to view changes");
                    }
                }
                if (AutoUpdate.IsUpdatable("http://www.noxhub.net/updates/MapEditor/scripts/editors","scripts\\objects\\modeditors\\"))
                {
                    if (MessageBox.Show(null, "New mod editors are available, do you wish to update now?", "Update Report", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                    {
                        AutoUpdate.UpdateFiles("http://www.noxhub.net/updates/MapEditor/scripts/editors","scripts\\objects\\modeditors\\");
                        MessageBox.Show("Update Complete, please use the Help-Updates menu to view changes");
                    }
                }
                if (AutoUpdate.IsUpdatable("http://www.noxhub.net/updates/MapEditor/scripts/functions", "scripts\\functions\\"))
                {
                    if (MessageBox.Show(null, "A new Functions.cs is available, do you wish to update now?", "Update Report", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                    {
                        AutoUpdate.UpdateFiles("http://www.noxhub.net/updates/MapEditor/scripts/functions", "scripts\\functions\\");
                        MessageBox.Show("Update Complete, please use the Help-Updates menu to view changes");
                    }
                }

            map = new Map();
            myMap = new MAP_GUI();
            cultures = GetSupportedCultures();
            InitializeComponent();

            MenuItem item;
            foreach (CultureInfo culture in cultures)
            {
                item = new MenuItem(culture.NativeName, new EventHandler(lang_Click));
                item.RadioCheck = true;
                langSelect.MenuItems.Add(item);
            }
            if (!Directory.Exists("Templates/"))
                Directory.CreateDirectory("Templates/");
            foreach (String templates in Directory.GetDirectories("Templates/"))
            {
                item = new MenuItem(templates.Replace("Templates/",""), templatesClick);
                templateMenu.MenuItems.Add(item);
            }

            mapType.Items.AddRange(new ArrayList(Map.MapInfo.MapTypeNames.Values).ToArray());
            mapType.SelectedIndex = 3;//arena by default

            unsafe
            {
                uint pHandle = (uint)GuiPanel.Handle.ToInt32();
                myMap.InitScreen(pHandle);
                myMap.Update_Window();
                //myMap.InitScreen(pHandle);
                //Encoding.ASCII ascii = new Encoding.ASCII;
                //Encoding unicode = Encoding.Unicode;

                //char * text = (char*)myMap.getName(11);
                //tabGUI.Text =
                //string str = Marshal.PtrToStringAnsi(text);

                //myMap.AddObject(1840, 100, 100);
            }
            LoadNewMap();
            spl.Close();
            if (JustUpdated)
            {
                UpdateList ulist = new UpdateList();
                ulist.ShowDialog();
            }
        }