コード例 #1
0
        private void btn_Extract_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog
            {
                Title            = "Select a game handler to extract",
                DefaultExt       = "nc",
                InitialDirectory = Gaming.GameManager.Instance.GetJsScriptsPath(),
                Filter           = "nc files (*.nc)|*.nc"
            };

            DialogResult result = ofd.ShowDialog();

            if (result == DialogResult.OK)
            {
                DownloadPrompt downloadPrompt = new DownloadPrompt(null, mainForm, ofd.FileName);
                downloadPrompt.ShowDialog();
            }
        }
コード例 #2
0
        private void btn_Download_Click(object sender, EventArgs e)
        {
            if (list_Games.SelectedItems.Count == 1)
            {
                int     index   = list_Games.Items.IndexOf(list_Games.SelectedItems[0]);
                Handler handler = searchHandlers[index];

                Regex  pattern        = new Regex("[\\/:*?\"<>|]");
                string frmHandleTitle = pattern.Replace(handler.Title, "");
                if (File.Exists(Path.Combine(Gaming.GameManager.Instance.GetJsScriptsPath(), frmHandleTitle + ".js")))
                {
                    DialogResult dialogResult = MessageBox.Show("An existing script with the name " + (frmHandleTitle + ".js") + " already exists. Do you wish to overwrite it?", "Script already exists", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                    if (dialogResult != DialogResult.Yes)
                    {
                        return;
                    }
                }

                DownloadPrompt downloadPrompt = new DownloadPrompt(handler, mainForm);
                downloadPrompt.ShowDialog();
            }
        }
コード例 #3
0
        private void btn_Download_Click(object sender, EventArgs e)
        {
            if (list_Games.SelectedItems.Count == 1)
            {
                //int index = list_Games.Items.IndexOf(list_Games.SelectedItems[0]);
                //Handler handler = searchHandlers[index];
                Handler handler = null;
                foreach (Handler hndl in searchHandlers)
                {
                    if (list_Games.SelectedItems[0].SubItems[8].Text == hndl.Id)
                    {
                        handler = hndl;
                        break;
                    }
                }

                if (handler == null)
                {
                    MessageBox.Show("Error fetching handler", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                //Regex pattern = new Regex("[\\/:*?\"<>|]");
                //string frmHandleTitle = pattern.Replace(handler.Title, "");
                //if (File.Exists(Path.Combine(Gaming.GameManager.Instance.GetJsScriptsPath(), frmHandleTitle + ".js")))
                //{
                //    DialogResult dialogResult = MessageBox.Show("An existing script with the name " + (frmHandleTitle + ".js") + " already exists. Do you wish to overwrite it?", "Script already exists", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                //    if (dialogResult != DialogResult.Yes)
                //    {
                //        return;
                //    }
                //}

                DownloadPrompt downloadPrompt = new DownloadPrompt(handler, mainForm, null);
                downloadPrompt.ShowDialog();
            }
        }
コード例 #4
0
        private void btn_Download_Click(object sender, EventArgs e)
        {
            DownloadPrompt downloadPrompt = new DownloadPrompt(Handler, mainForm, null);

            downloadPrompt.ShowDialog();
        }