Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit ae32e54

Browse files
committed
Add reading file from IsolatedStorage functionality for Windows Phone
1 parent 8c5d76b commit ae32e54

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

src/ServiceStack.Text/StringExtensions.cs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,17 @@
1111
//
1212

1313
using System;
14-
using System.Collections.Generic;
14+
using System.Globalization;
1515
using System.IO;
16-
using System.Linq;
1716
using System.Text;
18-
using System.Globalization;
1917
using System.Text.RegularExpressions;
2018
using ServiceStack.Text.Support;
19+
using System.Collections.Generic;
20+
#if WINDOWS_PHONE
21+
using System.IO.IsolatedStorage;
22+
using ServiceStack.Text.WP;
23+
24+
#endif
2125

2226
namespace ServiceStack.Text
2327
{
@@ -438,6 +442,15 @@ public static string ReadAllText(this string filePath)
438442
{
439443
return new StreamReader( fileStream ).ReadToEnd( ) ;
440444
}
445+
446+
#elif WINDOWS_PHONE
447+
using (var isoStore = IsolatedStorageFile.GetUserStoreForApplication())
448+
{
449+
using (var fileStream = isoStore.OpenFile(filePath, FileMode.Open))
450+
{
451+
return new StreamReader(fileStream).ReadToEnd();
452+
}
453+
}
441454
#else
442455
return File.ReadAllText(filePath);
443456
#endif

0 commit comments

Comments
 (0)