1
0
mirror of https://github.com/JKorf/CryptoExchange.Net synced 2025-06-09 08:56:13 +00:00

Updated version

This commit is contained in:
Jkorf 2021-12-07 15:47:14 +01:00
parent 48baaeb2d8
commit 2ab032b871
4 changed files with 15 additions and 5 deletions

View File

@ -390,6 +390,7 @@ namespace CryptoExchange.Net
/// Needs to check if a received message matches a handler by request. After subscribing data message will come in. These data messages need to be matched to a specific connection /// Needs to check if a received message matches a handler by request. After subscribing data message will come in. These data messages need to be matched to a specific connection
/// to pass the correct data to the correct handler. The implementation of this method should check if the message received matches the subscribe request that was sent. /// to pass the correct data to the correct handler. The implementation of this method should check if the message received matches the subscribe request that was sent.
/// </summary> /// </summary>
/// <param name="socketConnection">The socket connection the message was recieved on</param>
/// <param name="message">The received data</param> /// <param name="message">The received data</param>
/// <param name="request">The subscription request</param> /// <param name="request">The subscription request</param>
/// <returns>True if the message is for the subscription which sent the request</returns> /// <returns>True if the message is for the subscription which sent the request</returns>
@ -398,6 +399,7 @@ namespace CryptoExchange.Net
/// Needs to check if a received message matches a handler by identifier. Generally used by GenericHandlers. For example; a generic handler is registered which handles ping messages /// Needs to check if a received message matches a handler by identifier. Generally used by GenericHandlers. For example; a generic handler is registered which handles ping messages
/// from the server. This method should check if the message received is a ping message and the identifer is the identifier of the GenericHandler /// from the server. This method should check if the message received is a ping message and the identifer is the identifier of the GenericHandler
/// </summary> /// </summary>
/// <param name="socketConnection">The socket connection the message was recieved on</param>
/// <param name="message">The received data</param> /// <param name="message">The received data</param>
/// <param name="identifier">The string identifier of the handler</param> /// <param name="identifier">The string identifier of the handler</param>
/// <returns>True if the message is for the handler which has the identifier</returns> /// <returns>True if the message is for the handler which has the identifier</returns>
@ -468,7 +470,7 @@ namespace CryptoExchange.Net
/// Adds a generic message handler. Used for example to reply to ping requests /// Adds a generic message handler. Used for example to reply to ping requests
/// </summary> /// </summary>
/// <param name="identifier">The name of the request handler. Needs to be unique</param> /// <param name="identifier">The name of the request handler. Needs to be unique</param>
/// <param name="action">The action to execute when receiving a message for this handler (checked by <see cref="MessageMatchesHandler(Newtonsoft.Json.Linq.JToken,string)"/>)</param> /// <param name="action">The action to execute when receiving a message for this handler (checked by <see cref="MessageMatchesHandler(SocketConnection, Newtonsoft.Json.Linq.JToken,string)"/>)</param>
protected void AddGenericHandler(string identifier, Action<MessageEvent> action) protected void AddGenericHandler(string identifier, Action<MessageEvent> action)
{ {
genericHandlers.Add(identifier, action); genericHandlers.Add(identifier, action);

View File

@ -1,6 +1,7 @@
using Newtonsoft.Json; using Newtonsoft.Json;
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization; using System.Globalization;
namespace CryptoExchange.Net.Converters namespace CryptoExchange.Net.Converters
@ -150,24 +151,28 @@ namespace CryptoExchange.Net.Converters
/// </summary> /// </summary>
/// <param name="time"></param> /// <param name="time"></param>
/// <returns></returns> /// <returns></returns>
[return: NotNullIfNotNull("time")]
public static long? ConvertToSeconds(DateTime? time) => time == null ? null: (long)Math.Round((time.Value - _epoch).TotalSeconds); public static long? ConvertToSeconds(DateTime? time) => time == null ? null: (long)Math.Round((time.Value - _epoch).TotalSeconds);
/// <summary> /// <summary>
/// Convert a DateTime value to milliseconds since epoch (01-01-1970) value /// Convert a DateTime value to milliseconds since epoch (01-01-1970) value
/// </summary> /// </summary>
/// <param name="time"></param> /// <param name="time"></param>
/// <returns></returns> /// <returns></returns>
[return: NotNullIfNotNull("time")]
public static long? ConvertToMilliseconds(DateTime? time) => time == null ? null : (long)Math.Round((time.Value - _epoch).TotalMilliseconds); public static long? ConvertToMilliseconds(DateTime? time) => time == null ? null : (long)Math.Round((time.Value - _epoch).TotalMilliseconds);
/// <summary> /// <summary>
/// Convert a DateTime value to microseconds since epoch (01-01-1970) value /// Convert a DateTime value to microseconds since epoch (01-01-1970) value
/// </summary> /// </summary>
/// <param name="time"></param> /// <param name="time"></param>
/// <returns></returns> /// <returns></returns>
[return: NotNullIfNotNull("time")]
public static long? ConvertToMicroseconds(DateTime? time) => time == null ? null : (long)Math.Round((time.Value - _epoch).Ticks / ticksPerMicrosecond); public static long? ConvertToMicroseconds(DateTime? time) => time == null ? null : (long)Math.Round((time.Value - _epoch).Ticks / ticksPerMicrosecond);
/// <summary> /// <summary>
/// Convert a DateTime value to nanoseconds since epoch (01-01-1970) value /// Convert a DateTime value to nanoseconds since epoch (01-01-1970) value
/// </summary> /// </summary>
/// <param name="time"></param> /// <param name="time"></param>
/// <returns></returns> /// <returns></returns>
[return: NotNullIfNotNull("time")]
public static long? ConvertToNanoseconds(DateTime? time) => time == null ? null : (long)Math.Round((time.Value - _epoch).Ticks / ticksPerNanosecond); public static long? ConvertToNanoseconds(DateTime? time) => time == null ? null : (long)Math.Round((time.Value - _epoch).Ticks / ticksPerNanosecond);

View File

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks> <TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
</PropertyGroup> </PropertyGroup>
@ -6,16 +6,16 @@
<PackageId>CryptoExchange.Net</PackageId> <PackageId>CryptoExchange.Net</PackageId>
<Authors>JKorf</Authors> <Authors>JKorf</Authors>
<Description>A base package for implementing cryptocurrency exchange API's</Description> <Description>A base package for implementing cryptocurrency exchange API's</Description>
<PackageVersion>5.0.0</PackageVersion> <PackageVersion>5.0.0-alpha1</PackageVersion>
<AssemblyVersion>5.0.0</AssemblyVersion> <AssemblyVersion>5.0.0</AssemblyVersion>
<FileVersion>5.0.0</FileVersion> <FileVersion>5.0.0-alpha1</FileVersion>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance> <PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<RepositoryType>git</RepositoryType> <RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/JKorf/CryptoExchange.Net.git</RepositoryUrl> <RepositoryUrl>https://github.com/JKorf/CryptoExchange.Net.git</RepositoryUrl>
<PackageProjectUrl>https://github.com/JKorf/CryptoExchange.Net</PackageProjectUrl> <PackageProjectUrl>https://github.com/JKorf/CryptoExchange.Net</PackageProjectUrl>
<NeutralLanguage>en</NeutralLanguage> <NeutralLanguage>en</NeutralLanguage>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild> <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageReleaseNotes>5.0.0</PackageReleaseNotes> <PackageReleaseNotes>5.0.0.1-alpha - New client structures, multiple improvements and changes. Details will be available later</PackageReleaseNotes>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<LangVersion>9.0</LangVersion> <LangVersion>9.0</LangVersion>
<PackageLicenseExpression>MIT</PackageLicenseExpression> <PackageLicenseExpression>MIT</PackageLicenseExpression>

View File

@ -326,6 +326,9 @@ private void SomeMethod()
```` ````
## Release notes ## Release notes
* Version 5.0.0.1-alpha - 07 Dec 2021
* New client structures, multiple improvements and changes. Details will be available later
* Version 4.2.8 - 08 Oct 2021 * Version 4.2.8 - 08 Oct 2021
* Fixed deadlock in socket receive * Fixed deadlock in socket receive
* Fixed issue in reconnection handling when the client is disconnected again during resubscribing * Fixed issue in reconnection handling when the client is disconnected again during resubscribing