Пример #1
0
 private void updateIfNecessary(LoginUtil loginUtil, LoginUI loginUI) {
   UpdateUtil updateUtil =
       new UpdateUtil(
           loginUtil.getLatestVersion(), username, loginUtil.getDownloadTicket(), loginUI);
   if (updateUtil.updateDarkMod()) restart();
   updateUtil.updateMinecraft();
 }
Пример #2
0
 public static void checkVersion(final Context Tcontext, final FloatingActionButton button) {
   Log.d("CheckVersion", "Start");
   if (UpdateUtil.getState() == UpdateState.NO_UPDATE) {
     UpdateUtil.setState(UpdateState.START_UPDATE_CHECK);
     new checkAct(Tcontext, button).executeOnExecutor(ExecutorManager.getExecutor());
   }
 }
Пример #3
0
  /**
   * Updates a given folder with the content of the update file
   *
   * @param forPath
   * @param exclusions list of files we don't want to remove from the given folder
   * @return
   * @throws IOException
   */
  private void applyUpdateFor(String forPath, String[] exclusions) throws UpdateException {

    Boolean success;
    try {
      // First lets remove the "old" code in order to unzip the update on that folder
      File updatedFolder = new File(distributionHome + File.separator + forPath);
      if (exclusions != null) {
        success = UpdateUtil.deleteDirectory(updatedFolder, exclusions);
      } else {
        success = UpdateUtil.deleteDirectory(updatedFolder);
      }
      if (success) {
        logger.debug("Removed outdated folder: " + updatedFolder.getAbsolutePath());
      } else {
        if (exclusions == null) {
          logger.error("Error removing outdated folder: " + updatedFolder.getAbsolutePath());
        } else {
          // If we have exclusions is normal to have a false success because the folder could not be
          // removed as it have excluded files on it
          logger.debug("Removed outdated files in folder: " + updatedFolder.getAbsolutePath());
        }
      }

      // Now we need to unzip the content of the update file into the given folder, we just removed
      // it, so lets create it again....
      if (!updatedFolder.exists()) {
        success = updatedFolder.mkdirs();
        if (success) {
          logger.debug("Created folder: " + updatedFolder.getAbsolutePath());
        } else {
          logger.error("Error creating folder: " + updatedFolder.getAbsolutePath());
        }
      }
      success = UpdateUtil.unzipDirectory(updateFile, distributionHome, forPath, dryrun);
    } catch (IOException e) {
      String error = "Error unzipping update file on: " + forPath;
      if (!UpdateAgent.isDebug) {
        error += Messages.getString("UpdateAgent.text.use.verbose", UpdateAgent.logFile);
      }
      throw new UpdateException(error, UpdateException.ERROR);
    }

    if (!success) {
      String error = "Error unzipping update file on: " + forPath;
      if (!UpdateAgent.isDebug) {
        error += Messages.getString("UpdateAgent.text.use.verbose", UpdateAgent.logFile);
      }
      throw new UpdateException(error, UpdateException.ERROR);
    }
  }
 /**
  * 清除此用户任何组内的信息,确保一个用户只属于一个用户组
  *
  * @param userid String
  */
 public void clearUgUList(String userid) throws Exception {
   String sql = "delete USERGOURPUSERLIST where userid='" + userid + "'";
   logger.info("clearsql :" + sql);
   UpdateUtil del = new UpdateUtil();
   del.executeUpdate(sql);
 }