protected internal override UpdaterHandler OnTransition(UpdaterHandler[] all, UpdaterHandler next) { if (LocalVersion == RemoteVersion) { return(null); // over, no next any more } if (LocalVersion > RemoteVersion) { AppendLog("Local version greater than remote version! clear local all!"); // clear all, re update all UpdaterVerifyFileHandler.ClearAllUpdateFiles(_localUpdaterPath, this); // IMPOSSIBLE! local version cannot greater than Remote version! this must be a revert operation LocalVersion = 0; } if (RemoteVersion == 0) // no update! over now! { return(null); } AppendLog("Local version {0}, Remote Version {1}, do update!", LocalVersion, RemoteVersion); // default, next go return(next); }
private void Threader(object state) { if (Directory.Exists(_localUpdatePath)) { AppendLog("Flag check not valid!"); UpdaterVerifyFileHandler.ClearAllUpdateFiles(_localUpdatePath); } // else do nothing Finish(); }
protected internal override void Start() { // get local version try { LocalVersion = LocalVersionFile.GetLocalVersion(_localUpdaterPath, _versionFileName, 0); } catch (Exception e) { // parse resources_version file failed, clear all OnError(this, e.Message); UpdaterVerifyFileHandler.ClearAllUpdateFiles(_localUpdaterPath, this); } RemoteVersion = _requestVersionHandler.GetVersion(); Finish(); }