Example #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            // check for one valid url or users permission.
            ISiteHandler siteHandler = SiteHandlerManager.GetSiteHandlerByName(cbVersionControl.SelectedItem as string);

            if (siteHandler == null || siteHandler.IsValidURL(ModURL) || (MessageBox.Show(this, Messages.MSG_INVALID_URL_SAVE_ANYWAY, Messages.MSG_TITLE_ATTENTION, MessageBoxButtons.YesNo) == DialogResult.Yes))
            {
                DialogResult = DialogResult.OK;
                Close();
            }
        }
Example #2
0
        private void btnGotoSpaceport_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(ModURL))
            {
                MessageBox.Show(this, Messages.MSG_ENTER_VALID_URL_FIRST);
            }
            else
            {
                try
                {
                    ISiteHandler siteHandler = SiteHandlerManager.GetSiteHandlerByURL(ModURL); ////ByName(cbVersionControl.SelectedItem as string);
                    if (siteHandler == null)
                    {
                        // set selected sitehandler to none.
                        cbVersionControl.SelectedItem = cbVersionControl.Items[0];
                        string msg = string.Format(Messages.MSG_NO_SITEHANDLER_FOUND_FOR_URL_0, ModURL);
                        MessageBox.Show(this, msg, Messages.MSG_TITLE_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }

                    ModInfo newModInfo = null;
                    if (siteHandler.IsValidURL(ModURL))
                    {
                        newModInfo = siteHandler.GetModInfo(ModURL);
                    }

                    if (newModInfo != null)
                    {
                        newModInfo.AdditionalURL = ModInfo.AdditionalURL;
                        ModInfo = newModInfo;
                    }
                }
                catch (Exception ex)
                {
                    string msg = string.Format(Messages.MSG_ERROR_DURING_MODINFO_UPDATE, ModURL, Environment.NewLine, ex.Message);
                    MessageBox.Show(this, msg, Messages.MSG_TITLE_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Log.AddErrorS(msg, ex);
                }
            }
        }