public Updater(FtpDetails ftp) { ADDRESS = ftp.Address; USER = ftp.User; PASS = ftp.Password; excludeExtensionsList = ftp.ExcludeExtention; }
/// <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); }
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(); }