From c9c188f69760f7ab5b9d73418ec2b516e73f278e Mon Sep 17 00:00:00 2001 From: vdemydiuk Date: Mon, 19 Feb 2018 13:37:43 +0200 Subject: [PATCH] Minor refactoring to remove code syle warnings --- MtApi5/MqlRates.cs | 3 ++- MtApi5/MqlTick.cs | 3 ++- MtApi5/MqlTradeCheckResult.cs | 20 +++++++++++--------- MtApi5/Mt5CommandType.cs | 3 ++- MtApi5/Mt5ConnectionEventArgs.cs | 4 ++-- MtApi5/Mt5QuoteEventArgs.cs | 5 +---- MtApi5/Mt5TimeConverter.cs | 19 +++++++------------ MtApi5/MtApi5Client.cs | 2 +- 8 files changed, 28 insertions(+), 31 deletions(-) diff --git a/MtApi5/MqlRates.cs b/MtApi5/MqlRates.cs index 3517492b..ec958397 100755 --- a/MtApi5/MqlRates.cs +++ b/MtApi5/MqlRates.cs @@ -1,4 +1,5 @@ -using System; +// ReSharper disable InconsistentNaming +using System; namespace MtApi5 { diff --git a/MtApi5/MqlTick.cs b/MtApi5/MqlTick.cs index 41e9265b..32125d8a 100755 --- a/MtApi5/MqlTick.cs +++ b/MtApi5/MqlTick.cs @@ -1,4 +1,5 @@ -using System; +// ReSharper disable InconsistentNaming +using System; namespace MtApi5 { diff --git a/MtApi5/MqlTradeCheckResult.cs b/MtApi5/MqlTradeCheckResult.cs index d7e9e4ed..0d43919c 100755 --- a/MtApi5/MqlTradeCheckResult.cs +++ b/MtApi5/MqlTradeCheckResult.cs @@ -1,15 +1,17 @@ -namespace MtApi5 +// ReSharper disable InconsistentNaming + +namespace MtApi5 { public class MqlTradeCheckResult { - public uint Retcode { get; private set; } // Reply code - public double Balance { get; private set; } // Balance after the execution of the deal - public double Equity { get; private set; } // Equity after the execution of the deal - public double Profit { get; private set; } // Floating profit - public double Margin { get; private set; } // Margin requirements - public double Margin_free { get; private set; } // Free margin - public double Margin_level { get; private set; } // Margin level - public string Comment { get; private set; } // Comment to the reply code (description of the error) + public uint Retcode { get; } // Reply code + public double Balance { get; } // Balance after the execution of the deal + public double Equity { get; } // Equity after the execution of the deal + public double Profit { get; } // Floating profit + public double Margin { get; } // Margin requirements + public double Margin_free { get; } // Free margin + public double Margin_level { get; } // Margin level + public string Comment { get; } // Comment to the reply code (description of the error) public MqlTradeCheckResult(uint retcode , double balance diff --git a/MtApi5/Mt5CommandType.cs b/MtApi5/Mt5CommandType.cs index 2a0cc27e..241500a6 100755 --- a/MtApi5/Mt5CommandType.cs +++ b/MtApi5/Mt5CommandType.cs @@ -1,4 +1,5 @@ -namespace MtApi5 +// ReSharper disable InconsistentNaming +namespace MtApi5 { internal enum Mt5CommandType { diff --git a/MtApi5/Mt5ConnectionEventArgs.cs b/MtApi5/Mt5ConnectionEventArgs.cs index 14edb7e1..9ad00458 100755 --- a/MtApi5/Mt5ConnectionEventArgs.cs +++ b/MtApi5/Mt5ConnectionEventArgs.cs @@ -4,8 +4,8 @@ namespace MtApi5 { public class Mt5ConnectionEventArgs: EventArgs { - public Mt5ConnectionState Status { get; private set; } - public string ConnectionMessage { get; private set; } + public Mt5ConnectionState Status { get; } + public string ConnectionMessage { get; } public Mt5ConnectionEventArgs(Mt5ConnectionState status, string message) { diff --git a/MtApi5/Mt5QuoteEventArgs.cs b/MtApi5/Mt5QuoteEventArgs.cs index 4d98cbf3..068b100b 100755 --- a/MtApi5/Mt5QuoteEventArgs.cs +++ b/MtApi5/Mt5QuoteEventArgs.cs @@ -1,13 +1,10 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; namespace MtApi5 { public class Mt5QuoteEventArgs: EventArgs { - public Mt5Quote Quote { get; private set; } + public Mt5Quote Quote { get; } public Mt5QuoteEventArgs(Mt5Quote quote) { diff --git a/MtApi5/Mt5TimeConverter.cs b/MtApi5/Mt5TimeConverter.cs index c6cd2b30..8e209401 100755 --- a/MtApi5/Mt5TimeConverter.cs +++ b/MtApi5/Mt5TimeConverter.cs @@ -1,32 +1,27 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; namespace MtApi5 { - class Mt5TimeConverter + internal class Mt5TimeConverter { public static DateTime ConvertFromMtTime(int time) { - DateTime tmpTime = new DateTime(1970, 1, 1); + var tmpTime = new DateTime(1970, 1, 1); return new DateTime(tmpTime.Ticks + (time * 0x989680L)); } public static DateTime ConvertFromMtTime(long time) { - DateTime tmpTime = new DateTime(1970, 1, 1); + var tmpTime = new DateTime(1970, 1, 1); return new DateTime(tmpTime.Ticks + (time * 0x989680L)); } public static int ConvertToMtTime(DateTime time) { - int result = 0; - if (time != DateTime.MinValue) - { - DateTime tmpTime = new DateTime(1970, 1, 1); - result = (int)((time.Ticks - tmpTime.Ticks) / 0x989680L); - } + var result = 0; + if (time == DateTime.MinValue) return result; + var tmpTime = new DateTime(1970, 1, 1); + result = (int)((time.Ticks - tmpTime.Ticks) / 0x989680L); return result; } } diff --git a/MtApi5/MtApi5Client.cs b/MtApi5/MtApi5Client.cs index fef2493b..25463eaf 100755 --- a/MtApi5/MtApi5Client.cs +++ b/MtApi5/MtApi5Client.cs @@ -719,7 +719,7 @@ namespace MtApi5 return ratesArray?.Length ?? 0; } - + /// ///Gets history data of MqlRates structure of a specified symbol-period in specified quantity into the ratesArray array. The elements ordering of the copied data is from present to the past, i.e., starting position of 0 means the current bar. ///