summaryrefslogtreecommitdiff
path: root/src/de/blinkt/openvpn/ProfileManager.java
diff options
context:
space:
mode:
authorschwabe <devnull@localhost>2012-04-28 19:58:02 +0200
committerschwabe <devnull@localhost>2012-04-28 19:58:02 +0200
commit63e466054c2f1d66e4618ac4d73208751f1e5bd1 (patch)
tree84a00021ec486093b406ec050087ee486f6e6958 /src/de/blinkt/openvpn/ProfileManager.java
parent031186e74c9f174d05a09c4059def7bcbc558ac6 (diff)
Almost ready for version 0.4
Diffstat (limited to 'src/de/blinkt/openvpn/ProfileManager.java')
-rw-r--r--src/de/blinkt/openvpn/ProfileManager.java23
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);