// Path: src/com/gotech/tv/launcher/service/ContextManager.java
// public class ContextManager {
//     //private static final String TAG = ContextManager.class.getSimpleName();
// 
//     private static ContextManager instance = null;
// 
//     public static String ACTION_SN_ACTIVATE_RESULT = "action.sn.activate.result";
//     public static String ACTION_USER_REGIST_RESULT = "action.user.regist.result";
// 
//     public static String ACTION_LOAD_HOME_DATA_FINISH = "action.load.home.data.finish";
// 
//     public static String LOCAL_INSTALL_PATH = Environment.getExternalStorageDirectory() + "/TvLauncher";
//     public static String LOCAL_CACHE_PATH = LOCAL_INSTALL_PATH + "/download/";
//     public static String LOCAL_CONFIG_PATH = LOCAL_INSTALL_PATH + "/config/";
//     public static String LOCAL_FILE_PATH = LOCAL_INSTALL_PATH + "/files/";
// 
//     static {
//         File file = new File(LOCAL_CACHE_PATH);
//         if (!file.exists()) {
//             file.mkdirs();
//         }
//         file = new File(LOCAL_CONFIG_PATH);
//         if (!file.exists()) {
//             file.mkdirs();
//         }
//         file = new File(LOCAL_FILE_PATH);
//         if (!file.exists()) {
//             file.mkdirs();
//         }
//     }
// 
//     /**
//      * CN:最好使用baseContext
//      */
//     private Context mCtx;
//     private UserInfoVo mUserInfo;
// 
//     private ContextManager(Context ctx) {
//         mCtx = ctx;
//     }
// 
//     public static synchronized ContextManager obtain(Context ctx) {
//         if (instance == null) {
//             instance = new ContextManager(ctx.getApplicationContext());
//         }
//         return instance;
//     }
// 
//     /**
//      * CN:校验用户信息
//      *
//      * @return
//      */
//     public boolean checkUserInfoExist() {
//         UserInfoVo info = getUserInfo();
//         return (info != null && !TextUtils.isEmpty(info.mUserName));
//     }
// 
//     public UserInfoVo getUserInfo() {
//         if (mUserInfo == null) {
//             String userInfoStr = FileUtils.getInstance().getRegFile(Constant.UserDataTxt, mCtx);
//             if (!TextUtils.isEmpty(userInfoStr)) {
//                 mUserInfo = new UserInfoVo();
//                 String[] info = userInfoStr.split("\\|\\^\\|");
//                 mUserInfo.mUserName = info[0];
//                 mUserInfo.mPassword = info[1];
//             }
//         }
//         return mUserInfo;
//     }
// 
//     public String getUserName() {
//         return mUserInfo == null ? "" : mUserInfo.mUserName;
//     }
// 
// }


import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.util.Log;
import android.view.View;
import com.gotech.tv.launcher.service.ContextManager;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.RandomAccessFile;
import java.net.HttpURLConnection;
import java.net.URL;
package com.gotech.tv.launcher.util;




public class FileUtils {

    public static String TAG = "FileUtils";

    private static FileUtils instance;

    /**
     * singleton
     *
     * @return
     */
    public static FileUtils getInstance() {
        if (instance == null)
            instance = new FileUtils();
        return instance;
    }

    /**
     * 获取注册文件内容
     *
     * @param fileName
     * @param c
     * @return
     */
    public String getRegFile(String fileName, Context c) {
        String str = "";
        FileInputStream inStream = null;
        ByteArrayOutputStream outStream = null;
        try {
// Path: src/com/gotech/tv/launcher/service/ContextManager.java
// public class ContextManager {
//     //private static final String TAG = ContextManager.class.getSimpleName();
// 
//     private static ContextManager instance = null;
// 
//     public static String ACTION_SN_ACTIVATE_RESULT = "action.sn.activate.result";
//     public static String ACTION_USER_REGIST_RESULT = "action.user.regist.result";
// 
//     public static String ACTION_LOAD_HOME_DATA_FINISH = "action.load.home.data.finish";
// 
//     public static String LOCAL_INSTALL_PATH = Environment.getExternalStorageDirectory() + "/TvLauncher";
//     public static String LOCAL_CACHE_PATH = LOCAL_INSTALL_PATH + "/download/";
//     public static String LOCAL_CONFIG_PATH = LOCAL_INSTALL_PATH + "/config/";
//     public static String LOCAL_FILE_PATH = LOCAL_INSTALL_PATH + "/files/";
// 
//     static {
//         File file = new File(LOCAL_CACHE_PATH);
//         if (!file.exists()) {
//             file.mkdirs();
//         }
//         file = new File(LOCAL_CONFIG_PATH);
//         if (!file.exists()) {
//             file.mkdirs();
//         }
//         file = new File(LOCAL_FILE_PATH);
//         if (!file.exists()) {
//             file.mkdirs();
//         }
//     }
// 
//     /**
//      * CN:最好使用baseContext
//      */
//     private Context mCtx;
//     private UserInfoVo mUserInfo;
// 
//     private ContextManager(Context ctx) {
//         mCtx = ctx;
//     }
// 
//     public static synchronized ContextManager obtain(Context ctx) {
//         if (instance == null) {
//             instance = new ContextManager(ctx.getApplicationContext());
//         }
//         return instance;
//     }
// 
//     /**
//      * CN:校验用户信息
//      *
//      * @return
//      */
//     public boolean checkUserInfoExist() {
//         UserInfoVo info = getUserInfo();
//         return (info != null && !TextUtils.isEmpty(info.mUserName));
//     }
// 
//     public UserInfoVo getUserInfo() {
//         if (mUserInfo == null) {
//             String userInfoStr = FileUtils.getInstance().getRegFile(Constant.UserDataTxt, mCtx);
//             if (!TextUtils.isEmpty(userInfoStr)) {
//                 mUserInfo = new UserInfoVo();
//                 String[] info = userInfoStr.split("\\|\\^\\|");
//                 mUserInfo.mUserName = info[0];
//                 mUserInfo.mPassword = info[1];
//             }
//         }
//         return mUserInfo;
//     }
// 
//     public String getUserName() {
//         return mUserInfo == null ? "" : mUserInfo.mUserName;
//     }
// 
// }


// Path: src/com/gotech/tv/launcher/util/FileUtils.java
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.util.Log;
import android.view.View;
import com.gotech.tv.launcher.service.ContextManager;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.RandomAccessFile;
import java.net.HttpURLConnection;
import java.net.URL;

package com.gotech.tv.launcher.util;




public class FileUtils {

    public static String TAG = "FileUtils";

    private static FileUtils instance;

    /**
     * singleton
     *
     * @return
     */
    public static FileUtils getInstance() {
        if (instance == null)
            instance = new FileUtils();
        return instance;
    }

    /**
     * 获取注册文件内容
     *
     * @param fileName
     * @param c
     * @return
     */
    public String getRegFile(String fileName, Context c) {
        String str = "";
        FileInputStream inStream = null;
        ByteArrayOutputStream outStream = null;
        try {
            fileName = ContextManager.LOCAL_CONFIG_PATH + fileName;