public static ExceptionSummary ( |
||
ex | The logged exception. | |
return | void |
/// <summary> /// Gets the last used credentials. /// </summary> /// <returns>Array of strings containing the last used credentials</returns> public String[] GetCredentials() { String[] credentials = new String[3]; IsolatedStorageFile isFile = null; IsolatedStorageFileStream stream = null; StreamReader reader = null; try { isFile = IsolatedStorageFile.GetUserStoreForAssembly(); stream = new IsolatedStorageFileStream(filename, FileMode.Open, isFile); reader = new StreamReader(stream); int i = 0; while (!reader.EndOfStream) { String s = reader.ReadLine(); credentials[i] = s; i++; } } catch (Exception ex) { Log.ExceptionSummary(ex); credentials = null; } finally { if (reader != null) { reader.Close(); } if (stream != null) { stream.Close(); } if (isFile != null) { isFile.Dispose(); isFile.Close(); } } return(credentials); }
/// <summary> /// Erases the last saved credentials form isolated storage. /// </summary> public void ClearCredentials() { IsolatedStorageFile isFile = null; try { isFile = IsolatedStorageFile.GetUserStoreForAssembly(); isFile.DeleteFile(filename); } catch (IsolatedStorageException ex) { Log.ExceptionSummary(ex); } finally { if (isFile != null) { isFile.Dispose(); isFile.Close(); } } }