private bool CheckUpdates(string[] updateUrl, string downloadDirName, string appName, OutdatedMsgStyle style) { bool succ = false; if (isUpdated(updateUrl) == true) { string downloadUrl = String.Empty; bool foundBeta = false; // check for beta // the new method as in sourceforge string downloadFileBetaName = string.Format("{0}-{1}-{2}", appName, GetVersion(VersionDepth.MajorMinorBuildRevision), "setup.zip"); downloadUrl = downloadDirName + downloadFileBetaName; if (fRemoteFileExits(downloadUrl)) { foundBeta = true; } else { // look for old method : sub folder with /beta/ downloadUrl = Path.Combine(downloadDirName, "beta/") + downloadFileBetaName; if (fRemoteFileExits(downloadUrl)) { foundBeta = true; } } succ = foundBeta; if (foundBeta == true) { DialogResult ans = DialogResult.No; if (mRelNotes != null) { frmVer v = new frmVer(this.AppIcon, this.AppImage, getMsgOutdated(mAppName, OutdatedMsgStyle.BetaVersionAvailble, false), mRelNotes); v.Text = this.GetApplicationTitle(this.mAppName, GetRemoteVersion(), VersionDepth.MajorMinorBuildRevision) + " BETA"; v.ShowDialog(); ans = v.DialogResult; } else { ans = MessageBox.Show(getMsgOutdated(mAppName, OutdatedMsgStyle.BetaVersionAvailble, true), mAppName, MessageBoxButtons.YesNo, MessageBoxIcon.Question); } if (ans == DialogResult.Yes) { Process.Start(downloadUrl); } } else // updated beta is not found { string downloadFileName = string.Empty; if (appName != string.Empty) { downloadFileName = string.Format("{0}-{1}-{2}", appName, GetVersion(VersionDepth.MajorMinor), this.AppSuffix); if (!downloadDirName[downloadDirName.Length - 1].Equals('/')) { downloadDirName = downloadDirName + "/"; } } downloadUrl = downloadDirName + downloadFileName; if (fRemoteFileExits(downloadUrl)) { // update is final DialogResult ans = DialogResult.No; if (mRelNotes != null) { frmVer v = new frmVer(this.AppIcon, this.AppImage, getMsgOutdated(mAppName, OutdatedMsgStyle.NewVersionOfAppAvailable, false), mRelNotes); v.Text = this.GetApplicationTitle(this.mAppName, GetRemoteVersion(), VersionDepth.MajorMinorBuildRevision); v.ShowDialog(); ans = v.DialogResult; } else { ans = MessageBox.Show(getMsgOutdated(mAppName, style, true), mAppName, MessageBoxButtons.YesNo, MessageBoxIcon.Question); } if (ans == DialogResult.Yes) { Process.Start(downloadUrl); } succ = true; } } } else { MessageBox.Show(getMsgUpToDate(), mAppName, MessageBoxButtons.OK, MessageBoxIcon.Information); succ = true; } return succ; }
private bool CheckUpdates(string[] updateUrl, string downloadDirName, string appName, OutdatedMsgStyle style) { bool succ = false; if (isUpdated(updateUrl) == true) { string downloadUrl = String.Empty; bool foundBeta = false; // check for beta // the new method as in sourceforge string downloadFileBetaName = string.Format("{0}-{1}-{2}", appName, GetVersion(VersionDepth.MajorMinorBuildRevision), "setup.zip"); downloadUrl = downloadDirName + downloadFileBetaName; if (fRemoteFileExits(downloadUrl)) { foundBeta = true; } else { // look for old method : sub folder with /beta/ downloadUrl = Path.Combine(downloadDirName, "beta/") + downloadFileBetaName; if (fRemoteFileExits(downloadUrl)) { foundBeta = true; } } succ = foundBeta; if (foundBeta == true) { DialogResult ans = DialogResult.No; if (mRelNotes != null) { frmVer v = new frmVer(this.AppIcon, this.AppImage, getMsgOutdated(mAppName, OutdatedMsgStyle.BetaVersionAvailble, false), mRelNotes); v.Text = this.GetApplicationTitle(this.mAppName, GetRemoteVersion(), VersionDepth.MajorMinorBuildRevision) + " BETA"; v.ShowDialog(); ans = v.DialogResult; } else { ans = MessageBox.Show(getMsgOutdated(mAppName, OutdatedMsgStyle.BetaVersionAvailble, true), mAppName, MessageBoxButtons.YesNo, MessageBoxIcon.Question); } if (ans == DialogResult.Yes) { Process.Start(downloadUrl); } } else // updated beta is not found { string downloadFileName = string.Empty; if (appName != string.Empty) { downloadFileName = string.Format("{0}-{1}-{2}", appName, GetVersion(VersionDepth.MajorMinor), this.AppSuffix); if (!downloadDirName[downloadDirName.Length - 1].Equals('/')) { downloadDirName = downloadDirName + "/"; } } downloadUrl = downloadDirName + downloadFileName; if (fRemoteFileExits(downloadUrl)) { // update is final DialogResult ans = DialogResult.No; if (mRelNotes != null) { frmVer v = new frmVer(this.AppIcon, this.AppImage, getMsgOutdated(mAppName, OutdatedMsgStyle.NewVersionOfAppAvailable, false), mRelNotes); v.Text = this.GetApplicationTitle(this.mAppName, GetRemoteVersion(), VersionDepth.MajorMinorBuildRevision); v.ShowDialog(); ans = v.DialogResult; } else { ans = MessageBox.Show(getMsgOutdated(mAppName, style, true), mAppName, MessageBoxButtons.YesNo, MessageBoxIcon.Question); } if (ans == DialogResult.Yes) { Process.Start(downloadUrl); } succ = true; } } } else { MessageBox.Show(getMsgUpToDate(), mAppName, MessageBoxButtons.OK, MessageBoxIcon.Information); succ = true; } return(succ); }