Refactored MtApi4 (MT4) for working with new architecture

This commit is contained in:
Viacheslav Demydiuk
2024-06-16 13:57:50 +03:00
parent 6dd5e0190f
commit a830dc11a6
89 changed files with 1648 additions and 2390 deletions
+54 -13
View File
@@ -15,12 +15,24 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TestClients", "TestClients"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MtApi5TestClient", "TestClients\MtApi5TestClient\MtApi5TestClient.csproj", "{38B9C657-BC2F-44F0-8824-54B31F2A64F5}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MtApi5TestClient", "TestClients\MtApi5TestClient\MtApi5TestClient.csproj", "{38B9C657-BC2F-44F0-8824-54B31F2A64F5}"
EndProject EndProject
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "MtApi5Installer", "MtApi5Installer\MtApi5Installer.wixproj", "{A9ED070F-AB4D-4380-9DDE-5D931AC71333}" Project("{B7DD6F7E-DEF8-4E67-B5B7-07EF123DB6F0}") = "MtApi5Installer", "MtApi5Installer\MtApi5Installer.wixproj", "{A9ED070F-AB4D-4380-9DDE-5D931AC71333}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{AC8B5010-DA75-477E-9CA5-547C649E12D8} = {AC8B5010-DA75-477E-9CA5-547C649E12D8} {AC8B5010-DA75-477E-9CA5-547C649E12D8} = {AC8B5010-DA75-477E-9CA5-547C649E12D8}
{CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556} = {CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556} {CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556} = {CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MTConnector", "MTConnector\MTConnector.vcxproj", "{2BE5FAC1-7FB7-45C3-9215-31A5BC4B964F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MtApi", "MtApi\MtApi.csproj", "{7A76C388-A8FB-4949-8170-24D4742E934E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestApiClientUI", "TestClients\TestApiClientUI\TestApiClientUI.csproj", "{663CC515-EAAE-47D4-8933-5008C2DA1160}"
EndProject
Project("{B7DD6F7E-DEF8-4E67-B5B7-07EF123DB6F0}") = "MtApiInstaller", "MtApiInstaller\MtApiInstaller.wixproj", "{78B94552-DB17-40EC-B7C6-23D32DB85DC1}"
ProjectSection(ProjectDependencies) = postProject
{2BE5FAC1-7FB7-45C3-9215-31A5BC4B964F} = {2BE5FAC1-7FB7-45C3-9215-31A5BC4B964F}
{7A76C388-A8FB-4949-8170-24D4742E934E} = {7A76C388-A8FB-4949-8170-24D4742E934E}
EndProjectSection
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@@ -60,55 +72,84 @@ Global
{CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}.Debug|x64.ActiveCfg = Debug|x64 {CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}.Debug|x64.ActiveCfg = Debug|x64
{CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}.Debug|x64.Build.0 = Debug|x64 {CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}.Debug|x64.Build.0 = Debug|x64
{CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}.Debug|x86.ActiveCfg = Debug|Win32 {CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}.Debug|x86.ActiveCfg = Debug|Win32
{CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}.Debug|x86.Build.0 = Debug|Win32
{CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}.Release|Any CPU.ActiveCfg = Release|x64 {CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}.Release|Any CPU.ActiveCfg = Release|x64
{CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}.Release|Any CPU.Build.0 = Release|x64 {CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}.Release|Any CPU.Build.0 = Release|x64
{CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}.Release|x64.ActiveCfg = Release|x64 {CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}.Release|x64.ActiveCfg = Release|x64
{CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}.Release|x64.Build.0 = Release|x64 {CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}.Release|x64.Build.0 = Release|x64
{CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}.Release|x86.ActiveCfg = Release|Win32 {CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}.Release|x86.ActiveCfg = Release|Win32
{CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}.Release|x86.Build.0 = Release|Win32
{AC8B5010-DA75-477E-9CA5-547C649E12D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AC8B5010-DA75-477E-9CA5-547C649E12D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AC8B5010-DA75-477E-9CA5-547C649E12D8}.Debug|Any CPU.Build.0 = Debug|Any CPU {AC8B5010-DA75-477E-9CA5-547C649E12D8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AC8B5010-DA75-477E-9CA5-547C649E12D8}.Debug|x64.ActiveCfg = Debug|Any CPU {AC8B5010-DA75-477E-9CA5-547C649E12D8}.Debug|x64.ActiveCfg = Debug|Any CPU
{AC8B5010-DA75-477E-9CA5-547C649E12D8}.Debug|x64.Build.0 = Debug|Any CPU {AC8B5010-DA75-477E-9CA5-547C649E12D8}.Debug|x64.Build.0 = Debug|Any CPU
{AC8B5010-DA75-477E-9CA5-547C649E12D8}.Debug|x86.ActiveCfg = Debug|Any CPU {AC8B5010-DA75-477E-9CA5-547C649E12D8}.Debug|x86.ActiveCfg = Debug|Any CPU
{AC8B5010-DA75-477E-9CA5-547C649E12D8}.Debug|x86.Build.0 = Debug|Any CPU
{AC8B5010-DA75-477E-9CA5-547C649E12D8}.Release|Any CPU.ActiveCfg = Release|Any CPU {AC8B5010-DA75-477E-9CA5-547C649E12D8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AC8B5010-DA75-477E-9CA5-547C649E12D8}.Release|Any CPU.Build.0 = Release|Any CPU {AC8B5010-DA75-477E-9CA5-547C649E12D8}.Release|Any CPU.Build.0 = Release|Any CPU
{AC8B5010-DA75-477E-9CA5-547C649E12D8}.Release|x64.ActiveCfg = Release|Any CPU {AC8B5010-DA75-477E-9CA5-547C649E12D8}.Release|x64.ActiveCfg = Release|Any CPU
{AC8B5010-DA75-477E-9CA5-547C649E12D8}.Release|x64.Build.0 = Release|Any CPU {AC8B5010-DA75-477E-9CA5-547C649E12D8}.Release|x64.Build.0 = Release|Any CPU
{AC8B5010-DA75-477E-9CA5-547C649E12D8}.Release|x86.ActiveCfg = Release|Any CPU {AC8B5010-DA75-477E-9CA5-547C649E12D8}.Release|x86.ActiveCfg = Release|Any CPU
{AC8B5010-DA75-477E-9CA5-547C649E12D8}.Release|x86.Build.0 = Release|Any CPU
{38B9C657-BC2F-44F0-8824-54B31F2A64F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {38B9C657-BC2F-44F0-8824-54B31F2A64F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{38B9C657-BC2F-44F0-8824-54B31F2A64F5}.Debug|Any CPU.Build.0 = Debug|Any CPU {38B9C657-BC2F-44F0-8824-54B31F2A64F5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{38B9C657-BC2F-44F0-8824-54B31F2A64F5}.Debug|x64.ActiveCfg = Debug|Any CPU {38B9C657-BC2F-44F0-8824-54B31F2A64F5}.Debug|x64.ActiveCfg = Debug|Any CPU
{38B9C657-BC2F-44F0-8824-54B31F2A64F5}.Debug|x64.Build.0 = Debug|Any CPU {38B9C657-BC2F-44F0-8824-54B31F2A64F5}.Debug|x64.Build.0 = Debug|Any CPU
{38B9C657-BC2F-44F0-8824-54B31F2A64F5}.Debug|x86.ActiveCfg = Debug|x86 {38B9C657-BC2F-44F0-8824-54B31F2A64F5}.Debug|x86.ActiveCfg = Debug|Any CPU
{38B9C657-BC2F-44F0-8824-54B31F2A64F5}.Debug|x86.Build.0 = Debug|x86
{38B9C657-BC2F-44F0-8824-54B31F2A64F5}.Release|Any CPU.ActiveCfg = Release|Any CPU {38B9C657-BC2F-44F0-8824-54B31F2A64F5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{38B9C657-BC2F-44F0-8824-54B31F2A64F5}.Release|Any CPU.Build.0 = Release|Any CPU {38B9C657-BC2F-44F0-8824-54B31F2A64F5}.Release|Any CPU.Build.0 = Release|Any CPU
{38B9C657-BC2F-44F0-8824-54B31F2A64F5}.Release|x64.ActiveCfg = Release|Any CPU {38B9C657-BC2F-44F0-8824-54B31F2A64F5}.Release|x64.ActiveCfg = Release|Any CPU
{38B9C657-BC2F-44F0-8824-54B31F2A64F5}.Release|x64.Build.0 = Release|Any CPU {38B9C657-BC2F-44F0-8824-54B31F2A64F5}.Release|x64.Build.0 = Release|Any CPU
{38B9C657-BC2F-44F0-8824-54B31F2A64F5}.Release|x86.ActiveCfg = Release|x86 {38B9C657-BC2F-44F0-8824-54B31F2A64F5}.Release|x86.ActiveCfg = Release|Any CPU
{38B9C657-BC2F-44F0-8824-54B31F2A64F5}.Release|x86.Build.0 = Release|x86
{A9ED070F-AB4D-4380-9DDE-5D931AC71333}.Debug|Any CPU.ActiveCfg = Debug|x64 {A9ED070F-AB4D-4380-9DDE-5D931AC71333}.Debug|Any CPU.ActiveCfg = Debug|x64
{A9ED070F-AB4D-4380-9DDE-5D931AC71333}.Debug|Any CPU.Build.0 = Debug|x64 {A9ED070F-AB4D-4380-9DDE-5D931AC71333}.Debug|Any CPU.Build.0 = Debug|x64
{A9ED070F-AB4D-4380-9DDE-5D931AC71333}.Debug|x64.ActiveCfg = Debug|x64 {A9ED070F-AB4D-4380-9DDE-5D931AC71333}.Debug|x64.ActiveCfg = Debug|x64
{A9ED070F-AB4D-4380-9DDE-5D931AC71333}.Debug|x64.Build.0 = Debug|x64
{A9ED070F-AB4D-4380-9DDE-5D931AC71333}.Debug|x86.ActiveCfg = Debug|x86 {A9ED070F-AB4D-4380-9DDE-5D931AC71333}.Debug|x86.ActiveCfg = Debug|x86
{A9ED070F-AB4D-4380-9DDE-5D931AC71333}.Debug|x86.Build.0 = Debug|x86
{A9ED070F-AB4D-4380-9DDE-5D931AC71333}.Release|Any CPU.ActiveCfg = Release|x64 {A9ED070F-AB4D-4380-9DDE-5D931AC71333}.Release|Any CPU.ActiveCfg = Release|x64
{A9ED070F-AB4D-4380-9DDE-5D931AC71333}.Release|Any CPU.Build.0 = Release|x64 {A9ED070F-AB4D-4380-9DDE-5D931AC71333}.Release|Any CPU.Build.0 = Release|x64
{A9ED070F-AB4D-4380-9DDE-5D931AC71333}.Release|x64.ActiveCfg = Release|x64 {A9ED070F-AB4D-4380-9DDE-5D931AC71333}.Release|x64.ActiveCfg = Release|x64
{A9ED070F-AB4D-4380-9DDE-5D931AC71333}.Release|x64.Build.0 = Release|x64
{A9ED070F-AB4D-4380-9DDE-5D931AC71333}.Release|x86.ActiveCfg = Release|x86 {A9ED070F-AB4D-4380-9DDE-5D931AC71333}.Release|x86.ActiveCfg = Release|x86
{A9ED070F-AB4D-4380-9DDE-5D931AC71333}.Release|x86.Build.0 = Release|x86 {2BE5FAC1-7FB7-45C3-9215-31A5BC4B964F}.Debug|Any CPU.ActiveCfg = Debug|x64
{2BE5FAC1-7FB7-45C3-9215-31A5BC4B964F}.Debug|Any CPU.Build.0 = Debug|x64
{2BE5FAC1-7FB7-45C3-9215-31A5BC4B964F}.Debug|x64.ActiveCfg = Debug|x64
{2BE5FAC1-7FB7-45C3-9215-31A5BC4B964F}.Debug|x86.ActiveCfg = Debug|Win32
{2BE5FAC1-7FB7-45C3-9215-31A5BC4B964F}.Debug|x86.Build.0 = Debug|Win32
{2BE5FAC1-7FB7-45C3-9215-31A5BC4B964F}.Release|Any CPU.ActiveCfg = Release|x64
{2BE5FAC1-7FB7-45C3-9215-31A5BC4B964F}.Release|Any CPU.Build.0 = Release|x64
{2BE5FAC1-7FB7-45C3-9215-31A5BC4B964F}.Release|x64.ActiveCfg = Release|x64
{2BE5FAC1-7FB7-45C3-9215-31A5BC4B964F}.Release|x86.ActiveCfg = Release|Win32
{2BE5FAC1-7FB7-45C3-9215-31A5BC4B964F}.Release|x86.Build.0 = Release|Win32
{7A76C388-A8FB-4949-8170-24D4742E934E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7A76C388-A8FB-4949-8170-24D4742E934E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7A76C388-A8FB-4949-8170-24D4742E934E}.Debug|x64.ActiveCfg = Debug|Any CPU
{7A76C388-A8FB-4949-8170-24D4742E934E}.Debug|x86.ActiveCfg = Debug|Any CPU
{7A76C388-A8FB-4949-8170-24D4742E934E}.Debug|x86.Build.0 = Debug|Any CPU
{7A76C388-A8FB-4949-8170-24D4742E934E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7A76C388-A8FB-4949-8170-24D4742E934E}.Release|Any CPU.Build.0 = Release|Any CPU
{7A76C388-A8FB-4949-8170-24D4742E934E}.Release|x64.ActiveCfg = Release|Any CPU
{7A76C388-A8FB-4949-8170-24D4742E934E}.Release|x86.ActiveCfg = Release|Any CPU
{7A76C388-A8FB-4949-8170-24D4742E934E}.Release|x86.Build.0 = Release|Any CPU
{663CC515-EAAE-47D4-8933-5008C2DA1160}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{663CC515-EAAE-47D4-8933-5008C2DA1160}.Debug|Any CPU.Build.0 = Debug|Any CPU
{663CC515-EAAE-47D4-8933-5008C2DA1160}.Debug|x64.ActiveCfg = Debug|Any CPU
{663CC515-EAAE-47D4-8933-5008C2DA1160}.Debug|x86.ActiveCfg = Debug|Any CPU
{663CC515-EAAE-47D4-8933-5008C2DA1160}.Release|Any CPU.ActiveCfg = Release|Any CPU
{663CC515-EAAE-47D4-8933-5008C2DA1160}.Release|Any CPU.Build.0 = Release|Any CPU
{663CC515-EAAE-47D4-8933-5008C2DA1160}.Release|x64.ActiveCfg = Release|Any CPU
{663CC515-EAAE-47D4-8933-5008C2DA1160}.Release|x86.ActiveCfg = Release|Any CPU
{78B94552-DB17-40EC-B7C6-23D32DB85DC1}.Debug|Any CPU.ActiveCfg = Debug|x64
{78B94552-DB17-40EC-B7C6-23D32DB85DC1}.Debug|Any CPU.Build.0 = Debug|x64
{78B94552-DB17-40EC-B7C6-23D32DB85DC1}.Debug|x64.ActiveCfg = Debug|x64
{78B94552-DB17-40EC-B7C6-23D32DB85DC1}.Debug|x86.ActiveCfg = Debug|x86
{78B94552-DB17-40EC-B7C6-23D32DB85DC1}.Debug|x86.Build.0 = Debug|x86
{78B94552-DB17-40EC-B7C6-23D32DB85DC1}.Release|Any CPU.ActiveCfg = Release|x64
{78B94552-DB17-40EC-B7C6-23D32DB85DC1}.Release|Any CPU.Build.0 = Release|x64
{78B94552-DB17-40EC-B7C6-23D32DB85DC1}.Release|x64.ActiveCfg = Release|x64
{78B94552-DB17-40EC-B7C6-23D32DB85DC1}.Release|x86.ActiveCfg = Release|x86
{78B94552-DB17-40EC-B7C6-23D32DB85DC1}.Release|x86.Build.0 = Release|x86
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(NestedProjects) = preSolution GlobalSection(NestedProjects) = preSolution
{38B9C657-BC2F-44F0-8824-54B31F2A64F5} = {0C166554-D20F-4996-AA33-436997058FA1} {38B9C657-BC2F-44F0-8824-54B31F2A64F5} = {0C166554-D20F-4996-AA33-436997058FA1}
{663CC515-EAAE-47D4-8933-5008C2DA1160} = {0C166554-D20F-4996-AA33-436997058FA1}
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {7F3C954E-FEF0-4161-B557-9F8D62D7A39F} SolutionGuid = {7F3C954E-FEF0-4161-B557-9F8D62D7A39F}
+1 -1
View File
@@ -6,6 +6,6 @@
public int EventId { get; set; } public int EventId { get; set; }
public long Lparam { get; set; } public long Lparam { get; set; }
public double Dparam { get; set; } public double Dparam { get; set; }
public string Sparam { get; set; } public string Sparam { get; set; } = string.Empty;
} }
} }
+2 -1
View File
@@ -4,6 +4,7 @@
{ {
LastTimeBar = 1, LastTimeBar = 1,
ChartEvent = 2, ChartEvent = 2,
OnLockTicks = 3 OnLockTicks = 3,
OnTick = 4
} }
} }
+1 -1
View File
@@ -2,6 +2,6 @@
{ {
internal class OnLockTicksEvent internal class OnLockTicksEvent
{ {
public string Instrument { get; set; } public string Instrument { get; set; } = string.Empty;
} }
} }
+1 -3
View File
@@ -1,6 +1,4 @@
using System; namespace MtApi
namespace MtApi
{ {
[Flags] [Flags]
public enum FlagFontStyle public enum FlagFontStyle
+11
View File
@@ -0,0 +1,11 @@
namespace MtApi
{
public interface IMtLogger
{
void Debug(object message);
void Error(object message);
void Fatal(object message);
void Info(object message);
void Warn(object message);
}
}
+4 -12
View File
@@ -1,22 +1,14 @@
using System; namespace MtApi.Monitors
using System.Collections.Generic;
namespace MtApi.Monitors
{ {
public class AvailabilityOrdersEventArgs : EventArgs public class AvailabilityOrdersEventArgs(List<MtOrder> opened, List<MtOrder> closed) : EventArgs
{ {
public AvailabilityOrdersEventArgs(List<MtOrder> opened, List<MtOrder> closed)
{
Opened = opened;
Closed = closed;
}
/// <summary> /// <summary>
/// Contains all newly opened orders since the last time the monitor checked the open orders. /// Contains all newly opened orders since the last time the monitor checked the open orders.
/// </summary> /// </summary>
public List<MtOrder> Opened { get; private set; } public List<MtOrder> Opened { get; private set; } = opened;
/// <summary> /// <summary>
/// Contains all newly closed orders since the last time the monitor checked the open orders. /// Contains all newly closed orders since the last time the monitor checked the open orders.
/// </summary> /// </summary>
public List<MtOrder> Closed { get; private set; } public List<MtOrder> Closed { get; private set; } = closed;
} }
} }
+2 -2
View File
@@ -80,8 +80,8 @@ namespace MtApi.Monitors
MonitorTrigger.Stop(); MonitorTrigger.Stop();
} }
} }
private void MonitorTriggerRaised(object sender, EventArgs e) => OnTriggerRaised(); private void MonitorTriggerRaised(object? sender, EventArgs e) => OnTriggerRaised();
private void ApiClientConnectionStateChanged(object sender, MtConnectionEventArgs e) private void ApiClientConnectionStateChanged(object? sender, MtConnectionEventArgs e)
{ {
if (e.Status == MtConnectionState.Connected) if (e.Status == MtConnectionState.Connected)
OnMtConnected(); OnMtConnected();
@@ -1,10 +1,4 @@
using System; namespace MtApi.Monitors
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MtApi.Monitors
{ {
public class ModifiedOrdersEventArgs : EventArgs public class ModifiedOrdersEventArgs : EventArgs
{ {
@@ -1,16 +1,11 @@
using MtApi.Monitors.Triggers; using MtApi.Monitors.Triggers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MtApi.Monitors namespace MtApi.Monitors
{ {
public class ModifiedOrdersMonitor : MtMonitorBase public class ModifiedOrdersMonitor : MtMonitorBase
{ {
#region Fields #region Fields
private List<MtOrder> _lastOrders = null; private List<MtOrder>? _lastOrders;
#endregion #endregion
@@ -25,7 +20,7 @@ namespace MtApi.Monitors
/// <summary> /// <summary>
/// Will be raised when this monitor detects changes on open orders /// Will be raised when this monitor detects changes on open orders
/// </summary> /// </summary>
public event EventHandler<ModifiedOrdersEventArgs> OrdersModified; public event EventHandler<ModifiedOrdersEventArgs>? OrdersModified;
#endregion #endregion
#region ctor #region ctor
@@ -41,7 +36,7 @@ namespace MtApi.Monitors
/// Requests all current open orders /// Requests all current open orders
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
private List<MtOrder> GetOrders() => IsMtConnected ? ApiClient.GetOrders(OrderSelectSource.MODE_TRADES) : null; private List<MtOrder>? GetOrders() => IsMtConnected ? ApiClient.GetOrders(OrderSelectSource.MODE_TRADES) : null;
protected override void OnTriggerRaised() protected override void OnTriggerRaised()
{ {
if(_lastOrders == null) if(_lastOrders == null)
@@ -49,19 +44,23 @@ namespace MtApi.Monitors
_lastOrders = GetOrders(); _lastOrders = GetOrders();
return; return;
} }
List<MtOrder> currentOrders = GetOrders();
var currentOrders = GetOrders() ?? ([]);
OrderModifiedTypes omt = OrderModifiedTypes; OrderModifiedTypes omt = OrderModifiedTypes;
var mtModifiedOrders = currentOrders var mtModifiedOrders = currentOrders
.Select(co => new MtModifiedOrder(_lastOrders.FirstOrDefault(x => x.Ticket == co.Ticket), co)) .Select(co => new MtModifiedOrder(_lastOrders.FirstOrDefault(x => x.Ticket == co.Ticket), co))
.ToList(); .ToList();
List<MtModifiedOrder> modifiedOrders = new List<MtModifiedOrder>();
List<MtModifiedOrder> modifiedOrders = new();
modifiedOrders.AddRange(GetMtModifiedOrdersWithModType(mtModifiedOrders, omt, OrderModifiedTypes.TakeProfit)); //If the takeprofit were changed between both calls modifiedOrders.AddRange(GetMtModifiedOrdersWithModType(mtModifiedOrders, omt, OrderModifiedTypes.TakeProfit)); //If the takeprofit were changed between both calls
modifiedOrders.AddRange(GetMtModifiedOrdersWithModType(mtModifiedOrders, omt, OrderModifiedTypes.StopLoss)); //If the stoploss were changed between both calls modifiedOrders.AddRange(GetMtModifiedOrdersWithModType(mtModifiedOrders, omt, OrderModifiedTypes.StopLoss)); //If the stoploss were changed between both calls
modifiedOrders.AddRange(GetMtModifiedOrdersWithModType(mtModifiedOrders, omt, OrderModifiedTypes.Operation)); //If an order changed from limit / stop order to an open order modifiedOrders.AddRange(GetMtModifiedOrdersWithModType(mtModifiedOrders, omt, OrderModifiedTypes.Operation)); //If an order changed from limit / stop order to an open order
if (modifiedOrders.Count > 0) if (modifiedOrders.Count > 0)
OrdersModified?.Invoke(this, new ModifiedOrdersEventArgs(modifiedOrders)); OrdersModified?.Invoke(this, new ModifiedOrdersEventArgs(modifiedOrders));
_lastOrders = currentOrders; _lastOrders = currentOrders;
} }
private static IEnumerable<MtModifiedOrder> GetMtModifiedOrdersWithModType(IEnumerable<MtModifiedOrder> orders, OrderModifiedTypes globalSearchFlag, OrderModifiedTypes modifiedType) private static IEnumerable<MtModifiedOrder> GetMtModifiedOrdersWithModType(IEnumerable<MtModifiedOrder> orders, OrderModifiedTypes globalSearchFlag, OrderModifiedTypes modifiedType)
=> globalSearchFlag.HasFlag(modifiedType) ? orders.Where(o => o.ModifyType.HasFlag(modifiedType)) : new List<MtModifiedOrder>(); => globalSearchFlag.HasFlag(modifiedType) ? orders.Where(o => o.ModifyType.HasFlag(modifiedType)) : new List<MtModifiedOrder>();
} }
@@ -1,21 +1,15 @@
using System; namespace MtApi.Monitors
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MtApi.Monitors
{ {
public class MtModifiedOrder public class MtModifiedOrder
{ {
/// <summary> /// <summary>
/// The order in its old state (before the changes) /// The order in its old state (before the changes)
/// </summary> /// </summary>
public MtOrder OldOrder { get; } public MtOrder? OldOrder { get; }
/// <summary> /// <summary>
/// The order in its new state (after the changes) /// The order in its new state (after the changes)
/// </summary> /// </summary>
public MtOrder NewOrder { get; } public MtOrder? NewOrder { get; }
/// <summary> /// <summary>
/// The changes found by this instance /// The changes found by this instance
/// </summary> /// </summary>
@@ -25,7 +19,7 @@ namespace MtApi.Monitors
/// </summary> /// </summary>
/// <param name="oldOrder">The order in its old state (before the changes)</param> /// <param name="oldOrder">The order in its old state (before the changes)</param>
/// <param name="newOrder">The order in its new state (after the changes)</param> /// <param name="newOrder">The order in its new state (after the changes)</param>
public MtModifiedOrder(MtOrder oldOrder, MtOrder newOrder) public MtModifiedOrder(MtOrder? oldOrder, MtOrder ?newOrder)
{ {
if (oldOrder != null && newOrder != null && oldOrder.Ticket != newOrder.Ticket) if (oldOrder != null && newOrder != null && oldOrder.Ticket != newOrder.Ticket)
throw new ArgumentException(nameof(oldOrder) + " and " + nameof(newOrder) + " need to have the same ticket id"); throw new ArgumentException(nameof(oldOrder) + " and " + nameof(newOrder) + " need to have the same ticket id");
@@ -1,10 +1,4 @@
using System; namespace MtApi.Monitors
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MtApi.Monitors
{ {
[Flags] [Flags]
public enum OrderModifiedTypes public enum OrderModifiedTypes
+1 -2
View File
@@ -1,5 +1,4 @@
using System; using MtApi.Monitors.Triggers;
using MtApi.Monitors.Triggers;
namespace MtApi.Monitors namespace MtApi.Monitors
{ {
+7 -11
View File
@@ -1,23 +1,19 @@
using System; using MtApi.Monitors.Triggers;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using MtApi.Monitors.Triggers;
namespace MtApi.Monitors namespace MtApi.Monitors
{ {
public class TradeMonitor : MtMonitorBase public class TradeMonitor : MtMonitorBase
{ {
#region Fields #region Fields
private List<MtOrder> _prevOrders; private List<MtOrder>? _prevOrders;
private readonly object _locker = new object(); private readonly object _locker = new();
#endregion #endregion
#region Events #region Events
// //
// Summary: // Summary:
// Occurs when orders are opened or closed. // Occurs when orders are opened or closed.
public event EventHandler<AvailabilityOrdersEventArgs> AvailabilityOrdersChanged; public event EventHandler<AvailabilityOrdersEventArgs>? AvailabilityOrdersChanged;
#endregion #endregion
#region ctor #region ctor
@@ -73,10 +69,10 @@ namespace MtApi.Monitors
{ {
var openedOrders = new List<MtOrder>(); var openedOrders = new List<MtOrder>();
var closedOrders = new List<MtOrder>(); var closedOrders = new List<MtOrder>();
List<MtOrder> prevOrders; List<MtOrder>? prevOrders;
// get current orders from MetaTrader // get current orders from MetaTrader
var tradesOrders = ApiClient.GetOrders(OrderSelectSource.MODE_TRADES); var tradesOrders = ApiClient.GetOrders(OrderSelectSource.MODE_TRADES) ?? [];
lock (_locker) lock (_locker)
prevOrders = _prevOrders; prevOrders = _prevOrders;
@@ -92,7 +88,7 @@ namespace MtApi.Monitors
if (closeOrdersTemp.Count > 0) if (closeOrdersTemp.Count > 0)
{ {
//get closed orders from history with actual values //get closed orders from history with actual values
var historyOrders = ApiClient.GetOrders(OrderSelectSource.MODE_HISTORY); var historyOrders = ApiClient.GetOrders(OrderSelectSource.MODE_HISTORY) ?? [];
closedOrders = closeOrdersTemp.Where(cot => historyOrders.Find(a => a.Ticket == cot.Ticket) != null).ToList(); closedOrders = closeOrdersTemp.Where(cot => historyOrders.Find(a => a.Ticket == cot.Ticket) != null).ToList();
} }
} }
+1 -3
View File
@@ -1,6 +1,4 @@
using System; namespace MtApi.Monitors.Triggers
namespace MtApi.Monitors.Triggers
{ {
/// <summary> /// <summary>
/// Interface for triggers which can be used to trigger a <see cref="MtMonitorBase"/>. /// Interface for triggers which can be used to trigger a <see cref="MtMonitorBase"/>.
+3 -5
View File
@@ -1,6 +1,4 @@
using System; namespace MtApi.Monitors.Triggers
namespace MtApi.Monitors.Triggers
{ {
/// <summary> /// <summary>
/// Raises the <see cref="Raised"/> event if a bar is closed and a new one started. /// Raises the <see cref="Raised"/> event if a bar is closed and a new one started.
@@ -23,7 +21,7 @@ namespace MtApi.Monitors.Triggers
/// <summary> /// <summary>
/// Event will be called if the trigger raised. /// Event will be called if the trigger raised.
/// </summary> /// </summary>
public event EventHandler Raised; public event EventHandler? Raised;
#endregion #endregion
#region ctor #region ctor
@@ -46,7 +44,7 @@ namespace MtApi.Monitors.Triggers
#endregion #endregion
#region Private methods #region Private methods
private void _apiClient_OnLastTimeBar(object sender, TimeBarArgs e) private void _apiClient_OnLastTimeBar(object? sender, TimeBarArgs e)
{ {
if (_isStarted) if (_isStarted)
Raised?.Invoke(this, EventArgs.Empty); Raised?.Invoke(this, EventArgs.Empty);
@@ -1,12 +1,11 @@
using System; using System.Timers;
using System.Timers;
namespace MtApi.Monitors.Triggers namespace MtApi.Monitors.Triggers
{ {
public class TimeElapsedTrigger : IMonitorTrigger public class TimeElapsedTrigger : IMonitorTrigger
{ {
#region Fields #region Fields
readonly Timer _timer; readonly System.Timers.Timer _timer;
#endregion #endregion
#region Properties #region Properties
@@ -34,7 +33,7 @@ namespace MtApi.Monitors.Triggers
/// <summary> /// <summary>
/// Returns true if the trigger is started, otherwise false /// Returns true if the trigger is started, otherwise false
/// </summary> /// </summary>
public event EventHandler Raised; public event EventHandler? Raised;
#endregion #endregion
#region ctor #region ctor
@@ -45,7 +44,7 @@ namespace MtApi.Monitors.Triggers
/// <param name="autoReset">If true, the trigger will raise continuosly after elapsed <see cref="Interval"/>, otherwise the trigger will raise only once after elapsed <see cref="Interval"/>.</param> /// <param name="autoReset">If true, the trigger will raise continuosly after elapsed <see cref="Interval"/>, otherwise the trigger will raise only once after elapsed <see cref="Interval"/>.</param>
public TimeElapsedTrigger(TimeSpan time, bool autoReset = true) public TimeElapsedTrigger(TimeSpan time, bool autoReset = true)
{ {
_timer = new Timer(time.TotalMilliseconds); _timer = new System.Timers.Timer(time.TotalMilliseconds);
_timer.Elapsed += _timer_Elapsed; _timer.Elapsed += _timer_Elapsed;
AutoReset = autoReset; AutoReset = autoReset;
} }
@@ -63,7 +62,7 @@ namespace MtApi.Monitors.Triggers
#endregion #endregion
#region private methods #region private methods
private void _timer_Elapsed(object sender, ElapsedEventArgs e) private void _timer_Elapsed(object? sender, ElapsedEventArgs e)
{ {
_timer.Elapsed -= _timer_Elapsed; _timer.Elapsed -= _timer_Elapsed;
Raised?.Invoke(this, EventArgs.Empty); Raised?.Invoke(this, EventArgs.Empty);
+1 -3
View File
@@ -1,6 +1,4 @@
using System; namespace MtApi
namespace MtApi
{ {
public class MqlRates public class MqlRates
{ {
+1 -3
View File
@@ -1,6 +1,4 @@
using System; namespace MtApi
namespace MtApi
{ {
public class MqlTick public class MqlTick
{ {
+15 -166
View File
@@ -1,167 +1,16 @@
<?xml version="1.0" encoding="utf-8"?> <Project Sdk="Microsoft.NET.Sdk">
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup>
<PropertyGroup> <TargetFramework>net8.0</TargetFramework>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <ImplicitUsings>enable</ImplicitUsings>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Nullable>enable</Nullable>
<ProductVersion>8.0.30703</ProductVersion> <VersionPrefix>2.0.0</VersionPrefix>
<SchemaVersion>2.0</SchemaVersion> <BaseOutputPath>$(SolutionDir)build\products</BaseOutputPath>
<ProjectGuid>{7A76C388-A8FB-4949-8170-24D4742E934E}</ProjectGuid> <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<OutputType>Library</OutputType> </PropertyGroup>
<AppDesignerFolder>Properties</AppDesignerFolder> <ItemGroup>
<RootNamespace>MtApi</RootNamespace> <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<AssemblyName>MtApi</AssemblyName> </ItemGroup>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion> <ItemGroup>
<FileAlignment>512</FileAlignment> <ProjectReference Include="..\MtClient\MtClient.csproj" />
<TargetFrameworkProfile> </ItemGroup>
</TargetFrameworkProfile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\build\products\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\build\products\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>AnyCPU</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>false</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>
</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="ChartEventArgs.cs" />
<Compile Include="ChartPeriod.cs" />
<Compile Include="EnumAlignMode.cs" />
<Compile Include="EnumChartPropertyDouble.cs" />
<Compile Include="EnumChartPropertyInteger.cs" />
<Compile Include="EnumChartPropertyString.cs" />
<Compile Include="EnumColorFormat.cs" />
<Compile Include="EnumObject.cs" />
<Compile Include="EnumObjectPropertyDouble.cs" />
<Compile Include="EnumObjectPropertyInteger.cs" />
<Compile Include="EnumObjectPropertyString.cs" />
<Compile Include="EnumSeriesInfoInteger.cs" />
<Compile Include="EnumSymbolInfoDouble.cs" />
<Compile Include="EnumSymbolInfoInteger.cs" />
<Compile Include="EnumTerminalInfoDouble.cs" />
<Compile Include="EnumTerminalInfoInteger.cs" />
<Compile Include="Events\OnLockTicksEvent.cs" />
<Compile Include="FlagFontStyle.cs" />
<Compile Include="Monitors\AvailabilityOrdersEventArgs.cs" />
<Compile Include="Monitors\OrderModification\ModifiedOrdersEventArgs.cs" />
<Compile Include="Monitors\OrderModification\ModifiedOrdersMonitor.cs" />
<Compile Include="Monitors\OrderModification\MtModifiedOrder.cs" />
<Compile Include="Monitors\MtMonitorBase.cs" />
<Compile Include="Monitors\OrderModification\OrderModifiedTypes.cs" />
<Compile Include="Monitors\Triggers\IMonitorTrigger.cs" />
<Compile Include="Monitors\Triggers\NewBarTrigger.cs" />
<Compile Include="Monitors\Triggers\TimeElapsedTrigger.cs" />
<Compile Include="MqlRates.cs" />
<Compile Include="MqlTick.cs" />
<Compile Include="Events\MtChartEvent.cs" />
<Compile Include="MtConnectionEventArgs.cs" />
<Compile Include="MtConnectionException.cs" />
<Compile Include="MtConnectionState.cs" />
<Compile Include="MtCommandType.cs" />
<Compile Include="MtErrorCode.cs" />
<Compile Include="Events\MtEventTypes.cs" />
<Compile Include="MtExecutionException.cs" />
<Compile Include="MtLockTicksEventArgs.cs" />
<Compile Include="MtOrder.cs" />
<Compile Include="MtQuote.cs" />
<Compile Include="MtQuoteEventArgs.cs" />
<Compile Include="MtSession.cs" />
<Compile Include="MtTimeBar.cs" />
<Compile Include="MtTypes.cs" />
<Compile Include="Monitors\TradeMonitor.cs" />
<Compile Include="PriceConstantsType.cs" />
<Compile Include="MarketInfoModeType.cs" />
<Compile Include="MtApiClient.cs" />
<Compile Include="MtApiColorConverter.cs" />
<Compile Include="OrderSelectMode.cs" />
<Compile Include="OrderSelectSource.cs" />
<Compile Include="Requests\CopyRatesRequest.cs" />
<Compile Include="Requests\GetOrderRequest.cs" />
<Compile Include="Requests\GetOrdersRequest.cs" />
<Compile Include="Requests\ICustomRequest.cs" />
<Compile Include="Requests\OrderCloseByRequest.cs" />
<Compile Include="Requests\OrderCloseRequest.cs" />
<Compile Include="Requests\OrderDeleteRequest.cs" />
<Compile Include="Requests\OrderModifyRequest.cs" />
<Compile Include="Requests\OrderSendRequest.cs" />
<Compile Include="Requests\SeriesInfoIntegerRequest.cs" />
<Compile Include="Requests\SessionRequest.cs" />
<Compile Include="Requests\RequestBase.cs" />
<Compile Include="Requests\RequestType.cs" />
<Compile Include="Requests\SymbolInfoDoubleRequest.cs" />
<Compile Include="Requests\SymbolInfoTickRequest.cs" />
<Compile Include="Responses\CopyRatesResponse.cs" />
<Compile Include="Responses\GetOrderResponse.cs" />
<Compile Include="Responses\GetOrdersResponse.cs" />
<Compile Include="Responses\ICustomResponse.cs" />
<Compile Include="Responses\OrderSendResponse.cs" />
<Compile Include="Responses\SeriesInfoIntegerResponse.cs" />
<Compile Include="Responses\SessionResponse.cs" />
<Compile Include="Responses\ResponseBase.cs" />
<Compile Include="Responses\SymbolInfoDoubleResponse.cs" />
<Compile Include="Responses\SymbolInfoTickResponse.cs" />
<Compile Include="SeriesIdentifier.cs" />
<Compile Include="TimeBarArgs.cs" />
<Compile Include="Monitors\TimeframeTradeMonitor.cs" />
<Compile Include="Monitors\TimerTradeMonitor.cs" />
<Compile Include="TradeOperation.cs" />
<Compile Include="MtApiTimeConverter.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MTApiService\MTApiService.csproj">
<Project>{DE76D5C7-B99C-4467-8408-78173BDD84E0}</Project>
<Name>MTApiService</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup />
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project> </Project>
+1206 -999
View File
File diff suppressed because it is too large Load Diff
+1 -5
View File
@@ -1,8 +1,4 @@
using System; using System.Drawing;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
namespace MtApi namespace MtApi
{ {
+3 -8
View File
@@ -1,15 +1,10 @@
using System; namespace MtApi
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MtApi
{ {
class MtApiTimeConverter class MtApiTimeConverter
{ {
public static DateTime ConvertFromMtTime(int time) public static DateTime ConvertFromMtTime(int time)
{ {
DateTime tmpTime = new DateTime(1970, 1, 1); DateTime tmpTime = new(1970, 1, 1);
return new DateTime(tmpTime.Ticks + (time * 0x989680L)); return new DateTime(tmpTime.Ticks + (time * 0x989680L));
} }
@@ -18,7 +13,7 @@ namespace MtApi
int result = 0; int result = 0;
if (time != null && time != DateTime.MinValue) if (time != null && time != DateTime.MinValue)
{ {
DateTime tmpTime = new DateTime(1970, 1, 1); DateTime tmpTime = new(1970, 1, 1);
result = (int)((time.Value.Ticks - tmpTime.Ticks) / 0x989680L); result = (int)((time.Value.Ticks - tmpTime.Ticks) / 0x989680L);
} }
return result; return result;
+16 -7
View File
@@ -5,13 +5,11 @@
//NoCommand = 0 //NoCommand = 0
//trade operations //trade operations
// OrderSend = 1, OrderSend = 1,
// OrderSendBuy = 1001, OrderClose = 2,
// OrderSendSell = 1002,
// OrderClose = 2,
// OrderCloseByCurrentPrice = 152, // OrderCloseByCurrentPrice = 152,
// OrderCloseBy = 3, OrderCloseBy = 3,
OrderClosePrice = 4, OrderClosePrice = 4,
OrderClosePriceByTicket = 1004, OrderClosePriceByTicket = 1004,
OrderCloseTime = 5, OrderCloseTime = 5,
@@ -136,7 +134,7 @@
iBullsPower = 106, iBullsPower = 106,
iCCI = 107, iCCI = 107,
iCCIOnArray = 108, iCCIOnArray = 108,
//iCustom = 109, iCustom = 109,
//iCustom_d = 10109, //iCustom_d = 10109,
iDeMarker = 110, iDeMarker = 110,
iEnvelopes = 111, iEnvelopes = 111,
@@ -278,6 +276,17 @@
WindowXOnDropped = 278, WindowXOnDropped = 278,
WindowYOnDropped = 279, WindowYOnDropped = 279,
ChangeAccount = 280 ChangeAccount = 280,
GetOrder = 282,
GetOrders = 283,
CopyRates = 284,
Session = 285,
SeriesInfoInteger = 286,
SeriesInfoString = 287,
SymbolInfoTick = 288,
SymbolInfoDouble = 289,
GetQuote = 290
} }
} }
+4 -12
View File
@@ -1,16 +1,8 @@
using System; namespace MtApi
namespace MtApi
{ {
public class MtConnectionEventArgs: EventArgs public class MtConnectionEventArgs(MtConnectionState status, string message) : EventArgs
{ {
public MtConnectionState Status { get; private set; } public MtConnectionState Status { get; private set; } = status;
public string ConnectionMessage { get; private set; } public string ConnectionMessage { get; private set; } = message;
public MtConnectionEventArgs(MtConnectionState status, string message)
{
Status = status;
ConnectionMessage = message;
}
} }
} }
+3 -5
View File
@@ -1,6 +1,4 @@
using System; namespace MtApi
namespace MtApi
{ {
public class MtConnectionException: Exception public class MtConnectionException: Exception
{ {
@@ -9,12 +7,12 @@ namespace MtApi
{ {
} }
public MtConnectionException(string message) public MtConnectionException(string? message)
: this(message, null) : this(message, null)
{ {
} }
public MtConnectionException(string message, Exception exception) public MtConnectionException(string? message, Exception? exception)
: base(message, exception) : base(message, exception)
{ {
} }
+1 -6
View File
@@ -1,9 +1,4 @@
using System; namespace MtApi
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MtApi
{ {
public enum MtConnectionState public enum MtConnectionState
{ {
+3 -11
View File
@@ -1,15 +1,7 @@
using System; namespace MtApi
namespace MtApi
{ {
public class MtExecutionException: Exception public class MtExecutionException(MtErrorCode errorCode, string? message) : Exception(message)
{ {
public MtExecutionException(MtErrorCode errorCode, string message) public MtErrorCode ErrorCode { get; private set; } = errorCode;
:base(message)
{
ErrorCode = errorCode;
}
public MtErrorCode ErrorCode { get; private set; }
} }
} }
+1 -3
View File
@@ -1,6 +1,4 @@
using System; namespace MtApi
namespace MtApi
{ {
public class MtLockTicksEventArgs : EventArgs public class MtLockTicksEventArgs : EventArgs
{ {
+3 -5
View File
@@ -1,11 +1,9 @@
using System; namespace MtApi
namespace MtApi
{ {
public class MtOrder public class MtOrder
{ {
public int Ticket { get; set; } public int Ticket { get; set; }
public string Symbol { get; set; } public string Symbol { get; set; } = string.Empty;
public TradeOperation Operation { get; set; } public TradeOperation Operation { get; set; }
public double OpenPrice { get; set; } public double OpenPrice { get; set; }
public double ClosePrice { get; set; } public double ClosePrice { get; set; }
@@ -13,7 +11,7 @@ namespace MtApi
public int MtOpenTime { get; set; } public int MtOpenTime { get; set; }
public int MtCloseTime { get; set; } public int MtCloseTime { get; set; }
public double Profit { get; set; } public double Profit { get; set; }
public string Comment { get; set; } public string Comment { get; set; } = string.Empty;
public double Commission { get; set; } public double Commission { get; set; }
public int MagicNumber { get; set; } public int MagicNumber { get; set; }
public double Swap { get; set; } public double Swap { get; set; }
+8
View File
@@ -0,0 +1,8 @@
namespace MtApi.MtProtocol
{
internal class FuncResult<T>
{
public bool RetVal { get; set; }
public T? Result { get; set; }
}
}
+13
View File
@@ -0,0 +1,13 @@
namespace MtApi.MtProtocol
{
namespace ICustomRequest
{
public enum ParametersType
{
Int = 0,
Double = 1,
String = 2,
Boolean = 3
}
}
}
+12
View File
@@ -0,0 +1,12 @@
namespace MtApi.MtProtocol
{
public class MtTick
{
public double Bid { get; set; } // Current Bid price
public double Ask { get; set; } // Current Ask price
public long Time { get; set; } // Time of the last prices update
public double Last { get; set; } // Price of the last deal (Last)
public ulong Volume { get; set; } // Volume for the current Last price
public double VolumeReal { get; set; } // Volume for the current Last price with greater accuracy
}
}
+9
View File
@@ -0,0 +1,9 @@
namespace MtApi.MtProtocol
{
internal class MtRpcQuote
{
public MtTick? Tick { get; set; }
public string? Instrument { get; set; }
public int ExpertHandle { get; set; }
}
}
+10
View File
@@ -0,0 +1,10 @@
namespace MtApi.MtProtocol
{
internal class Response<T>
{
public int ErrorCode { get; set; }
public string? ErrorMessage { get; set; }
public T? Value { get; set; }
}
}
+6 -9
View File
@@ -2,10 +2,10 @@
{ {
public class MtQuote public class MtQuote
{ {
public string Instrument { get; private set; } public string Instrument { get; set; } = string.Empty;
public double Bid { get; private set; } public double Bid { get; set; }
public double Ask { get; private set; } public double Ask { get; set; }
public int ExpertHandle { get; private set; } public int ExpertHandle { get; set; }
public MtQuote(string instrument, double bid, double ask) public MtQuote(string instrument, double bid, double ask)
{ {
@@ -14,12 +14,9 @@
Ask = ask; Ask = ask;
} }
internal MtQuote(MTApiService.MtQuote quote) public MtQuote()
{ {
Instrument = quote.Instrument;
Bid = quote.Bid;
Ask = quote.Ask;
ExpertHandle = quote.ExpertHandle;
} }
} }
} }
+3 -10
View File
@@ -1,14 +1,7 @@
using System; namespace MtApi
namespace MtApi
{ {
public class MtQuoteEventArgs : EventArgs public class MtQuoteEventArgs(MtQuote quote) : EventArgs
{ {
public MtQuote Quote { get; private set; } public MtQuote Quote { get; private set; } = quote;
public MtQuoteEventArgs(MtQuote quote)
{
Quote = quote;
}
} }
} }
+8
View File
@@ -0,0 +1,8 @@
namespace MtApi
{
public class MtQuotesEventArgs(IEnumerable<MtQuote> quotes) : EventArgs
{
public IEnumerable<MtQuote> Quotes { get; } = quotes;
}
}
+2 -4
View File
@@ -1,10 +1,8 @@
using System; namespace MtApi
namespace MtApi
{ {
public class MtSession public class MtSession
{ {
public string Symbol { get; set; } public string? Symbol { get; set; }
public DayOfWeek DayOfWeek { get; set; } public DayOfWeek DayOfWeek { get; set; }
public uint Index { get; set; } public uint Index { get; set; }
public int MtFromTime { get; set; } public int MtFromTime { get; set; }
+2 -4
View File
@@ -1,10 +1,8 @@
using System; namespace MtApi
namespace MtApi
{ {
public class MtTimeBar public class MtTimeBar
{ {
public string Symbol { get; set; } public string Symbol { get; set; } = string.Empty;
public int MtOpenTime { get; set; } public int MtOpenTime { get; set; }
public int MtCloseTime { get; set; } public int MtCloseTime { get; set; }
public double Open { get; set; } public double Open { get; set; }
+1 -3
View File
@@ -1,6 +1,4 @@
// ReSharper disable InconsistentNaming namespace MtApi
namespace MtApi
{ {
public enum ENUM_TERMINAL_INFO_STRING public enum ENUM_TERMINAL_INFO_STRING
{ {
+1 -6
View File
@@ -1,9 +1,4 @@
using System; namespace MtApi
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MtApi
{ {
public enum OrderSelectMode public enum OrderSelectMode
{ {
+1 -6
View File
@@ -1,9 +1,4 @@
using System; namespace MtApi
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MtApi
{ {
public enum OrderSelectSource public enum OrderSelectSource
{ {
+1 -6
View File
@@ -1,9 +1,4 @@
using System; namespace MtApi
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MtApi
{ {
public enum PriceConstantsType public enum PriceConstantsType
{ {
-36
View File
@@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("MtApi")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("DW")]
[assembly: AssemblyProduct("MtApi")]
[assembly: AssemblyCopyright("Copyright © DW 2011")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("650e3c56-dbce-45d4-a844-94bbe9f9a3bf")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.43.0")]
[assembly: AssemblyFileVersion("1.0.43.0")]
-43
View File
@@ -1,43 +0,0 @@
namespace MtApi.Requests
{
internal abstract class CopyRatesRequestBase : RequestBase
{
public enum CopyRatesTypeEnum
{
CopyRates_1 = 1,
CopyRates_2 = 2,
CopyRates_3 = 3,
}
public override RequestType RequestType => RequestType.CopyRates;
public abstract CopyRatesTypeEnum CopyRatesType { get; }
public string SymbolName { get; set; }
public ENUM_TIMEFRAMES Timeframe { get; set; }
}
internal class CopyRates1Request : CopyRatesRequestBase
{
public override CopyRatesTypeEnum CopyRatesType => CopyRatesTypeEnum.CopyRates_1;
public int StartPos { get; set; }
public int Count { get; set; }
}
internal class CopyRates2Request : CopyRatesRequestBase
{
public override CopyRatesTypeEnum CopyRatesType => CopyRatesTypeEnum.CopyRates_2;
public int StartTime { get; set; }
public int Count { get; set; }
}
internal class CopyRates3Request : CopyRatesRequestBase
{
public override CopyRatesTypeEnum CopyRatesType => CopyRatesTypeEnum.CopyRates_3;
public int StartTime { get; set; }
public int StopTime { get; set; }
}
}
-11
View File
@@ -1,11 +0,0 @@
namespace MtApi.Requests
{
internal class GetOrderRequest: RequestBase
{
public int Index { get; set; }
public int Select { get; set; }
public int Pool { get; set; }
public override RequestType RequestType => RequestType.GetOrder;
}
}
-9
View File
@@ -1,9 +0,0 @@
namespace MtApi.Requests
{
internal class GetOrdersRequest: RequestBase
{
public int Pool { get; set; }
public override RequestType RequestType => RequestType.GetOrders;
}
}
-25
View File
@@ -1,25 +0,0 @@
using System.Collections;
namespace MtApi.Requests
{
internal class ICustomRequest : RequestBase
{
public enum ParametersType
{
Int = 0,
Double = 1,
String = 2,
Boolean = 3
}
public string Symbol { get; set; }
public int Timeframe { get; set; }
public string Name { get; set; }
public int Mode { get; set; }
public int Shift { get; set; }
public ArrayList Params { get; set; }
public ParametersType ParamsType { get; set; }
public override RequestType RequestType => RequestType.iCustom;
}
}
-12
View File
@@ -1,12 +0,0 @@
namespace MtApi.Requests
{
internal class OrderCloseByRequest: RequestBase
{
public int Ticket { get; set; }
public int Opposite { get; set; }
public int? ArrowColor { get; set; }
public override RequestType RequestType => RequestType.OrderCloseBy;
}
}
-14
View File
@@ -1,14 +0,0 @@
namespace MtApi.Requests
{
internal class OrderCloseRequest: RequestBase
{
public int Ticket { get; set; }
public double? Lots { get; set; }
public double? Price { get; set; }
public int? Slippage { get; set; }
public int? ArrowColor { get; set; }
public override RequestType RequestType => RequestType.OrderClose;
}
}
-11
View File
@@ -1,11 +0,0 @@
namespace MtApi.Requests
{
internal class OrderDeleteRequest: RequestBase
{
public int Ticket { get; set; }
public int? ArrowColor { get; set; }
public override RequestType RequestType => RequestType.OrderDelete;
}
}
-15
View File
@@ -1,15 +0,0 @@
namespace MtApi.Requests
{
internal class OrderModifyRequest: RequestBase
{
public int Ticket { get; set; }
public double Price { get; set; }
public double Stoploss { get; set; }
public double Takeprofit { get; set; }
public int Expiration { get; set; }
public int? ArrowColor { get; set; }
public override RequestType RequestType => RequestType.OrderModify;
}
}
-20
View File
@@ -1,20 +0,0 @@
namespace MtApi.Requests
{
internal class OrderSendRequest: RequestBase
{
public string Symbol { get; set; }
public int Cmd { get; set; }
public double Volume { get; set; }
public double? Price { get; set; }
public int? Slippage { get; set; }
public double? Stoploss { get; set; }
public double? Takeprofit { get; set; }
public string Comment { get; set; }
public int? Magic { get; set; }
public int? Expiration { get; set; }
public int? ArrowColor { get; set; }
public override RequestType RequestType => RequestType.OrderSend;
}
}
-7
View File
@@ -1,7 +0,0 @@
namespace MtApi.Requests
{
internal abstract class RequestBase
{
public abstract RequestType RequestType { get; }
}
}
-20
View File
@@ -1,20 +0,0 @@
namespace MtApi.Requests
{
internal enum RequestType
{
Unknown = 0,
GetOrder = 1,
GetOrders = 2,
OrderSend = 3,
OrderClose = 4,
OrderCloseBy = 5,
OrderDelete = 6,
OrderModify = 7,
iCustom = 8,
CopyRates = 9,
Session = 10,
SeriesInfoInteger = 11,
SymbolInfoDouble = 12,
SymbolInfoTick = 13
}
}
@@ -1,11 +0,0 @@
namespace MtApi.Requests
{
internal class SeriesInfoIntegerRequest: RequestBase
{
public override RequestType RequestType => RequestType.SeriesInfoInteger;
public string SymbolName { get; set; }
public int Timeframe { get; set; }
public int PropId { get; set; }
}
}
-14
View File
@@ -1,14 +0,0 @@
using System;
namespace MtApi.Requests
{
internal class SessionRequest : RequestBase
{
public string Symbol { get; set; }
public DayOfWeek DayOfWeek { get; set; }
public int SessionIndex { get; set; }
public SessionType SessionType { get; set; }
public override RequestType RequestType => RequestType.Session;
}
}
-12
View File
@@ -1,12 +0,0 @@
using System;
namespace MtApi.Requests
{
internal class SymbolInfoDoubleRequest : RequestBase
{
public override RequestType RequestType => RequestType.SymbolInfoDouble;
public string SymbolName { get; set; }
public int PropId { get; set; }
}
}
-9
View File
@@ -1,9 +0,0 @@
namespace MtApi.Requests
{
internal class SymbolInfoTickRequest: RequestBase
{
public override RequestType RequestType => RequestType.SymbolInfoTick;
public string Symbol { get; set; }
}
}
-9
View File
@@ -1,9 +0,0 @@
using System.Collections.Generic;
namespace MtApi.Responses
{
internal class CopyRatesResponse: ResponseBase
{
public List<MqlRates> Rates { get; set; }
}
}
-7
View File
@@ -1,7 +0,0 @@
namespace MtApi.Responses
{
internal class GetOrderResponse: ResponseBase
{
public MtOrder Order { get; set; }
}
}
-9
View File
@@ -1,9 +0,0 @@
using System.Collections.Generic;
namespace MtApi.Responses
{
internal class GetOrdersResponse: ResponseBase
{
public List<MtOrder> Orders { get; set; }
}
}
-7
View File
@@ -1,7 +0,0 @@
namespace MtApi.Responses
{
internal class ICustomResponse: ResponseBase
{
public double Value { get; set; }
}
}
-7
View File
@@ -1,7 +0,0 @@
namespace MtApi.Responses
{
internal class OrderSendResponse: ResponseBase
{
public int Ticket { get; set; }
}
}
-8
View File
@@ -1,8 +0,0 @@
namespace MtApi.Responses
{
internal class ResponseBase
{
public int ErrorCode { get; set; }
public string ErrorMessage { get; set; }
}
}
@@ -1,7 +0,0 @@
namespace MtApi.Responses
{
internal class SeriesInfoIntegerResponse: ResponseBase
{
public long Value { get; set; }
}
}
-7
View File
@@ -1,7 +0,0 @@
namespace MtApi.Responses
{
internal class SessionResponse : ResponseBase
{
public MtSession Session { get; set; }
}
}
@@ -1,7 +0,0 @@
namespace MtApi.Responses
{
internal class SymbolInfoDoubleResponse: ResponseBase
{
public double Value { get; set; }
}
}
@@ -1,7 +0,0 @@
namespace MtApi.Responses
{
internal class SymbolInfoTickResponse: ResponseBase
{
public MqlTick Tick { get; set; }
}
}
+1 -6
View File
@@ -1,9 +1,4 @@
using System; namespace MtApi
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MtApi
{ {
public enum SeriesIdentifier public enum SeriesIdentifier
{ {
+1 -3
View File
@@ -1,6 +1,4 @@
using System; namespace MtApi
namespace MtApi
{ {
public class TimeBarArgs: EventArgs public class TimeBarArgs: EventArgs
{ {
Regular → Executable
View File
+4 -10
View File
@@ -1,13 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> <?define ProductPath="..\build\products\$(var.Configuration)\net8.0\"?>
<Fragment Id="CustomActions"> <Fragment Id="CustomActions">
<CustomAction Id="CopyEx4" Script="vbscript"> <!--<Binary Id="InstallEx4File" SourceFile="$(var.MtApiSetupActions.TargetDir)$(var.MtApiSetupActions.TargetName).dll" />
<![CDATA[ <CustomAction Id="InstallEx4FileAction" DllEntry="InstallEx4File" Execute="immediate" Return="check" BinaryRef="InstallEx4File" />-->
MsgBox("Test")
]]>
</CustomAction>
<Binary Id="InstallEx4File" SourceFile="$(var.MtApiSetupActions.TargetDir)$(var.MtApiSetupActions.TargetName).CA.dll"/>
<CustomAction Id="InstallEx4FileAction" BinaryKey="InstallEx4File" DllEntry="InstallEx4File" Execute="immediate" Return="check"/>
</Fragment> </Fragment>
</Wix> </Wix>
+3 -39
View File
@@ -1,52 +1,16 @@
<?xml version="1.0" encoding="utf-8"?> <Project Sdk="WixToolset.Sdk/5.0.0">
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>3.6</ProductVersion> <ProductVersion>3.6</ProductVersion>
<ProjectGuid>{78b94552-db17-40ec-b7c6-23d32db85dc1}</ProjectGuid> <RunWixToolsOutOfProc>true</RunWixToolsOutOfProc>
<SchemaVersion>2.0</SchemaVersion>
<OutputName>MtApiInstaller</OutputName>
<OutputType>Package</OutputType>
<WixTargetsPath Condition=" '$(WixTargetsPath)' == '' AND '$(MSBuildExtensionsPath32)' != '' ">$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
<WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<OutputPath>..\build\installers\$(Configuration)\</OutputPath> <OutputPath>..\build\installers\$(Configuration)\</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
<DefineConstants>Debug</DefineConstants> <DefineConstants>Debug</DefineConstants>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>..\build\installers\$(Configuration)\</OutputPath> <OutputPath>..\build\installers\$(Configuration)\</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Compile Include="CustomActions.wxs" /> <PackageReference Include="WixToolset.UI.wixext" Version="5.0.0" />
<Compile Include="Product.wxs" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<WixExtension Include="WixUIExtension">
<HintPath>$(WixExtDir)\WixUIExtension.dll</HintPath>
<Name>WixUIExtension</Name>
</WixExtension>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MtApiSetupActions\MtApiSetupActions.csproj">
<Name>MtApiSetupActions</Name>
<Project>{10800f37-f71b-4818-8351-8cf744295f80}</Project>
<Private>True</Private>
<DoNotHarvest>True</DoNotHarvest>
<RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups>
<RefTargetDir>INSTALLFOLDER</RefTargetDir>
</ProjectReference>
</ItemGroup>
<Import Project="$(WixTargetsPath)" />
<!--
To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Wix.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project> </Project>
+35 -59
View File
@@ -1,17 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?> <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui">
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<?define ProductName="MtApi" ?> <?define ProductName="MtApi" ?>
<?define ProductVersion=!(bind.FileVersion.MtApi.dll) ?> <?define ProductVersion=!(bind.FileVersion.MtApi.dll) ?>
<?define Manufacturer="DW"?> <?define Manufacturer="DW"?>
<?define ProductPath="..\build\products\$(var.Configuration)\"?> <?define ProductPath="..\build\products\$(var.Configuration)\net8.0\"?>
<?define ProductPathNative="..\build\products\$(var.Configuration)\$(var.Platform)\"?>
<Package Name="$(var.ProductName) $(var.ProductVersion)" Language="1033" Version="$(var.ProductVersion)" Manufacturer="$(var.Manufacturer)" UpgradeCode="4107F5F4-7300-4B45-88CE-63929AF228FA" InstallerVersion="200">
<Product Id="*"
Name="$(var.ProductName) $(var.ProductVersion)"
Language="1033"
Version="$(var.ProductVersion)"
Manufacturer="$(var.Manufacturer)"
UpgradeCode="4107F5F4-7300-4B45-88CE-63929AF228FA">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<WixVariable Id="WixUILicenseRtf" Value="..\LICENSE.rtf" /> <WixVariable Id="WixUILicenseRtf" Value="..\LICENSE.rtf" />
@@ -19,105 +14,86 @@
<MediaTemplate EmbedCab="yes" /> <MediaTemplate EmbedCab="yes" />
<Feature Id="MtApi" Title="$(var.ProductName)" Level="1"> <Feature Id="MtApi" Title="$(var.ProductName)" Level="1">
<ComponentGroupRef Id="MtApiComponents"/> <ComponentGroupRef Id="MtApiComponents" />
</Feature> </Feature>
<Feature Id="MTConnector" Title="MT Connector" Level="1"> <Feature Id="MTConnector" Title="MT Connector" Level="1">
<ComponentGroupRef Id="MTConnectorComponents"/> <ComponentGroupRef Id="MTConnectorComponents" />
</Feature> </Feature>
<Property Id="WIXUI_INSTALLDIR">INSTALLFOLDER</Property> <Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />
<UI> <UI>
<UIRef Id="WixUI_Mondo" /> <ui:WixUI Id="WixUI_Mondo" />
</UI> </UI>
<InstallExecuteSequence> <InstallExecuteSequence>
<Custom Action="InstallEx4FileAction" After="InstallFinalize">NOT Installed</Custom> <!--<Custom Action="InstallEx4FileAction" After="InstallFinalize" Condition="NOT Installed" />-->
<!--<Custom Action="CopyEx4" After="InstallFinalize" Condition="NOT Installed" />-->
</InstallExecuteSequence> </InstallExecuteSequence>
</Product> </Package>
<Fragment> <Fragment>
<Directory Id="TARGETDIR" Name="SourceDir"> <StandardDirectory Id="ProgramFilesFolder">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="$(var.ProductName)"> <Directory Id="INSTALLFOLDER" Name="$(var.ProductName)">
<Directory Id="ExpertFolder" Name="Experts"> <Directory Id="ExpertFolder" Name="Experts">
</Directory> </Directory>
<Directory Id="GAC" Name="GAC">
</Directory>
</Directory> </Directory>
</Directory> </StandardDirectory>
<Directory Id="SystemFolder"> <StandardDirectory Id="SystemFolder">
</Directory> </StandardDirectory>
<Directory Id="ProgramMenuFolder"> <StandardDirectory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="$(var.ProductName)"> <Directory Id="ApplicationProgramsFolder" Name="$(var.ProductName)">
</Directory> </Directory>
</Directory> </StandardDirectory>
</Directory> </Fragment>
</Fragment>
<Fragment> <Fragment>
<ComponentGroup Id="MtApiComponents"> <ComponentGroup Id="MtApiComponents">
<Component Id="MtApiDll" Directory="INSTALLFOLDER"> <Component Id="MtApiDll" Directory="INSTALLFOLDER">
<File Id="MtApi.dll" Name="MtApi.dll" KeyPath="yes" <File Id="MtApi.dll" Name="MtApi.dll" KeyPath="yes" Source="$(var.ProductPath)MtApi.dll" />
Source="$(var.ProductPath)MtApi.dll" />
<RegistryKey Root="HKLM" <RegistryKey Root="HKLM" Key="Software\Microsoft\.NetFramework\v4.0.30319\AssemblyFoldersEx\$(var.ProductName)" ForceCreateOnInstall="yes" ForceDeleteOnUninstall="yes">
Key="Software\Microsoft\.NetFramework\v4.0.30319\AssemblyFoldersEx\$(var.ProductName)" <RegistryValue Type="string" Value="[INSTALLFOLDER]" />
Action="createAndRemoveOnUninstall">
<RegistryValue Type="string" Value="[INSTALLFOLDER]"/>
</RegistryKey> </RegistryKey>
</Component> </Component>
<!--<Component Id="MTApiServiceDll" Directory="INSTALLFOLDER"> <Component Id="MtClientDll" Directory="INSTALLFOLDER">
<File Id="GAC_MTApiService.dll" Name="MTApiService.dll" KeyPath="yes" <File Id="MtClient.dll" Name="MtClient.dll" KeyPath="yes" Source="$(var.ProductPath)MtClient.dll" />
src="$(var.ProductPath)MTApiService.dll"/> </Component>
</Component>-->
<Component Id="NewtonsoftJsondll" Directory="INSTALLFOLDER"> <Component Id="NewtonsoftJsondll" Directory="INSTALLFOLDER">
<File Id="Newtonsoft.Json.dll" Name="Newtonsoft.Json.dll" KeyPath="yes" <File Id="Newtonsoft.Json.dll" Name="Newtonsoft.Json.dll" KeyPath="yes" Source="$(var.ProductPath)Newtonsoft.Json.dll" />
src="$(var.ProductPath)Newtonsoft.Json.dll"/>
</Component> </Component>
<Component Id="MtApiExpert" Directory="ExpertFolder"> <Component Id="MtApiExpert" Directory="ExpertFolder">
<File Id="MtApi.ex4" Name="MtApi.ex4" KeyPath="yes" <File Id="MtApi.ex4" Name="MtApi.ex4" KeyPath="yes" Source="..\mq4\MtApi.ex4" />
Source="..\mq4\MtApi.ex4" />
</Component> </Component>
<Component Id="AppShortcutConnMgr" Guid="*" Directory="ApplicationProgramsFolder"> <Component Id="AppShortcutConnMgr" Directory="ApplicationProgramsFolder">
<RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/> <RemoveFolder Id="ApplicationProgramsFolder" On="uninstall" />
<RegistryValue Root="HKCU" Key="Software\$(var.ProductName)" Name="installed" Type="integer" Value="1" KeyPath="yes"/> <RegistryValue Root="HKCU" Key="Software\$(var.ProductName)" Name="installed" Type="integer" Value="1" KeyPath="yes" />
</Component> </Component>
</ComponentGroup> </ComponentGroup>
<ComponentGroup Id="MTConnectorComponents"> <ComponentGroup Id="MTConnectorComponents">
<Component Id="ConnectionProfileRegistryKey" Guid="*" Directory="INSTALLFOLDER"> <Component Id="ConnectionProfileRegistryKey" Directory="INSTALLFOLDER">
<RegistryKey Root="HKCU" <RegistryKey Root="HKCU" Key="Software\MtApi\ConnectionProfiles\Local" ForceCreateOnInstall="yes" ForceDeleteOnUninstall="yes">
Key="Software\MtApi\ConnectionProfiles\Local" <RegistryValue Type="string" Name="Host" Value="" />
Action="createAndRemoveOnUninstall"> <RegistryValue Type="integer" Name="Port" Value="8222" KeyPath="yes" />
<RegistryValue Type="string" Name="Host" Value=""/>
<RegistryValue Type="integer" Name="Port" Value="8222" KeyPath="yes"/>
</RegistryKey> </RegistryKey>
</Component> </Component>
<Component Id="MTApiServiceDllGAC" Guid="7285AE3C-D4A9-482A-BC7E-8F5B2A0FE97E" Directory="GAC">
<File Id="MTApiService.dll" Name="MTApiService.dll" KeyPath="yes"
src="$(var.ProductPath)MTApiService.dll" Checksum="yes"
Assembly=".net" AssemblyManifest="MTApiService.dll" Vital="yes" />
</Component>
<Component Id="MTConnectorDll" Directory="SystemFolder"> <Component Id="MTConnectorDll" Directory="SystemFolder">
<File Id="MTConnector.dll" Name="MTConnector.dll" KeyPath="yes" <File Id="MTConnector.dll" Name="MTConnector.dll" KeyPath="yes" Source="$(var.ProductPathNative)MTConnector.dll" />
Source="$(var.ProductPath)MTConnector.dll" />
</Component> </Component>
</ComponentGroup> </ComponentGroup>
+29 -32
View File
@@ -1,9 +1,4 @@
using System; using WixToolset.Dtf.WindowsInstaller;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Windows.Forms;
using Microsoft.Deployment.WindowsInstaller;
namespace MtApiSetupActions namespace MtApiSetupActions
{ {
@@ -20,38 +15,40 @@ namespace MtApiSetupActions
{ {
session.Log("Begin action InstallEx4File..."); session.Log("Begin action InstallEx4File...");
var appDataFolder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); //Directory.CreateDirectory("c:\\dw");
var metaquotesFolder = appDataFolder + TerminalFolder; //var appDataFolder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
if (Directory.Exists(metaquotesFolder)) //var metaquotesFolder = appDataFolder + TerminalFolder;
{
var foldersFound = Directory.GetDirectories(metaquotesFolder, Mql4Folder, SearchOption.AllDirectories);
Console.WriteLine(string.Join("\n", foldersFound));
foreach (var folder in foldersFound) //if (Directory.Exists(metaquotesFolder))
{ //{
var srcFile = session[InstalledExpertFolderProperty] + MtApiFile; // var foldersFound = Directory.GetDirectories(metaquotesFolder, Mql4Folder, SearchOption.AllDirectories);
var destFile = folder + DestinationExpertFolder + MtApiFile; // Console.WriteLine(string.Join("\n", foldersFound));
session.Log(string.Format("Try to copy from {0} to {1}", srcFile, destFile)); // foreach (var folder in foldersFound)
// {
// var srcFile = session[InstalledExpertFolderProperty] + MtApiFile;
// var destFile = folder + DestinationExpertFolder + MtApiFile;
try // session.Log(string.Format("Try to copy from {0} to {1}", srcFile, destFile));
{
File.Copy(srcFile, destFile, true);
}
catch (Exception e)
{
session.Log(string.Format("Failed to copy MtApi4.ex4. {0}", e.Message));
}
session.Log(string.Format("MtApi.ex4 has been coppied to {0}", destFile)); // try
} // {
} // File.Copy(srcFile, destFile, true);
else // }
{ // catch (Exception e)
session.Log("MetaTrader is not installed"); // {
} // session.Log(string.Format("Failed to copy MtApi4.ex4. {0}", e.Message));
// }
// session.Log(string.Format("MtApi.ex4 has been coppied to {0}", destFile));
// }
//}
//else
//{
// session.Log("MetaTrader is not installed");
//}
return ActionResult.Success; return ActionResult.Success;
} }
+11 -51
View File
@@ -1,52 +1,12 @@
<?xml version="1.0" encoding="utf-8"?> <Project Sdk="Microsoft.NET.Sdk">
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup>
<PropertyGroup> <TargetFramework>net8.0</TargetFramework>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <ImplicitUsings>enable</ImplicitUsings>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform> <Nullable>enable</Nullable>
<ProductVersion>8.0.30703</ProductVersion> <BaseOutputPath>$(SolutionDir)build\products</BaseOutputPath>
<SchemaVersion>2.0</SchemaVersion> <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<ProjectGuid>{10800F37-F71B-4818-8351-8CF744295F80}</ProjectGuid> </PropertyGroup>
<OutputType>Library</OutputType> <ItemGroup>
<AppDesignerFolder>Properties</AppDesignerFolder> <PackageReference Include="WixToolset.Dtf.CustomAction" Version="5.0.0" />
<RootNamespace>MtApiSetupActions</RootNamespace> </ItemGroup>
<AssemblyName>MtApiSetupActions</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<WixCATargetsPath Condition=" '$(WixCATargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.CA.targets</WixCATargetsPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.Deployment.WindowsInstaller">
<Private>True</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="CustomAction.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Content Include="CustomAction.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(WixCATargetsPath)" />
</Project> </Project>
@@ -1,35 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("MtApiSetupActions")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MtApiSetupActions")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c0ee9849-c0cd-4f67-8423-fe334565b863")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
+50 -13
View File
@@ -1,4 +1,5 @@
using System.Net.WebSockets; using System.Diagnostics;
using System.Net.WebSockets;
using System.Text; using System.Text;
namespace MtClient namespace MtClient
@@ -137,22 +138,58 @@ namespace MtClient
{ {
try try
{ {
byte[] recvBuffer = new byte[64 * 1024]; using (var ms = new MemoryStream())
while (ws_.State == WebSocketState.Open)
{ {
var result = await ws_.ReceiveAsync(new ArraySegment<byte>(recvBuffer), CancellationToken.None); var messageBuffer = WebSocket.CreateClientBuffer(1024, 64);
if (result.MessageType == WebSocketMessageType.Close) while (ws_.State == WebSocketState.Open)
{ {
logger_.Info($"MtRpcClient.DoReceive: close signal {result.CloseStatusDescription}"); int recvCount = 0;
Disconnected?.Invoke(this, EventArgs.Empty); WebSocketReceiveResult result;
break; do
} {
else result = await ws_.ReceiveAsync(messageBuffer, CancellationToken.None);
{ var byteArray = messageBuffer.Array;
var msg = Encoding.ASCII.GetString(recvBuffer, 0, result.Count); if (byteArray != null)
OnReceive(msg); {
ms.Write(byteArray, messageBuffer.Offset, result.Count);
recvCount += result.Count;
}
}
while (!result.EndOfMessage);
if (result.MessageType == WebSocketMessageType.Close)
{
logger_.Info($"MtRpcClient.DoReceive: close signal {result.CloseStatusDescription}");
Disconnected?.Invoke(this, EventArgs.Empty);
break;
}
else if (result.MessageType == WebSocketMessageType.Text)
{
var msg = Encoding.UTF8.GetString(ms.ToArray(), 0, recvCount);
//var msg = Encoding.ASCII.GetString(recvBuffer, 0, result.Count);
OnReceive(msg);
}
ms.Seek(0, SeekOrigin.Begin);
ms.Position = 0;
} }
} }
//byte[] recvBuffer = new byte[64 * 1024];
//while (ws_.State == WebSocketState.Open)
//{
// var result = await ws_.ReceiveAsync(new ArraySegment<byte>(recvBuffer), CancellationToken.None);
// if (result.MessageType == WebSocketMessageType.Close)
// {
// logger_.Info($"MtRpcClient.DoReceive: close signal {result.CloseStatusDescription}");
// Disconnected?.Invoke(this, EventArgs.Empty);
// break;
// }
// else
// {
// var msg = Encoding.ASCII.GetString(recvBuffer, 0, result.Count);
// OnReceive(msg);
// }
//}
} }
catch (Exception ex) catch (Exception ex)
{ {
+15
View File
@@ -70,6 +70,18 @@
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup> </ImportGroup>
<PropertyGroup Label="UserMacros" /> <PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>$(SolutionDir)\build\products\$(Configuration)\$(Platform)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)\build\products\$(Configuration)\x86\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>$(SolutionDir)\build\products\$(Configuration)\$(Platform)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)\build\products\$(Configuration)\x86\</OutDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
@@ -78,6 +90,7 @@
<ConformanceMode>true</ConformanceMode> <ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader> <PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile> <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<AdditionalIncludeDirectories>$(SolutionDir)thirdparty\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem> <SubSystem>
@@ -95,6 +108,7 @@
<ConformanceMode>true</ConformanceMode> <ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader> <PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile> <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<AdditionalIncludeDirectories>$(SolutionDir)thirdparty\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem> <SubSystem>
@@ -131,6 +145,7 @@
<ConformanceMode>true</ConformanceMode> <ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader> <PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile> <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<AdditionalIncludeDirectories>$(SolutionDir)thirdparty\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem> <SubSystem>
+41 -5
View File
@@ -2,20 +2,50 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Globalization; using System.Globalization;
using System.Windows.Forms;
using MtApi; using MtApi;
using System.Threading.Tasks;
using System.Linq;
using MtApi.Monitors; using MtApi.Monitors;
using System.Runtime.InteropServices;
namespace TestApiClientUI namespace TestApiClientUI
{ {
class MtLogger : IMtLogger
{
public void Debug(object message)
{
Write("DEBUG", message);
}
public void Error(object message)
{
Write("ERROR", message);
}
public void Fatal(object message)
{
Write("FATAL", message);
}
public void Info(object message)
{
Write("INFO", message);
}
public void Warn(object message)
{
Write("WARN", message);
}
private void Write(string level, object message)
{
Console.WriteLine($"[{Environment.CurrentManagedThreadId}] [{level}] {message}");
}
}
public partial class Form1 : Form public partial class Form1 : Form
{ {
#region Fields #region Fields
private readonly List<Action> _groupOrderCommands = new List<Action>(); private readonly List<Action> _groupOrderCommands = [];
private readonly MtApiClient _apiClient = new MtApiClient(); private readonly MtApiClient _apiClient = new (new MtLogger());
private readonly TimerTradeMonitor _timerTradeMonitor; private readonly TimerTradeMonitor _timerTradeMonitor;
private readonly TimeframeTradeMonitor _timeframeTradeMonitor; private readonly TimeframeTradeMonitor _timeframeTradeMonitor;
@@ -61,8 +91,14 @@ namespace TestApiClientUI
_timeframeTradeMonitor = new TimeframeTradeMonitor(_apiClient); _timeframeTradeMonitor = new TimeframeTradeMonitor(_apiClient);
_timeframeTradeMonitor.AvailabilityOrdersChanged += _tradeMonitor_AvailabilityOrdersChanged; _timeframeTradeMonitor.AvailabilityOrdersChanged += _tradeMonitor_AvailabilityOrdersChanged;
AllocConsole();
} }
[DllImport("kernel32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool AllocConsole();
private void InitOrderCommandsGroup() private void InitOrderCommandsGroup()
{ {
_groupOrderCommands.Add(CloseOrders); _groupOrderCommands.Add(CloseOrders);
@@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("TestApiClientUI")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("DW")]
[assembly: AssemblyProduct("TestApiClientUI")]
[assembly: AssemblyCopyright("Copyright © DW 2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("b8a613a1-ac11-4582-a67d-33bfd80fc490")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
@@ -1,63 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestApiClientUI.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TestApiClientUI.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}
@@ -1,117 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -1,26 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestApiClientUI.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}
@@ -1,7 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
@@ -1,169 +1,15 @@
<?xml version="1.0" encoding="utf-8"?> <Project Sdk="Microsoft.NET.Sdk">
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <OutputType>WinExe</OutputType>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform> <TargetFramework>net8.0-windows</TargetFramework>
<ProductVersion>8.0.30703</ProductVersion> <Nullable>enable</Nullable>
<SchemaVersion>2.0</SchemaVersion> <UseWindowsForms>true</UseWindowsForms>
<ProjectGuid>{663CC515-EAAE-47D4-8933-5008C2DA1160}</ProjectGuid> <ImplicitUsings>enable</ImplicitUsings>
<OutputType>WinExe</OutputType> </PropertyGroup>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>TestApiClientUI</RootNamespace> <ItemGroup>
<AssemblyName>TestApiClientUI</AssemblyName> <ProjectReference Include="..\..\MtApi\MtApi.csproj" />
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion> </ItemGroup>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<CodeAnalysisLogFile>bin\Debug\TestApiClientUI.exe.CodeAnalysisLog.xml</CodeAnalysisLogFile>
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<CodeAnalysisLogFile>bin\Release\TestApiClientUI.exe.CodeAnalysisLog.xml</CodeAnalysisLogFile>
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="app.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.0,Profile=Client">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4 Client Profile %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
<Visible>False</Visible>
<ProductName>Windows Installer 3.1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\MtApi\MtApi.csproj">
<Project>{7a76c388-a8fb-4949-8170-24d4742e934e}</Project>
<Name>MtApi</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project> </Project>
+1 -1
View File
@@ -1,3 +1,3 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<configuration> <configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration> <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>