Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
P-H-Maillefer committed Mar 2, 2022
2 parents 0b820ac + 5fd0bf1 commit b906a92
Show file tree
Hide file tree
Showing 63 changed files with 785 additions and 1,223 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/github-woopsa-create-nuget-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ jobs:
- name: Setup .NET Core 2.2
uses: actions/setup-dotnet@v1
with:
dotnet-version: 2.2.207
dotnet-version: 2.2.207

- name: Setup .NET Core 3.1
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.404

- name: Generate Nuget Package
run: dotnet pack ./Woopsa.sln --configuration Release --version-suffix preview.${{ github.run_number }} -o '${{ github.workspace }}/Sources/DotNet/artifacts'
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/github-woopsa-deploy-nuget-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: 2.2.207

- name: Setup .NET Core 3.1
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.404

- name: Install dependencies
run: dotnet restore ./Woopsa.sln
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/github-woopsa-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: 2.2.207


- name: Setup .NET Core 3.1
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.404

- name: Install dependencies
run: dotnet restore ./Woopsa.sln
working-directory: ./Sources/DotNet
Expand Down
29 changes: 11 additions & 18 deletions Sources/DotNet/Woopsa/Client/WoopsaClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,24 @@ public WoopsaClient(string url, WoopsaContainer container,

#region Public Properties

public WoopsaClientProtocol ClientProtocol { get; private set; }
public WoopsaClientProtocol ClientProtocol { get; }

public string Url { get; private set; }
public string AuthorityUrl { get; private set; }
public string Url { get; }
public string AuthorityUrl { get; }

public string Username
{
get { return ClientProtocol.Username; }
set { ClientProtocol.Username = value; }
get => ClientProtocol.Username;
set => ClientProtocol.Username = value;
}

public string Password
{
get { return ClientProtocol.Password; }
set { ClientProtocol.Password = value; }
get => ClientProtocol.Password;
set => ClientProtocol.Password = value;
}

public WoopsaClientSubscriptionChannel SubscriptionChannel { get; private set; }
public WoopsaClientSubscriptionChannel SubscriptionChannel { get; }

#endregion

Expand All @@ -62,10 +62,8 @@ public WoopsaBoundClientObject CreateBoundRoot(string name = null)
return new WoopsaBoundClientObject(this, _container, name ?? meta.Name, null);
}

public WoopsaUnboundClientObject CreateUnboundRoot(string name)
{
return new WoopsaUnboundClientObject(this, _container, name, null);
}
public WoopsaUnboundClientObject CreateUnboundRoot(string name) =>
new WoopsaUnboundClientObject(this, _container, name, null);

public void ExecuteMultiRequest(WoopsaClientMultiRequest multiRequest)
{
Expand Down Expand Up @@ -100,15 +98,10 @@ protected virtual void Dispose(bool disposing)
SubscriptionChannel.Terminate();
ClientProtocol.Terminate();
if (SubscriptionChannel != null)
{
SubscriptionChannel.Dispose();
SubscriptionChannel = null;
}

if (ClientProtocol != null)
{
ClientProtocol.Dispose();
ClientProtocol = null;
}
}
}

Expand Down
18 changes: 6 additions & 12 deletions Sources/DotNet/Woopsa/Client/WoopsaClientMultiRequest.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Woopsa
{
Expand All @@ -13,7 +11,7 @@ public WoopsaClientMultiRequest()
_clientRequestsById = new Dictionary<int, Woopsa.WoopsaClientRequest>();
}

public IEnumerable<WoopsaClientRequest> ClientRequests { get { return _clientRequests; } }
public IEnumerable<WoopsaClientRequest> ClientRequests => _clientRequests;

public IEnumerable<ClientRequest> Requests
{
Expand Down Expand Up @@ -120,12 +118,11 @@ public void Clear()
_clientRequestsById.Clear();
}

public int Count { get { return _clientRequests.Count; } }
public int Count => _clientRequests.Count;

public WoopsaClientRequest RequestById(int Id)
{
WoopsaClientRequest result;
_clientRequestsById.TryGetValue(Id, out result);
_clientRequestsById.TryGetValue(Id, out WoopsaClientRequest result);
return result;
}

Expand All @@ -142,10 +139,7 @@ public void Reset()
}
}

private int GetNextRequestId()
{
return _clientRequests.Count + 1;
}
private int GetNextRequestId() => _clientRequests.Count + 1;

private void Add(WoopsaClientRequest clientRequest)
{
Expand All @@ -159,8 +153,8 @@ internal void DispatchResults(WoopsaJsonData jsonData)
{
WoopsaJsonData item = jsonData[i];
int id = item[WoopsaFormat.KeyId];
WoopsaClientRequest request;
if (_clientRequestsById.TryGetValue(id, out request))

if (_clientRequestsById.TryGetValue(id, out WoopsaClientRequest request))
{
WoopsaJsonData result = item[WoopsaFormat.KeyResult];
if (result.ContainsKey(WoopsaFormat.KeyError))
Expand Down
19 changes: 6 additions & 13 deletions Sources/DotNet/Woopsa/Client/WoopsaClientNotification.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;

namespace Woopsa
{
Expand All @@ -11,11 +10,11 @@ public WoopsaClientNotification(WoopsaValue value, int subscriptionId)
SubscriptionId = subscriptionId;
}

public WoopsaValue Value { get; private set; }
public WoopsaValue Value { get; }

IWoopsaValue IWoopsaNotification.Value { get { return Value; } }
IWoopsaValue IWoopsaNotification.Value => Value;

public int SubscriptionId { get; private set; }
public int SubscriptionId { get; }

public int Id { get; set; }

Expand All @@ -28,15 +27,9 @@ public WoopsaClientNotifications()
_notifications = new List<WoopsaClientNotification>();
}

public void Add(WoopsaClientNotification notification)
{
_notifications.Add(notification);
}
public void Add(WoopsaClientNotification notification) => _notifications.Add(notification);

public IEnumerable<IWoopsaNotification> Notifications
{
get { return _notifications; }
}
public IEnumerable<IWoopsaNotification> Notifications => _notifications;

private readonly List<WoopsaClientNotification> _notifications;
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/DotNet/Woopsa/Client/WoopsaClientObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ internal WoopsaBaseClientObject(WoopsaClient client, WoopsaContainer container,

#endregion

public WoopsaClient Client { get; private set; }
public IWoopsaContainer Root { get; private set; }
public WoopsaClient Client { get; }
public IWoopsaContainer Root { get; }

public WoopsaClientSubscription Subscribe(string relativePath,
EventHandler<WoopsaNotificationEventArgs> propertyChangedHandler,
Expand Down
Loading

0 comments on commit b906a92

Please sign in to comment.