My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from System.IO.IsolatedStorage import (
IsolatedStorageFile, IsolatedStorageFileStream
)

from System.IO import (
FileMode, StreamReader, StreamWriter
)


def CheckForFile(filename):
store = IsolatedStorageFile.GetUserStoreForApplication()
return store.FileExists(filename)


def DeleteFile(filename):
store = IsolatedStorageFile.GetUserStoreForApplication()
store.DeleteFile(filename)


def SaveFile(filename, data):
store = IsolatedStorageFile.GetUserStoreForApplication()
isolatedStream = IsolatedStorageFileStream(filename, FileMode.Create, store)

writer = StreamWriter(isolatedStream)
writer.Write(data)

writer.Close()
isolatedStream.Close()


def LoadFile(filename):
store = IsolatedStorageFile.GetUserStoreForApplication()
isolatedStream = IsolatedStorageFileStream(filename, FileMode.Open, store)

reader = StreamReader(isolatedStream)
data = reader.ReadToEnd()

reader.Close()
isolatedStream.Close()

return data

Change log

r132 by fuzzyman on Apr 25, 2010   Diff
Reverting revision 131. IronPython 2.6
compatibility will have to come a
different way.
Go to: 
Project members, sign in to write a code review

Older revisions

r131 by fuzzyman on Apr 10, 2010   Diff
Moving things around for the move to
gestalt and Silverlight 4
compatibility. Everything is now
broken...
r125 by fuzzyman on Oct 8, 2009   Diff
Further improvements to the file type.
Almost API complete. Some attributes
need to become properties and
docstrings need adding.
All revisions of this file

File info

Size: 1005 bytes, 42 lines
Powered by Google Project Hosting