示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="app"></param>
        /// <param name="style"></param>
        /// <param name="history">Whether to include Version History</param>
        /// <returns></returns>
        public string getMsgOutdated(string app, OutdatedMsgStyle style, bool history)
        {
            string msg = "";

            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            if (history)
            {
                if (null != mRelNotes)
                {
                    sb.AppendLine();
                    sb.AppendLine();
                    foreach (string var in mRelNotes)
                    {
                        sb.AppendLine(string.Format("* {0}", var));
                    }
                }
            }

            switch (style)
            {
            case OutdatedMsgStyle.AppVerNumberAvailable:
                msg = app + " " + GetRemoteVersion() + " is available.\nWould you like to download it now?";
                break;

            case OutdatedMsgStyle.NewVersionOfAppAvailable:
                msg = string.Format("New version of {0} is available.{1}\nWould you like to download it now?", app, sb.ToString());
                break;

            case OutdatedMsgStyle.BetaVersionAvailble:
                msg = String.Format("A beta version of {0} is available.{1}\nWould you like to download it now?", mAppName, sb.ToString());
                break;
            }

            return(msg + getMsgStatistics());
        }
示例#2
0
        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;
        }
示例#3
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="app"></param>
        /// <param name="style"></param>
        /// <param name="history">Whether to include Version History</param>
        /// <returns></returns>
        public string getMsgOutdated(string app, OutdatedMsgStyle style, bool history)
        {
            string msg = "";

            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            if (history)
            {
                if (null != mRelNotes)
                {
                    sb.AppendLine();
                    sb.AppendLine();
                    foreach (string var in mRelNotes)
                    {
                        sb.AppendLine(string.Format("* {0}", var));
                    }
                }
            }

            switch (style)
            {
                case OutdatedMsgStyle.AppVerNumberAvailable:
                    msg = app + " " + GetRemoteVersion() + " is available.\nWould you like to download it now?";
                    break;
                case OutdatedMsgStyle.NewVersionOfAppAvailable:
                    msg = string.Format("New version of {0} is available.{1}\nWould you like to download it now?", app, sb.ToString());
                    break;
                case OutdatedMsgStyle.BetaVersionAvailble:
                    msg = String.Format("A beta version of {0} is available.{1}\nWould you like to download it now?", mAppName, sb.ToString());
                    break;
            }

            return msg + getMsgStatistics();
        }
示例#4
0
 /// <summary>
 /// Checks all download directories and returns true if succesfully completed
 /// </summary>
 /// <param name="updateUrl"></param>
 /// <param name="downloadDirs">An array of download directories</param>
 /// <param name="appName"></param>
 /// <param name="style"></param>
 /// <returns></returns>
 public bool CheckUpdates(string[] updateUrl, string[] downloadDirs, string appName, OutdatedMsgStyle style)
 {
     foreach (string dirName in downloadDirs)
     {
         if (CheckUpdates(updateUrl, dirName, appName, style))
         {
             return true;
         }
     }
     return false;
 }
示例#5
0
        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);
        }
示例#6
0
 /// <summary>
 /// Checks all download directories and returns true if succesfully completed
 /// </summary>
 /// <param name="updateUrl"></param>
 /// <param name="downloadDirs">An array of download directories</param>
 /// <param name="appName"></param>
 /// <param name="style"></param>
 /// <returns></returns>
 public bool CheckUpdates(string[] updateUrl, string[] downloadDirs, string appName, OutdatedMsgStyle style)
 {
     foreach (string dirName in downloadDirs)
     {
         if (CheckUpdates(updateUrl, dirName, appName, style))
         {
             return(true);
         }
     }
     return(false);
 }