.NET: Get rid of extra BinaryReader casts
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/76f26c1e Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/76f26c1e Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/76f26c1e Branch: refs/heads/ignite-3443 Commit: 76f26c1e6e2ec9c221717ccd98b5d92b89c66d14 Parents: db300ba Author: Pavel Tupitsyn <[email protected]> Authored: Mon Aug 29 19:53:47 2016 +0300 Committer: Pavel Tupitsyn <[email protected]> Committed: Mon Aug 29 19:53:47 2016 +0300 ---------------------------------------------------------------------- .../Cache/Affinity/AffinityFunctionContext.cs | 4 ++-- .../dotnet/Apache.Ignite.Core/Events/DiscoveryEvent.cs | 4 ++-- .../platforms/dotnet/Apache.Ignite.Core/Events/EventReader.cs | 6 +++--- .../Impl/Cache/Affinity/AffinityFunctionSerializer.cs | 2 +- .../platforms/dotnet/Apache.Ignite.Core/Impl/IgniteUtils.cs | 5 ++--- 5 files changed, 10 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/76f26c1e/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/AffinityFunctionContext.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/AffinityFunctionContext.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/AffinityFunctionContext.cs index 6067af4..6f356f9 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/AffinityFunctionContext.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/AffinityFunctionContext.cs @@ -19,10 +19,10 @@ namespace Apache.Ignite.Core.Cache.Affinity { using System.Collections.Generic; using System.Diagnostics; - using Apache.Ignite.Core.Binary; using Apache.Ignite.Core.Cluster; using Apache.Ignite.Core.Events; using Apache.Ignite.Core.Impl; + using Apache.Ignite.Core.Impl.Binary; /// <summary> /// Affinity function context. @@ -48,7 +48,7 @@ namespace Apache.Ignite.Core.Cache.Affinity /// Initializes a new instance of the <see cref="AffinityFunctionContext"/> class. /// </summary> /// <param name="reader">The reader.</param> - internal AffinityFunctionContext(IBinaryRawReader reader) + internal AffinityFunctionContext(BinaryReader reader) { Debug.Assert(reader != null); http://git-wip-us.apache.org/repos/asf/ignite/blob/76f26c1e/modules/platforms/dotnet/Apache.Ignite.Core/Events/DiscoveryEvent.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Events/DiscoveryEvent.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Events/DiscoveryEvent.cs index 5c163a2..011febf 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Events/DiscoveryEvent.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Events/DiscoveryEvent.cs @@ -20,9 +20,9 @@ namespace Apache.Ignite.Core.Events using System.Collections.Generic; using System.Collections.ObjectModel; using System.Globalization; - using Apache.Ignite.Core.Binary; using Apache.Ignite.Core.Cluster; using Apache.Ignite.Core.Impl; + using Apache.Ignite.Core.Impl.Binary; /// <summary> /// Grid discovery event. @@ -42,7 +42,7 @@ namespace Apache.Ignite.Core.Events /// Constructor. /// </summary> /// <param name="r">The reader to read data from.</param> - internal DiscoveryEvent(IBinaryRawReader r) : base(r) + internal DiscoveryEvent(BinaryReader r) : base(r) { _eventNode = ReadNode(r); _topologyVersion = r.ReadLong(); http://git-wip-us.apache.org/repos/asf/ignite/blob/76f26c1e/modules/platforms/dotnet/Apache.Ignite.Core/Events/EventReader.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Events/EventReader.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Events/EventReader.cs index ee1c837..269e0bb 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Events/EventReader.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Events/EventReader.cs @@ -18,7 +18,7 @@ namespace Apache.Ignite.Core.Events { using System; - using Apache.Ignite.Core.Binary; + using Apache.Ignite.Core.Impl.Binary; /// <summary> /// Event reader. @@ -32,7 +32,7 @@ namespace Apache.Ignite.Core.Events /// <param name="reader">Reader.</param> /// <returns>Deserialized event.</returns> /// <exception cref="System.InvalidCastException">Incompatible event type.</exception> - public static T Read<T>(IBinaryRawReader reader) where T : IEvent + public static T Read<T>(BinaryReader reader) where T : IEvent { var clsId = reader.ReadInt(); @@ -49,7 +49,7 @@ namespace Apache.Ignite.Core.Events /// <param name="reader">Reader.</param> /// <returns>Created and deserialized instance.</returns> /// <exception cref="System.InvalidOperationException">Invalid event class id: + clsId</exception> - private static IEvent CreateInstance(int clsId, IBinaryRawReader reader) + private static IEvent CreateInstance(int clsId, BinaryReader reader) { switch (clsId) { http://git-wip-us.apache.org/repos/asf/ignite/blob/76f26c1e/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Affinity/AffinityFunctionSerializer.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Affinity/AffinityFunctionSerializer.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Affinity/AffinityFunctionSerializer.cs index 888445a..5d940c5 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Affinity/AffinityFunctionSerializer.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Affinity/AffinityFunctionSerializer.cs @@ -209,7 +209,7 @@ namespace Apache.Ignite.Core.Impl.Cache.Affinity Debug.Assert(stream != null); Debug.Assert(marsh != null); - IBinaryRawReader reader = marsh.StartUnmarshal(stream); + var reader = marsh.StartUnmarshal(stream); var partCnt = reader.ReadInt(); http://git-wip-us.apache.org/repos/asf/ignite/blob/76f26c1e/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteUtils.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteUtils.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteUtils.cs index 04296c7..a5a3129 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteUtils.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteUtils.cs @@ -27,7 +27,6 @@ namespace Apache.Ignite.Core.Impl using System.Reflection; using System.Runtime.InteropServices; using System.Text; - using Apache.Ignite.Core.Binary; using Apache.Ignite.Core.Cluster; using Apache.Ignite.Core.Common; using Apache.Ignite.Core.Impl.Binary; @@ -464,7 +463,7 @@ namespace Apache.Ignite.Core.Impl /// <param name="reader">Reader.</param> /// <param name="pred">The predicate.</param> /// <returns> Nodes list or null. </returns> - public static List<IClusterNode> ReadNodes(IBinaryRawReader reader, Func<ClusterNodeImpl, bool> pred = null) + public static List<IClusterNode> ReadNodes(BinaryReader reader, Func<ClusterNodeImpl, bool> pred = null) { var cnt = reader.ReadInt(); @@ -473,7 +472,7 @@ namespace Apache.Ignite.Core.Impl var res = new List<IClusterNode>(cnt); - var ignite = ((BinaryReader)reader).Marshaller.Ignite; + var ignite = reader.Marshaller.Ignite; if (pred == null) {
