- * Chrome から user_session を取得。エラーが起こった場合、例外を投げずに空文字を返す
- * </p>
- * @return user_session
- */
- private String GetUserSesionChrome() {
- String user_session = "";
- String cookie_file = "";
- String googleChrome = "\\Google\\Chrome\\User Data\\Default\\Cookies";
- try {
- String local_Appdir = System.getenv("LOCALAPPDATA");
- if (local_Appdir != null && !local_Appdir.isEmpty()) {
- // Win7 32bit
- cookie_file = local_Appdir + googleChrome;
- if (Path.isFile(cookie_file)) {
- String dataStr = Path.ReadAllText(cookie_file, "UTF-8");
- user_session = CutUserSession(dataStr, cookie_file);
- if (!user_session.isEmpty()) {
- return user_session;
- }
- }
- }
- String profile_dir = System.getenv("USERPROFILE");
- if (profile_dir != null && !profile_dir.isEmpty()) {
- // XP 32bit
- cookie_file = profile_dir
- + "\\Local Settings\\Application Data" + googleChrome;
- if (Path.isFile(cookie_file)) {
- String dataStr = Path.ReadAllText(cookie_file, "UTF-8");
- user_session = CutUserSession(dataStr, cookie_file);
- return user_session;
- }
- }
- String app_dir = System.getenv("APPDATA");
- if (app_dir != null && !app_dir.isEmpty()) {
- // ??? just try
- cookie_file = app_dir + googleChrome;
- if (Path.isFile(cookie_file)) {
- String dataStr = Path.ReadAllText(cookie_file, "UTF-8");
- user_session = CutUserSession(dataStr, cookie_file);
- return user_session;
- }
- }
- return user_session;
- } catch (Exception e) {
- e.printStackTrace();
- return user_session;
- }
- }
-
- /** <p>