diff options
author | schwabe <none@none> | 2012-04-28 19:58:02 +0200 |
---|---|---|
committer | schwabe <none@none> | 2012-04-28 19:58:02 +0200 |
commit | 6dbfffefaf70609ac5bb7b3ebd71a0258427360a (patch) | |
tree | 84a00021ec486093b406ec050087ee486f6e6958 /src/de/blinkt/openvpn/ProfileManager.java | |
parent | 6f74ca80d395542ae92e7e9eb97af11aa4c706bd (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); |