diff options
author | schwabe <devnull@localhost> | 2012-04-28 19:58:02 +0200 |
---|---|---|
committer | schwabe <devnull@localhost> | 2012-04-28 19:58:02 +0200 |
commit | 63e466054c2f1d66e4618ac4d73208751f1e5bd1 (patch) | |
tree | 84a00021ec486093b406ec050087ee486f6e6958 /src/de/blinkt/openvpn/ProfileManager.java | |
parent | 031186e74c9f174d05a09c4059def7bcbc558ac6 (diff) |
Almost ready for version 0.4
Diffstat (limited to 'src/de/blinkt/openvpn/ProfileManager.java')
-rw-r--r-- | src/de/blinkt/openvpn/ProfileManager.java | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/de/blinkt/openvpn/ProfileManager.java b/src/de/blinkt/openvpn/ProfileManager.java index 078403e1..5e6b7912 100644 --- a/src/de/blinkt/openvpn/ProfileManager.java +++ b/src/de/blinkt/openvpn/ProfileManager.java @@ -3,6 +3,7 @@ package de.blinkt.openvpn; import java.io.FileNotFoundException; import java.io.IOException; import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; import java.io.StreamCorruptedException; import java.util.Collection; import java.util.HashMap; @@ -66,6 +67,28 @@ public class ProfileManager { profiles.put(profile.getUUID().toString(),profile); } + + + public void saveProfile(Context context,VpnProfile profile) { + // First let basic settings save its state + + ObjectOutputStream vpnfile; + try { + vpnfile = new ObjectOutputStream(context.openFileOutput((profile.getUUID().toString() + ".vp"),Activity.MODE_PRIVATE)); + + vpnfile.writeObject(profile); + vpnfile.flush(); + vpnfile.close(); + } catch (FileNotFoundException e) { + + e.printStackTrace(); + } catch (IOException e) { + + e.printStackTrace(); + } + } + + void loadVPNList(Context context) { profiles = new HashMap<String, VpnProfile>(); SharedPreferences settings =context.getSharedPreferences(PREFS_NAME,Activity.MODE_PRIVATE); |