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

Commit

Permalink
Add static Configure methods to all PCL Providers
Browse files Browse the repository at this point in the history
  • Loading branch information
mythz committed Jan 18, 2014
1 parent 19ee97b commit 8541502
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 9 deletions.
3 changes: 2 additions & 1 deletion src/ServiceStack.Text/PclExport.Net40.cs
Expand Up @@ -47,9 +47,10 @@ public Net40PclExport()
this.PlatformName = Environment.OSVersion.Platform.ToString();
}

public static void Configure()
public static PclExport Configure()
{
Configure(Provider);
return Provider;
}

public override string ReadAllText(string filePath)
Expand Down
11 changes: 6 additions & 5 deletions src/ServiceStack.Text/PclExport.Sl5.cs
Expand Up @@ -21,6 +21,12 @@ public Sl5PclExport()
this.PlatformName = "Silverlight5";
}

public static PclExport Configure()
{
Configure(Provider);
return Provider;
}

public override string ReadAllText(string filePath)
{
return File.ReadAllText(filePath);
Expand Down Expand Up @@ -64,11 +70,6 @@ public override HttpWebRequest CreateWebRequest(string requestUri, bool? emulate

return (HttpWebRequest)creator.Create(new Uri(requestUri));
}

public static void Configure()
{
Configure(Provider);
}
}
}

Expand Down
8 changes: 7 additions & 1 deletion src/ServiceStack.Text/PclExport.WP.cs
Expand Up @@ -13,13 +13,19 @@ namespace ServiceStack
{
public class WpPclExport : PclExport
{
public new static WpPclExport Instance = new WpPclExport();
public static WpPclExport Provider = new WpPclExport();

public WpPclExport()
{
this.PlatformName = "WindowsPhone";
}

public static PclExport Configure()
{
Configure(Provider);
return Provider;
}

public override string ReadAllText(string filePath)
{
using (var isoStore = IsolatedStorageFile.GetUserStoreForApplication())
Expand Down
3 changes: 2 additions & 1 deletion src/ServiceStack.Text/PclExport.WinStore.cs
Expand Up @@ -19,9 +19,10 @@ public WinStorePclExport()
this.PlatformName = "WindowsStore";
}

public static void Configure()
public static PclExport Configure()
{
Configure(Provider);
return Provider;
}

public override string ReadAllText(string filePath)
Expand Down
8 changes: 7 additions & 1 deletion src/ServiceStack.Text/PclExport.Xbox.cs
Expand Up @@ -8,13 +8,19 @@ namespace ServiceStack
{
public class XboxPclExport : PclExport
{
public new static XboxPclExport Instance = new XboxPclExport();
public static XboxPclExport Provider = new XboxPclExport();

public XboxPclExport()
{
this.PlatformName = "XBOX";
}

public static PclExport Configure()
{
Configure(Provider);
return Provider;
}

public override string ReadAllText(string filePath)
{
using (var fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read))
Expand Down

0 comments on commit 8541502

Please sign in to comment.