using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Text;
using System.Windows.Forms;

namespace Skyside3gbySourceEditer
{
    public partial class MapEditer : Form
    {
        public MapEditer()
        {
            InitializeComponent();
            //numericUpDown1.TextChanged += new EventHandler(numericUpDown1_ValueChanged);
        }

        void CreateCMD()
        {
            FileStream fs = new FileStream("D:\\~wtmp.bat", FileMode.Create);
            StreamWriter sw = new StreamWriter(fs, Encoding.Default);

            sw.Write("java -jar Skyside3gbyMapEditer.jar");
            
            sw.Close();
            fs.Close();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            CreateCMD();
            Process cmd = new Process();
            cmd.StartInfo.FileName = "D:\\~wtmp.bat";
            cmd.StartInfo.RedirectStandardOutput = true;
            cmd.StartInfo.UseShellExecute = false;
            cmd.StartInfo.CreateNoWindow = true;
            cmd.Start();
            string info = cmd.StandardOutput.ReadToEnd();
            cmd.WaitForExit();

            cmd.Close(); 
        }

        private void button1_Click_1(object sender, EventArgs e)
        {
            Close();
        }
    }
}
