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

Commit 3b38c79

Browse files
committed
Change to use PclExport.Platforms constants instead of magic strings
1 parent 4f09feb commit 3b38c79

File tree

6 files changed

+14
-17
lines changed

6 files changed

+14
-17
lines changed

src/ServiceStack.Text/Env.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ static Env()
1414
throw new ArgumentException("PclExport.Instance needs to be initialized");
1515

1616
var platformName = PclExport.Instance.PlatformName;
17-
if (platformName != "WindowsStore")
17+
if (platformName != PclExport.Platforms.WindowsStore)
1818
{
1919
IsMono = AssemblyUtils.FindType("Mono.Runtime") != null;
2020

@@ -31,7 +31,7 @@ static Env()
3131
}
3232
else
3333
{
34-
IsWinRT = true;
34+
IsWindowsStore = true;
3535
}
3636

3737
#if PCL
@@ -59,7 +59,7 @@ static Env()
5959

6060
public static bool IsAndroid { get; set; }
6161

62-
public static bool IsWinRT { get; set; }
62+
public static bool IsWindowsStore { get; set; }
6363

6464
public static bool IsSilverlight { get; set; }
6565

src/ServiceStack.Text/PclExport.Sl5.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public class Sl5PclExport : PclExport
1818

1919
public Sl5PclExport()
2020
{
21-
this.PlatformName = "Silverlight5";
21+
this.PlatformName = Platforms.Silverlight5;
2222
}
2323

2424
public static PclExport Configure()

src/ServiceStack.Text/PclExport.WP.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public class WpPclExport : PclExport
1717

1818
public WpPclExport()
1919
{
20-
this.PlatformName = "WindowsPhone";
20+
this.PlatformName = Platforms.WindowsPhone;
2121
}
2222

2323
public static PclExport Configure()

src/ServiceStack.Text/PclExport.WinStore.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class WinStorePclExport : PclExport
1616

1717
public WinStorePclExport()
1818
{
19-
this.PlatformName = "WindowsStore";
19+
this.PlatformName = Platforms.WindowsStore;
2020
}
2121

2222
public static PclExport Configure()

src/ServiceStack.Text/PclExport.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,14 @@ namespace ServiceStack
2020
{
2121
public abstract class PclExport
2222
{
23-
public const string WindowsStore = "WindowsStore";
24-
public const string Android = "Android";
25-
public const string IOS = "IOS";
26-
public const string Silverlight5 = "Silverlight5";
23+
public static class Platforms
24+
{
25+
public const string WindowsStore = "WindowsStore";
26+
public const string Android = "Android";
27+
public const string IOS = "IOS";
28+
public const string Silverlight5 = "Silverlight5";
29+
public const string WindowsPhone = "WindowsPhone";
30+
}
2731

2832
public static PclExport Instance
2933
#if PCL

tests/ServiceStack.Text.Tests/JsConfigTests.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,6 @@ public class Bar
5050
[TestFixture]
5151
public class SerializEmitLowerCaseUnderscoreNamesTests
5252
{
53-
//[SetUp]
54-
//public void Reset()
55-
//{
56-
// JsConfig.EmitLowercaseUnderscoreNames = false;
57-
// JsConfig<TestObject>.EmitLowercaseUnderscoreNames = null;
58-
//}
59-
6053
[Test]
6154
public void TestJsonDataWithJsConfigScope()
6255
{

0 commit comments

Comments
 (0)