Updated MatApi4 expert to build on last version of MT4

This commit is contained in:
Vyacheslav Demidyuk
2015-06-30 15:21:28 +03:00
parent c51e682555
commit ddee6c792e
7 changed files with 288 additions and 302 deletions
+2 -2
View File
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.16.0")] [assembly: AssemblyVersion("1.0.17.0")]
[assembly: AssemblyFileVersion("1.0.16.0")] [assembly: AssemblyFileVersion("1.0.17.0")]
+13 -25
View File
@@ -17,26 +17,14 @@ using namespace System::IO;
using namespace System::Collections::Generic; using namespace System::Collections::Generic;
using namespace System::Diagnostics; using namespace System::Diagnostics;
struct MqlStr void convertSystemString(wchar_t* dest, String^ src)
{ {
}; pin_ptr<const wchar_t> wch = PtrToStringChars(src);
memcpy(dest, wch, wcslen(wch) * sizeof(wchar_t));
void mqlStrFromNetStr(MqlStr* dst, String^ src) dest[wcslen(wch)] = '\0';
{
char* numPtr2 = *((char**) (dst + 4));
char* numPtr = (char*) Marshal::StringToHGlobalAnsi(src).ToPointer();
int num = strlen(numPtr);
int num2 = 0x80;
if (num >= num2)
{
num = num2 - 1;
}
strncpy_s(numPtr2, (unsigned int) num2, numPtr, (unsigned int) num);
Marshal::FreeHGlobal((IntPtr) numPtr);
*((int*) dst) = num;
} }
int _stdcall initExpert(int expertHandle, int port, char* symbol, double bid, double ask, MqlStr* err) int _stdcall initExpert(int expertHandle, int port, wchar_t* symbol, double bid, double ask, wchar_t* err)
{ {
try try
{ {
@@ -46,14 +34,14 @@ int _stdcall initExpert(int expertHandle, int port, char* symbol, double bid, do
} }
catch (Exception^ e) catch (Exception^ e)
{ {
mqlStrFromNetStr(err, e->Message); convertSystemString(err, e->Message);
Debug::WriteLine("[ERROR] MTConnector:initExpert(): " + e->Message); Debug::WriteLine("[ERROR] MTConnector:initExpert(): " + e->Message);
return 0; return 0;
} }
return 1; return 1;
} }
int _stdcall deinitExpert(int expertHandle, MqlStr* err) int _stdcall deinitExpert(int expertHandle, wchar_t* err)
{ {
try try
{ {
@@ -61,14 +49,14 @@ int _stdcall deinitExpert(int expertHandle, MqlStr* err)
} }
catch (Exception^ e) catch (Exception^ e)
{ {
mqlStrFromNetStr(err, e->Message); convertSystemString(err, e->Message);
Debug::WriteLine("[ERROR] MTConnector:deinitExpert(): " + e->Message); Debug::WriteLine("[ERROR] MTConnector:deinitExpert(): " + e->Message);
return 0; return 0;
} }
return 1; return 1;
} }
int _stdcall updateQuote(int expertHandle, char* symbol, double bid, double ask, MqlStr* err) int _stdcall updateQuote(int expertHandle, wchar_t* symbol, double bid, double ask, wchar_t* err)
{ {
try try
{ {
@@ -76,7 +64,7 @@ int _stdcall updateQuote(int expertHandle, char* symbol, double bid, double ask,
} }
catch (Exception^ e) catch (Exception^ e)
{ {
mqlStrFromNetStr(err, e->Message); convertSystemString(err, e->Message);
Debug::WriteLine("[ERROR] MTConnector:updateQuote(): " + e->Message); Debug::WriteLine("[ERROR] MTConnector:updateQuote(): " + e->Message);
return 0; return 0;
} }
@@ -127,7 +115,7 @@ int _stdcall sendDoubleResponse(int expertHandle, double response)
return 1; return 1;
} }
int _stdcall sendStringResponse(int expertHandle, char* response) int _stdcall sendStringResponse(int expertHandle, wchar_t* response)
{ {
try try
{ {
@@ -239,11 +227,11 @@ int _stdcall getDoubleValue(int expertHandle, int paramIndex, double* res)
return 1; return 1;
} }
int _stdcall getStringValue(int expertHandle, int paramIndex, MqlStr* res) int _stdcall getStringValue(int expertHandle, int paramIndex, wchar_t* res)
{ {
try try
{ {
mqlStrFromNetStr(res, (String^)MtServerInstance::GetInstance()->GetCommandParameter(expertHandle, paramIndex)); convertSystemString(res, (String^)MtServerInstance::GetInstance()->GetCommandParameter(expertHandle, paramIndex));
} }
catch (Exception^ e) catch (Exception^ e)
{ {
+2 -2
View File
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.18.0")] [assembly: AssemblyVersion("1.0.19.0")]
[assembly: AssemblyFileVersion("1.0.18.0")] [assembly: AssemblyFileVersion("1.0.19.0")]
+1 -1
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<?define ProductName="MtApi" ?> <?define ProductName="MtApi" ?>
<?define ProductVersion="1.0.18" ?> <?define ProductVersion="1.0.19" ?>
<?define Manufacturer="DW"?> <?define Manufacturer="DW"?>
<Product Id="*" <Product Id="*"
+4 -6
View File
@@ -82,6 +82,10 @@
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules> <CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="MtApi, Version=1.0.19.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\Program Files (x86)\MtApi\MtApi.dll</HintPath>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
@@ -148,12 +152,6 @@
<Install>true</Install> <Install>true</Install>
</BootstrapperPackage> </BootstrapperPackage>
</ItemGroup> </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" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- 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. Other similar extension points exist, see Microsoft.Common.targets.
BIN
View File
Binary file not shown.
+266 -266
View File
File diff suppressed because it is too large Load Diff