Example #1
0
 public Updater(FtpDetails ftp)
 {
     ADDRESS = ftp.Address;
     USER    = ftp.User;
     PASS    = ftp.Password;
     excludeExtensionsList = ftp.ExcludeExtention;
 }
Example #2
0
        /// <summary>
        /// If necessary, update application version from ftp.
        /// </summary>
        /// <param name="ftp">FTP server details - mandatory</param>
        /// <param name="appName">app name - optional</param>
        /// <returns></returns>
        public bool UpdateAssemblyVersion(FtpDetails ftp, string appName = "")
        {
            FillDetails(ftp, appName);
            bool updated = false;

            if (updated = ShouldBeUpdate())//ftp has different verion
            {
                UpdateManager.WriteToConsole("Start to update...", Color.YELLOW);
                if (updated = UpdateVersion())
                {
                    UpdateManager.WriteToConsole("Restart...", Color.YELLOW);
                    updated = RestartApplication();
                }
            }
            return(updated);
        }
Example #3
0
 private void FillDetails(FtpDetails ftp, string appName)
 {
     if (appName == string.Empty)//UpdateNewVersion automatically(run the dll from the app itself)
     {
         mApplicationPath     = GetCurrentApplicationPath();
         mUpdater             = new Updater(ftp);
         mUpdater.ExeFilePath = mApplicationPath;
         mLocalVersion        = GetCurrentAssemblyVersion();
     }
     else//UpdateNewVersion from loader(external Loader.exe file)
     {
         mAppName = appName;
         if (Path.GetExtension(appName) != ".exe")
         {
             mAppName += ".exe";
         }
         mApplicationPath     = GetApplicationPath();
         mUpdater             = new Updater(ftp);
         mUpdater.ExeFilePath = mApplicationPath;
         mLocalVersion        = GetAssemblyVersion();
     }
     mUpdaterlVersion = GetFtpAssemblyVersion();
 }