ptupitsyn commented on a change in pull request #6356: IGNITE-7101: .NET: 
IIgnite.GetVersion
URL: https://github.com/apache/ignite/pull/6356#discussion_r271613731
 
 

 ##########
 File path: 
modules/platforms/dotnet/Apache.Ignite.Core/Common/IgniteProductVersion.cs
 ##########
 @@ -0,0 +1,224 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Apache.Ignite.Core.Common
+{
+    using System;
+    using System.Globalization;
+    using Apache.Ignite.Core.Binary;
+    using Apache.Ignite.Core.Impl.Binary;
+    using Apache.Ignite.Core.Impl.Common;
+
+    /// <summary>
+    /// Represents node version.
+    /// </summary>
+    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", 
"CA1036:OverrideMethodsOnComparableTypes")]
+    public class IgniteProductVersion : IEquatable<IgniteProductVersion>, 
IComparable<IgniteProductVersion>
+    {
+        /** Major version number. */
+        private readonly byte _major;
+
+        /** Minor version number. */
+        private readonly byte _minor;
+
+        /** Maintenance version number. */
+        private readonly byte _maintenance;
+
+        /** Stage of development. */
+        private readonly String _stage;
+
+        /** Revision timestamp. */
+        private readonly long _revTs;
+
+        /** Revision hash. */
+        private byte[] _revHash;
+
+        /// <summary>
+        /// Constructor.
+        /// </summary>
+        /// <param name="major">Major version number.</param>
+        /// <param name="minor">Minor version number.</param>
+        /// <param name="maintenance">Maintenance version number.</param>
+        /// <param name="revTs">Revision timestamp.</param>
+        /// <param name="revHash">Revision hash.</param>
+        public IgniteProductVersion(byte major, byte minor, byte maintenance, 
long revTs, byte[] revHash)
+            : this(major, minor, maintenance, "", revTs, revHash)
+        {
+            // No-op.
+        }
+
+        /// <summary>
+        /// Constructor.
+        /// </summary>
+        /// <param name="major">Major version number.</param>
+        /// <param name="minor">Minor version number.</param>
+        /// <param name="maintenance">Maintenance version number.</param>
+        /// <param name="stage">Stage of development.</param>
+        /// <param name="revTs">Revision timestamp.</param>
+        /// <param name="revHash">Revision hash.</param>
+        public IgniteProductVersion(byte major, byte minor, byte maintenance, 
String stage, long revTs, byte[] revHash)
+        {
+            if (revHash != null && revHash.Length != 20)
+            {
+                throw new ArgumentException("Invalid length for SHA1 hash 
(must be 20): " + revHash.Length);
+            }
+
+            _major = major;
+            _minor = minor;
+            _maintenance = maintenance;
+            _stage = stage;
+            _revTs = revTs;
+            _revHash = revHash;
+        }
+
+        /// <summary>
+        /// Constructor.
+        /// </summary>
+        /// <param name="reader"><see cref="IBinaryRawReader"/></param>
+        public IgniteProductVersion(IBinaryRawReader reader)
+        {
+            IgniteArgumentCheck.NotNull(reader, "reader");
+
+            _major = reader.ReadByte();
+            _minor = reader.ReadByte();
+            _maintenance = reader.ReadByte();
+            _revTs = reader.ReadLong();
+
+            _revHash = reader.ReadByteArray();
+        }
+
+        /// <summary>
+        /// Gets the major version number.
+        /// </summary>
+        public byte Major
+        {
+            get { return _major; }
+        }
+
+        /// <summary>
+        /// Gets the minor version number.
+        /// </summary>
+        public byte Minor
+        {
+            get { return _minor; }
+        }
+
+        /// <summary>
+        /// Gets the maintenance version number.
+        /// </summary>
+        public byte Maintenance
+        {
+            get { return _maintenance; }
+        }
+
+        /// <summary>
+        /// Gets the stage of development.
+        /// </summary>
+        public string Stage
+        {
+            get { return _stage; }
+        }
+
+        /// <summary>
+        /// Gets the revision timestamp.
+        /// </summary>
+        public long RevisionTimestamp
+        {
+            get { return _revTs; }
+        }
+
+        /// <summary>
+        /// Gets the release date.
+        /// </summary>
+        public DateTime ReleaseDate
+        {
+            get { return new DateTime(BinaryUtils.JavaDateTicks + _revTs * 
1000); }
 
 Review comment:
   Specify `DateTimeKind.Utc` to avoid ambiguity

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to