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

Commit 0b88f79

Browse files
committed
Move .NET 45 Write/FlushAsync into new Net45PclExport
1 parent 26f30f8 commit 0b88f79

File tree

2 files changed

+25
-5
lines changed

2 files changed

+25
-5
lines changed

src/ServiceStack.Text/PclExport.Net40.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,29 @@ public MacPclExport()
691691
}
692692
#endif
693693

694+
#if NET45 || NETFX_CORE
695+
public class Net45PclExport : Net40PclExport
696+
{
697+
public static new Net45PclExport Provider = new IosPclExport();
698+
699+
public Net45PclExport()
700+
{
701+
PlatformName = "NET45 " + Environment.OSVersion.Platform.ToString();
702+
}
703+
704+
public new static void Configure()
705+
{
706+
Configure(Provider);
707+
}
708+
709+
public override Task WriteAndFlushAsync(Stream stream, byte[] bytes)
710+
{
711+
return stream.WriteAsync(bytes, 0, bytes.Length)
712+
.ContinueWith(t => stream.FlushAsync());
713+
}
714+
}
715+
#endif
716+
694717
#if __IOS__ || __MAC__
695718
[Preserve(AllMembers = true)]
696719
internal class Poco

src/ServiceStack.Text/PclExport.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ public static PclExport Instance
4646
= new MacPclExport()
4747
#elif ANDROID
4848
= new AndroidPclExport()
49+
#elif NET45
50+
= new Net45PclExport()
4951
#else
5052
= new Net40PclExport()
5153
#endif
@@ -485,14 +487,9 @@ public virtual string GetStackTrace()
485487

486488
public virtual Task WriteAndFlushAsync(Stream stream, byte[] bytes)
487489
{
488-
#if !SL5
489-
return stream.WriteAsync(bytes, 0, bytes.Length)
490-
.ContinueWith(t => stream.FlushAsync());
491-
#else
492490
stream.Write(bytes, 0, bytes.Length);
493491
stream.Flush();
494492
return EmptyTask;
495-
#endif
496493
}
497494
}
498495

0 commit comments

Comments
 (0)