From 840513525ba032ba183d855be3d0f8335f8da070 Mon Sep 17 00:00:00 2001
From: Jedd Morgan <45512892+JR-Morgan@users.noreply.github.com>
Date: Mon, 17 Jun 2024 16:15:25 +0100
Subject: [PATCH] =?UTF-8?q?extracting=20some=20non-controversial=20changes?=
=?UTF-8?q?=20to=20be=20merged=20first=20for=20clea=E2=80=A6=20(#3517)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* extracting some non-controversial changes to be merged first for cleaner diff
* More binding alighment
* formatting
* fix merge mistake
* removed lies
---
Core/Core/Core.csproj | 1 -
.../Bindings/ArcGISSelectionBinding.cs | 6 +++---
.../Bindings/AutocadSelectionBinding.cs | 14 ++++++--------
.../Bindings/AutocadSendBinding.cs | 2 +-
.../Bindings/RevitBaseBinding.cs | 6 +++---
.../Bindings/RhinoBasicConnectorBinding.cs | 4 ++--
.../Bindings/RhinoReceiveBinding.cs | 4 ++--
.../Bindings/RhinoSendBinding.cs | 4 ++--
.../packages.lock.json | 9 ---------
.../Bindings/AccountBinding.cs | 4 ++--
.../Speckle.Connectors.DUI/Bindings/TestBinding.cs | 4 ++--
.../Speckle.Connectors.Utils/NotNullExtensions.cs | 8 ++++++++
12 files changed, 31 insertions(+), 35 deletions(-)
diff --git a/Core/Core/Core.csproj b/Core/Core/Core.csproj
index 275dcc12cc..caaa2ab93a 100644
--- a/Core/Core/Core.csproj
+++ b/Core/Core/Core.csproj
@@ -51,7 +51,6 @@
-
diff --git a/DUI3-DX/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/Bindings/ArcGISSelectionBinding.cs b/DUI3-DX/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/Bindings/ArcGISSelectionBinding.cs
index ddc096b629..157bad2797 100644
--- a/DUI3-DX/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/Bindings/ArcGISSelectionBinding.cs
+++ b/DUI3-DX/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/Bindings/ArcGISSelectionBinding.cs
@@ -7,8 +7,8 @@ namespace Speckle.Connectors.ArcGIS.Bindings;
public class ArcGISSelectionBinding : ISelectionBinding
{
- public string Name { get; } = "selectionBinding";
- public IBridge Parent { get; set; }
+ public string Name => "selectionBinding";
+ public IBridge Parent { get; }
public ArcGISSelectionBinding(IBridge parent)
{
@@ -22,7 +22,7 @@ public ArcGISSelectionBinding(IBridge parent)
private void OnSelectionChanged(MapViewEventArgs args)
{
SelectionInfo selInfo = GetSelection();
- Parent?.Send(SelectionBindingEvents.SET_SELECTION, selInfo);
+ Parent.Send(SelectionBindingEvents.SET_SELECTION, selInfo);
}
public SelectionInfo GetSelection()
diff --git a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Bindings/AutocadSelectionBinding.cs b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Bindings/AutocadSelectionBinding.cs
index b52fcba337..1da7250ceb 100644
--- a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Bindings/AutocadSelectionBinding.cs
+++ b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Bindings/AutocadSelectionBinding.cs
@@ -9,10 +9,8 @@ public class AutocadSelectionBinding : ISelectionBinding
{
private const string SELECTION_EVENT = "setSelection";
- private readonly List _visitedDocuments = new();
-
- public string Name { get; set; } = "selectionBinding";
-
+ private readonly HashSet _visitedDocuments = new();
+ public string Name => "selectionBinding";
public IBridge Parent { get; }
public AutocadSelectionBinding(IBridge parent)
@@ -26,9 +24,9 @@ public AutocadSelectionBinding(IBridge parent)
Application.DocumentManager.DocumentActivated += (sender, e) => OnDocumentChanged(e.Document);
}
- private void OnDocumentChanged(Document document) => TryRegisterDocumentForSelection(document);
+ private void OnDocumentChanged(Document? document) => TryRegisterDocumentForSelection(document);
- private void TryRegisterDocumentForSelection(Document document)
+ private void TryRegisterDocumentForSelection(Document? document)
{
if (document == null)
{
@@ -49,13 +47,13 @@ private void TryRegisterDocumentForSelection(Document document)
private void OnSelectionChanged()
{
SelectionInfo selInfo = GetSelection();
- Parent?.Send(SELECTION_EVENT, selInfo);
+ Parent.Send(SELECTION_EVENT, selInfo);
}
public SelectionInfo GetSelection()
{
// POC: Will be addressed to move it into AutocadContext! https://spockle.atlassian.net/browse/CNX-9319
- Document doc = Application.DocumentManager.MdiActiveDocument;
+ Document? doc = Application.DocumentManager.MdiActiveDocument;
List objs = new();
List objectTypes = new();
if (doc != null)
diff --git a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Bindings/AutocadSendBinding.cs b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Bindings/AutocadSendBinding.cs
index 296dd64359..8ebb187279 100644
--- a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Bindings/AutocadSendBinding.cs
+++ b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Bindings/AutocadSendBinding.cs
@@ -18,7 +18,7 @@ namespace Speckle.Connectors.Autocad.Bindings;
public sealed class AutocadSendBinding : ISendBinding
{
- public string Name { get; } = "sendBinding";
+ public string Name => "sendBinding";
public SendBindingUICommands Commands { get; }
public IBridge Parent { get; }
diff --git a/DUI3-DX/Connectors/Revit/Speckle.Connectors.RevitShared/Bindings/RevitBaseBinding.cs b/DUI3-DX/Connectors/Revit/Speckle.Connectors.RevitShared/Bindings/RevitBaseBinding.cs
index 7e1e0afdec..566cc9c41a 100644
--- a/DUI3-DX/Connectors/Revit/Speckle.Connectors.RevitShared/Bindings/RevitBaseBinding.cs
+++ b/DUI3-DX/Connectors/Revit/Speckle.Connectors.RevitShared/Bindings/RevitBaseBinding.cs
@@ -8,13 +8,13 @@ namespace Speckle.Connectors.Revit.Bindings;
internal abstract class RevitBaseBinding : IBinding
{
// POC: name and bridge might be better for them to be protected props?
- public string Name { get; protected set; }
- public IBridge Parent { get; protected set; }
+ public string Name { get; }
+ public IBridge Parent { get; }
protected readonly DocumentModelStore Store;
protected readonly RevitContext RevitContext;
- public RevitBaseBinding(string name, DocumentModelStore store, IBridge bridge, RevitContext revitContext)
+ protected RevitBaseBinding(string name, DocumentModelStore store, IBridge bridge, RevitContext revitContext)
{
Name = name;
Parent = bridge;
diff --git a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Bindings/RhinoBasicConnectorBinding.cs b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Bindings/RhinoBasicConnectorBinding.cs
index 4154665c7b..1ceb31b69a 100644
--- a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Bindings/RhinoBasicConnectorBinding.cs
+++ b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Bindings/RhinoBasicConnectorBinding.cs
@@ -14,8 +14,8 @@ namespace Speckle.Connectors.Rhino7.Bindings;
public class RhinoBasicConnectorBinding : IBasicConnectorBinding
{
- public string Name { get; set; } = "baseBinding";
- public IBridge Parent { get; set; }
+ public string Name => "baseBinding";
+ public IBridge Parent { get; }
public BasicConnectorBindingCommands Commands { get; }
private readonly DocumentModelStore _store;
diff --git a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Bindings/RhinoReceiveBinding.cs b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Bindings/RhinoReceiveBinding.cs
index 0314a0f78f..951ff40f6f 100644
--- a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Bindings/RhinoReceiveBinding.cs
+++ b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Bindings/RhinoReceiveBinding.cs
@@ -12,8 +12,8 @@ namespace Speckle.Connectors.Rhino7.Bindings;
public class RhinoReceiveBinding : IReceiveBinding
{
- public string Name { get; set; } = "receiveBinding";
- public IBridge Parent { get; set; }
+ public string Name => "receiveBinding";
+ public IBridge Parent { get; }
private readonly CancellationManager _cancellationManager;
private readonly DocumentModelStore _store;
diff --git a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Bindings/RhinoSendBinding.cs b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Bindings/RhinoSendBinding.cs
index 8f8594f193..b2c2ab1a20 100644
--- a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Bindings/RhinoSendBinding.cs
+++ b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Bindings/RhinoSendBinding.cs
@@ -18,9 +18,9 @@ namespace Speckle.Connectors.Rhino7.Bindings;
public sealed class RhinoSendBinding : ISendBinding
{
- public string Name { get; } = "sendBinding";
+ public string Name => "sendBinding";
public SendBindingUICommands Commands { get; }
- public IBridge Parent { get; set; }
+ public IBridge Parent { get; }
private readonly DocumentModelStore _store;
private readonly RhinoIdleManager _idleManager;
diff --git a/DUI3-DX/Converters/Revit/Speckle.Converters.Revit2023.Tests/packages.lock.json b/DUI3-DX/Converters/Revit/Speckle.Converters.Revit2023.Tests/packages.lock.json
index 6fdd69eb66..8fd5af7998 100644
--- a/DUI3-DX/Converters/Revit/Speckle.Converters.Revit2023.Tests/packages.lock.json
+++ b/DUI3-DX/Converters/Revit/Speckle.Converters.Revit2023.Tests/packages.lock.json
@@ -251,14 +251,6 @@
"Serilog": "2.4.0"
}
},
- "Serilog.Enrichers.GlobalLogContext": {
- "type": "Transitive",
- "resolved": "3.0.0",
- "contentHash": "IIZcj5mAUVhIl/NTA+YI2KC+sPDzcwvs0ZMHH42jsPfl1a4LVX7ohVpw5UK+e3GxuV3Nv239Il5oM2peUIl44g==",
- "dependencies": {
- "Serilog": "2.12.0"
- }
- },
"Serilog.Exceptions": {
"type": "Transitive",
"resolved": "8.4.0",
@@ -529,7 +521,6 @@
"Sentry.Serilog": "[3.33.0, )",
"Serilog": "[2.12.0, )",
"Serilog.Enrichers.ClientInfo": "[1.3.0, )",
- "Serilog.Enrichers.GlobalLogContext": "[3.0.0, )",
"Serilog.Exceptions": "[8.4.0, )",
"Serilog.Sinks.Console": "[4.1.0, )",
"Serilog.Sinks.Seq": "[5.2.2, )",
diff --git a/DUI3-DX/DUI3/Speckle.Connectors.DUI/Bindings/AccountBinding.cs b/DUI3-DX/DUI3/Speckle.Connectors.DUI/Bindings/AccountBinding.cs
index ffd61239c1..6357195a43 100644
--- a/DUI3-DX/DUI3/Speckle.Connectors.DUI/Bindings/AccountBinding.cs
+++ b/DUI3-DX/DUI3/Speckle.Connectors.DUI/Bindings/AccountBinding.cs
@@ -5,8 +5,8 @@ namespace Speckle.Connectors.DUI.Bindings;
public class AccountBinding : IBinding
{
- public string Name { get; set; } = "accountsBinding";
- public IBridge Parent { get; private set; }
+ public string Name => "accountsBinding";
+ public IBridge Parent { get; }
public AccountBinding(IBridge bridge)
{
diff --git a/DUI3-DX/DUI3/Speckle.Connectors.DUI/Bindings/TestBinding.cs b/DUI3-DX/DUI3/Speckle.Connectors.DUI/Bindings/TestBinding.cs
index e4676053e0..f0523db541 100644
--- a/DUI3-DX/DUI3/Speckle.Connectors.DUI/Bindings/TestBinding.cs
+++ b/DUI3-DX/DUI3/Speckle.Connectors.DUI/Bindings/TestBinding.cs
@@ -9,8 +9,8 @@ namespace Speckle.Connectors.DUI.Bindings;
///
public class TestBinding : IBinding
{
- public string Name { get; set; } = "testBinding";
- public IBridge Parent { get; private set; }
+ public string Name => "testBinding";
+ public IBridge Parent { get; }
public TestBinding(IBridge bridge)
{
diff --git a/DUI3-DX/Sdk/Speckle.Connectors.Utils/NotNullExtensions.cs b/DUI3-DX/Sdk/Speckle.Connectors.Utils/NotNullExtensions.cs
index a34d6dd671..59d9f2b3c0 100644
--- a/DUI3-DX/Sdk/Speckle.Connectors.Utils/NotNullExtensions.cs
+++ b/DUI3-DX/Sdk/Speckle.Connectors.Utils/NotNullExtensions.cs
@@ -5,6 +5,7 @@ namespace Speckle.Connectors.Utils;
public static class NotNullExtensions
{
+ ///
public static async Task NotNull(
this Task task,
[CallerArgumentExpression(nameof(task))] string? message = null
@@ -19,6 +20,7 @@ public static async Task NotNull(
return x;
}
+ ///
public static async Task NotNull(
this Task task,
[CallerArgumentExpression(nameof(task))] string? message = null
@@ -33,6 +35,11 @@ public static async Task NotNull(
return x.Value;
}
+ /// the object to check for null
+ /// see
+ /// type
+ /// A non null value
+ /// was null
public static T NotNull([NotNull] this T? obj, [CallerArgumentExpression(nameof(obj))] string? paramName = null)
where T : class
{
@@ -43,6 +50,7 @@ public static T NotNull([NotNull] this T? obj, [CallerArgumentExpression(name
return obj;
}
+ ///
public static T NotNull([NotNull] this T? obj, [CallerArgumentExpression(nameof(obj))] string? paramName = null)
where T : struct
{