예제 #1
0
  /** 读取系统配置信息 */
  private static void readSystemConfig() {
    File file = new File(sAppRootDirPath, SYS_CONFIG_FILE_NAME);
    if (!file.exists()) {
      systemConfigInfo = null;
      return;
    }
    String systemConfigJson = FileUtil.readFileFromSDCard(sAppRootDirPath, SYS_CONFIG_FILE_NAME);

    Gson gson = new Gson();
    systemConfigInfo = gson.fromJson(systemConfigJson, SystemConfigInfo.class);
  }
예제 #2
0
  /**
   * 读取用户配置信息
   *
   * @return void
   */
  private static void readUserConfig() {
    File file = new File(sCurrentUserConfigPath, USER_CONFIG_FILE_NAME);
    if (!file.exists()) {
      userConfigInfo = null;
      return;
    }

    String userConfigJson =
        FileUtil.readFileFromSDCard(sCurrentUserConfigPath, USER_CONFIG_FILE_NAME);

    Gson gson = new Gson();
    userConfigInfo = gson.fromJson(userConfigJson, UserConfigInfo.class);
  }
예제 #3
0
  private static void writeUserConfig() {
    File file = new File(sCurrentUserConfigPath);

    if (!file.exists()) {
      file.mkdirs();
    }

    checkUserConfig();

    Gson gson = new Gson();
    String userConfigJson = gson.toJson(userConfigInfo);
    synchronized (sSynByte) {
      try {
        FileUtil.saveFileToSDCard(sCurrentUserConfigPath, USER_CONFIG_FILE_NAME, userConfigJson);
      } catch (Exception e) {
      }
    }
  }
예제 #4
0
  private static void writeSystemConfig() {
    File file = new File(sAppRootDirPath);

    if (!file.exists()) {
      file.mkdirs();
    }

    checkSystemConfig();

    Gson gson = new Gson();
    String systemConfigJson = gson.toJson(systemConfigInfo);
    synchronized (sSynByte) {
      try {
        FileUtil.saveFileToSDCard(sAppRootDirPath, SYS_CONFIG_FILE_NAME, systemConfigJson);
      } catch (Exception e) {
      }
    }
  }