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

Commit b16ce24

Browse files
committed
Move Stream.Close() ext method to SS.Text and add TaskUtils.Sleep()
1 parent 0b6a694 commit b16ce24

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

src/ServiceStack.Text/PclExport.Net40.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -568,15 +568,6 @@ public override SetPropertyDelegate GetSetMethod(PropertyInfo propertyInfo, Fiel
568568
: CreateIlFieldSetter(fieldInfo);
569569
}
570570

571-
public override Type UseType(Type type)
572-
{
573-
if (type.IsInterface || type.IsAbstract)
574-
{
575-
return DynamicProxy.GetInstanceFor(type).GetType();
576-
}
577-
return type;
578-
}
579-
580571
public override DataContractAttribute GetWeakDataContract(Type type)
581572
{
582573
return type.GetWeakDataContract();

src/ServiceStack.Text/StreamExtensions.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,9 +285,10 @@ public static byte[] Combine(this byte[] bytes, params byte[][] withBytes)
285285
return to;
286286
}
287287

288-
#if NETSTANDARD1_1
288+
#if PCL || NETSTANDARD1_1
289289
public static void Close(this Stream stream)
290290
{
291+
PclExport.Instance?.CloseStream(stream);
291292
stream.Dispose();
292293
}
293294
#endif

src/ServiceStack.Text/TaskUtils.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,5 +147,14 @@ static void StartNextIteration<T>(TaskCompletionSource<object> tcs,
147147
if (iterationTask != null)
148148
iterationTask.ContinueWith(next, CancellationToken.None, TaskContinuationOptions.ExecuteSynchronously, TaskScheduler.Default);
149149
}
150+
151+
public static void Sleep(int timeMs)
152+
{
153+
#if PCL || NETSTANDARD1_1
154+
Task.Delay(timeMs).Wait();
155+
#else
156+
Thread.Sleep(timeMs);
157+
#endif
158+
}
150159
}
151160
}

0 commit comments

Comments
 (0)