private void BtnCreate_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtPath.Text))
            {
                MessageBox.Show("You must select a valid mod path!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (cmbVersionList.SelectedItem == null)
            {
                MessageBox.Show("You must select a valid openra version!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (string.IsNullOrEmpty(txtModID.Text))
            {
                MessageBox.Show("You must enter a valid mod id!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (string.IsNullOrEmpty(txtModName.Text))
            {
                MessageBox.Show("You must enter a valid mod name!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                DialogResult = DialogResult.OK;
                Close();

                string modFullPath = txtPath.Text + "\\" + txtModName.Text;
                if (!Directory.Exists(modFullPath))
                {
                    Directory.CreateDirectory(modFullPath);
                }

                mod         = new OraMod(txtPath.Text);
                mod.Version = cmbVersionList.SelectedItem.ToString();
                mod.Author  = txtModAuthor.Text;
                mod.ModID   = txtModID.Text;
                mod.ModName = txtModName.Text;
                mod.Create();

                DownloadTask downloadTask = new DownloadTask()
                {
                    FileName     = "OpenModSDK",
                    FileSavePath = System.Environment.GetEnvironmentVariable("TEMP") + "\\OpenModSDK-" + cmbVersionList.SelectedItem.ToString() + ".zip",
                    Url          = "https://github.com/OpenRA/OpenRAModSDK/archive/" + cmbVersionList.SelectedItem.ToString() + ".zip"
                };

                frmDownload downloadingWin = new frmDownload(downloadTask);
                downloadingWin.afterDownload += DownloadingWin_afterDownload;
                downloadingWin.ShowDialog();
            }
        }
Exemple #2
0
        public frmDownload(DownloadTask downloadTask)
        {
            InitializeComponent();
            this.downloadTask = downloadTask;
            timer             = new Timer();
            timer.Tick       += Timer_Tick;
            timer.Interval    = 100;
            timer.Start();
            DownloadManager.Instance.Download(downloadTask);
            downloadTask.DownloadFinished += DownloadTask_DownloadFinished;
            downloadTask.DownloadFailture += DownloadTask_DownloadFailture;
            progressBar2.Maximum           = 100;
            changeButtonTextDelegate       = new ChangeButtonTextDelegate(ChangeButtonTextDelegateMethod);
            closeFormDelegate              = new CloseFormDelegate(CloseFormDelegateMethod);

            InitLanguageOptions();
        }
Exemple #3
0
 public void Download(DownloadTask downloadTask)
 {
     Taskes.Add(downloadTask);
 }
Exemple #4
0
 public void Cancel(DownloadTask downloadTask)
 {
     Taskes.Remove(downloadTask);
 }