Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct package description add readme to package #23

Merged
merged 1 commit into from
Feb 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Authors>Chris Pulman</Authors>
<Description>A Reactive Property for use in cross platform applications based on ReactiveUI</Description>
<Description>A Reactive Serial Port for use in cross platform applications</Description>
<Copyright>Copyright © https://github.com/ChrisPulman $([System.DateTime]::Now.ToString(yyyy))</Copyright>
<IsTestProject>$(MSBuildProjectName.Contains('Tests'))</IsTestProject>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageReadmeFile>readme.md</PackageReadmeFile>
<LangVersion>preview</LangVersion>
<Configuration>$(TargetFramework)</Configuration>
<Company>ChrisPulman</Company>
Expand All @@ -15,7 +16,7 @@
<PackageIcon>logo.png</PackageIcon>
<Configurations>Debug;Release;PreRelease</Configurations>
<PackageReleaseNotes>Compatability with Net 6, Net 7 and netstandard2.0</PackageReleaseNotes>
<PackageTags>SerialPort;reactiveui;rx;reactive;extensions;observable;LINQ;net;netstandard</PackageTags>
<PackageTags>SerialPort;rx;reactive;extensions;observable;LINQ;net;netstandard</PackageTags>
<EnableNETAnalyzers>True</EnableNETAnalyzers>
<AnalysisLevel>latest</AnalysisLevel>

Expand Down Expand Up @@ -44,6 +45,7 @@
<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)images\logo.png" Pack="true" PackagePath="\"/>
<None Include="$(MSBuildThisFileDirectory)LICENSE" Pack="true" PackagePath="LICENSE" />
<None Include="$(MSBuildThisFileDirectory)README.md" Pack="true" PackagePath="\"/>
</ItemGroup>

<ItemGroup Condition="'$(IsTestProject)' == 'true'">
Expand Down
2 changes: 1 addition & 1 deletion Version.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
"version": "2.3.2",
"version": "2.3.3",
"nuGetPackageVersion": {
"semVer": 2.0
},
Expand Down
54 changes: 21 additions & 33 deletions src/SerialPortRx/SerialPortRxMixins.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,7 @@ public static IObservable<string> BufferUntil(this IObservable<char> @this, IObs
}
}).AddTo(dis);

if (scheduler == null)
{
scheduler = new EventLoopScheduler();
}
scheduler ??= new EventLoopScheduler();

Observable.Interval(TimeSpan.FromMilliseconds(1), scheduler).Subscribe(_ =>
{
Expand Down Expand Up @@ -145,10 +142,7 @@ public static IObservable<string> BufferUntil(this IObservable<char> @this, IObs
}
}).AddTo(dis);

if (scheduler == null)
{
scheduler = new EventLoopScheduler();
}
scheduler ??= new EventLoopScheduler();

Observable.Interval(TimeSpan.FromMilliseconds(1), scheduler).Subscribe(_ =>
{
Expand Down Expand Up @@ -186,9 +180,7 @@ public static IObservable<string> BufferUntil(this IObservable<char> @this, IObs
/// <param name="this">The this.</param>
/// <returns>Observable value.</returns>
public static IObservable<T> ForEach<T>(this IObservable<T[]> @this) =>
Observable.Create<T>(obs =>
{
return @this.Subscribe(
Observable.Create<T>(obs => @this.Subscribe(
list =>
{
foreach (var item in list)
Expand All @@ -200,8 +192,7 @@ public static IObservable<T> ForEach<T>(this IObservable<T[]> @this) =>
}
},
obs.OnError,
obs.OnCompleted);
});
obs.OnCompleted));

/// <summary>
/// <para>Repeats the source observable sequence until it successfully terminates.</para>
Expand Down Expand Up @@ -275,28 +266,25 @@ public static IObservable<TSource> OnErrorRetry<TSource, TException>(this IObser
/// <returns>Observable value.</returns>
public static IObservable<TSource> OnErrorRetry<TSource, TException>(
this IObservable<TSource> source, Action<TException> onError, int retryCount, TimeSpan delay, IScheduler delayScheduler)
where TException : Exception
{
return Observable.Defer(() =>
{
var dueTime = (delay.Ticks < 0) ? TimeSpan.Zero : delay;
var empty = Observable.Empty<TSource>();
var count = 0;
where TException : Exception => Observable.Defer(() =>
{
var dueTime = (delay.Ticks < 0) ? TimeSpan.Zero : delay;
var empty = Observable.Empty<TSource>();
var count = 0;

var self = default(IObservable<TSource>)!;
self = source.Catch((TException ex) =>
{
onError(ex);
return (++count < retryCount)
? (dueTime == TimeSpan.Zero)
? self.SubscribeOn(Scheduler.CurrentThread)
: empty.Delay(dueTime, delayScheduler).Concat(self).SubscribeOn(Scheduler.CurrentThread)
: Observable.Throw<TSource>(ex);
});
var self = default(IObservable<TSource>)!;
self = source.Catch((TException ex) =>
{
onError(ex);
return (++count < retryCount)
? (dueTime == TimeSpan.Zero)
? self.SubscribeOn(Scheduler.CurrentThread)
: empty.Delay(dueTime, delayScheduler).Concat(self).SubscribeOn(Scheduler.CurrentThread)
: Observable.Throw<TSource>(ex);
});

return self;
});
}
return self;
});

/// <summary>
/// Executes while port is open at the given TimeSpan.
Expand Down