Exemplo n.º 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);
  }
Exemplo n.º 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);
  }
Exemplo n.º 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) {
      }
    }
  }
Exemplo n.º 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) {
      }
    }
  }