예제 #1
0
        public static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            #if !DEBUG
            AppDomain.CurrentDomain.UnhandledException += (sender, args) =>
            {
                Exception exception = (Exception)args.ExceptionObject;

                ExceptionDialog formException = new ExceptionDialog("An unrecoverable problem has occurred!", exception);
                formException.ShowDialog();

                if (args.IsTerminating)
                    Application.Exit();
            };

            if (Process.GetProcessesByName("Cube").Length > 0)
            {
                MessageBox.Show("Please close Cube World before running the Character Editor.", "Character Editor", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            #endif

            Application.Run(new Editor());
        }
예제 #2
0
        private void DatabaseLoad(string filename)
        {
            try
            {
                database.Load(filename);
            }
            catch (Exception e)
            {
                ExceptionDialog exceptionDialog = new ExceptionDialog("Database appears to be corrupted!", e);
                exceptionDialog.ShowDialog(this);

                return;
            }

            Characters.Clear();
            listBoxCharacters.Items.Clear();

            try
            {
                int characterCount = database.ReadBlobByKey("num")[0];
                for (int i = 0; i < characterCount; ++i)
                {
                    Character.Character character = new Character.Character(i);
                    character.Load(database);

                    Characters.Add(character);
                    listBoxCharacters.Items.Add(character.Name);
                }
            }
            catch (Exception e)
            {
                ExceptionDialog exceptionDialog = new ExceptionDialog("Database appears to be corrupted!", e);
                exceptionDialog.ShowDialog(this);

                Characters.Clear();
                listBoxCharacters.Items.Clear();
            }
        }
        private void DatabaseLoad(string filename)
        {
            try
            {
                database.Load(filename);
            }
            catch (Exception e)
            {
                ExceptionDialog exceptionDialog = new ExceptionDialog("Database appears to be corrupted!", e);
                exceptionDialog.ShowDialog(this);

                return;
            }

            Characters.Clear();
            listBoxCharacters.Items.Clear();

            try
            {
                int characterCount = database.ReadBlobByKey("num")[0];
                for (int i = 0; i < characterCount; ++i)
                {
                    Character.Character character = new Character.Character(i);
                    character.Load(database);

                    Characters.Add(character);
                    listBoxCharacters.Items.Add(character.Name);
                }
            }
            catch (Exception e)
            {
                ExceptionDialog exceptionDialog = new ExceptionDialog("Database appears to be corrupted!", e);
                exceptionDialog.ShowDialog(this);

                Characters.Clear();
                listBoxCharacters.Items.Clear();
            }
        }