mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-08-13 02:38:07 +00:00
Compare commits
30
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f376b4e0e5 | ||
|
|
fc54b5dd4a | ||
|
|
dd05804082 | ||
|
|
4349eb3538 | ||
|
|
e0daf9a82e | ||
|
|
3997b6df74 | ||
|
|
abfe1a281a | ||
|
|
93bfe8e56f | ||
|
|
bb27b4e50d | ||
|
|
0f809cd60a | ||
|
|
f22a6c21f0 | ||
|
|
625753d83a | ||
|
|
d621312a8b | ||
|
|
a4df4bbf1e | ||
|
|
43ef628c69 | ||
|
|
688149bd67 | ||
|
|
c33a5ed6f5 | ||
|
|
828c1185b3 | ||
|
|
4b384d9da2 | ||
|
|
26de553443 | ||
|
|
ee81cfe012 | ||
|
|
5f4ae3cd9e | ||
|
|
13b8aa9644 | ||
|
|
e364b313c3 | ||
|
|
68f2a7ae07 | ||
|
|
42a1da3356 | ||
|
|
44fab4dae1 | ||
|
|
d1387148df | ||
|
|
bb4ac426cd | ||
|
|
34b4e33cc9 |
@@ -18,6 +18,9 @@ bld/
|
|||||||
[Bb]in/
|
[Bb]in/
|
||||||
[Oo]bj/
|
[Oo]bj/
|
||||||
|
|
||||||
|
# Visual Studio 2015/2017 cache/options directory
|
||||||
|
.vs/
|
||||||
|
|
||||||
# Roslyn cache directories
|
# Roslyn cache directories
|
||||||
*.ide/
|
*.ide/
|
||||||
|
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
<Window x:Class="ConnectionsManager.AboutWindow"
|
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
||||||
Title="About" Height="130" Width="300"
|
|
||||||
WindowStyle="ToolWindow"
|
|
||||||
WindowStartupLocation="CenterOwner">
|
|
||||||
<Window.Resources>
|
|
||||||
<BitmapImage x:Key="MtApiIcon" UriSource="pack://application:,,,/ConnectionsManager;component/favicon.ico"/>
|
|
||||||
</Window.Resources>
|
|
||||||
<Grid>
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="*"/>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
|
|
||||||
<Grid>
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="Auto"/>
|
|
||||||
<ColumnDefinition Width="*"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<Image Source="{StaticResource MtApiIcon}" Width="50" Height="50" HorizontalAlignment="Left" Margin="5"/>
|
|
||||||
<TextBlock Grid.Column="1" Text="Connection manager for MtApi" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<Button Grid.Row="1" Content="OK" Margin="5"
|
|
||||||
Width="70" IsDefault="True" IsCancel="True"
|
|
||||||
DockPanel.Dock="Bottom"
|
|
||||||
VerticalAlignment="Center"/>
|
|
||||||
</Grid>
|
|
||||||
</Window>
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Controls;
|
|
||||||
using System.Windows.Data;
|
|
||||||
using System.Windows.Documents;
|
|
||||||
using System.Windows.Input;
|
|
||||||
using System.Windows.Media;
|
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
using System.Windows.Shapes;
|
|
||||||
|
|
||||||
namespace ConnectionsManager
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Interaction logic for AboutWindow.xaml
|
|
||||||
/// </summary>
|
|
||||||
public partial class AboutWindow : Window
|
|
||||||
{
|
|
||||||
public AboutWindow(Window owner)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
|
|
||||||
this.Owner = owner;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
<Window x:Class="ConnectionsManager.AddProfileDialog"
|
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
||||||
Title="Add new connection profile" Height="180" Width="300"
|
|
||||||
WindowStyle="ToolWindow"
|
|
||||||
WindowStartupLocation="CenterOwner">
|
|
||||||
<Grid x:Name="_MainLayout">
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="Auto" />
|
|
||||||
<RowDefinition Height="Auto" />
|
|
||||||
<RowDefinition Height="Auto" />
|
|
||||||
<RowDefinition Height="Auto" />
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="Auto"/>
|
|
||||||
<ColumnDefinition Width="*"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
|
|
||||||
<TextBlock Grid.Row="0" Grid.Column="0" Text="Profile name" Margin="5"/>
|
|
||||||
<TextBox Grid.Row="0" Grid.Column="1" Margin="5"
|
|
||||||
Text="{Binding Path=ProfileName, UpdateSourceTrigger=PropertyChanged}"
|
|
||||||
TextChanged="TextBox_TextChanged"/>
|
|
||||||
|
|
||||||
<TextBlock Grid.Row="1" Grid.Column="0" Text="Host" Margin="5"/>
|
|
||||||
<ComboBox Grid.Row="1" Grid.Column="1" Margin="5"
|
|
||||||
ItemsSource="{Binding HostList}"
|
|
||||||
SelectedItem="{Binding Host}"/>
|
|
||||||
|
|
||||||
<TextBlock Grid.Row="2" Grid.Column="0" Text="Port" Margin="5"/>
|
|
||||||
<TextBox Grid.Row="2" Grid.Column="1" Margin="5"
|
|
||||||
Text="{Binding Path=Port, UpdateSourceTrigger=PropertyChanged}"
|
|
||||||
PreviewTextInput="TextBox_PreviewTextInput"
|
|
||||||
TextChanged="TextBox_TextChanged"/>
|
|
||||||
|
|
||||||
<StackPanel Grid.Row="3" Grid.ColumnSpan="2" Margin="0,10,0,0"
|
|
||||||
Orientation="Horizontal"
|
|
||||||
HorizontalAlignment="Center"
|
|
||||||
VerticalAlignment="Bottom">
|
|
||||||
<Button Content="OK" Width="70" Margin="4" IsDefault="True" Command="{Binding OkCommand}"/>
|
|
||||||
<Button Content="Cancel" Width="70" Margin="4" IsCancel="True"/>
|
|
||||||
</StackPanel>
|
|
||||||
</Grid>
|
|
||||||
</Window>
|
|
||||||
@@ -1,97 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Controls;
|
|
||||||
using System.Windows.Data;
|
|
||||||
using System.Windows.Documents;
|
|
||||||
using System.Windows.Input;
|
|
||||||
using System.Windows.Media;
|
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
using System.Windows.Shapes;
|
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
using System.Net;
|
|
||||||
|
|
||||||
namespace ConnectionsManager
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Interaction logic for AddProfileDialog.xaml
|
|
||||||
/// </summary>
|
|
||||||
public partial class AddProfileDialog : Window
|
|
||||||
{
|
|
||||||
// private const string PIPE_SERVER_NAME = "localhost(pipe)";
|
|
||||||
private const string LOCALHOST_NAME = "localhost";
|
|
||||||
|
|
||||||
public string ProfileName { get; set; }
|
|
||||||
|
|
||||||
public static readonly DependencyProperty HostProperty = DependencyProperty.Register("Host", typeof(string), typeof(AddProfileDialog));
|
|
||||||
public string Host
|
|
||||||
{
|
|
||||||
get { return (string)this.GetValue(HostProperty); }
|
|
||||||
set { this.SetValue(HostProperty, value); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Port { get; set; }
|
|
||||||
|
|
||||||
public DelegateCommand OkCommand { get; set; }
|
|
||||||
|
|
||||||
public List<string> HostList { get; set; }
|
|
||||||
|
|
||||||
public AddProfileDialog(Window owner)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
|
|
||||||
this.Owner = owner;
|
|
||||||
|
|
||||||
OkCommand = new DelegateCommand(ExecuteOk, CanExecuteOk);
|
|
||||||
_MainLayout.DataContext = this;
|
|
||||||
|
|
||||||
Loaded += (sender, e) => MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
|
|
||||||
|
|
||||||
IPHostEntry ips = Dns.GetHostEntry(Dns.GetHostName());
|
|
||||||
|
|
||||||
HostList = new List<string>();
|
|
||||||
HostList.Add(string.Empty);
|
|
||||||
HostList.Add(LOCALHOST_NAME);
|
|
||||||
|
|
||||||
if (ips != null)
|
|
||||||
{
|
|
||||||
foreach (IPAddress ipAddress in ips.AddressList)
|
|
||||||
{
|
|
||||||
HostList.Add(ipAddress.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Host = HostList.First();
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool CanExecuteOk(object o)
|
|
||||||
{
|
|
||||||
return string.IsNullOrEmpty(ProfileName) == false
|
|
||||||
&& string.IsNullOrEmpty(Port) == false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ExecuteOk(object o)
|
|
||||||
{
|
|
||||||
this.DialogResult = true;
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static bool IsTextAllowed(string text)
|
|
||||||
{
|
|
||||||
Regex regex = new Regex("[^0-9]+");
|
|
||||||
return !regex.IsMatch(text);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void TextBox_PreviewTextInput(object sender, TextCompositionEventArgs e)
|
|
||||||
{
|
|
||||||
e.Handled = !IsTextAllowed(e.Text);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
|
|
||||||
{
|
|
||||||
OkCommand.RaiseCanExecuteChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
<Application x:Class="ConnectionsManager.App"
|
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
||||||
StartupUri="MainWindow.xaml">
|
|
||||||
<Application.Resources>
|
|
||||||
|
|
||||||
</Application.Resources>
|
|
||||||
</Application>
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Configuration;
|
|
||||||
using System.Data;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Windows;
|
|
||||||
|
|
||||||
namespace ConnectionsManager
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Interaction logic for App.xaml
|
|
||||||
/// </summary>
|
|
||||||
public partial class App : Application
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,168 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<PropertyGroup>
|
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
|
||||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
|
||||||
<ProductVersion>8.0.30703</ProductVersion>
|
|
||||||
<SchemaVersion>2.0</SchemaVersion>
|
|
||||||
<ProjectGuid>{C8751BA1-6A85-468C-87BD-758F37B8C0DD}</ProjectGuid>
|
|
||||||
<OutputType>WinExe</OutputType>
|
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
|
||||||
<RootNamespace>ConnectionsManager</RootNamespace>
|
|
||||||
<AssemblyName>ConnectionsManager</AssemblyName>
|
|
||||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
|
||||||
<TargetFrameworkProfile>
|
|
||||||
</TargetFrameworkProfile>
|
|
||||||
<FileAlignment>512</FileAlignment>
|
|
||||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
|
||||||
<PlatformTarget>x86</PlatformTarget>
|
|
||||||
<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' ">
|
|
||||||
<PlatformTarget>x86</PlatformTarget>
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>bin\Release\</OutputPath>
|
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
</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\ConnectionsManager.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>
|
|
||||||
</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\ConnectionsManager.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>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup>
|
|
||||||
<ApplicationIcon>favicon.ico</ApplicationIcon>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="System" />
|
|
||||||
<Reference Include="System.Data" />
|
|
||||||
<Reference Include="System.Xml" />
|
|
||||||
<Reference Include="Microsoft.CSharp" />
|
|
||||||
<Reference Include="System.Core" />
|
|
||||||
<Reference Include="System.Xml.Linq" />
|
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
|
||||||
<Reference Include="System.Xaml">
|
|
||||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="WindowsBase" />
|
|
||||||
<Reference Include="PresentationCore" />
|
|
||||||
<Reference Include="PresentationFramework" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ApplicationDefinition Include="App.xaml">
|
|
||||||
<Generator>MSBuild:Compile</Generator>
|
|
||||||
<SubType>Designer</SubType>
|
|
||||||
</ApplicationDefinition>
|
|
||||||
<Compile Include="AboutWindow.xaml.cs">
|
|
||||||
<DependentUpon>AboutWindow.xaml</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="AddProfileDialog.xaml.cs">
|
|
||||||
<DependentUpon>AddProfileDialog.xaml</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="DelegateCommand.cs" />
|
|
||||||
<Compile Include="ViewModel.cs" />
|
|
||||||
<Page Include="AboutWindow.xaml">
|
|
||||||
<SubType>Designer</SubType>
|
|
||||||
<Generator>MSBuild:Compile</Generator>
|
|
||||||
</Page>
|
|
||||||
<Page Include="AddProfileDialog.xaml">
|
|
||||||
<SubType>Designer</SubType>
|
|
||||||
<Generator>MSBuild:Compile</Generator>
|
|
||||||
</Page>
|
|
||||||
<Page Include="MainWindow.xaml">
|
|
||||||
<Generator>MSBuild:Compile</Generator>
|
|
||||||
<SubType>Designer</SubType>
|
|
||||||
</Page>
|
|
||||||
<Compile Include="App.xaml.cs">
|
|
||||||
<DependentUpon>App.xaml</DependentUpon>
|
|
||||||
<SubType>Code</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="MainWindow.xaml.cs">
|
|
||||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
|
||||||
<SubType>Code</SubType>
|
|
||||||
</Compile>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="Properties\AssemblyInfo.cs">
|
|
||||||
<SubType>Code</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="Properties\Resources.Designer.cs">
|
|
||||||
<AutoGen>True</AutoGen>
|
|
||||||
<DesignTime>True</DesignTime>
|
|
||||||
<DependentUpon>Resources.resx</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="Properties\Settings.Designer.cs">
|
|
||||||
<AutoGen>True</AutoGen>
|
|
||||||
<DependentUpon>Settings.settings</DependentUpon>
|
|
||||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
|
||||||
</Compile>
|
|
||||||
<EmbeddedResource Include="Properties\Resources.resx">
|
|
||||||
<Generator>ResXFileCodeGenerator</Generator>
|
|
||||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
|
||||||
</EmbeddedResource>
|
|
||||||
<None Include="app.config" />
|
|
||||||
<None Include="Properties\Settings.settings">
|
|
||||||
<Generator>SettingsSingleFileGenerator</Generator>
|
|
||||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
|
||||||
</None>
|
|
||||||
<AppDesigner Include="Properties\" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\MTApiService\MTApiService.csproj">
|
|
||||||
<Project>{DE76D5C7-B99C-4467-8408-78173BDD84E0}</Project>
|
|
||||||
<Name>MTApiService</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Resource Include="favicon.ico" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
|
||||||
<PropertyGroup>
|
|
||||||
<PostBuildEvent>copy $(TargetPath) $(SolutionDir)Release\</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>
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Windows.Input;
|
|
||||||
|
|
||||||
namespace ConnectionsManager
|
|
||||||
{
|
|
||||||
public class DelegateCommand : ICommand
|
|
||||||
{
|
|
||||||
private readonly Predicate<object> _canExecute;
|
|
||||||
private readonly Action<object> _execute;
|
|
||||||
|
|
||||||
public event EventHandler CanExecuteChanged;
|
|
||||||
|
|
||||||
public DelegateCommand(Action<object> execute)
|
|
||||||
: this(execute, null)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public DelegateCommand(Action<object> execute,
|
|
||||||
Predicate<object> canExecute)
|
|
||||||
{
|
|
||||||
_execute = execute;
|
|
||||||
_canExecute = canExecute;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool CanExecute(object parameter)
|
|
||||||
{
|
|
||||||
if (_canExecute == null)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return _canExecute(parameter);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Execute(object parameter)
|
|
||||||
{
|
|
||||||
_execute(parameter);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void RaiseCanExecuteChanged()
|
|
||||||
{
|
|
||||||
if (CanExecuteChanged != null)
|
|
||||||
{
|
|
||||||
CanExecuteChanged(this, EventArgs.Empty);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
<Window x:Class="ConnectionsManager.MainWindow"
|
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
||||||
Title="MtApi Connections Manager" Height="300" Width="440"
|
|
||||||
Loaded="Window_Loaded">
|
|
||||||
<Grid x:Name="_MainLayout">
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
<RowDefinition Height="*"/>
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
|
|
||||||
<Menu>
|
|
||||||
<MenuItem Header="Edit">
|
|
||||||
<MenuItem Header="Add Profile..." Command="{Binding AddProfileCommand}"/>
|
|
||||||
<MenuItem Header="Delete Profile" Command="{Binding DeleteProfileCommand}"/>
|
|
||||||
</MenuItem>
|
|
||||||
<MenuItem Header="Help">
|
|
||||||
<MenuItem Header="About" Command="{Binding ShowAboutCommand}"/>
|
|
||||||
</MenuItem>
|
|
||||||
</Menu>
|
|
||||||
|
|
||||||
<ListView Grid.Row="1"
|
|
||||||
ItemsSource="{Binding ConnectionProfiles}"
|
|
||||||
SelectionMode="Single"
|
|
||||||
SelectedItem="{Binding SelectedProfile}">
|
|
||||||
<ListView.View>
|
|
||||||
<GridView>
|
|
||||||
<GridViewColumn Width="140" Header="Profile" DisplayMemberBinding="{Binding Name}" />
|
|
||||||
<GridViewColumn Width="180" Header="Host" DisplayMemberBinding="{Binding Host}" />
|
|
||||||
<GridViewColumn Width="80" Header="Port" DisplayMemberBinding="{Binding Port}" />
|
|
||||||
</GridView>
|
|
||||||
</ListView.View>
|
|
||||||
</ListView>
|
|
||||||
</Grid>
|
|
||||||
</Window>
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Controls;
|
|
||||||
using System.Windows.Data;
|
|
||||||
using System.Windows.Documents;
|
|
||||||
using System.Windows.Input;
|
|
||||||
using System.Windows.Media;
|
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
using System.Windows.Navigation;
|
|
||||||
using System.Windows.Shapes;
|
|
||||||
|
|
||||||
namespace ConnectionsManager
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Interaction logic for MainWindow.xaml
|
|
||||||
/// </summary>
|
|
||||||
public partial class MainWindow : Window
|
|
||||||
{
|
|
||||||
private ViewModel _vm;
|
|
||||||
|
|
||||||
public MainWindow()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
|
|
||||||
_vm = new ViewModel();
|
|
||||||
_MainLayout.DataContext = _vm;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
_vm.Initialize();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
using System.Reflection;
|
|
||||||
using System.Resources;
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Windows;
|
|
||||||
|
|
||||||
// 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("ConnectionsManager")]
|
|
||||||
[assembly: AssemblyDescription("")]
|
|
||||||
[assembly: AssemblyConfiguration("")]
|
|
||||||
[assembly: AssemblyCompany("")]
|
|
||||||
[assembly: AssemblyProduct("ConnectionsManager")]
|
|
||||||
[assembly: AssemblyCopyright("Copyright © 2013")]
|
|
||||||
[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)]
|
|
||||||
|
|
||||||
//In order to begin building localizable applications, set
|
|
||||||
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
|
|
||||||
//inside a <PropertyGroup>. For example, if you are using US english
|
|
||||||
//in your source files, set the <UICulture> to en-US. Then uncomment
|
|
||||||
//the NeutralResourceLanguage attribute below. Update the "en-US" in
|
|
||||||
//the line below to match the UICulture setting in the project file.
|
|
||||||
|
|
||||||
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
|
|
||||||
|
|
||||||
|
|
||||||
[assembly: ThemeInfo(
|
|
||||||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
|
||||||
//(used if a resource is not found in the page,
|
|
||||||
// or application resource dictionaries)
|
|
||||||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
|
||||||
//(used if a resource is not found in the page,
|
|
||||||
// app, or any theme specific resource dictionaries)
|
|
||||||
)]
|
|
||||||
|
|
||||||
|
|
||||||
// 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.1.0")]
|
|
||||||
[assembly: AssemblyFileVersion("1.0.1.0")]
|
|
||||||
-63
@@ -1,63 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
|
||||||
// This code was generated by a tool.
|
|
||||||
// Runtime Version:4.0.30319.18034
|
|
||||||
//
|
|
||||||
// Changes to this file may cause incorrect behavior and will be lost if
|
|
||||||
// the code is regenerated.
|
|
||||||
// </auto-generated>
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
namespace ConnectionsManager.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("ConnectionsManager.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>
|
|
||||||
-26
@@ -1,26 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
|
||||||
// This code was generated by a tool.
|
|
||||||
// Runtime Version:4.0.30319.18034
|
|
||||||
//
|
|
||||||
// Changes to this file may cause incorrect behavior and will be lost if
|
|
||||||
// the code is regenerated.
|
|
||||||
// </auto-generated>
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
namespace ConnectionsManager.Properties {
|
|
||||||
|
|
||||||
|
|
||||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
|
||||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.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="uri:settings" CurrentProfile="(Default)">
|
|
||||||
<Profiles>
|
|
||||||
<Profile Name="(Default)" />
|
|
||||||
</Profiles>
|
|
||||||
<Settings />
|
|
||||||
</SettingsFile>
|
|
||||||
@@ -1,114 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
using MTApiService;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Windows;
|
|
||||||
|
|
||||||
namespace ConnectionsManager
|
|
||||||
{
|
|
||||||
class ViewModel : INotifyPropertyChanged
|
|
||||||
{
|
|
||||||
#region Properties
|
|
||||||
|
|
||||||
private ObservableCollection<MtConnectionProfile> _ConnectionProfiles = new ObservableCollection<MtConnectionProfile>();
|
|
||||||
public ObservableCollection<MtConnectionProfile> ConnectionProfiles
|
|
||||||
{
|
|
||||||
get { return _ConnectionProfiles; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public DelegateCommand AddProfileCommand { get; private set; }
|
|
||||||
public DelegateCommand DeleteProfileCommand { get; private set; }
|
|
||||||
public DelegateCommand ShowAboutCommand { get; private set; }
|
|
||||||
|
|
||||||
private MtConnectionProfile _SelectedProfile;
|
|
||||||
public MtConnectionProfile SelectedProfile
|
|
||||||
{
|
|
||||||
get { return _SelectedProfile; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_SelectedProfile = value;
|
|
||||||
OnPropertyChanged("SelectedProfile");
|
|
||||||
DeleteProfileCommand.RaiseCanExecuteChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Public Methods
|
|
||||||
public ViewModel()
|
|
||||||
{
|
|
||||||
AddProfileCommand = new DelegateCommand(ExecuteAddProfile);
|
|
||||||
DeleteProfileCommand = new DelegateCommand(ExecuteDeleteProfile, CanExecuteDeleteProfile);
|
|
||||||
ShowAboutCommand = new DelegateCommand(ExecuteShowAbout);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Initialize()
|
|
||||||
{
|
|
||||||
var profiles = MtRegistryManager.LoadConnectionProfiles();
|
|
||||||
if (profiles != null)
|
|
||||||
{
|
|
||||||
foreach(var prof in profiles)
|
|
||||||
{
|
|
||||||
ConnectionProfiles.Add(prof);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Private Methods
|
|
||||||
private void ExecuteAddProfile(object o)
|
|
||||||
{
|
|
||||||
var dlg = new AddProfileDialog(App.Current.MainWindow);
|
|
||||||
var result = dlg.ShowDialog();
|
|
||||||
|
|
||||||
if (result == true)
|
|
||||||
{
|
|
||||||
var profile = new MtConnectionProfile(dlg.ProfileName);
|
|
||||||
profile.Host = dlg.Host;
|
|
||||||
profile.Port = int.Parse(dlg.Port);
|
|
||||||
|
|
||||||
MtRegistryManager.AddConnectionProfile(profile);
|
|
||||||
ConnectionProfiles.Add(profile);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool CanExecuteDeleteProfile(object o)
|
|
||||||
{
|
|
||||||
return SelectedProfile != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ExecuteDeleteProfile(object o)
|
|
||||||
{
|
|
||||||
var result = MessageBox.Show("Do you want to delete connection profile '" + SelectedProfile.Name + "' ?"
|
|
||||||
, "Question", MessageBoxButton.YesNo, MessageBoxImage.Question);
|
|
||||||
|
|
||||||
if (result == MessageBoxResult.Yes)
|
|
||||||
{
|
|
||||||
MtRegistryManager.RemoveConnectionProfile(SelectedProfile.Name);
|
|
||||||
ConnectionProfiles.Remove(SelectedProfile);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ExecuteShowAbout(object o)
|
|
||||||
{
|
|
||||||
var dlg = new AboutWindow(App.Current.MainWindow);
|
|
||||||
dlg.ShowDialog();
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region INotifyPropertyChanged
|
|
||||||
public event PropertyChangedEventHandler PropertyChanged;
|
|
||||||
|
|
||||||
protected virtual void OnPropertyChanged(string propertyName)
|
|
||||||
{
|
|
||||||
PropertyChangedEventHandler handler = PropertyChanged;
|
|
||||||
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Fields
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
<configuration>
|
|
||||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 894 B |
@@ -1,61 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Security.Cryptography;
|
|
||||||
using System.Text;
|
|
||||||
using System.Security;
|
|
||||||
|
|
||||||
namespace Licensing
|
|
||||||
{
|
|
||||||
public class DigitalSignatureHelper
|
|
||||||
{
|
|
||||||
public static String GeneratePrivateKey()
|
|
||||||
{
|
|
||||||
DSACryptoServiceProvider dsa = new DSACryptoServiceProvider();
|
|
||||||
return dsa.ToXmlString(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String GetPublicKey(String privateKey)
|
|
||||||
{
|
|
||||||
DSACryptoServiceProvider dsa = new DSACryptoServiceProvider();
|
|
||||||
dsa.FromXmlString(privateKey);
|
|
||||||
return dsa.ToXmlString(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string CreateSignature(string inputData, String privateKey)
|
|
||||||
{
|
|
||||||
// create the crypto-service provider:
|
|
||||||
DSACryptoServiceProvider dsa = new DSACryptoServiceProvider();
|
|
||||||
|
|
||||||
// setup the dsa from the private key:
|
|
||||||
dsa.FromXmlString(privateKey);
|
|
||||||
|
|
||||||
byte[] data = UTF8Encoding.ASCII.GetBytes(inputData);
|
|
||||||
|
|
||||||
// get the signature:
|
|
||||||
byte[] signature = dsa.SignData(data);
|
|
||||||
|
|
||||||
return Convert.ToBase64String(signature);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool VerifySignature(string inputData, string signature, string publicKey)
|
|
||||||
{
|
|
||||||
// create the crypto-service provider:
|
|
||||||
DSACryptoServiceProvider dsa = new DSACryptoServiceProvider();
|
|
||||||
|
|
||||||
// setup the provider from the public key:
|
|
||||||
dsa.FromXmlString(publicKey);
|
|
||||||
|
|
||||||
// get the license terms data:
|
|
||||||
//byte[] data = Convert.FromBase64String(inputData);
|
|
||||||
byte[] data = UTF8Encoding.ASCII.GetBytes(inputData);
|
|
||||||
|
|
||||||
// get the signature data:
|
|
||||||
byte[] signatureData = Convert.FromBase64String(signature);
|
|
||||||
|
|
||||||
// verify that the license-terms match the signature data
|
|
||||||
if (dsa.VerifyData(data, signatureData) == false)
|
|
||||||
throw new SecurityException("Signature Not Verified!");
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<PropertyGroup>
|
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
|
||||||
<ProductVersion>8.0.30703</ProductVersion>
|
|
||||||
<SchemaVersion>2.0</SchemaVersion>
|
|
||||||
<ProjectGuid>{21FA6E21-EE5D-4A84-B0ED-E1D8876B41FB}</ProjectGuid>
|
|
||||||
<OutputType>WinExe</OutputType>
|
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
|
||||||
<RootNamespace>Licensing</RootNamespace>
|
|
||||||
<AssemblyName>Licensing</AssemblyName>
|
|
||||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
|
||||||
<FileAlignment>512</FileAlignment>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
|
||||||
<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|AnyCPU' ">
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>bin\Release\</OutputPath>
|
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup>
|
|
||||||
<StartupObject />
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="System" />
|
|
||||||
<Reference Include="System.Core" />
|
|
||||||
<Reference Include="System.Drawing" />
|
|
||||||
<Reference Include="System.Windows.Forms" />
|
|
||||||
<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="DigitalSignatureHelper.cs" />
|
|
||||||
<Compile Include="MainForm.cs">
|
|
||||||
<SubType>Form</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="MainForm.Designer.cs">
|
|
||||||
<DependentUpon>MainForm.cs</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="Program.cs" />
|
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<EmbeddedResource Include="MainForm.resx">
|
|
||||||
<DependentUpon>MainForm.cs</DependentUpon>
|
|
||||||
</EmbeddedResource>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\MTApiService\MTApiService.csproj">
|
|
||||||
<Project>{DE76D5C7-B99C-4467-8408-78173BDD84E0}</Project>
|
|
||||||
<Name>MTApiService</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>
|
|
||||||
Generated
-326
@@ -1,326 +0,0 @@
|
|||||||
namespace Licensing
|
|
||||||
{
|
|
||||||
partial class MainForm
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
this.textBoxPublicKey = new System.Windows.Forms.TextBox();
|
|
||||||
this.buttonGenerateKey = new System.Windows.Forms.Button();
|
|
||||||
this.buttonLoadKey = new System.Windows.Forms.Button();
|
|
||||||
this.buttonSaveKey = new System.Windows.Forms.Button();
|
|
||||||
this.textBoxPrivateKey = new System.Windows.Forms.TextBox();
|
|
||||||
this.label4 = new System.Windows.Forms.Label();
|
|
||||||
this.textBoxAccountName = new System.Windows.Forms.TextBox();
|
|
||||||
this.textBoxAccountNumber = new System.Windows.Forms.TextBox();
|
|
||||||
this.buttonSign = new System.Windows.Forms.Button();
|
|
||||||
this.textBoxSignature = new System.Windows.Forms.TextBox();
|
|
||||||
this.buttonGetPublicKey = new System.Windows.Forms.Button();
|
|
||||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
|
||||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
|
||||||
this.clipboardCopyBtn = new System.Windows.Forms.Button();
|
|
||||||
this.buttonExportPublicKey = new System.Windows.Forms.Button();
|
|
||||||
this.groupBox3 = new System.Windows.Forms.GroupBox();
|
|
||||||
this.label3 = new System.Windows.Forms.Label();
|
|
||||||
this.groupBox4 = new System.Windows.Forms.GroupBox();
|
|
||||||
this.saveToRegBtn = new System.Windows.Forms.Button();
|
|
||||||
this.buttonVerify = new System.Windows.Forms.Button();
|
|
||||||
this.buttonExportSignature = new System.Windows.Forms.Button();
|
|
||||||
this.readRegBtn = new System.Windows.Forms.Button();
|
|
||||||
this.groupBox1.SuspendLayout();
|
|
||||||
this.groupBox2.SuspendLayout();
|
|
||||||
this.groupBox3.SuspendLayout();
|
|
||||||
this.groupBox4.SuspendLayout();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// textBoxPublicKey
|
|
||||||
//
|
|
||||||
this.textBoxPublicKey.Location = new System.Drawing.Point(6, 19);
|
|
||||||
this.textBoxPublicKey.Name = "textBoxPublicKey";
|
|
||||||
this.textBoxPublicKey.ReadOnly = true;
|
|
||||||
this.textBoxPublicKey.Size = new System.Drawing.Size(620, 20);
|
|
||||||
this.textBoxPublicKey.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// buttonGenerateKey
|
|
||||||
//
|
|
||||||
this.buttonGenerateKey.Location = new System.Drawing.Point(6, 45);
|
|
||||||
this.buttonGenerateKey.Name = "buttonGenerateKey";
|
|
||||||
this.buttonGenerateKey.Size = new System.Drawing.Size(75, 23);
|
|
||||||
this.buttonGenerateKey.TabIndex = 2;
|
|
||||||
this.buttonGenerateKey.Text = "Generate";
|
|
||||||
this.buttonGenerateKey.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonGenerateKey.Click += new System.EventHandler(this.buttonGenerateKey_Click);
|
|
||||||
//
|
|
||||||
// buttonLoadKey
|
|
||||||
//
|
|
||||||
this.buttonLoadKey.Location = new System.Drawing.Point(168, 45);
|
|
||||||
this.buttonLoadKey.Name = "buttonLoadKey";
|
|
||||||
this.buttonLoadKey.Size = new System.Drawing.Size(75, 23);
|
|
||||||
this.buttonLoadKey.TabIndex = 3;
|
|
||||||
this.buttonLoadKey.Text = "Load";
|
|
||||||
this.buttonLoadKey.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonLoadKey.Click += new System.EventHandler(this.buttonLoadKey_Click);
|
|
||||||
//
|
|
||||||
// buttonSaveKey
|
|
||||||
//
|
|
||||||
this.buttonSaveKey.Location = new System.Drawing.Point(87, 45);
|
|
||||||
this.buttonSaveKey.Name = "buttonSaveKey";
|
|
||||||
this.buttonSaveKey.Size = new System.Drawing.Size(75, 23);
|
|
||||||
this.buttonSaveKey.TabIndex = 4;
|
|
||||||
this.buttonSaveKey.Text = "Save";
|
|
||||||
this.buttonSaveKey.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonSaveKey.Click += new System.EventHandler(this.buttonSaveKey_Click);
|
|
||||||
//
|
|
||||||
// textBoxPrivateKey
|
|
||||||
//
|
|
||||||
this.textBoxPrivateKey.Location = new System.Drawing.Point(6, 19);
|
|
||||||
this.textBoxPrivateKey.Name = "textBoxPrivateKey";
|
|
||||||
this.textBoxPrivateKey.ReadOnly = true;
|
|
||||||
this.textBoxPrivateKey.Size = new System.Drawing.Size(620, 20);
|
|
||||||
this.textBoxPrivateKey.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// label4
|
|
||||||
//
|
|
||||||
this.label4.AutoSize = true;
|
|
||||||
this.label4.Location = new System.Drawing.Point(8, 48);
|
|
||||||
this.label4.Name = "label4";
|
|
||||||
this.label4.Size = new System.Drawing.Size(47, 13);
|
|
||||||
this.label4.TabIndex = 6;
|
|
||||||
this.label4.Text = "Number:";
|
|
||||||
//
|
|
||||||
// textBoxAccountName
|
|
||||||
//
|
|
||||||
this.textBoxAccountName.Location = new System.Drawing.Point(67, 19);
|
|
||||||
this.textBoxAccountName.Name = "textBoxAccountName";
|
|
||||||
this.textBoxAccountName.Size = new System.Drawing.Size(559, 20);
|
|
||||||
this.textBoxAccountName.TabIndex = 7;
|
|
||||||
//
|
|
||||||
// textBoxAccountNumber
|
|
||||||
//
|
|
||||||
this.textBoxAccountNumber.Location = new System.Drawing.Point(67, 45);
|
|
||||||
this.textBoxAccountNumber.Name = "textBoxAccountNumber";
|
|
||||||
this.textBoxAccountNumber.Size = new System.Drawing.Size(559, 20);
|
|
||||||
this.textBoxAccountNumber.TabIndex = 7;
|
|
||||||
//
|
|
||||||
// buttonSign
|
|
||||||
//
|
|
||||||
this.buttonSign.Location = new System.Drawing.Point(10, 45);
|
|
||||||
this.buttonSign.Name = "buttonSign";
|
|
||||||
this.buttonSign.Size = new System.Drawing.Size(75, 23);
|
|
||||||
this.buttonSign.TabIndex = 8;
|
|
||||||
this.buttonSign.Text = "Sign";
|
|
||||||
this.buttonSign.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonSign.Click += new System.EventHandler(this.buttonSign_Click);
|
|
||||||
//
|
|
||||||
// textBoxSignature
|
|
||||||
//
|
|
||||||
this.textBoxSignature.Location = new System.Drawing.Point(10, 19);
|
|
||||||
this.textBoxSignature.Name = "textBoxSignature";
|
|
||||||
this.textBoxSignature.Size = new System.Drawing.Size(615, 20);
|
|
||||||
this.textBoxSignature.TabIndex = 10;
|
|
||||||
//
|
|
||||||
// buttonGetPublicKey
|
|
||||||
//
|
|
||||||
this.buttonGetPublicKey.Location = new System.Drawing.Point(6, 45);
|
|
||||||
this.buttonGetPublicKey.Name = "buttonGetPublicKey";
|
|
||||||
this.buttonGetPublicKey.Size = new System.Drawing.Size(75, 23);
|
|
||||||
this.buttonGetPublicKey.TabIndex = 11;
|
|
||||||
this.buttonGetPublicKey.Text = "Get Key";
|
|
||||||
this.buttonGetPublicKey.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonGetPublicKey.Click += new System.EventHandler(this.buttonGetPublicKey_Click);
|
|
||||||
//
|
|
||||||
// groupBox1
|
|
||||||
//
|
|
||||||
this.groupBox1.Controls.Add(this.textBoxPrivateKey);
|
|
||||||
this.groupBox1.Controls.Add(this.buttonGenerateKey);
|
|
||||||
this.groupBox1.Controls.Add(this.buttonLoadKey);
|
|
||||||
this.groupBox1.Controls.Add(this.buttonSaveKey);
|
|
||||||
this.groupBox1.Location = new System.Drawing.Point(12, 12);
|
|
||||||
this.groupBox1.Name = "groupBox1";
|
|
||||||
this.groupBox1.Size = new System.Drawing.Size(632, 78);
|
|
||||||
this.groupBox1.TabIndex = 12;
|
|
||||||
this.groupBox1.TabStop = false;
|
|
||||||
this.groupBox1.Text = "Private Key";
|
|
||||||
//
|
|
||||||
// groupBox2
|
|
||||||
//
|
|
||||||
this.groupBox2.Controls.Add(this.clipboardCopyBtn);
|
|
||||||
this.groupBox2.Controls.Add(this.buttonExportPublicKey);
|
|
||||||
this.groupBox2.Controls.Add(this.textBoxPublicKey);
|
|
||||||
this.groupBox2.Controls.Add(this.buttonGetPublicKey);
|
|
||||||
this.groupBox2.Location = new System.Drawing.Point(12, 96);
|
|
||||||
this.groupBox2.Name = "groupBox2";
|
|
||||||
this.groupBox2.Size = new System.Drawing.Size(632, 77);
|
|
||||||
this.groupBox2.TabIndex = 13;
|
|
||||||
this.groupBox2.TabStop = false;
|
|
||||||
this.groupBox2.Text = "Public Key";
|
|
||||||
//
|
|
||||||
// clipboardCopyBtn
|
|
||||||
//
|
|
||||||
this.clipboardCopyBtn.Location = new System.Drawing.Point(169, 46);
|
|
||||||
this.clipboardCopyBtn.Name = "clipboardCopyBtn";
|
|
||||||
this.clipboardCopyBtn.Size = new System.Drawing.Size(113, 23);
|
|
||||||
this.clipboardCopyBtn.TabIndex = 13;
|
|
||||||
this.clipboardCopyBtn.Text = "Copy to Clipboard";
|
|
||||||
this.clipboardCopyBtn.UseVisualStyleBackColor = true;
|
|
||||||
this.clipboardCopyBtn.Click += new System.EventHandler(this.clipboardCopyBtn_Click);
|
|
||||||
//
|
|
||||||
// buttonExportPublicKey
|
|
||||||
//
|
|
||||||
this.buttonExportPublicKey.Location = new System.Drawing.Point(88, 46);
|
|
||||||
this.buttonExportPublicKey.Name = "buttonExportPublicKey";
|
|
||||||
this.buttonExportPublicKey.Size = new System.Drawing.Size(75, 23);
|
|
||||||
this.buttonExportPublicKey.TabIndex = 12;
|
|
||||||
this.buttonExportPublicKey.Text = "Export";
|
|
||||||
this.buttonExportPublicKey.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonExportPublicKey.Click += new System.EventHandler(this.buttonExportPublicKey_Click);
|
|
||||||
//
|
|
||||||
// groupBox3
|
|
||||||
//
|
|
||||||
this.groupBox3.Controls.Add(this.textBoxAccountName);
|
|
||||||
this.groupBox3.Controls.Add(this.label3);
|
|
||||||
this.groupBox3.Controls.Add(this.textBoxAccountNumber);
|
|
||||||
this.groupBox3.Controls.Add(this.label4);
|
|
||||||
this.groupBox3.Location = new System.Drawing.Point(12, 180);
|
|
||||||
this.groupBox3.Name = "groupBox3";
|
|
||||||
this.groupBox3.Size = new System.Drawing.Size(635, 81);
|
|
||||||
this.groupBox3.TabIndex = 14;
|
|
||||||
this.groupBox3.TabStop = false;
|
|
||||||
this.groupBox3.Text = "Account";
|
|
||||||
//
|
|
||||||
// label3
|
|
||||||
//
|
|
||||||
this.label3.AutoSize = true;
|
|
||||||
this.label3.Location = new System.Drawing.Point(8, 22);
|
|
||||||
this.label3.Name = "label3";
|
|
||||||
this.label3.Size = new System.Drawing.Size(38, 13);
|
|
||||||
this.label3.TabIndex = 5;
|
|
||||||
this.label3.Text = "Name:";
|
|
||||||
//
|
|
||||||
// groupBox4
|
|
||||||
//
|
|
||||||
this.groupBox4.Controls.Add(this.readRegBtn);
|
|
||||||
this.groupBox4.Controls.Add(this.saveToRegBtn);
|
|
||||||
this.groupBox4.Controls.Add(this.buttonVerify);
|
|
||||||
this.groupBox4.Controls.Add(this.buttonExportSignature);
|
|
||||||
this.groupBox4.Controls.Add(this.textBoxSignature);
|
|
||||||
this.groupBox4.Controls.Add(this.buttonSign);
|
|
||||||
this.groupBox4.Location = new System.Drawing.Point(13, 268);
|
|
||||||
this.groupBox4.Name = "groupBox4";
|
|
||||||
this.groupBox4.Size = new System.Drawing.Size(631, 76);
|
|
||||||
this.groupBox4.TabIndex = 15;
|
|
||||||
this.groupBox4.TabStop = false;
|
|
||||||
this.groupBox4.Text = "Signature";
|
|
||||||
//
|
|
||||||
// saveToRegBtn
|
|
||||||
//
|
|
||||||
this.saveToRegBtn.Location = new System.Drawing.Point(172, 45);
|
|
||||||
this.saveToRegBtn.Name = "saveToRegBtn";
|
|
||||||
this.saveToRegBtn.Size = new System.Drawing.Size(101, 23);
|
|
||||||
this.saveToRegBtn.TabIndex = 13;
|
|
||||||
this.saveToRegBtn.Text = "Save To Reg";
|
|
||||||
this.saveToRegBtn.UseVisualStyleBackColor = true;
|
|
||||||
this.saveToRegBtn.Click += new System.EventHandler(this.saveToRegBtn_Click);
|
|
||||||
//
|
|
||||||
// buttonVerify
|
|
||||||
//
|
|
||||||
this.buttonVerify.Location = new System.Drawing.Point(550, 45);
|
|
||||||
this.buttonVerify.Name = "buttonVerify";
|
|
||||||
this.buttonVerify.Size = new System.Drawing.Size(75, 23);
|
|
||||||
this.buttonVerify.TabIndex = 12;
|
|
||||||
this.buttonVerify.Text = "Verify";
|
|
||||||
this.buttonVerify.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonVerify.Click += new System.EventHandler(this.buttonVerify_Click);
|
|
||||||
//
|
|
||||||
// buttonExportSignature
|
|
||||||
//
|
|
||||||
this.buttonExportSignature.Location = new System.Drawing.Point(91, 45);
|
|
||||||
this.buttonExportSignature.Name = "buttonExportSignature";
|
|
||||||
this.buttonExportSignature.Size = new System.Drawing.Size(75, 23);
|
|
||||||
this.buttonExportSignature.TabIndex = 11;
|
|
||||||
this.buttonExportSignature.Text = "Export";
|
|
||||||
this.buttonExportSignature.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonExportSignature.Click += new System.EventHandler(this.buttonExportSignature_Click);
|
|
||||||
//
|
|
||||||
// readRegBtn
|
|
||||||
//
|
|
||||||
this.readRegBtn.Location = new System.Drawing.Point(279, 45);
|
|
||||||
this.readRegBtn.Name = "readRegBtn";
|
|
||||||
this.readRegBtn.Size = new System.Drawing.Size(132, 23);
|
|
||||||
this.readRegBtn.TabIndex = 14;
|
|
||||||
this.readRegBtn.Text = "Read from Registry";
|
|
||||||
this.readRegBtn.UseVisualStyleBackColor = true;
|
|
||||||
this.readRegBtn.Click += new System.EventHandler(this.readRegBtn_Click);
|
|
||||||
//
|
|
||||||
// MainForm
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(659, 351);
|
|
||||||
this.Controls.Add(this.groupBox4);
|
|
||||||
this.Controls.Add(this.groupBox3);
|
|
||||||
this.Controls.Add(this.groupBox2);
|
|
||||||
this.Controls.Add(this.groupBox1);
|
|
||||||
this.Name = "MainForm";
|
|
||||||
this.Text = "Liccensing";
|
|
||||||
this.groupBox1.ResumeLayout(false);
|
|
||||||
this.groupBox1.PerformLayout();
|
|
||||||
this.groupBox2.ResumeLayout(false);
|
|
||||||
this.groupBox2.PerformLayout();
|
|
||||||
this.groupBox3.ResumeLayout(false);
|
|
||||||
this.groupBox3.PerformLayout();
|
|
||||||
this.groupBox4.ResumeLayout(false);
|
|
||||||
this.groupBox4.PerformLayout();
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private System.Windows.Forms.TextBox textBoxPublicKey;
|
|
||||||
private System.Windows.Forms.Button buttonGenerateKey;
|
|
||||||
private System.Windows.Forms.Button buttonLoadKey;
|
|
||||||
private System.Windows.Forms.Button buttonSaveKey;
|
|
||||||
private System.Windows.Forms.TextBox textBoxPrivateKey;
|
|
||||||
private System.Windows.Forms.Label label4;
|
|
||||||
private System.Windows.Forms.TextBox textBoxAccountName;
|
|
||||||
private System.Windows.Forms.TextBox textBoxAccountNumber;
|
|
||||||
private System.Windows.Forms.Button buttonSign;
|
|
||||||
private System.Windows.Forms.TextBox textBoxSignature;
|
|
||||||
private System.Windows.Forms.Button buttonGetPublicKey;
|
|
||||||
private System.Windows.Forms.GroupBox groupBox1;
|
|
||||||
private System.Windows.Forms.GroupBox groupBox2;
|
|
||||||
private System.Windows.Forms.GroupBox groupBox3;
|
|
||||||
private System.Windows.Forms.Label label3;
|
|
||||||
private System.Windows.Forms.Button buttonExportPublicKey;
|
|
||||||
private System.Windows.Forms.GroupBox groupBox4;
|
|
||||||
private System.Windows.Forms.Button buttonExportSignature;
|
|
||||||
private System.Windows.Forms.Button buttonVerify;
|
|
||||||
private System.Windows.Forms.Button clipboardCopyBtn;
|
|
||||||
private System.Windows.Forms.Button saveToRegBtn;
|
|
||||||
private System.Windows.Forms.Button readRegBtn;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,352 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
using System.IO;
|
|
||||||
using System.Security;
|
|
||||||
using MTApiService;
|
|
||||||
|
|
||||||
namespace Licensing
|
|
||||||
{
|
|
||||||
public partial class MainForm : Form
|
|
||||||
{
|
|
||||||
private bool mIsSaved = true;
|
|
||||||
|
|
||||||
public MainForm()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonGenerateKey_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
textBoxPrivateKey.Text = DigitalSignatureHelper.GeneratePrivateKey();
|
|
||||||
|
|
||||||
mIsSaved = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonGetPublicKey_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
string privateKey = textBoxPrivateKey.Text;
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(privateKey) == false)
|
|
||||||
{
|
|
||||||
textBoxPublicKey.Text = DigitalSignatureHelper.GetPublicKey(privateKey);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MessageBox.Show("Private Key is empty!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonSaveKey_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
string privateKey = textBoxPrivateKey.Text;
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(privateKey) == false)
|
|
||||||
{
|
|
||||||
SaveFileDialog dlg = new SaveFileDialog();
|
|
||||||
|
|
||||||
dlg.Filter = "MetaTraderApi Key Files (*.mtk)|*.mtk";
|
|
||||||
dlg.Title = "Save MetaTraderApi Key File";
|
|
||||||
|
|
||||||
if (dlg.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
using (TextWriter file = new StreamWriter(dlg.FileName, true))
|
|
||||||
{
|
|
||||||
file.WriteLine(privateKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
mIsSaved = true;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var errorMsg = string.Format("Saving failed!\n{0}", ex.Message);
|
|
||||||
MessageBox.Show(errorMsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MessageBox.Show("Private Key is empty!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonLoadKey_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (mIsSaved == false)
|
|
||||||
{
|
|
||||||
if (MessageBox.Show("Private Key is not saved. Continue?", "Private Key", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
OpenFileDialog dlg = new OpenFileDialog();
|
|
||||||
|
|
||||||
dlg.Filter = "MetaTraderApi Key Files (*.mtk)|*.mtk";
|
|
||||||
dlg.Title = "Load MetaTraderApi Key File";
|
|
||||||
|
|
||||||
if (dlg.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
textBoxPrivateKey.Text = string.Empty;
|
|
||||||
textBoxPublicKey.Text = string.Empty;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
using (TextReader file = new StreamReader(dlg.FileName))
|
|
||||||
{
|
|
||||||
textBoxPrivateKey.Text = file.ReadLine();
|
|
||||||
}
|
|
||||||
|
|
||||||
mIsSaved = true;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var errorMsg = string.Format("Saving failed!\n{0}", ex.Message);
|
|
||||||
MessageBox.Show(errorMsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonSign_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
string privateKey = textBoxPrivateKey.Text;
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(privateKey) == false)
|
|
||||||
{
|
|
||||||
string accountName = textBoxAccountName.Text;
|
|
||||||
string accountNumber = textBoxAccountNumber.Text;
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(accountName) == false)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(accountNumber) == false)
|
|
||||||
{
|
|
||||||
string inputData = accountName + accountNumber;
|
|
||||||
|
|
||||||
textBoxSignature.Text = DigitalSignatureHelper.CreateSignature(inputData, privateKey);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MessageBox.Show("AccountNumber is empty!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MessageBox.Show("AccountName is empty!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MessageBox.Show("Private Key is empty!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonExportPublicKey_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
string publicKey = textBoxPublicKey.Text;
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(publicKey) == false)
|
|
||||||
{
|
|
||||||
SaveFileDialog dlg = new SaveFileDialog();
|
|
||||||
|
|
||||||
dlg.Filter = "MetaTraderApi Key Files (*.mtk)|*.mtk";
|
|
||||||
dlg.Title = "Export MetaTraderApi Key File";
|
|
||||||
|
|
||||||
if (dlg.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
using (TextWriter file = new StreamWriter(dlg.FileName, true))
|
|
||||||
{
|
|
||||||
file.WriteLine(publicKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
mIsSaved = true;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var errorMsg = string.Format("Export failed!\n{0}", ex.Message);
|
|
||||||
MessageBox.Show(errorMsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MessageBox.Show("Public Key is empty!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonExportSignature_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
string signature = textBoxSignature.Text;
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(signature) == false)
|
|
||||||
{
|
|
||||||
SaveFileDialog dlg = new SaveFileDialog();
|
|
||||||
|
|
||||||
dlg.Filter = "MetaTraderApi Key (*.mta)|*.mta";
|
|
||||||
dlg.Title = "Export MetaTraderApi Key";
|
|
||||||
|
|
||||||
if (dlg.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
using (TextWriter file = new StreamWriter(dlg.FileName))
|
|
||||||
{
|
|
||||||
file.WriteLine(signature);
|
|
||||||
}
|
|
||||||
|
|
||||||
mIsSaved = true;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var errorMsg = string.Format("Export failed!\n{0}", ex.Message);
|
|
||||||
MessageBox.Show(errorMsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MessageBox.Show("Signature is empty!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonVerify_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
string publicKey = textBoxPublicKey.Text;
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(publicKey) == false)
|
|
||||||
{
|
|
||||||
string signature = textBoxSignature.Text;
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(signature) == false)
|
|
||||||
{
|
|
||||||
string accountName = textBoxAccountName.Text;
|
|
||||||
string accountNumber = textBoxAccountNumber.Text;
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(accountName) == false)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(accountNumber) == false)
|
|
||||||
{
|
|
||||||
string inputData = accountName + accountNumber;
|
|
||||||
var verifyResult = false;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
verifyResult = DigitalSignatureHelper.VerifySignature(inputData, signature, publicKey);
|
|
||||||
}
|
|
||||||
catch (SecurityException ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Verify", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
||||||
verifyResult = false;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
string errorMsg = string.Format("Verify process failed!\n{0}", ex.Message);
|
|
||||||
MessageBox.Show(errorMsg, "Verify", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
verifyResult = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (verifyResult == true)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Signature good", "Verify", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MessageBox.Show("AccountNumber is empty!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MessageBox.Show("AccountName is empty!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MessageBox.Show("Signature is empty!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MessageBox.Show("Public Key is empty!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void clipboardCopyBtn_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
Clipboard.SetText(textBoxPublicKey.Text);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void saveToRegBtn_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
string signature = textBoxSignature.Text;
|
|
||||||
string accountName = textBoxAccountName.Text;
|
|
||||||
string accountNumber = textBoxAccountNumber.Text;
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(signature))
|
|
||||||
{
|
|
||||||
MessageBox.Show("Signature is empty!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(accountName))
|
|
||||||
{
|
|
||||||
MessageBox.Show("AccountName is empty!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(accountNumber))
|
|
||||||
{
|
|
||||||
MessageBox.Show("AccountNumber is empty!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
SaveFileDialog dlg = new SaveFileDialog();
|
|
||||||
|
|
||||||
dlg.Filter = "Registry files (*.reg)|*.reg";
|
|
||||||
dlg.Title = "Registry files";
|
|
||||||
|
|
||||||
if (dlg.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
string key = MtRegistryManager.SaveSignatureKey(accountName, accountNumber, signature);
|
|
||||||
|
|
||||||
bool exported = MtRegistryManager.ExportKey(key, dlg.FileName);
|
|
||||||
|
|
||||||
if (exported)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Export successed.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.None);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MessageBox.Show("Export failed!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void readRegBtn_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
string accountName = textBoxAccountName.Text;
|
|
||||||
string accountNumber = textBoxAccountNumber.Text;
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(accountName))
|
|
||||||
{
|
|
||||||
MessageBox.Show("AccountName is empty!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(accountNumber))
|
|
||||||
{
|
|
||||||
MessageBox.Show("AccountNumber is empty!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
string signature = MtRegistryManager.ReadSignatureKey(accountName, accountNumber);
|
|
||||||
textBoxSignature.Text = signature;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,120 +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.Runtime.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:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<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" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</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" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
</root>
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace Licensing
|
|
||||||
{
|
|
||||||
static class Program
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// The main entry point for the application.
|
|
||||||
/// </summary>
|
|
||||||
[STAThread]
|
|
||||||
static void Main()
|
|
||||||
{
|
|
||||||
Application.EnableVisualStyles();
|
|
||||||
Application.SetCompatibleTextRenderingDefault(false);
|
|
||||||
Application.Run(new MainForm());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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("Licensing")]
|
|
||||||
[assembly: AssemblyDescription("")]
|
|
||||||
[assembly: AssemblyConfiguration("")]
|
|
||||||
[assembly: AssemblyCompany("DW")]
|
|
||||||
[assembly: AssemblyProduct("Licensing")]
|
|
||||||
[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("2c3df81b-2285-44ff-a152-0111e25d9b1a")]
|
|
||||||
|
|
||||||
// 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")]
|
|
||||||
@@ -31,22 +31,6 @@ public struct CMqlRates
|
|||||||
int spread; // Spread
|
int spread; // Spread
|
||||||
__int64 real_volume; // Trade volume
|
__int64 real_volume; // Trade volume
|
||||||
};
|
};
|
||||||
|
|
||||||
public struct CMqlTick
|
|
||||||
{
|
|
||||||
__int64 time; // Time of the last prices update
|
|
||||||
double bid; // Current Bid price
|
|
||||||
double ask; // Current Ask price
|
|
||||||
double last; // Price of the last deal (Last)
|
|
||||||
unsigned __int64 volume; // Volume for the current Last price
|
|
||||||
};
|
|
||||||
|
|
||||||
public struct CMqlBookInfo
|
|
||||||
{
|
|
||||||
int type; // Order type from ENUM_BOOK_TYPE enumeration
|
|
||||||
double price; // Price
|
|
||||||
__int64 volume; // Volume
|
|
||||||
};
|
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
void convertSystemString(wchar_t* dest, String^ src)
|
void convertSystemString(wchar_t* dest, String^ src)
|
||||||
@@ -224,37 +208,6 @@ _DLLAPI int _stdcall sendMqlRatesArrayResponse(int expertHandle, CMqlRates value
|
|||||||
}, err, 0);
|
}, err, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
_DLLAPI int _stdcall sendMqlTickResponse(int expertHandle, CMqlTick* response, wchar_t* err)
|
|
||||||
{
|
|
||||||
return Execute<int>([&expertHandle, response]() {
|
|
||||||
MtMqlTick^ mtResponse = gcnew MtMqlTick();
|
|
||||||
mtResponse->time = response->time;
|
|
||||||
mtResponse->bid = response->bid;
|
|
||||||
mtResponse->ask = response->ask;
|
|
||||||
mtResponse->last = response->last;
|
|
||||||
mtResponse->volume = response->volume;
|
|
||||||
MtAdapter::GetInstance()->SendResponse(expertHandle, gcnew MtResponseMqlTick(mtResponse));
|
|
||||||
return 1;
|
|
||||||
}, err, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
_DLLAPI int _stdcall sendMqlBookInfoArrayResponse(int expertHandle, CMqlBookInfo values[], int size, wchar_t* err)
|
|
||||||
{
|
|
||||||
return Execute<int>([&expertHandle, values, &size]() {
|
|
||||||
array<MtMqlBookInfo^>^ list = gcnew array<MtMqlBookInfo^>(size);
|
|
||||||
for (int i = 0; i < size; i++)
|
|
||||||
{
|
|
||||||
MtMqlBookInfo^ info = gcnew MtMqlBookInfo();
|
|
||||||
info->type = values[i].type;
|
|
||||||
info->price = values[i].price;
|
|
||||||
info->volume = values[i].volume;
|
|
||||||
list[i] = info;
|
|
||||||
}
|
|
||||||
MtAdapter::GetInstance()->SendResponse(expertHandle, gcnew MtResponseMqlBookInfoArray(list));
|
|
||||||
return 1;
|
|
||||||
}, err, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------- get values -------------------------------
|
//----------- get values -------------------------------
|
||||||
|
|
||||||
_DLLAPI int _stdcall getCommandType(int expertHandle, int* res, wchar_t* err)
|
_DLLAPI int _stdcall getCommandType(int expertHandle, int* res, wchar_t* err)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
<ProjectConfiguration Include="Debug|Win32">
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
<Configuration>Debug</Configuration>
|
<Configuration>Debug</Configuration>
|
||||||
@@ -23,6 +23,7 @@
|
|||||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||||
<Keyword>ManagedCProj</Keyword>
|
<Keyword>ManagedCProj</Keyword>
|
||||||
<RootNamespace>MT5Connector</RootNamespace>
|
<RootNamespace>MT5Connector</RootNamespace>
|
||||||
|
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
@@ -30,28 +31,28 @@
|
|||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<CLRSupport>true</CLRSupport>
|
<CLRSupport>true</CLRSupport>
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
<PlatformToolset>v140</PlatformToolset>
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<CLRSupport>true</CLRSupport>
|
<CLRSupport>true</CLRSupport>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
<PlatformToolset>v140</PlatformToolset>
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<CLRSupport>true</CLRSupport>
|
<CLRSupport>true</CLRSupport>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
<PlatformToolset>v140</PlatformToolset>
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<CLRSupport>true</CLRSupport>
|
<CLRSupport>true</CLRSupport>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
<PlatformToolset>v140</PlatformToolset>
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
|||||||
@@ -72,9 +72,7 @@
|
|||||||
<Compile Include="MtClient.cs" />
|
<Compile Include="MtClient.cs" />
|
||||||
<Compile Include="MtCommandTask.cs" />
|
<Compile Include="MtCommandTask.cs" />
|
||||||
<Compile Include="MtEvent.cs" />
|
<Compile Include="MtEvent.cs" />
|
||||||
<Compile Include="MtMqlBookInfo.cs" />
|
|
||||||
<Compile Include="MtMqlRates.cs" />
|
<Compile Include="MtMqlRates.cs" />
|
||||||
<Compile Include="MtMqlTick.cs" />
|
|
||||||
<Compile Include="MtMqlTradeRequest.cs" />
|
<Compile Include="MtMqlTradeRequest.cs" />
|
||||||
<Compile Include="MtRegistryManager.cs" />
|
<Compile Include="MtRegistryManager.cs" />
|
||||||
<Compile Include="MtConnectionProfile.cs" />
|
<Compile Include="MtConnectionProfile.cs" />
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
using System.Runtime.Serialization;
|
|
||||||
|
|
||||||
namespace MTApiService
|
|
||||||
{
|
|
||||||
[DataContract]
|
|
||||||
public class MtMqlBookInfo
|
|
||||||
{
|
|
||||||
[DataMember]
|
|
||||||
public int type { get; set; }
|
|
||||||
|
|
||||||
[DataMember]
|
|
||||||
public double price { get; set; }
|
|
||||||
|
|
||||||
[DataMember]
|
|
||||||
public long volume { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
using System.Runtime.Serialization;
|
|
||||||
|
|
||||||
namespace MTApiService
|
|
||||||
{
|
|
||||||
[DataContract]
|
|
||||||
public class MtMqlTick
|
|
||||||
{
|
|
||||||
[DataMember]
|
|
||||||
public long time { get; set; } // Time of the last prices update
|
|
||||||
|
|
||||||
[DataMember]
|
|
||||||
public double bid { get; set; } // Current Bid price
|
|
||||||
|
|
||||||
[DataMember]
|
|
||||||
public double ask { get; set; } // Current Ask price
|
|
||||||
|
|
||||||
[DataMember]
|
|
||||||
public double last { get; set; } // Price of the last deal (Last)
|
|
||||||
|
|
||||||
[DataMember]
|
|
||||||
public ulong volume { get; set; } // Volume for the current Last price
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -17,9 +17,8 @@ namespace MTApiService
|
|||||||
typeof(MtResponseString), typeof(MtResponseBool),
|
typeof(MtResponseString), typeof(MtResponseBool),
|
||||||
typeof(MtResponseLong), typeof(MtResponseULong),
|
typeof(MtResponseLong), typeof(MtResponseULong),
|
||||||
typeof(MtResponseDoubleArray), typeof(MtResponseIntArray),
|
typeof(MtResponseDoubleArray), typeof(MtResponseIntArray),
|
||||||
typeof(MtResponseLongArray), typeof(MtResponseMqlTick),
|
typeof(MtResponseLongArray),
|
||||||
typeof(MtResponseArrayList), typeof(MtResponseMqlRatesArray),
|
typeof(MtResponseArrayList), typeof(MtResponseMqlRatesArray)};
|
||||||
typeof(MtResponseMqlBookInfoArray)};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract object GetValue();
|
public abstract object GetValue();
|
||||||
@@ -255,43 +254,4 @@ namespace MTApiService
|
|||||||
return Value.ToString();
|
return Value.ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[DataContract]
|
|
||||||
public class MtResponseMqlTick : MtResponse
|
|
||||||
{
|
|
||||||
public MtResponseMqlTick(MtMqlTick value)
|
|
||||||
{
|
|
||||||
Value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
[DataMember]
|
|
||||||
public MtMqlTick Value { get; private set; }
|
|
||||||
|
|
||||||
public override object GetValue() { return Value; }
|
|
||||||
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
return Value.ToString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[DataContract]
|
|
||||||
public class MtResponseMqlBookInfoArray : MtResponse
|
|
||||||
{
|
|
||||||
public MtResponseMqlBookInfoArray(MtMqlBookInfo[] value)
|
|
||||||
{
|
|
||||||
Value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
[DataMember]
|
|
||||||
public MtMqlBookInfo[] Value { get; private set; }
|
|
||||||
|
|
||||||
public override object GetValue() { return Value; }
|
|
||||||
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
return Value.ToString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.30.0")]
|
[assembly: AssemblyVersion("1.0.31.0")]
|
||||||
[assembly: AssemblyFileVersion("1.0.30.0")]
|
[assembly: AssemblyFileVersion("1.0.31.0")]
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
<ProjectConfiguration Include="Debug|Win32">
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
<Configuration>Debug</Configuration>
|
<Configuration>Debug</Configuration>
|
||||||
@@ -24,6 +24,7 @@
|
|||||||
<Keyword>ManagedCProj</Keyword>
|
<Keyword>ManagedCProj</Keyword>
|
||||||
<RootNamespace>MTConnector</RootNamespace>
|
<RootNamespace>MTConnector</RootNamespace>
|
||||||
<ProjectName>MTConnector</ProjectName>
|
<ProjectName>MTConnector</ProjectName>
|
||||||
|
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
@@ -31,28 +32,28 @@
|
|||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<CLRSupport>true</CLRSupport>
|
<CLRSupport>true</CLRSupport>
|
||||||
<CharacterSet>NotSet</CharacterSet>
|
<CharacterSet>NotSet</CharacterSet>
|
||||||
<PlatformToolset>v140</PlatformToolset>
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<CLRSupport>true</CLRSupport>
|
<CLRSupport>true</CLRSupport>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
<PlatformToolset>v140</PlatformToolset>
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<CLRSupport>true</CLRSupport>
|
<CLRSupport>true</CLRSupport>
|
||||||
<CharacterSet>NotSet</CharacterSet>
|
<CharacterSet>NotSet</CharacterSet>
|
||||||
<PlatformToolset>v140</PlatformToolset>
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<CLRSupport>true</CLRSupport>
|
<CLRSupport>true</CLRSupport>
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
<PlatformToolset>v140</PlatformToolset>
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
|||||||
@@ -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.40.0")]
|
[assembly: AssemblyVersion("1.0.41.0")]
|
||||||
[assembly: AssemblyFileVersion("1.0.40.0")]
|
[assembly: AssemblyFileVersion("1.0.41.0")]
|
||||||
@@ -7,6 +7,9 @@
|
|||||||
OP_BUYLIMIT = 2,
|
OP_BUYLIMIT = 2,
|
||||||
OP_SELLLIMIT = 3,
|
OP_SELLLIMIT = 3,
|
||||||
OP_BUYSTOP = 4,
|
OP_BUYSTOP = 4,
|
||||||
OP_SELLSTOP = 5
|
OP_SELLSTOP = 5,
|
||||||
|
OP_BALANCE = 6,
|
||||||
|
OP_CREDIT = 7,
|
||||||
|
OP_REBATE = 8
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ namespace MtApi5
|
|||||||
public ENUM_BOOK_TYPE type { get; set; } // Order type from ENUM_BOOK_TYPE enumeration
|
public ENUM_BOOK_TYPE type { get; set; } // Order type from ENUM_BOOK_TYPE enumeration
|
||||||
public double price { get; set; } // Price
|
public double price { get; set; } // Price
|
||||||
public long volume { get; set; } // Volume
|
public long volume { get; set; } // Volume
|
||||||
|
public double volume_real { get; set; } // Volume for the current Last price with greater accuracy
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
|
|||||||
+2
-1
@@ -23,7 +23,8 @@ namespace MtApi5
|
|||||||
public double bid { get; set; } // Current Bid price
|
public double bid { get; set; } // Current Bid price
|
||||||
public double ask { get; set; } // Current Ask price
|
public double ask { get; set; } // Current Ask price
|
||||||
public double last { get; set; } // Price of the last deal (Last)
|
public double last { get; set; } // Price of the last deal (Last)
|
||||||
public ulong volume { get; set; } // Volume for the current Last price
|
public ulong volume { get; set; } // Volume for the current Last price
|
||||||
|
public double volume_real { get; set; } // Volume for the current Last price with greater accuracy
|
||||||
|
|
||||||
public DateTime time => Mt5TimeConverter.ConvertFromMtTime(MtTime);
|
public DateTime time => Mt5TimeConverter.ConvertFromMtTime(MtTime);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,6 +101,9 @@ namespace MtApi5
|
|||||||
//CTrade
|
//CTrade
|
||||||
PositionClose = 64,
|
PositionClose = 64,
|
||||||
PositionOpen = 65,
|
PositionOpen = 65,
|
||||||
|
PositionModify = 6066,
|
||||||
|
PositionClosePartial_bySymbol = 6067,
|
||||||
|
PositionClosePartial_byTicket = 6068,
|
||||||
//PositionOpenWithResult = 1065,
|
//PositionOpenWithResult = 1065,
|
||||||
|
|
||||||
//Backtesting
|
//Backtesting
|
||||||
@@ -251,6 +254,7 @@ namespace MtApi5
|
|||||||
GlobalVariablesTotal = 158,
|
GlobalVariablesTotal = 158,
|
||||||
|
|
||||||
UnlockTicks = 159,
|
UnlockTicks = 159,
|
||||||
PositionCloseAll = 160
|
PositionCloseAll = 160,
|
||||||
|
TesterStop = 161
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -223,6 +223,9 @@ namespace MtApi5
|
|||||||
SYMBOL_LAST = 7,
|
SYMBOL_LAST = 7,
|
||||||
SYMBOL_LASTHIGH = 8,
|
SYMBOL_LASTHIGH = 8,
|
||||||
SYMBOL_LASTLOW = 9,
|
SYMBOL_LASTLOW = 9,
|
||||||
|
SYMBOL_VOLUME_REAL = 10,
|
||||||
|
SYMBOL_VOLUMEHIGH_REAL = 11,
|
||||||
|
SYMBOL_VOLUMELOW_REAL = 12,
|
||||||
SYMBOL_OPTION_STRIKE = 72,
|
SYMBOL_OPTION_STRIKE = 72,
|
||||||
SYMBOL_POINT = 16,
|
SYMBOL_POINT = 16,
|
||||||
SYMBOL_TRADE_TICK_VALUE = 26,
|
SYMBOL_TRADE_TICK_VALUE = 26,
|
||||||
@@ -548,7 +551,6 @@ namespace MtApi5
|
|||||||
POSITION_SL = 6, //Stop Loss level of opened position
|
POSITION_SL = 6, //Stop Loss level of opened position
|
||||||
POSITION_TP = 7, //Take Profit level of opened position
|
POSITION_TP = 7, //Take Profit level of opened position
|
||||||
POSITION_PRICE_CURRENT = 5, //Current price of the position symbol
|
POSITION_PRICE_CURRENT = 5, //Current price of the position symbol
|
||||||
POSITION_COMMISSION = 8, //FIXME: Undocumented!
|
|
||||||
POSITION_SWAP = 9, //Cumulative swap
|
POSITION_SWAP = 9, //Cumulative swap
|
||||||
POSITION_PROFIT = 10 //Current profit
|
POSITION_PROFIT = 10 //Current profit
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,8 +32,8 @@
|
|||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net40\Newtonsoft.Json.dll</HintPath>
|
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net40\Newtonsoft.Json.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
@@ -98,6 +98,7 @@
|
|||||||
<Compile Include="Requests\Response.cs" />
|
<Compile Include="Requests\Response.cs" />
|
||||||
<Compile Include="Requests\SymbolInfoStringRequest.cs" />
|
<Compile Include="Requests\SymbolInfoStringRequest.cs" />
|
||||||
<Compile Include="Requests\SymbolInfoStringResult.cs" />
|
<Compile Include="Requests\SymbolInfoStringResult.cs" />
|
||||||
|
<Compile Include="Requests\SymbolInfoTickRequest.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\MTApiService\MTApiService.csproj">
|
<ProjectReference Include="..\MTApiService\MTApiService.csproj">
|
||||||
@@ -108,7 +109,6 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<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.
|
||||||
|
|||||||
+87
-10
@@ -547,6 +547,20 @@ namespace MtApi5
|
|||||||
return SendCommand<bool>(Mt5CommandType.PositionClose, commandParameters);
|
return SendCommand<bool>(Mt5CommandType.PositionClose, commandParameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Modifies existing position
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ticket">>Ticket of the position</param>
|
||||||
|
/// <param name="sl">Stop loss</param>
|
||||||
|
/// <param name="tp">Take profit</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public bool PositionModify(ulong ticket, double sl, double tp)
|
||||||
|
{
|
||||||
|
var commandParameters = new ArrayList { ticket, sl,tp };
|
||||||
|
|
||||||
|
return SendCommand<bool>(Mt5CommandType.PositionModify, commandParameters);
|
||||||
|
}
|
||||||
|
|
||||||
///<summary>
|
///<summary>
|
||||||
///Closes a position with the specified ticket.
|
///Closes a position with the specified ticket.
|
||||||
///</summary>
|
///</summary>
|
||||||
@@ -641,6 +655,34 @@ namespace MtApi5
|
|||||||
{
|
{
|
||||||
return PositionOpen(symbol, orderType, volume, price, sl, tp, "", out result);
|
return PositionOpen(symbol, orderType, volume, price, sl, tp, "", out result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Partially closes a position on a specified symbol in case of a "hedging" accounting.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="symbol">Name of a trading instrument, on which a position is closed partially.</param>
|
||||||
|
/// <param name="volume"> Volume, by which a position should be decreased. If the value exceeds the volume of a partially closed position, it is closed in full. No position in the opposite direction is opened.</param>
|
||||||
|
/// <param name="deviation">The maximum deviation from the current price (in points).</param>
|
||||||
|
/// <returns>true if the basic check of structures is successful, otherwise false.</returns>
|
||||||
|
public bool PositionClosePartial(string symbol, double volume, ulong deviation = ulong.MaxValue)
|
||||||
|
{
|
||||||
|
var commandParameters = new ArrayList { symbol, volume, deviation };
|
||||||
|
|
||||||
|
return SendCommand<bool>(Mt5CommandType.PositionClosePartial_bySymbol, commandParameters);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Partially closes a position on a specified symbol in case of a "hedging" accounting.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ticket">Closed position ticket.</param>
|
||||||
|
/// <param name="volume"> Volume, by which a position should be decreased. If the value exceeds the volume of a partially closed position, it is closed in full. No position in the opposite direction is opened.</param>
|
||||||
|
/// <param name="deviation">The maximum deviation from the current price (in points).</param>
|
||||||
|
/// <returns>true if the basic check of structures is successful, otherwise false.</returns>
|
||||||
|
public bool PositionClosePartial(ulong ticket, double volume, ulong deviation = ulong.MaxValue)
|
||||||
|
{
|
||||||
|
var commandParameters = new ArrayList { ticket, volume, deviation };
|
||||||
|
|
||||||
|
return SendCommand<bool>(Mt5CommandType.PositionClosePartial_byTicket, commandParameters);
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Account Information functions
|
#region Account Information functions
|
||||||
@@ -1476,19 +1518,27 @@ namespace MtApi5
|
|||||||
///<param name="tick"> Link to the structure of the MqlTick type, to which the current prices and time of the last price update will be placed.</param>
|
///<param name="tick"> Link to the structure of the MqlTick type, to which the current prices and time of the last price update will be placed.</param>
|
||||||
public bool SymbolInfoTick(string symbol, out MqlTick tick)
|
public bool SymbolInfoTick(string symbol, out MqlTick tick)
|
||||||
{
|
{
|
||||||
var commandParameters = new ArrayList { symbol };
|
tick = SendRequest<MqlTick>(new SymbolInfoTickRequest
|
||||||
|
|
||||||
var retVal = SendCommand<MtMqlTick>(Mt5CommandType.SymbolInfoTick, commandParameters);
|
|
||||||
|
|
||||||
tick = null;
|
|
||||||
if (retVal != null)
|
|
||||||
{
|
{
|
||||||
tick = new MqlTick { MtTime = retVal.time, ask = retVal.ask, bid = retVal.bid, last = retVal.last, volume = retVal.volume };
|
SymbolName = symbol
|
||||||
}
|
});
|
||||||
|
|
||||||
return tick != null;
|
return tick != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
///The function returns current prices of a specified symbol in a variable of the MqlTick type.
|
||||||
|
///</summary>
|
||||||
|
///<param name="symbol">Symbol name.</param>
|
||||||
|
public MqlTick SymbolInfoTick(string symbol)
|
||||||
|
{
|
||||||
|
var tick = SendRequest<MqlTick>(new SymbolInfoTickRequest
|
||||||
|
{
|
||||||
|
SymbolName = symbol
|
||||||
|
});
|
||||||
|
|
||||||
|
return tick;
|
||||||
|
}
|
||||||
|
|
||||||
///<summary>
|
///<summary>
|
||||||
///Allows receiving time of beginning and end of the specified quoting sessions for a specified symbol and weekday.
|
///Allows receiving time of beginning and end of the specified quoting sessions for a specified symbol and weekday.
|
||||||
@@ -2073,6 +2123,14 @@ namespace MtApi5
|
|||||||
SendCommand<object>(Mt5CommandType.Alert, commandParameters);
|
SendCommand<object>(Mt5CommandType.Alert, commandParameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
///Gives program operation completion command when testing.
|
||||||
|
///</summary>
|
||||||
|
public void TesterStop()
|
||||||
|
{
|
||||||
|
SendCommand<object>(Mt5CommandType.TesterStop, null);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion // Common Functions
|
#endregion // Common Functions
|
||||||
|
|
||||||
#region Object Functions
|
#region Object Functions
|
||||||
@@ -2086,9 +2144,28 @@ namespace MtApi5
|
|||||||
///<param name="nwin">Number of the chart subwindow. 0 means the main chart window. The specified subwindow must exist, otherwise the function returns false.</param>
|
///<param name="nwin">Number of the chart subwindow. 0 means the main chart window. The specified subwindow must exist, otherwise the function returns false.</param>
|
||||||
///<param name="time">The time coordinate of the first anchor.</param>
|
///<param name="time">The time coordinate of the first anchor.</param>
|
||||||
///<param name="price">The price coordinate of the first anchor point.</param>
|
///<param name="price">The price coordinate of the first anchor point.</param>
|
||||||
public bool ObjectCreate(long chartId, string name, ENUM_OBJECT type, int nwin, DateTime time, double price)
|
///<param name="listOfCoordinates">List of further anchor points (tuple of time and price).</param>
|
||||||
|
public bool ObjectCreate(long chartId, string name, ENUM_OBJECT type, int nwin, DateTime time, double price, List<Tuple<DateTime, double>> listOfCoordinates = null)
|
||||||
{
|
{
|
||||||
var commandParameters = new ArrayList { chartId, name, (int)type, nwin, Mt5TimeConverter.ConvertToMtTime(time), price };
|
//Count the additional coordinates
|
||||||
|
int iAdditionalCoordinates = (listOfCoordinates != null) ? listOfCoordinates.Count() : 0;
|
||||||
|
if(iAdditionalCoordinates > 29)
|
||||||
|
{
|
||||||
|
throw new ArgumentOutOfRangeException("listOfCoordinates", "The maximum amount of coordinates in 30.");
|
||||||
|
}
|
||||||
|
|
||||||
|
int nParameter = 6 + iAdditionalCoordinates * 2;
|
||||||
|
var commandParameters = new ArrayList { nParameter, chartId, name, (int)type, nwin, Mt5TimeConverter.ConvertToMtTime(time), price };
|
||||||
|
|
||||||
|
if (iAdditionalCoordinates > 0)
|
||||||
|
{
|
||||||
|
foreach (Tuple<DateTime, double> coordinateTuple in listOfCoordinates)
|
||||||
|
{
|
||||||
|
commandParameters.Add(Mt5TimeConverter.ConvertToMtTime(coordinateTuple.Item1));
|
||||||
|
commandParameters.Add(coordinateTuple.Item2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return SendCommand<bool>(Mt5CommandType.ObjectCreate, commandParameters);
|
return SendCommand<bool>(Mt5CommandType.ObjectCreate, commandParameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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.19")]
|
[assembly: AssemblyVersion("1.0.21")]
|
||||||
[assembly: AssemblyFileVersion("1.0.19")]
|
[assembly: AssemblyFileVersion("1.0.21")]
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ namespace MtApi5.Requests
|
|||||||
SymbolInfoString = 8,
|
SymbolInfoString = 8,
|
||||||
ChartTimePriceToXY = 9,
|
ChartTimePriceToXY = 9,
|
||||||
ChartXYToTimePrice = 10,
|
ChartXYToTimePrice = 10,
|
||||||
PositionClose = 11
|
PositionClose = 11,
|
||||||
|
SymbolInfoTick = 12
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace MtApi5.Requests
|
||||||
|
{
|
||||||
|
internal class SymbolInfoTickRequest : RequestBase
|
||||||
|
{
|
||||||
|
public override RequestType RequestType => RequestType.SymbolInfoTick;
|
||||||
|
|
||||||
|
public string SymbolName { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net40" />
|
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net40" />
|
||||||
</packages>
|
</packages>
|
||||||
@@ -12,7 +12,7 @@ MTApiService is a common engine communication project of the API for MT4 and MT5
|
|||||||
MTApiService library should be placed in Windows GAC (Global Assembly Cache). Installers in the project will be copied to GAC automatically.
|
MTApiService library should be placed in Windows GAC (Global Assembly Cache). Installers in the project will be copied to GAC automatically.
|
||||||
|
|
||||||
# How to Build Solution
|
# How to Build Solution
|
||||||
The project is supported by Visual Studio 2015 and requires WIX Tools (http://wixtoolset.org/).
|
The project is supported by Visual Studio 2017 and requires WIX Tools (http://wixtoolset.org/).
|
||||||
|
|
||||||
To make an API for MetaTrader4 use MtApiInstaller and for MetaTrader5 use MtApi5Installer.
|
To make an API for MetaTrader4 use MtApiInstaller and for MetaTrader5 use MtApi5Installer.
|
||||||
All installers will be placed in the folder "[root]\build\installers\" and all *.dll files will be placed in "[root]\build\products\".
|
All installers will be placed in the folder "[root]\build\installers\" and all *.dll files will be placed in "[root]\build\products\".
|
||||||
|
|||||||
@@ -439,6 +439,7 @@
|
|||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<DockPanel Grid.Row="0" LastChildFill="True">
|
<DockPanel Grid.Row="0" LastChildFill="True">
|
||||||
@@ -454,6 +455,15 @@
|
|||||||
<Button Command="{Binding IndicatorReleaseCommand}" Margin="2"
|
<Button Command="{Binding IndicatorReleaseCommand}" Margin="2"
|
||||||
Content="IndicatorRelease" HorizontalAlignment="Left" />
|
Content="IndicatorRelease" HorizontalAlignment="Left" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
<WrapPanel Grid.Row="2" Margin="2">
|
||||||
|
<Button Command="{Binding iCustomCommand}" Content="iCustom" Margin="2"/>
|
||||||
|
<Button Command="{Binding iBullsPowerCommand}" Content="iBullPower" Margin="2"/>
|
||||||
|
<Button Command="{Binding iBearsPowerCommand}" Content="iBearPower" Margin="2"/>
|
||||||
|
</WrapPanel>
|
||||||
|
<WrapPanel Grid.Row="3">
|
||||||
|
<Button Command="{Binding BarsCalculatedCommand}" Content="BarsCalculated" Margin="2"/>
|
||||||
|
<Button Command="{Binding CopyBufferCommand}" Content="CopyBuffer" Margin="2"/>
|
||||||
|
</WrapPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
@@ -498,11 +508,6 @@
|
|||||||
</Grid>
|
</Grid>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
|
|
||||||
<TabItem Header="Indicators">
|
|
||||||
<WrapPanel VerticalAlignment="Top" Margin="5">
|
|
||||||
<Button Command="{Binding iCustomCommand}" Content="iCustom" Margin="2"/>
|
|
||||||
</WrapPanel>
|
|
||||||
</TabItem>
|
|
||||||
<TabItem Header="Chart Functions">
|
<TabItem Header="Chart Functions">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
@@ -582,6 +587,7 @@
|
|||||||
<WrapPanel VerticalAlignment="Top" Margin="5">
|
<WrapPanel VerticalAlignment="Top" Margin="5">
|
||||||
<Button Command="{Binding GetLastErrorCommand}" Content="GetLastError" Margin="2"/>
|
<Button Command="{Binding GetLastErrorCommand}" Content="GetLastError" Margin="2"/>
|
||||||
<Button Command="{Binding ResetLastErrorCommand}" Content="ResetLastError" Margin="2"/>
|
<Button Command="{Binding ResetLastErrorCommand}" Content="ResetLastError" Margin="2"/>
|
||||||
|
<Button Command="{Binding TesterStopCommand}" Content="TesterStop" Margin="2"/>
|
||||||
</WrapPanel>
|
</WrapPanel>
|
||||||
|
|
||||||
<Button Grid.Row="1" Content="UnlockTicks" HorizontalAlignment="Left" Margin="5" Command="{Binding UnlockTicksCommand}"/>
|
<Button Grid.Row="1" Content="UnlockTicks" HorizontalAlignment="Left" Margin="5" Command="{Binding UnlockTicksCommand}"/>
|
||||||
|
|||||||
@@ -44,6 +44,11 @@ namespace MtApi5TestClient
|
|||||||
public DelegateCommand CopyCloseCommand { get; private set; }
|
public DelegateCommand CopyCloseCommand { get; private set; }
|
||||||
public DelegateCommand IndicatorCreateCommand { get; private set; }
|
public DelegateCommand IndicatorCreateCommand { get; private set; }
|
||||||
public DelegateCommand IndicatorReleaseCommand { get; private set; }
|
public DelegateCommand IndicatorReleaseCommand { get; private set; }
|
||||||
|
public DelegateCommand iCustomCommand { get; private set; }
|
||||||
|
public DelegateCommand iBullsPowerCommand { get; private set; }
|
||||||
|
public DelegateCommand iBearsPowerCommand { get; private set; }
|
||||||
|
public DelegateCommand BarsCalculatedCommand { get; private set; }
|
||||||
|
public DelegateCommand CopyBufferCommand { get; private set; }
|
||||||
|
|
||||||
public DelegateCommand CopyTickVolumeCommand { get; private set; }
|
public DelegateCommand CopyTickVolumeCommand { get; private set; }
|
||||||
public DelegateCommand CopyRealVolumeCommand { get; private set; }
|
public DelegateCommand CopyRealVolumeCommand { get; private set; }
|
||||||
@@ -73,8 +78,7 @@ namespace MtApi5TestClient
|
|||||||
public DelegateCommand ResetLastErrorCommand { get; private set; }
|
public DelegateCommand ResetLastErrorCommand { get; private set; }
|
||||||
public DelegateCommand PrintCommand { get; private set; }
|
public DelegateCommand PrintCommand { get; private set; }
|
||||||
public DelegateCommand AlertCommand { get; private set; }
|
public DelegateCommand AlertCommand { get; private set; }
|
||||||
|
public DelegateCommand TesterStopCommand { get; private set; }
|
||||||
public DelegateCommand iCustomCommand { get; private set; }
|
|
||||||
|
|
||||||
public DelegateCommand TimeCurrentCommand { get; private set; }
|
public DelegateCommand TimeCurrentCommand { get; private set; }
|
||||||
|
|
||||||
@@ -353,6 +357,11 @@ namespace MtApi5TestClient
|
|||||||
CopyCloseCommand = new DelegateCommand(ExecuteCopyClose);
|
CopyCloseCommand = new DelegateCommand(ExecuteCopyClose);
|
||||||
IndicatorCreateCommand = new DelegateCommand(ExecuteIndicatorCreate);
|
IndicatorCreateCommand = new DelegateCommand(ExecuteIndicatorCreate);
|
||||||
IndicatorReleaseCommand = new DelegateCommand(ExecuteIndicatorRelease);
|
IndicatorReleaseCommand = new DelegateCommand(ExecuteIndicatorRelease);
|
||||||
|
iCustomCommand = new DelegateCommand(ExecuteICustom);
|
||||||
|
iBullsPowerCommand = new DelegateCommand(ExecuteIBullsPowerCommand);
|
||||||
|
iBearsPowerCommand = new DelegateCommand(ExecuteIBearsPowerCommand);
|
||||||
|
BarsCalculatedCommand = new DelegateCommand(ExecuteBarsCalculatedCommand);
|
||||||
|
CopyBufferCommand = new DelegateCommand(ExecuteCopyBufferCommand);
|
||||||
|
|
||||||
CopyTickVolumeCommand = new DelegateCommand(ExecuteCopyTickVolume);
|
CopyTickVolumeCommand = new DelegateCommand(ExecuteCopyTickVolume);
|
||||||
CopyRealVolumeCommand = new DelegateCommand(ExecuteCopyRealVolume);
|
CopyRealVolumeCommand = new DelegateCommand(ExecuteCopyRealVolume);
|
||||||
@@ -382,8 +391,7 @@ namespace MtApi5TestClient
|
|||||||
AlertCommand = new DelegateCommand(ExecuteAlert);
|
AlertCommand = new DelegateCommand(ExecuteAlert);
|
||||||
GetLastErrorCommand = new DelegateCommand(ExecuteGetLastError);
|
GetLastErrorCommand = new DelegateCommand(ExecuteGetLastError);
|
||||||
ResetLastErrorCommand = new DelegateCommand(ExecuteResetLastError);
|
ResetLastErrorCommand = new DelegateCommand(ExecuteResetLastError);
|
||||||
|
TesterStopCommand = new DelegateCommand(ExecuteTesterStop);
|
||||||
iCustomCommand = new DelegateCommand(ExecuteICustom);
|
|
||||||
|
|
||||||
ChartOpenCommand = new DelegateCommand(ExecuteChartOpen);
|
ChartOpenCommand = new DelegateCommand(ExecuteChartOpen);
|
||||||
ChartTimePriceToXYCommand = new DelegateCommand(ExecuteChartTimePriceToXY);
|
ChartTimePriceToXYCommand = new DelegateCommand(ExecuteChartTimePriceToXY);
|
||||||
@@ -804,6 +812,68 @@ namespace MtApi5TestClient
|
|||||||
AddLog($"IndicatorRelease [{indicatorHandle}]: result - {retVal}");
|
AddLog($"IndicatorRelease [{indicatorHandle}]: result - {retVal}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async void ExecuteICustom(object o)
|
||||||
|
{
|
||||||
|
const string name = @"Examples\Custom Moving Average";
|
||||||
|
int[] parameters = { 0, 21, (int)ENUM_APPLIED_PRICE.PRICE_CLOSE };
|
||||||
|
|
||||||
|
var retVal = await Execute(() => _mtApiClient.iCustom(TimeSeriesValues.SymbolValue, TimeSeriesValues.TimeFrame, name, parameters));
|
||||||
|
TimeSeriesValues.IndicatorHandle = retVal;
|
||||||
|
AddLog($"Custom Moving Average: result - {retVal}");
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void ExecuteIBullsPowerCommand(object o)
|
||||||
|
{
|
||||||
|
const int maPeriod = 13;
|
||||||
|
var retVal = await Execute(() => _mtApiClient.iBullsPower(TimeSeriesValues.SymbolValue, TimeSeriesValues.TimeFrame, maPeriod));
|
||||||
|
TimeSeriesValues.IndicatorHandle = retVal;
|
||||||
|
|
||||||
|
AddLog($"iBullPower: result - {retVal}");
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void ExecuteIBearsPowerCommand(object o)
|
||||||
|
{
|
||||||
|
const int maPeriod = 13;
|
||||||
|
var retVal = await Execute(() => _mtApiClient.iBearsPower(TimeSeriesValues.SymbolValue, TimeSeriesValues.TimeFrame, maPeriod));
|
||||||
|
TimeSeriesValues.IndicatorHandle = retVal;
|
||||||
|
|
||||||
|
AddLog($"iBearsPower: result - {retVal}");
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void ExecuteBarsCalculatedCommand(object o)
|
||||||
|
{
|
||||||
|
var retVal = await Execute(() => _mtApiClient.BarsCalculated(TimeSeriesValues.IndicatorHandle));
|
||||||
|
|
||||||
|
AddLog($"BarsCalculated: result - {retVal}");
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void ExecuteCopyBufferCommand(object o)
|
||||||
|
{
|
||||||
|
TimeSeriesResults.Clear();
|
||||||
|
|
||||||
|
var result = await Execute(() =>
|
||||||
|
{
|
||||||
|
var count = _mtApiClient.CopyBuffer(TimeSeriesValues.IndicatorHandle, 0, TimeSeriesValues.StartPos, TimeSeriesValues.Count, out var values);
|
||||||
|
return count > 0 ? values : null;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (result == null)
|
||||||
|
{
|
||||||
|
AddLog("CopyRates: result is null");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
RunOnUiThread(() =>
|
||||||
|
{
|
||||||
|
foreach (var value in result)
|
||||||
|
{
|
||||||
|
TimeSeriesResults.Add($"{value:F6}");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
AddLog("CopyRates: success");
|
||||||
|
}
|
||||||
|
|
||||||
private async void ExecuteCopyRates(object o)
|
private async void ExecuteCopyRates(object o)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(TimeSeriesValues?.SymbolValue)) return;
|
if (string.IsNullOrEmpty(TimeSeriesValues?.SymbolValue)) return;
|
||||||
@@ -992,6 +1062,12 @@ namespace MtApi5TestClient
|
|||||||
{
|
{
|
||||||
var retVal = await Execute(() => _mtApiClient.SymbolInfoDouble("EURUSD", ENUM_SYMBOL_INFO_DOUBLE.SYMBOL_BID));
|
var retVal = await Execute(() => _mtApiClient.SymbolInfoDouble("EURUSD", ENUM_SYMBOL_INFO_DOUBLE.SYMBOL_BID));
|
||||||
AddLog($"SymbolInfoDouble(EURUSD, ENUM_SYMBOL_INFO_DOUBLE.SYMBOL_BID): result = {retVal}");
|
AddLog($"SymbolInfoDouble(EURUSD, ENUM_SYMBOL_INFO_DOUBLE.SYMBOL_BID): result = {retVal}");
|
||||||
|
retVal = await Execute(() => _mtApiClient.SymbolInfoDouble("EURUSD", ENUM_SYMBOL_INFO_DOUBLE.SYMBOL_VOLUME_REAL));
|
||||||
|
AddLog($"SymbolInfoDouble(EURUSD, ENUM_SYMBOL_INFO_DOUBLE.SYMBOL_VOLUME_REAL): result = {retVal}");
|
||||||
|
retVal = await Execute(() => _mtApiClient.SymbolInfoDouble("EURUSD", ENUM_SYMBOL_INFO_DOUBLE.SYMBOL_VOLUMEHIGH_REAL));
|
||||||
|
AddLog($"SymbolInfoDouble(EURUSD, ENUM_SYMBOL_INFO_DOUBLE.SYMBOL_VOLUMEHIGH_REAL): result = {retVal}");
|
||||||
|
retVal = await Execute(() => _mtApiClient.SymbolInfoDouble("EURUSD", ENUM_SYMBOL_INFO_DOUBLE.SYMBOL_VOLUMELOW_REAL));
|
||||||
|
AddLog($"SymbolInfoDouble(EURUSD, ENUM_SYMBOL_INFO_DOUBLE.SYMBOL_VOLUMELOW_REAL): result = {retVal}");
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void ExecuteSymbolInfoInteger(object o)
|
private async void ExecuteSymbolInfoInteger(object o)
|
||||||
@@ -1030,6 +1106,7 @@ namespace MtApi5TestClient
|
|||||||
AddLog($"SymbolInfoTick(EURUSD) tick.ask = {result.ask}");
|
AddLog($"SymbolInfoTick(EURUSD) tick.ask = {result.ask}");
|
||||||
AddLog($"SymbolInfoTick(EURUSD) tick.last = {result.last}");
|
AddLog($"SymbolInfoTick(EURUSD) tick.last = {result.last}");
|
||||||
AddLog($"SymbolInfoTick(EURUSD) tick.volume = {result.volume}");
|
AddLog($"SymbolInfoTick(EURUSD) tick.volume = {result.volume}");
|
||||||
|
AddLog($"SymbolInfoTick(EURUSD) tick.volume_real = {result.volume_real}");
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void ExecuteSymbolInfoSessionQuote(object o)
|
private async void ExecuteSymbolInfoSessionQuote(object o)
|
||||||
@@ -1100,7 +1177,7 @@ namespace MtApi5TestClient
|
|||||||
|
|
||||||
for (var i = 0; i < result.Length; i++)
|
for (var i = 0; i < result.Length; i++)
|
||||||
{
|
{
|
||||||
AddLog($"MarketBookGet: [{i}] - {result[i].price} | {result[i].volume} | {result[i].type}");
|
AddLog($"MarketBookGet: [{i}] - {result[i].price} | {result[i].volume} | {result[i].type} | {result[i].volume_real}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1162,15 +1239,10 @@ namespace MtApi5TestClient
|
|||||||
AddLog("ResetLastError: executed.");
|
AddLog("ResetLastError: executed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void ExecuteICustom(object o)
|
private void ExecuteTesterStop(object obj)
|
||||||
{
|
{
|
||||||
const string symbol = "EURUSD";
|
_mtApiClient.TesterStop();
|
||||||
const ENUM_TIMEFRAMES timeframe = ENUM_TIMEFRAMES.PERIOD_H1;
|
AddLog("TesterStop: executed.");
|
||||||
const string name = @"Examples\Custom Moving Average";
|
|
||||||
int[] parameters = { 0, 21, (int)ENUM_APPLIED_PRICE.PRICE_CLOSE };
|
|
||||||
|
|
||||||
var retVal = await Execute(() => _mtApiClient.iCustom(symbol, timeframe, name, parameters));
|
|
||||||
AddLog($"Custom Moving Average: result - {retVal}");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void ExecuteTimeCurrent(object o)
|
private async void ExecuteTimeCurrent(object o)
|
||||||
@@ -1661,7 +1733,7 @@ namespace MtApi5TestClient
|
|||||||
|
|
||||||
private void _mtApiClient_OnLastTimeBar(object sender, Mt5TimeBarArgs e)
|
private void _mtApiClient_OnLastTimeBar(object sender, Mt5TimeBarArgs e)
|
||||||
{
|
{
|
||||||
AddLog($"OnBookEvent: ExpertHandle = {e.ExpertHandle}, Symbol = {e.Symbol}, open = {e.Rates.open}, close = {e.Rates.close}, time = {e.Rates.time}, high = {e.Rates.high}, low = {e.Rates.low}");
|
AddLog($"OnLastTimeBarEvent: ExpertHandle = {e.ExpertHandle}, Symbol = {e.Symbol}, open = {e.Rates.open}, close = {e.Rates.close}, time = {e.Rates.time}, high = {e.Rates.high}, low = {e.Rates.low}");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void _mtApiClient_OnLockTicks(object sender, Mt5LockTicksEventArgs e)
|
private void _mtApiClient_OnLockTicks(object sender, Mt5LockTicksEventArgs e)
|
||||||
|
|||||||
@@ -86,10 +86,6 @@
|
|||||||
<Prefer32Bit>false</Prefer32Bit>
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
<HintPath>C:\Program Files (x86)\MtApi\Newtonsoft.Json.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" />
|
||||||
|
|||||||
Binary file not shown.
Executable → Regular
BIN
Binary file not shown.
+260
-78
@@ -25,8 +25,6 @@
|
|||||||
bool sendULongResponse(int expertHandle, ulong response, string& err);
|
bool sendULongResponse(int expertHandle, ulong response, string& err);
|
||||||
bool sendLongArrayResponse(int expertHandle, long& values[], int size, string& err);
|
bool sendLongArrayResponse(int expertHandle, long& values[], int size, string& err);
|
||||||
bool sendMqlRatesArrayResponse(int expertHandle, MqlRates& values[], int size, string& err);
|
bool sendMqlRatesArrayResponse(int expertHandle, MqlRates& values[], int size, string& err);
|
||||||
bool sendMqlTickResponse(int expertHandle, MqlTick& response, string& err);
|
|
||||||
bool sendMqlBookInfoArrayResponse(int expertHandle, MqlBookInfo& values[], int size, string& err);
|
|
||||||
bool sendErrorResponse(int expertHandle, int code, string message, string& err);
|
bool sendErrorResponse(int expertHandle, int code, string message, string& err);
|
||||||
|
|
||||||
bool sendEvent(int expertHandle, int eventType, string payload, string& err);
|
bool sendEvent(int expertHandle, int eventType, string payload, string& err);
|
||||||
@@ -52,6 +50,12 @@ enum LockTickType
|
|||||||
|
|
||||||
input int Port = 8228;
|
input int Port = 8228;
|
||||||
input LockTickType BacktestingLockTicks = NO_LOCK;
|
input LockTickType BacktestingLockTicks = NO_LOCK;
|
||||||
|
input group "Disable Events "
|
||||||
|
input bool Enable_OnBookEvent = true;
|
||||||
|
input bool Enable_OnTickEvent = true;
|
||||||
|
input bool Enable_OnTradeTransactionEvent = true;
|
||||||
|
input bool Enable_OnLastBarEvent = true;
|
||||||
|
|
||||||
|
|
||||||
int ExpertHandle;
|
int ExpertHandle;
|
||||||
|
|
||||||
@@ -91,27 +95,31 @@ void OnTick()
|
|||||||
long lastbar_time = SeriesInfoInteger(symbol, Period(), SERIES_LASTBAR_DATE);
|
long lastbar_time = SeriesInfoInteger(symbol, Period(), SERIES_LASTBAR_DATE);
|
||||||
if (_last_bar_open_time != lastbar_time)
|
if (_last_bar_open_time != lastbar_time)
|
||||||
{
|
{
|
||||||
if (_last_bar_open_time != 0)
|
if (_last_bar_open_time != 0 )
|
||||||
{
|
{
|
||||||
MqlRates rates_array[];
|
if(Enable_OnLastBarEvent)
|
||||||
CopyRates(symbol, Period(), 1, 1, rates_array);
|
{
|
||||||
|
MqlRates rates_array[];
|
||||||
|
CopyRates(symbol, Period(), 1, 1, rates_array);
|
||||||
|
|
||||||
MtTimeBarEvent* time_bar = new MtTimeBarEvent(symbol, rates_array[0]);
|
MtTimeBarEvent* time_bar = new MtTimeBarEvent(symbol, rates_array[0]);
|
||||||
SendMtEvent(ON_LAST_TIME_BAR_EVENT, time_bar);
|
SendMtEvent(ON_LAST_TIME_BAR_EVENT, time_bar);
|
||||||
delete time_bar;
|
delete time_bar;
|
||||||
|
}
|
||||||
lastbar_time_changed = true;
|
lastbar_time_changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
_last_bar_open_time = lastbar_time;
|
_last_bar_open_time = lastbar_time;
|
||||||
}
|
}
|
||||||
|
if (Enable_OnTickEvent)
|
||||||
|
{
|
||||||
|
MqlTick last_tick;
|
||||||
|
SymbolInfoTick(Symbol(),last_tick);
|
||||||
|
|
||||||
MqlTick last_tick;
|
MtOnTickEvent * tick_event = new MtOnTickEvent(symbol, last_tick);
|
||||||
SymbolInfoTick(Symbol(),last_tick);
|
SendMtEvent(ON_TICK_EVENT, tick_event);
|
||||||
|
delete tick_event;
|
||||||
MtOnTickEvent * tick_event = new MtOnTickEvent(symbol, last_tick);
|
}
|
||||||
SendMtEvent(ON_TICK_EVENT, tick_event);
|
|
||||||
delete tick_event;
|
|
||||||
|
|
||||||
if (IsTesting())
|
if (IsTesting())
|
||||||
{
|
{
|
||||||
@@ -134,26 +142,33 @@ void OnTradeTransaction(
|
|||||||
const MqlTradeRequest& request, // request structure
|
const MqlTradeRequest& request, // request structure
|
||||||
const MqlTradeResult& result // result structure
|
const MqlTradeResult& result // result structure
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
#ifdef __DEBUG_LOG__
|
if(!Enable_OnTradeTransactionEvent) return;
|
||||||
PrintFormat("%s:", __FUNCTION__);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
MtOnTradeTransactionEvent* trans_event = new MtOnTradeTransactionEvent(trans, request, result);
|
#ifdef __DEBUG_LOG__
|
||||||
SendMtEvent(ON_TRADE_TRANSACTION_EVENT, trans_event);
|
PrintFormat("%s:", __FUNCTION__);
|
||||||
delete trans_event;
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
MtOnTradeTransactionEvent* trans_event = new MtOnTradeTransactionEvent(trans, request, result);
|
||||||
|
SendMtEvent(ON_TRADE_TRANSACTION_EVENT, trans_event);
|
||||||
|
delete trans_event;
|
||||||
|
|
||||||
|
}
|
||||||
void OnBookEvent(const string& symbol)
|
void OnBookEvent(const string& symbol)
|
||||||
{
|
{
|
||||||
#ifdef __DEBUG_LOG__
|
|
||||||
PrintFormat("%s: %s", __FUNCTION__, symbol);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
MtOnBookEvent * book_event = new MtOnBookEvent(symbol);
|
if(!Enable_OnBookEvent) return;
|
||||||
SendMtEvent(ON_BOOK_EVENT, book_event);
|
|
||||||
delete book_event;
|
#ifdef __DEBUG_LOG__
|
||||||
}
|
PrintFormat("%s: %s", __FUNCTION__, symbol);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
MtOnBookEvent * book_event = new MtOnBookEvent(symbol);
|
||||||
|
SendMtEvent(ON_BOOK_EVENT, book_event);
|
||||||
|
delete book_event;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
int preinit()
|
int preinit()
|
||||||
{
|
{
|
||||||
@@ -532,9 +547,8 @@ int executeCommand()
|
|||||||
case 56: //SymbolInfoString
|
case 56: //SymbolInfoString
|
||||||
Execute_SymbolInfoString();
|
Execute_SymbolInfoString();
|
||||||
break;
|
break;
|
||||||
case 57: //SymbolInfoTick
|
// case 57: //SymbolInfoTick
|
||||||
Execute_SymbolInfoTick();
|
// break;
|
||||||
break;
|
|
||||||
case 58: //SymbolInfoSessionQuote
|
case 58: //SymbolInfoSessionQuote
|
||||||
Execute_SymbolInfoSessionQuote();
|
Execute_SymbolInfoSessionQuote();
|
||||||
break;
|
break;
|
||||||
@@ -555,6 +569,15 @@ int executeCommand()
|
|||||||
// case 1065: //PositionOpenWithResult
|
// case 1065: //PositionOpenWithResult
|
||||||
// Execute_PositionOpen(true);
|
// Execute_PositionOpen(true);
|
||||||
// break;
|
// break;
|
||||||
|
case 6066: //PositionModify
|
||||||
|
Execute_PositionModify();
|
||||||
|
break;
|
||||||
|
case 6067: //PositionClosePartial_bySymbol
|
||||||
|
Execute_PositionClosePartial_bySymbol();
|
||||||
|
break;
|
||||||
|
case 6068: //Execute_PositionClosePartial_byTicket
|
||||||
|
Execute_PositionClosePartial_byTicket();
|
||||||
|
break;
|
||||||
case 66: //BacktestingReady
|
case 66: //BacktestingReady
|
||||||
Execute_BacktestingReady();
|
Execute_BacktestingReady();
|
||||||
break;
|
break;
|
||||||
@@ -794,6 +817,9 @@ int executeCommand()
|
|||||||
case 160: //PositionCloseAll
|
case 160: //PositionCloseAll
|
||||||
Execute_PositionCloseAll();
|
Execute_PositionCloseAll();
|
||||||
break;
|
break;
|
||||||
|
case 161: //TesterStop
|
||||||
|
Execute_TesterStop();
|
||||||
|
break;
|
||||||
case 204: //TerminalInfoInteger
|
case 204: //TerminalInfoInteger
|
||||||
Execute_TerminalInfoInteger();
|
Execute_TerminalInfoInteger();
|
||||||
break;
|
break;
|
||||||
@@ -3150,37 +3176,6 @@ void Execute_SymbolInfoString()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Execute_SymbolInfoTick()
|
|
||||||
{
|
|
||||||
string symbol;
|
|
||||||
StringInit(symbol, 100, 0);
|
|
||||||
|
|
||||||
if (!getStringValue(ExpertHandle, 0, symbol, _error))
|
|
||||||
{
|
|
||||||
PrintParamError("SymbolInfoTick", "symbol", _error);
|
|
||||||
sendErrorResponse(ExpertHandle, -1, _error, _response_error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
MqlTick tick={0};
|
|
||||||
bool ok = SymbolInfoTick(symbol, tick);
|
|
||||||
|
|
||||||
if (ok)
|
|
||||||
{
|
|
||||||
if (!sendMqlTickResponse(ExpertHandle, tick, _response_error))
|
|
||||||
{
|
|
||||||
PrintResponseError("SymbolInfoTick", _response_error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!sendVoidResponse(ExpertHandle, _response_error))
|
|
||||||
{
|
|
||||||
PrintResponseError("SymbolInfoTick", _response_error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Execute_SymbolInfoSessionQuote()
|
void Execute_SymbolInfoSessionQuote()
|
||||||
{
|
{
|
||||||
string symbol;
|
string symbol;
|
||||||
@@ -3289,6 +3284,115 @@ void Execute_MarketBookRelease()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Execute_PositionModify()
|
||||||
|
{
|
||||||
|
ulong ticket;
|
||||||
|
double sl;
|
||||||
|
double tp;
|
||||||
|
|
||||||
|
if (!getULongValue(ExpertHandle, 0, ticket, _error))
|
||||||
|
{
|
||||||
|
PrintParamError("PositionModify", "ticket", _error);
|
||||||
|
sendErrorResponse(ExpertHandle, -1, _error, _response_error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!getDoubleValue(ExpertHandle, 1, sl, _error))
|
||||||
|
{
|
||||||
|
PrintParamError("PositionModify", "sl", _error);
|
||||||
|
sendErrorResponse(ExpertHandle, -1, _error, _response_error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!getDoubleValue(ExpertHandle, 2, tp, _error))
|
||||||
|
{
|
||||||
|
PrintParamError("PositionModify", "tp", _error);
|
||||||
|
sendErrorResponse(ExpertHandle, -1, _error, _response_error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CTrade trade;
|
||||||
|
bool ok = trade.PositionModify(ticket,sl,tp);
|
||||||
|
Print("command PositionModify: result = ", ok);
|
||||||
|
|
||||||
|
if (!sendBooleanResponse(ExpertHandle, ok, _response_error))
|
||||||
|
{
|
||||||
|
PrintResponseError("PositionModify", _response_error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Execute_PositionClosePartial_bySymbol()
|
||||||
|
{
|
||||||
|
string symbol;
|
||||||
|
double volume;
|
||||||
|
ulong deviation;
|
||||||
|
|
||||||
|
if (!getStringValue(ExpertHandle, 0, symbol, _error))
|
||||||
|
{
|
||||||
|
PrintParamError("PositionClosePartial (1)", "symbol", _error);
|
||||||
|
sendErrorResponse(ExpertHandle, -1, _error, _response_error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!getDoubleValue(ExpertHandle, 1, volume, _error))
|
||||||
|
{
|
||||||
|
PrintParamError("PositionClosePartial (1)", "volume", _error);
|
||||||
|
sendErrorResponse(ExpertHandle, -1, _error, _response_error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!getULongValue(ExpertHandle, 2, deviation, _error))
|
||||||
|
{
|
||||||
|
PrintParamError("PositionClosePartial (1)", "deviation", _error);
|
||||||
|
sendErrorResponse(ExpertHandle, -1, _error, _response_error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CTrade trade;
|
||||||
|
bool ok = trade.PositionClosePartial(symbol, volume, deviation);
|
||||||
|
#ifdef __DEBUG_LOG__
|
||||||
|
Print("command PositionClosePartial (1): result = ", ok);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!sendBooleanResponse(ExpertHandle, ok, _response_error))
|
||||||
|
{
|
||||||
|
PrintResponseError("PositionClosePartial (1)", _response_error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Execute_PositionClosePartial_byTicket()
|
||||||
|
{
|
||||||
|
ulong ticket;
|
||||||
|
double volume;
|
||||||
|
ulong deviation;
|
||||||
|
|
||||||
|
if (!getULongValue(ExpertHandle, 0, ticket, _error))
|
||||||
|
{
|
||||||
|
PrintParamError("PositionClosePartial (2)", "ticket", _error);
|
||||||
|
sendErrorResponse(ExpertHandle, -1, _error, _response_error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!getDoubleValue(ExpertHandle, 1, volume, _error))
|
||||||
|
{
|
||||||
|
PrintParamError("PositionClosePartial (2)", "volume", _error);
|
||||||
|
sendErrorResponse(ExpertHandle, -1, _error, _response_error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!getULongValue(ExpertHandle, 2, deviation, _error))
|
||||||
|
{
|
||||||
|
PrintParamError("PositionClosePartial (2)", "deviation", _error);
|
||||||
|
sendErrorResponse(ExpertHandle, -1, _error, _response_error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CTrade trade;
|
||||||
|
bool ok = trade.PositionClosePartial(ticket, volume, deviation);
|
||||||
|
#ifdef __DEBUG_LOG__
|
||||||
|
Print("command PositionClosePartial (2): result = ", ok);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!sendBooleanResponse(ExpertHandle, ok, _response_error))
|
||||||
|
{
|
||||||
|
PrintResponseError("PositionClosePartial (2)", _response_error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Execute_PositionOpen(bool isTradeResultRequired)
|
void Execute_PositionOpen(bool isTradeResultRequired)
|
||||||
{
|
{
|
||||||
string symbol;
|
string symbol;
|
||||||
@@ -3433,52 +3537,87 @@ void Execute_PositionSelectByTicket()
|
|||||||
|
|
||||||
void Execute_ObjectCreate()
|
void Execute_ObjectCreate()
|
||||||
{
|
{
|
||||||
|
int nParameter = 0;
|
||||||
long chartId;
|
long chartId;
|
||||||
string name;
|
string name;
|
||||||
int type;
|
int type;
|
||||||
int nwin;
|
int nwin;
|
||||||
int time;
|
int time1;
|
||||||
double price;
|
double price1;
|
||||||
|
int arrTime[29];
|
||||||
|
double arrPrice[29];
|
||||||
StringInit(name, 200, 0);
|
StringInit(name, 200, 0);
|
||||||
|
|
||||||
if (!getLongValue(ExpertHandle, 0, chartId, _error))
|
if (!getIntValue(ExpertHandle, 0, nParameter, _error))
|
||||||
|
{
|
||||||
|
PrintParamError("ObjectCreate", "nParameter", _error);
|
||||||
|
sendErrorResponse(ExpertHandle, -1, _error, _response_error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!getLongValue(ExpertHandle, 1, chartId, _error))
|
||||||
{
|
{
|
||||||
PrintParamError("ObjectCreate", "chartId", _error);
|
PrintParamError("ObjectCreate", "chartId", _error);
|
||||||
sendErrorResponse(ExpertHandle, -1, _error, _response_error);
|
sendErrorResponse(ExpertHandle, -1, _error, _response_error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!getStringValue(ExpertHandle, 1, name, _error))
|
if (!getStringValue(ExpertHandle, 2, name, _error))
|
||||||
{
|
{
|
||||||
PrintParamError("ObjectCreate", "name", _error);
|
PrintParamError("ObjectCreate", "name", _error);
|
||||||
sendErrorResponse(ExpertHandle, -1, _error, _response_error);
|
sendErrorResponse(ExpertHandle, -1, _error, _response_error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!getIntValue(ExpertHandle, 2, type, _error))
|
if (!getIntValue(ExpertHandle, 3, type, _error))
|
||||||
{
|
{
|
||||||
PrintParamError("ObjectCreate", "type", _error);
|
PrintParamError("ObjectCreate", "type", _error);
|
||||||
sendErrorResponse(ExpertHandle, -1, _error, _response_error);
|
sendErrorResponse(ExpertHandle, -1, _error, _response_error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!getIntValue(ExpertHandle, 3, nwin, _error))
|
if (!getIntValue(ExpertHandle, 4, nwin, _error))
|
||||||
{
|
{
|
||||||
PrintParamError("ObjectCreate", "nwin", _error);
|
PrintParamError("ObjectCreate", "nwin", _error);
|
||||||
sendErrorResponse(ExpertHandle, -1, _error, _response_error);
|
sendErrorResponse(ExpertHandle, -1, _error, _response_error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!getIntValue(ExpertHandle, 4, time, _error))
|
if (!getIntValue(ExpertHandle, 5, time1, _error))
|
||||||
{
|
{
|
||||||
PrintParamError("ObjectCreate", "time", _error);
|
PrintParamError("ObjectCreate", "time1", _error);
|
||||||
sendErrorResponse(ExpertHandle, -1, _error, _response_error);
|
sendErrorResponse(ExpertHandle, -1, _error, _response_error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!getDoubleValue(ExpertHandle, 5, price, _error))
|
if (!getDoubleValue(ExpertHandle, 6, price1, _error))
|
||||||
{
|
{
|
||||||
PrintParamError("ObjectCreate", "price", _error);
|
PrintParamError("ObjectCreate", "price1", _error);
|
||||||
sendErrorResponse(ExpertHandle, -1, _error, _response_error);
|
sendErrorResponse(ExpertHandle, -1, _error, _response_error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sendBooleanResponse(ExpertHandle, ObjectCreate(chartId, name, (ENUM_OBJECT)type, nwin, (datetime)time, price), _response_error))
|
ArrayInitialize(arrTime, 0);
|
||||||
|
ArrayInitialize(arrPrice, 0);
|
||||||
|
for(int i = 0; i * 2 + 6 < nParameter; i++)
|
||||||
|
{
|
||||||
|
if (!getIntValue(ExpertHandle, i * 2 + 7, arrTime[i], _error))
|
||||||
|
{
|
||||||
|
PrintParamError("ObjectCreate", "time" + IntegerToString(i * 2 + 7), _error);
|
||||||
|
sendErrorResponse(ExpertHandle, -1, _error, _response_error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (!getDoubleValue(ExpertHandle, i * 2 + 8, arrPrice[i], _error))
|
||||||
|
{
|
||||||
|
PrintParamError("ObjectCreate", "price" + IntegerToString(i * 2 + 8), _error);
|
||||||
|
sendErrorResponse(ExpertHandle, -1, _error, _response_error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!sendBooleanResponse(ExpertHandle
|
||||||
|
,ObjectCreate(chartId, name, (ENUM_OBJECT)type, nwin, (datetime)time1, price1
|
||||||
|
,(datetime)arrTime[0], arrPrice[0],(datetime)arrTime[1], arrPrice[1],(datetime)arrTime[2], arrPrice[2],(datetime)arrTime[3], arrPrice[3],(datetime)arrTime[4], arrPrice[4],(datetime)arrTime[5], arrPrice[5]
|
||||||
|
,(datetime)arrTime[6], arrPrice[6],(datetime)arrTime[7], arrPrice[7],(datetime)arrTime[8], arrPrice[8],(datetime)arrTime[9], arrPrice[9],(datetime)arrTime[10], arrPrice[10],(datetime)arrTime[11], arrPrice[11]
|
||||||
|
,(datetime)arrTime[12], arrPrice[12],(datetime)arrTime[13], arrPrice[13],(datetime)arrTime[14], arrPrice[14],(datetime)arrTime[15], arrPrice[15],(datetime)arrTime[16], arrPrice[16],(datetime)arrTime[17], arrPrice[17]
|
||||||
|
,(datetime)arrTime[18], arrPrice[18],(datetime)arrTime[19], arrPrice[19],(datetime)arrTime[20], arrPrice[20],(datetime)arrTime[21], arrPrice[21],(datetime)arrTime[22], arrPrice[22],(datetime)arrTime[23], arrPrice[23]
|
||||||
|
,(datetime)arrTime[24], arrPrice[24],(datetime)arrTime[25], arrPrice[25],(datetime)arrTime[26], arrPrice[26],(datetime)arrTime[27], arrPrice[27],(datetime)arrTime[28], arrPrice[28])
|
||||||
|
, _response_error))
|
||||||
{
|
{
|
||||||
PrintResponseError("ObjectCreate", _response_error);
|
PrintResponseError("ObjectCreate", _response_error);
|
||||||
}
|
}
|
||||||
@@ -4415,7 +4554,7 @@ void Execute_iBullsPower()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!sendIntResponse(ExpertHandle,
|
if (!sendIntResponse(ExpertHandle,
|
||||||
iBearsPower(symbol, (ENUM_TIMEFRAMES)period, ma_period),
|
iBullsPower(symbol, (ENUM_TIMEFRAMES)period, ma_period),
|
||||||
_error))
|
_error))
|
||||||
{
|
{
|
||||||
PrintResponseError("iBullsPower", _response_error);
|
PrintResponseError("iBullsPower", _response_error);
|
||||||
@@ -6541,6 +6680,24 @@ void Execute_PositionCloseAll()
|
|||||||
SEND_INT_RESPONSE(res)
|
SEND_INT_RESPONSE(res)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Execute_TesterStop()
|
||||||
|
{
|
||||||
|
if (!IsTesting())
|
||||||
|
{
|
||||||
|
Print("WARNING: function UnlockTicks can be used only for backtesting");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Print("TesterStop called.");
|
||||||
|
TesterStop();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!sendVoidResponse(ExpertHandle, _response_error))
|
||||||
|
{
|
||||||
|
PrintResponseError("TesterStop", _response_error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Execute_TerminalInfoInteger()
|
void Execute_TerminalInfoInteger()
|
||||||
{
|
{
|
||||||
int propertyId;
|
int propertyId;
|
||||||
@@ -6795,6 +6952,9 @@ string OnRequest(string json)
|
|||||||
case 11: //PositionClose
|
case 11: //PositionClose
|
||||||
response = ExecuteRequest_PositionClose(jo);
|
response = ExecuteRequest_PositionClose(jo);
|
||||||
break;
|
break;
|
||||||
|
case 12: //SymbolInfoTick
|
||||||
|
response = ExecuteRequest_SymbolInfoTick(jo);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
PrintFormat("%s [WARNING]: Unknown request type %d", __FUNCTION__, requestType);
|
PrintFormat("%s [WARNING]: Unknown request type %d", __FUNCTION__, requestType);
|
||||||
response = CreateErrorResponse(-1, "Unknown request type");
|
response = CreateErrorResponse(-1, "Unknown request type");
|
||||||
@@ -7083,6 +7243,7 @@ JSONObject* MqlBookInfoToJson(MqlBookInfo& info)
|
|||||||
jo.put("type", new JSONNumber((int)info.type));
|
jo.put("type", new JSONNumber((int)info.type));
|
||||||
jo.put("price", new JSONNumber(info.price));
|
jo.put("price", new JSONNumber(info.price));
|
||||||
jo.put("volume", new JSONNumber(info.volume));
|
jo.put("volume", new JSONNumber(info.volume));
|
||||||
|
jo.put("volume_real", new JSONNumber(info.volume_real));
|
||||||
return jo;
|
return jo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7306,6 +7467,25 @@ string ExecuteRequest_PositionClose(JSONObject *jo)
|
|||||||
return CreateSuccessResponse("Value", result_value_jo);
|
return CreateSuccessResponse("Value", result_value_jo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string ExecuteRequest_SymbolInfoTick(JSONObject *jo)
|
||||||
|
{
|
||||||
|
CHECK_JSON_VALUE(jo, "SymbolName", CreateErrorResponse(-1, "Undefinded mandatory parameter SymbolName"));
|
||||||
|
string symbol_name = jo.getString("SymbolName");
|
||||||
|
|
||||||
|
#ifdef __DEBUG_LOG__
|
||||||
|
PrintFormat("%s: symbol_name = %s", __FUNCTION__, symbol_name);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
MqlTick tick={0};
|
||||||
|
bool ok = SymbolInfoTick(symbol_name, tick);
|
||||||
|
|
||||||
|
#ifdef __DEBUG_LOG__
|
||||||
|
PrintFormat("%s: ok = %s", __FUNCTION__, BoolToString(ok));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return CreateSuccessResponse("Value", MqlTickToJson(tick));
|
||||||
|
}
|
||||||
|
|
||||||
//------------ Events -------------------------------------------------------
|
//------------ Events -------------------------------------------------------
|
||||||
|
|
||||||
enum MtEventTypes
|
enum MtEventTypes
|
||||||
@@ -7438,6 +7618,7 @@ void SendMtEvent(MtEventTypes eventType, MtEvent* mtEvent)
|
|||||||
if (sendEvent(ExpertHandle, (int)eventType, json.toString(), _error))
|
if (sendEvent(ExpertHandle, (int)eventType, json.toString(), _error))
|
||||||
{
|
{
|
||||||
#ifdef __DEBUG_LOG__
|
#ifdef __DEBUG_LOG__
|
||||||
|
PrintFormat("%s: event = %s", __FUNCTION__, EnumToString(eventType));
|
||||||
PrintFormat("%s: payload = %s", __FUNCTION__, json.toString());
|
PrintFormat("%s: payload = %s", __FUNCTION__, json.toString());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -7537,6 +7718,7 @@ JSONObject* MqlTickToJson(MqlTick& tick)
|
|||||||
jo.put("ask", new JSONNumber(tick.ask));
|
jo.put("ask", new JSONNumber(tick.ask));
|
||||||
jo.put("last", new JSONNumber(tick.last));
|
jo.put("last", new JSONNumber(tick.last));
|
||||||
jo.put("volume", new JSONNumber(tick.volume));
|
jo.put("volume", new JSONNumber(tick.volume));
|
||||||
|
jo.put("volume_real", new JSONNumber(tick.volume_real));
|
||||||
return jo;
|
return jo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user