mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-07-27 18:47:55 +00:00
Removed ConnectionManager from MtApi4 and MtApi5 installers. Api server side listens all newtwork connections
This commit is contained in:
@@ -94,7 +94,7 @@ void _stdcall verify(int isDemo, wchar_t* accountName, long accountNumber)
|
||||
g_IsVerified = VerifySignature(inputData, gcnew System::String(signature), publicKey);
|
||||
}
|
||||
|
||||
int _stdcall initExpert(int expertHandle, wchar_t* connectionProfile, wchar_t* symbol, double bid, double ask, wchar_t* err)
|
||||
int _stdcall initExpert(int expertHandle, int port, wchar_t* symbol, double bid, double ask, wchar_t* err)
|
||||
{
|
||||
if (g_IsVerified == false)
|
||||
{
|
||||
@@ -107,7 +107,7 @@ int _stdcall initExpert(int expertHandle, wchar_t* connectionProfile, wchar_t* s
|
||||
try
|
||||
{
|
||||
MT5Handler^ mtHander = gcnew MT5Handler();
|
||||
MtServerInstance::GetInstance()->InitExpert(expertHandle, gcnew String(connectionProfile), gcnew String(symbol), bid, ask, mtHander);
|
||||
MtServerInstance::GetInstance()->InitExpert(expertHandle, port, gcnew String(symbol), bid, ask, mtHander);
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
|
||||
+123
-66
@@ -8,6 +8,7 @@ using System.Net;
|
||||
using System.Diagnostics;
|
||||
using System.ServiceModel.Channels;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Net.Sockets;
|
||||
|
||||
namespace MTApiService
|
||||
{
|
||||
@@ -19,38 +20,28 @@ namespace MTApiService
|
||||
#endregion
|
||||
|
||||
#region ctor
|
||||
public MtServer(MtConnectionProfile profile)
|
||||
public MtServer(int port)
|
||||
{
|
||||
Profile = profile;
|
||||
Port = port;
|
||||
mService = new MtService(this);
|
||||
|
||||
mHosts = new List<ServiceHost>();
|
||||
|
||||
mExecutorManager = new MtCommandExecutorManager();
|
||||
mExecutorManager.CommandExecuted += mExecutorManager_CommandExecuted;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
public MtConnectionProfile Profile { get; private set; }
|
||||
public int Port { get; private set; }
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
public void Start()
|
||||
{
|
||||
lock (mHostLocker)
|
||||
{
|
||||
if (mHost != null)
|
||||
return;
|
||||
|
||||
ServiceHost host = new ServiceHost(mService);
|
||||
|
||||
string mServerUrlAdress = CreateConnectionAddress(Profile);
|
||||
Binding mBinding = CreateConnectionBinding(Profile);
|
||||
|
||||
host.AddServiceEndpoint(typeof(IMtApi), mBinding, mServerUrlAdress);
|
||||
host.Open();
|
||||
|
||||
mHost = host;
|
||||
}
|
||||
bool hostsInitialized = InitHosts(Port);
|
||||
if (hostsInitialized == false)
|
||||
return;
|
||||
|
||||
lock (mExpertsLocker)
|
||||
{
|
||||
@@ -58,6 +49,69 @@ namespace MTApiService
|
||||
}
|
||||
}
|
||||
|
||||
private bool InitHosts(int port)
|
||||
{
|
||||
lock (mHostLocker)
|
||||
{
|
||||
if (mHosts.Count > 0)
|
||||
return false;
|
||||
|
||||
//init local pipe host
|
||||
string localUrl = CreateConnectionAddress(null, port, true);
|
||||
ServiceHost localServiceHost = CreateServiceHost(localUrl, true);
|
||||
if (localServiceHost != null)
|
||||
{
|
||||
mHosts.Add(localServiceHost);
|
||||
}
|
||||
|
||||
//init network hosts
|
||||
IPHostEntry ips = Dns.GetHostEntry(Dns.GetHostName());
|
||||
if (ips != null)
|
||||
{
|
||||
foreach (IPAddress ipAddress in ips.AddressList)
|
||||
{
|
||||
if (ipAddress != null)
|
||||
{
|
||||
if (ipAddress.AddressFamily == AddressFamily.InterNetwork)
|
||||
{
|
||||
string ip = ipAddress.ToString();
|
||||
string networkUrl = CreateConnectionAddress(ip, port, false);
|
||||
ServiceHost serviceHost = CreateServiceHost(networkUrl, false);
|
||||
if (serviceHost != null)
|
||||
{
|
||||
mHosts.Add(serviceHost);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private ServiceHost CreateServiceHost(string serverUrlAdress, bool local)
|
||||
{
|
||||
ServiceHost serviceHost = null;
|
||||
if (serverUrlAdress != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
serviceHost = new ServiceHost(mService);
|
||||
Binding binding = CreateConnectionBinding(local);
|
||||
|
||||
serviceHost.AddServiceEndpoint(typeof(IMtApi), binding, serverUrlAdress);
|
||||
serviceHost.Open();
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Debug.WriteLine("CreateServiceHost: Create ServiceHost failed. " + e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
return serviceHost;
|
||||
}
|
||||
|
||||
public void AddExpert(MtExpert expert)
|
||||
{
|
||||
if (expert != null)
|
||||
@@ -148,67 +202,64 @@ namespace MTApiService
|
||||
stopTimer.Elapsed -= stopTimer_Elapsed;
|
||||
}
|
||||
|
||||
private string CreateConnectionAddress(MtConnectionProfile profile)
|
||||
private string CreateConnectionAddress(string host, int port, bool local)
|
||||
{
|
||||
string connectionAddress = null;
|
||||
|
||||
if (profile != null)
|
||||
if (local == true)
|
||||
{
|
||||
if (string.IsNullOrEmpty(profile.Host))
|
||||
//by Pipe
|
||||
connectionAddress = "net.pipe://localhost/MtApiService_" + port.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
//by Socket
|
||||
if (host != null)
|
||||
{
|
||||
//by Pipe
|
||||
connectionAddress = "net.pipe://localhost/MtApiService_" + profile.Port.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
//by Socket
|
||||
connectionAddress = "net.tcp://" + profile.Host.ToString() + ":" + profile.Port.ToString() + "/MtApiService";
|
||||
}
|
||||
connectionAddress = "net.tcp://" + host.ToString() + ":" + port.ToString() + "/MtApiService";
|
||||
}
|
||||
}
|
||||
|
||||
return connectionAddress;
|
||||
}
|
||||
|
||||
private static Binding CreateConnectionBinding(MtConnectionProfile profile)
|
||||
private static Binding CreateConnectionBinding(bool local)
|
||||
{
|
||||
Binding connectionBinding = null;
|
||||
|
||||
if (profile != null)
|
||||
if (local == true)
|
||||
{
|
||||
if (string.IsNullOrEmpty(profile.Host))
|
||||
{
|
||||
//by Pipe
|
||||
var bind = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None);
|
||||
bind.MaxReceivedMessageSize = 2147483647;
|
||||
bind.MaxBufferSize = 2147483647;
|
||||
//by Pipe
|
||||
var bind = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None);
|
||||
bind.MaxReceivedMessageSize = 2147483647;
|
||||
bind.MaxBufferSize = 2147483647;
|
||||
|
||||
// Commented next statement since it is not required
|
||||
bind.MaxBufferPoolSize = 2147483647;
|
||||
bind.ReaderQuotas.MaxArrayLength = 2147483647;
|
||||
bind.ReaderQuotas.MaxBytesPerRead = 2147483647;
|
||||
bind.ReaderQuotas.MaxDepth = 2147483647;
|
||||
bind.ReaderQuotas.MaxStringContentLength = 2147483647;
|
||||
bind.ReaderQuotas.MaxNameTableCharCount = 2147483647;
|
||||
// Commented next statement since it is not required
|
||||
bind.MaxBufferPoolSize = 2147483647;
|
||||
bind.ReaderQuotas.MaxArrayLength = 2147483647;
|
||||
bind.ReaderQuotas.MaxBytesPerRead = 2147483647;
|
||||
bind.ReaderQuotas.MaxDepth = 2147483647;
|
||||
bind.ReaderQuotas.MaxStringContentLength = 2147483647;
|
||||
bind.ReaderQuotas.MaxNameTableCharCount = 2147483647;
|
||||
|
||||
connectionBinding = bind;
|
||||
}
|
||||
else
|
||||
{
|
||||
//by Socket
|
||||
var bind = new NetTcpBinding(SecurityMode.None);
|
||||
bind.MaxReceivedMessageSize = 2147483647;
|
||||
bind.MaxBufferSize = 2147483647;
|
||||
connectionBinding = bind;
|
||||
}
|
||||
else
|
||||
{
|
||||
//by Socket
|
||||
var bind = new NetTcpBinding(SecurityMode.None);
|
||||
bind.MaxReceivedMessageSize = 2147483647;
|
||||
bind.MaxBufferSize = 2147483647;
|
||||
|
||||
// Commented next statement since it is not required
|
||||
bind.MaxBufferPoolSize = 2147483647;
|
||||
bind.ReaderQuotas.MaxArrayLength = 2147483647;
|
||||
bind.ReaderQuotas.MaxBytesPerRead = 2147483647;
|
||||
bind.ReaderQuotas.MaxDepth = 2147483647;
|
||||
bind.ReaderQuotas.MaxStringContentLength = 2147483647;
|
||||
bind.ReaderQuotas.MaxNameTableCharCount = 2147483647;
|
||||
// Commented next statement since it is not required
|
||||
bind.MaxBufferPoolSize = 2147483647;
|
||||
bind.ReaderQuotas.MaxArrayLength = 2147483647;
|
||||
bind.ReaderQuotas.MaxBytesPerRead = 2147483647;
|
||||
bind.ReaderQuotas.MaxDepth = 2147483647;
|
||||
bind.ReaderQuotas.MaxStringContentLength = 2147483647;
|
||||
bind.ReaderQuotas.MaxNameTableCharCount = 2147483647;
|
||||
|
||||
connectionBinding = bind;
|
||||
}
|
||||
connectionBinding = bind;
|
||||
}
|
||||
|
||||
return connectionBinding;
|
||||
@@ -220,23 +271,29 @@ namespace MTApiService
|
||||
|
||||
lock (mHostLocker)
|
||||
{
|
||||
if (mHost == null)
|
||||
if (mHosts.Count == 0)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
mHost.Close();
|
||||
foreach (var host in mHosts)
|
||||
{
|
||||
host.Close();
|
||||
}
|
||||
}
|
||||
catch (TimeoutException)
|
||||
{
|
||||
mHost.Abort();
|
||||
foreach (var host in mHosts)
|
||||
{
|
||||
host.Abort();
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
finally
|
||||
{
|
||||
mHost = null;
|
||||
mHosts.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -317,7 +374,7 @@ namespace MTApiService
|
||||
|
||||
#region Fields
|
||||
private readonly MtService mService;
|
||||
private ServiceHost mHost;
|
||||
private readonly List<ServiceHost> mHosts;
|
||||
|
||||
private readonly MtCommandExecutorManager mExecutorManager;
|
||||
private List<MtExpert> mExperts;
|
||||
|
||||
@@ -31,37 +31,22 @@ namespace MTApiService
|
||||
|
||||
|
||||
#region Public Methods
|
||||
public void InitExpert(int expertHandle, string profileName, string symbol, double bid, double ask, IMetaTraderHandler mtHandler)
|
||||
public void InitExpert(int expertHandle, int port, string symbol, double bid, double ask, IMetaTraderHandler mtHandler)
|
||||
{
|
||||
Debug.WriteLine("MtApiServerInstance::InitExpert: symbol = {0}, expertHandle = {1}, profileName = {2}", symbol, expertHandle, profileName);
|
||||
|
||||
if (profileName == null)
|
||||
{
|
||||
string errorMessage = string.Format("Connection profile is null or empty");
|
||||
throw new Exception(errorMessage);
|
||||
}
|
||||
Debug.WriteLine("MtApiServerInstance::InitExpert: symbol = {0}, expertHandle = {1}, port = {2}", symbol, expertHandle, port);
|
||||
|
||||
MtServer server = null;
|
||||
lock (mServersDictionary)
|
||||
{
|
||||
if (mServersDictionary.ContainsKey(profileName))
|
||||
if (mServersDictionary.ContainsKey(port))
|
||||
{
|
||||
server = mServersDictionary[profileName];
|
||||
server = mServersDictionary[port];
|
||||
}
|
||||
else
|
||||
{
|
||||
var profile = MtRegistryManager.LoadConnectionProfile(profileName);
|
||||
|
||||
if (profile == null)
|
||||
{
|
||||
string errorMessage = string.Format("Connection profile '{0}' is not found", profileName);
|
||||
throw new Exception(errorMessage);
|
||||
}
|
||||
|
||||
server = new MtServer(profile);
|
||||
server = new MtServer(port);
|
||||
server.Stopped += new EventHandler(server_Stopped);
|
||||
|
||||
mServersDictionary[profile.Name] = server;
|
||||
mServersDictionary[port] = server;
|
||||
|
||||
server.Start();
|
||||
}
|
||||
@@ -69,7 +54,7 @@ namespace MTApiService
|
||||
|
||||
var expert = new MtExpert(expertHandle, new MtQuote(symbol, bid, ask), mtHandler);
|
||||
|
||||
lock(mExpertsDictionary)
|
||||
lock (mExpertsDictionary)
|
||||
{
|
||||
mExpertsDictionary[expert.Handle] = expert;
|
||||
}
|
||||
@@ -167,15 +152,12 @@ namespace MTApiService
|
||||
MtServer server = (MtServer)sender;
|
||||
server.Stopped -= server_Stopped;
|
||||
|
||||
var profile = server.Profile;
|
||||
if (profile != null)
|
||||
var port = server.Port;
|
||||
lock (mServersDictionary)
|
||||
{
|
||||
lock (mServersDictionary)
|
||||
if (mServersDictionary.ContainsKey(port))
|
||||
{
|
||||
if (mServersDictionary.ContainsKey(profile.Name))
|
||||
{
|
||||
mServersDictionary.Remove(profile.Name);
|
||||
}
|
||||
mServersDictionary.Remove(port);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -183,7 +165,7 @@ namespace MTApiService
|
||||
|
||||
#region Fields
|
||||
private readonly MtRegistryManager mConnectionManager = new MtRegistryManager();
|
||||
private readonly Dictionary<string, MtServer> mServersDictionary = new Dictionary<string, MtServer>();
|
||||
private readonly Dictionary<int, MtServer> mServersDictionary = new Dictionary<int, MtServer>();
|
||||
private readonly Dictionary<int, MtExpert> mExpertsDictionary = new Dictionary<int, MtExpert>();
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// 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.15.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.15.0")]
|
||||
[assembly: AssemblyVersion("1.0.16.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.16.0")]
|
||||
|
||||
@@ -36,13 +36,13 @@ void mqlStrFromNetStr(MqlStr* dst, String^ src)
|
||||
*((int*) dst) = num;
|
||||
}
|
||||
|
||||
int _stdcall initExpert(int expertHandle, char* connectionProfile, char* symbol, double bid, double ask, MqlStr* err)
|
||||
int _stdcall initExpert(int expertHandle, int port, char* symbol, double bid, double ask, MqlStr* err)
|
||||
{
|
||||
try
|
||||
{
|
||||
MT4Handler^ mtHandler = gcnew MT4Handler();
|
||||
|
||||
MtServerInstance::GetInstance()->InitExpert(expertHandle, gcnew String(connectionProfile), gcnew String(symbol), bid, ask, mtHandler);
|
||||
MtServerInstance::GetInstance()->InitExpert(expertHandle, port, gcnew String(symbol), bid, ask, mtHandler);
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
|
||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// 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.17.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.17.0")]
|
||||
[assembly: AssemblyVersion("1.0.18.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.18.0")]
|
||||
|
||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// 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.8.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.8.0")]
|
||||
[assembly: AssemblyVersion("1.0.9.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.9.0")]
|
||||
|
||||
@@ -15,13 +15,13 @@
|
||||
{
|
||||
"Entry"
|
||||
{
|
||||
"MsmKey" = "8:_26066077D06445DAA7176D267C4A5A5C"
|
||||
"OwnerKey" = "8:_UNDEFINED"
|
||||
"MsmKey" = "8:_09A2A529F84A49C7B6AB040A24312600"
|
||||
"OwnerKey" = "8:_8B9C059CECE541EF9F06C906252E106A"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
}
|
||||
"Entry"
|
||||
{
|
||||
"MsmKey" = "8:_324E39D64C4D4ECDA1AAA532677EA0F4"
|
||||
"MsmKey" = "8:_26066077D06445DAA7176D267C4A5A5C"
|
||||
"OwnerKey" = "8:_UNDEFINED"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
}
|
||||
@@ -40,7 +40,7 @@
|
||||
"Entry"
|
||||
{
|
||||
"MsmKey" = "8:_C28BD2D9EC05E0CCB849ABEEA4360539"
|
||||
"OwnerKey" = "8:_324E39D64C4D4ECDA1AAA532677EA0F4"
|
||||
"OwnerKey" = "8:_A1E29B278F4C4BCAA1195F775A473B52"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
}
|
||||
"Entry"
|
||||
@@ -51,14 +51,14 @@
|
||||
}
|
||||
"Entry"
|
||||
{
|
||||
"MsmKey" = "8:_C28BD2D9EC05E0CCB849ABEEA4360539"
|
||||
"MsmKey" = "8:_UNDEFINED"
|
||||
"OwnerKey" = "8:_A1E29B278F4C4BCAA1195F775A473B52"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
}
|
||||
"Entry"
|
||||
{
|
||||
"MsmKey" = "8:_UNDEFINED"
|
||||
"OwnerKey" = "8:_324E39D64C4D4ECDA1AAA532677EA0F4"
|
||||
"OwnerKey" = "8:_8B9C059CECE541EF9F06C906252E106A"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
}
|
||||
"Entry"
|
||||
@@ -67,18 +67,6 @@
|
||||
"OwnerKey" = "8:_C28BD2D9EC05E0CCB849ABEEA4360539"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
}
|
||||
"Entry"
|
||||
{
|
||||
"MsmKey" = "8:_UNDEFINED"
|
||||
"OwnerKey" = "8:_8B9C059CECE541EF9F06C906252E106A"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
}
|
||||
"Entry"
|
||||
{
|
||||
"MsmKey" = "8:_UNDEFINED"
|
||||
"OwnerKey" = "8:_A1E29B278F4C4BCAA1195F775A473B52"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
}
|
||||
}
|
||||
"Configurations"
|
||||
{
|
||||
@@ -208,9 +196,14 @@
|
||||
{
|
||||
"AssemblyRegister" = "3:1"
|
||||
"AssemblyIsInGAC" = "11:FALSE"
|
||||
"AssemblyAsmDisplayName" = "8:MTApiService, Version=1.0.13.0, Culture=neutral, PublicKeyToken=704b91b7000ff499, processorArchitecture=MSIL"
|
||||
"AssemblyAsmDisplayName" = "8:MTApiService, Version=1.0.16.0, Culture=neutral, PublicKeyToken=704b91b7000ff499, processorArchitecture=MSIL"
|
||||
"ScatterAssemblies"
|
||||
{
|
||||
"_C28BD2D9EC05E0CCB849ABEEA4360539"
|
||||
{
|
||||
"Name" = "8:MTApiService.dll"
|
||||
"Attributes" = "3:512"
|
||||
}
|
||||
}
|
||||
"SourcePath" = "8:MTApiService.dll"
|
||||
"TargetName" = "8:"
|
||||
@@ -341,15 +334,15 @@
|
||||
{
|
||||
"Name" = "8:Microsoft Visual Studio"
|
||||
"ProductName" = "8:MtApi5"
|
||||
"ProductCode" = "8:{02DC498A-5F06-4134-BD32-C5D677B8017A}"
|
||||
"PackageCode" = "8:{23755B17-D96D-4C2C-A6BD-D3E136A8992E}"
|
||||
"ProductCode" = "8:{63AEBD77-6321-43A9-AAD6-A23851E21689}"
|
||||
"PackageCode" = "8:{7C51C7DD-2527-4EAA-BFEB-E679F5598C7C}"
|
||||
"UpgradeCode" = "8:{5673F99F-74B5-4D75-9648-3250C9B492FB}"
|
||||
"AspNetVersion" = "8:4.0.30319.0"
|
||||
"RestartWWWService" = "11:FALSE"
|
||||
"RemovePreviousVersions" = "11:TRUE"
|
||||
"DetectNewerInstalledVersion" = "11:TRUE"
|
||||
"InstallAllUsers" = "11:FALSE"
|
||||
"ProductVersion" = "8:1.0.8"
|
||||
"ProductVersion" = "8:1.0.9"
|
||||
"Manufacturer" = "8:DW"
|
||||
"ARPHELPTELEPHONE" = "8:"
|
||||
"ARPHELPLINK" = "8:"
|
||||
@@ -612,20 +605,6 @@
|
||||
}
|
||||
"Shortcut"
|
||||
{
|
||||
"{970C0BB2-C7D0-45D7-ABFA-7EC378858BC0}:_1ED863424C6F4192BB1EA4C93066568D"
|
||||
{
|
||||
"Name" = "8:ConnectionsManager"
|
||||
"Arguments" = "8:"
|
||||
"Description" = "8:"
|
||||
"ShowCmd" = "3:1"
|
||||
"IconIndex" = "3:32512"
|
||||
"Transitive" = "11:FALSE"
|
||||
"Target" = "8:_324E39D64C4D4ECDA1AAA532677EA0F4"
|
||||
"Folder" = "8:_DBA35A849F8E43DA91CB111FD9E4DA07"
|
||||
"WorkingFolder" = "8:_234A0E905EAA4F9288321F174D48109C"
|
||||
"Icon" = "8:_324E39D64C4D4ECDA1AAA532677EA0F4"
|
||||
"Feature" = "8:"
|
||||
}
|
||||
"{970C0BB2-C7D0-45D7-ABFA-7EC378858BC0}:_A632B76B37AF4FF4B995A0F1797DB1D8"
|
||||
{
|
||||
"Name" = "8:MtApi5.ex5"
|
||||
@@ -1036,40 +1015,26 @@
|
||||
}
|
||||
"MergeModule"
|
||||
{
|
||||
"{CEE29DC0-9FBA-4B99-8D47-5BC643D9B626}:_09A2A529F84A49C7B6AB040A24312600"
|
||||
{
|
||||
"UseDynamicProperties" = "11:TRUE"
|
||||
"IsDependency" = "11:TRUE"
|
||||
"SourcePath" = "8:Microsoft_VC100_CRT_x64.msm"
|
||||
"Properties"
|
||||
{
|
||||
}
|
||||
"LanguageId" = "3:0"
|
||||
"Exclude" = "11:FALSE"
|
||||
"Folder" = "8:"
|
||||
"Feature" = "8:"
|
||||
"IsolateTo" = "8:"
|
||||
}
|
||||
}
|
||||
"ProjectOutput"
|
||||
{
|
||||
"{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_324E39D64C4D4ECDA1AAA532677EA0F4"
|
||||
{
|
||||
"SourcePath" = "8:..\\ConnectionsManager\\obj\\Release\\ConnectionsManager.exe"
|
||||
"TargetName" = "8:"
|
||||
"Tag" = "8:"
|
||||
"Folder" = "8:_234A0E905EAA4F9288321F174D48109C"
|
||||
"Condition" = "8:"
|
||||
"Transitive" = "11:FALSE"
|
||||
"Vital" = "11:TRUE"
|
||||
"ReadOnly" = "11:FALSE"
|
||||
"Hidden" = "11:FALSE"
|
||||
"System" = "11:FALSE"
|
||||
"Permanent" = "11:FALSE"
|
||||
"SharedLegacy" = "11:FALSE"
|
||||
"PackageAs" = "3:1"
|
||||
"Register" = "3:1"
|
||||
"Exclude" = "11:FALSE"
|
||||
"IsDependency" = "11:FALSE"
|
||||
"IsolateTo" = "8:"
|
||||
"ProjectOutputGroupRegister" = "3:1"
|
||||
"OutputConfiguration" = "8:"
|
||||
"OutputGroupCanonicalName" = "8:Built"
|
||||
"OutputProjectGuid" = "8:{C8751BA1-6A85-468C-87BD-758F37B8C0DD}"
|
||||
"ShowKeyOutput" = "11:TRUE"
|
||||
"ExcludeFilters"
|
||||
{
|
||||
}
|
||||
}
|
||||
"{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_8B9C059CECE541EF9F06C906252E106A"
|
||||
{
|
||||
"SourcePath" = "8:..\\Release\\MT5Connector.dll"
|
||||
"SourcePath" = "8:..\\x64\\Release\\MT5Connector.dll"
|
||||
"TargetName" = "8:"
|
||||
"Tag" = "8:"
|
||||
"Folder" = "8:_6185AD4113574BCA9BE89DF5A396A60C"
|
||||
|
||||
@@ -28,29 +28,23 @@
|
||||
"Entry"
|
||||
{
|
||||
"MsmKey" = "8:_1894B11511EC28CA06BF342E1D467761"
|
||||
"OwnerKey" = "8:_67B77AB154964269BD0C77F69052517C"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
}
|
||||
"Entry"
|
||||
{
|
||||
"MsmKey" = "8:_1894B11511EC28CA06BF342E1D467761"
|
||||
"OwnerKey" = "8:_BC617CC9A43A49E8B6CDC49115E4A3BC"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
}
|
||||
"Entry"
|
||||
{
|
||||
"MsmKey" = "8:_67B77AB154964269BD0C77F69052517C"
|
||||
"OwnerKey" = "8:_UNDEFINED"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
}
|
||||
"Entry"
|
||||
{
|
||||
"MsmKey" = "8:_BC617CC9A43A49E8B6CDC49115E4A3BC"
|
||||
"OwnerKey" = "8:_UNDEFINED"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
}
|
||||
"Entry"
|
||||
{
|
||||
"MsmKey" = "8:_D37870AADDAD48659E6D4F4674204721"
|
||||
"OwnerKey" = "8:_BC617CC9A43A49E8B6CDC49115E4A3BC"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
}
|
||||
"Entry"
|
||||
{
|
||||
"MsmKey" = "8:_EEB0B45EB0DA4A1C8854FBB96C7C1BC1"
|
||||
"OwnerKey" = "8:_UNDEFINED"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
@@ -64,12 +58,6 @@
|
||||
"Entry"
|
||||
{
|
||||
"MsmKey" = "8:_UNDEFINED"
|
||||
"OwnerKey" = "8:_67B77AB154964269BD0C77F69052517C"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
}
|
||||
"Entry"
|
||||
{
|
||||
"MsmKey" = "8:_UNDEFINED"
|
||||
"OwnerKey" = "8:_038CD973685F41E989B4EFA7BDE0FCC7"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
}
|
||||
@@ -188,9 +176,14 @@
|
||||
{
|
||||
"AssemblyRegister" = "3:1"
|
||||
"AssemblyIsInGAC" = "11:FALSE"
|
||||
"AssemblyAsmDisplayName" = "8:MTApiService, Version=1.0.13.0, Culture=neutral, PublicKeyToken=704b91b7000ff499, processorArchitecture=MSIL"
|
||||
"AssemblyAsmDisplayName" = "8:MTApiService, Version=1.0.16.0, Culture=neutral, PublicKeyToken=704b91b7000ff499, processorArchitecture=MSIL"
|
||||
"ScatterAssemblies"
|
||||
{
|
||||
"_1894B11511EC28CA06BF342E1D467761"
|
||||
{
|
||||
"Name" = "8:MTApiService.dll"
|
||||
"Attributes" = "3:512"
|
||||
}
|
||||
}
|
||||
"SourcePath" = "8:MTApiService.dll"
|
||||
"TargetName" = "8:"
|
||||
@@ -341,15 +334,15 @@
|
||||
{
|
||||
"Name" = "8:Microsoft Visual Studio"
|
||||
"ProductName" = "8:MtApi5"
|
||||
"ProductCode" = "8:{4B2B9BEE-9FB1-4E27-9B5F-0C7DAE61A624}"
|
||||
"PackageCode" = "8:{743CA117-4184-4A9C-B0F9-298A4D6925DB}"
|
||||
"ProductCode" = "8:{75616430-7567-496D-A23B-F985F257B728}"
|
||||
"PackageCode" = "8:{AEFB2055-7349-4209-A97F-10C3125D1609}"
|
||||
"UpgradeCode" = "8:{0D37B66D-F57F-4AF8-9AF5-B0EB060D60BE}"
|
||||
"AspNetVersion" = "8:4.0.30319.0"
|
||||
"RestartWWWService" = "11:FALSE"
|
||||
"RemovePreviousVersions" = "11:TRUE"
|
||||
"DetectNewerInstalledVersion" = "11:TRUE"
|
||||
"InstallAllUsers" = "11:FALSE"
|
||||
"ProductVersion" = "8:1.0.8"
|
||||
"ProductVersion" = "8:1.0.9"
|
||||
"Manufacturer" = "8:DW"
|
||||
"ARPHELPTELEPHONE" = "8:"
|
||||
"ARPHELPLINK" = "8:"
|
||||
@@ -520,20 +513,6 @@
|
||||
}
|
||||
"Shortcut"
|
||||
{
|
||||
"{970C0BB2-C7D0-45D7-ABFA-7EC378858BC0}:_1E1CBEE93704418385DA08BF427F2BFB"
|
||||
{
|
||||
"Name" = "8:ConnectionsManager"
|
||||
"Arguments" = "8:"
|
||||
"Description" = "8:"
|
||||
"ShowCmd" = "3:1"
|
||||
"IconIndex" = "3:32512"
|
||||
"Transitive" = "11:FALSE"
|
||||
"Target" = "8:_67B77AB154964269BD0C77F69052517C"
|
||||
"Folder" = "8:_AF5FE77112F9440DA1B35AC8377AB0B0"
|
||||
"WorkingFolder" = "8:_C5686AA9455245A68A7C203AF12544DE"
|
||||
"Icon" = "8:_67B77AB154964269BD0C77F69052517C"
|
||||
"Feature" = "8:"
|
||||
}
|
||||
"{970C0BB2-C7D0-45D7-ABFA-7EC378858BC0}:_A1DA4D11FC714A5BB03D89269007F5FF"
|
||||
{
|
||||
"Name" = "8:MtApi5.ex5"
|
||||
@@ -944,6 +923,20 @@
|
||||
}
|
||||
"MergeModule"
|
||||
{
|
||||
"{CEE29DC0-9FBA-4B99-8D47-5BC643D9B626}:_D37870AADDAD48659E6D4F4674204721"
|
||||
{
|
||||
"UseDynamicProperties" = "11:TRUE"
|
||||
"IsDependency" = "11:TRUE"
|
||||
"SourcePath" = "8:Microsoft_VC100_CRT_x86.msm"
|
||||
"Properties"
|
||||
{
|
||||
}
|
||||
"LanguageId" = "3:0"
|
||||
"Exclude" = "11:FALSE"
|
||||
"Folder" = "8:"
|
||||
"Feature" = "8:"
|
||||
"IsolateTo" = "8:"
|
||||
}
|
||||
}
|
||||
"ProjectOutput"
|
||||
{
|
||||
@@ -975,37 +968,9 @@
|
||||
{
|
||||
}
|
||||
}
|
||||
"{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_67B77AB154964269BD0C77F69052517C"
|
||||
{
|
||||
"SourcePath" = "8:..\\ConnectionsManager\\obj\\Release\\ConnectionsManager.exe"
|
||||
"TargetName" = "8:"
|
||||
"Tag" = "8:"
|
||||
"Folder" = "8:_C5686AA9455245A68A7C203AF12544DE"
|
||||
"Condition" = "8:"
|
||||
"Transitive" = "11:FALSE"
|
||||
"Vital" = "11:TRUE"
|
||||
"ReadOnly" = "11:FALSE"
|
||||
"Hidden" = "11:FALSE"
|
||||
"System" = "11:FALSE"
|
||||
"Permanent" = "11:FALSE"
|
||||
"SharedLegacy" = "11:FALSE"
|
||||
"PackageAs" = "3:1"
|
||||
"Register" = "3:1"
|
||||
"Exclude" = "11:FALSE"
|
||||
"IsDependency" = "11:FALSE"
|
||||
"IsolateTo" = "8:"
|
||||
"ProjectOutputGroupRegister" = "3:1"
|
||||
"OutputConfiguration" = "8:"
|
||||
"OutputGroupCanonicalName" = "8:Built"
|
||||
"OutputProjectGuid" = "8:{C8751BA1-6A85-468C-87BD-758F37B8C0DD}"
|
||||
"ShowKeyOutput" = "11:TRUE"
|
||||
"ExcludeFilters"
|
||||
{
|
||||
}
|
||||
}
|
||||
"{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_BC617CC9A43A49E8B6CDC49115E4A3BC"
|
||||
{
|
||||
"SourcePath" = "8:..\\x64\\Release\\MT5Connector.dll"
|
||||
"SourcePath" = "8:..\\Release\\MT5Connector.dll"
|
||||
"TargetName" = "8:"
|
||||
"Tag" = "8:"
|
||||
"Folder" = "8:_82290571E7764B168E741604315C2206"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
|
||||
<?define ProductName="MtApi" ?>
|
||||
<?define ProductVersion="1.0.17" ?>
|
||||
<?define ProductVersion="1.0.18" ?>
|
||||
<?define Manufacturer="DW"?>
|
||||
|
||||
<Product Id="*"
|
||||
@@ -77,17 +77,21 @@
|
||||
Source="..\mq4\MtApi.ex4" />
|
||||
</Component>
|
||||
|
||||
<!--
|
||||
<Component Id="ConnectionsManagerApp" Directory="INSTALLFOLDER">
|
||||
<File Id="ConnectionsManager.exe" Name="ConnectionsManager.exe" KeyPath="yes"
|
||||
Source="..\Release\ConnectionsManager.exe" />
|
||||
</Component>
|
||||
|
||||
-->
|
||||
|
||||
<Component Id="AppShortcutConnMgr" Guid="*" Directory="ApplicationProgramsFolder">
|
||||
<!--
|
||||
<Shortcut Id="ShortcutConnMgr"
|
||||
Name="ConnectionManager"
|
||||
Description="$(var.ProductName)"
|
||||
Target="[INSTALLFOLDER]ConnectionsManager.exe"
|
||||
WorkingDirectory="INSTALLFOLDER"/>
|
||||
-->
|
||||
<RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
|
||||
<RegistryValue Root="HKCU" Key="Software\$(var.ProductName)" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
|
||||
</Component>
|
||||
|
||||
Binary file not shown.
+3
-3
@@ -5,7 +5,7 @@
|
||||
#include <stdlib.mqh>
|
||||
|
||||
#import "MTConnector.dll"
|
||||
bool initExpert(int expertHandle, string connectionProfile, string symbol, double bid, double ask, string& err[]);
|
||||
bool initExpert(int expertHandle, int port, string symbol, double bid, double ask, string& err[]);
|
||||
bool deinitExpert(int expertHandle, string& err[]);
|
||||
bool updateQuote(int expertHandle, string symbol, double bid, double ask, string& err[]);
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
bool getStringValue(int expertHandle, int paramIndex, string& res[]);
|
||||
#import
|
||||
|
||||
extern string ConnectionProfile = "Local";
|
||||
extern int Port = 8222;
|
||||
|
||||
int ExpertHandle;
|
||||
|
||||
@@ -169,7 +169,7 @@ int init() {
|
||||
|
||||
ExpertHandle = WindowHandle(Symbol(), Period());
|
||||
|
||||
if (!initExpert(ExpertHandle, ConnectionProfile, Symbol(), Bid, Ask, message))
|
||||
if (!initExpert(ExpertHandle, Port, Symbol(), Bid, Ask, message))
|
||||
{
|
||||
MessageBox(message[0], "MtApi", MB_OK);
|
||||
isCrashed = TRUE;
|
||||
|
||||
Executable
BIN
Binary file not shown.
Binary file not shown.
+15
-16
@@ -5,7 +5,7 @@
|
||||
#include <trade/trade.mqh>
|
||||
|
||||
#import "MT5Connector.dll"
|
||||
bool initExpert(int expertHandle, string connectionProfile, string symbol, double bid, double ask, string& err);
|
||||
bool initExpert(int expertHandle, int port, string symbol, double bid, double ask, string& err);
|
||||
bool deinitExpert(int expertHandle, string& err);
|
||||
|
||||
bool updateQuote(int expertHandle, string symbol, double bid, double ask, string& err);
|
||||
@@ -36,7 +36,7 @@
|
||||
// void verify(bool isDemo, string accountName, long accountNumber);
|
||||
#import
|
||||
|
||||
input string ConnectionProfile = "Local5";
|
||||
input int Port = 8228;
|
||||
|
||||
int ExpertHandle;
|
||||
|
||||
@@ -121,7 +121,7 @@ int init()
|
||||
myBid = Bid;
|
||||
myAsk = Ask;
|
||||
|
||||
if (!initExpert(ExpertHandle, ConnectionProfile, Symbol(), Bid, Ask, message))
|
||||
if (!initExpert(ExpertHandle, Port, Symbol(), Bid, Ask, message))
|
||||
{
|
||||
MessageBox(message, "MtApi", 0);
|
||||
isCrashed = true;
|
||||
@@ -216,7 +216,17 @@ int executeCommand()
|
||||
|
||||
sendStringResponse(ExpertHandle, ResultToString(retVal, result));
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case 63: //OrderCloseAll
|
||||
{
|
||||
bool retVal;
|
||||
|
||||
retVal = OrderCloseAll();
|
||||
|
||||
sendBooleanResponse(ExpertHandle, retVal);
|
||||
}
|
||||
break;
|
||||
|
||||
case 2: // OrderCalcMargin
|
||||
{
|
||||
@@ -1590,18 +1600,7 @@ int executeCommand()
|
||||
sendVoidResponse(ExpertHandle);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 63: //OrderCloseAll
|
||||
{
|
||||
bool retVal;
|
||||
|
||||
retVal = OrderCloseAll();
|
||||
|
||||
sendBooleanResponse(ExpertHandle, retVal);
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
Print("Unknown command type = ", commandType);
|
||||
|
||||
Reference in New Issue
Block a user