mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-07-27 18:47:55 +00:00
Added projects MtApi4 and MtApi5
This commit is contained in:
Executable
+30
@@ -0,0 +1,30 @@
|
||||
<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>
|
||||
Executable
+28
@@ -0,0 +1,28 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+43
@@ -0,0 +1,43 @@
|
||||
<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>
|
||||
Executable
+97
@@ -0,0 +1,97 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+8
@@ -0,0 +1,8 @@
|
||||
<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>
|
||||
Executable
+16
@@ -0,0 +1,16 @@
|
||||
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
|
||||
{
|
||||
}
|
||||
}
|
||||
Executable
+168
@@ -0,0 +1,168 @@
|
||||
<?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>
|
||||
Executable
+51
@@ -0,0 +1,51 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
<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>
|
||||
Executable
+37
@@ -0,0 +1,37 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
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
@@ -0,0 +1,63 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+117
@@ -0,0 +1,117 @@
|
||||
<?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
@@ -0,0 +1,26 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
Executable
+114
@@ -0,0 +1,114 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
||||
Executable
BIN
Binary file not shown.
|
After Width: | Height: | Size: 894 B |
Executable
+61
@@ -0,0 +1,61 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+77
@@ -0,0 +1,77 @@
|
||||
<?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>
|
||||
+326
@@ -0,0 +1,326 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Executable
+352
@@ -0,0 +1,352 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+120
@@ -0,0 +1,120 @@
|
||||
<?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>
|
||||
Executable
+21
@@ -0,0 +1,21 @@
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+36
@@ -0,0 +1,36 @@
|
||||
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")]
|
||||
Executable
+40
@@ -0,0 +1,40 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
using namespace System;
|
||||
using namespace System::Reflection;
|
||||
using namespace System::Runtime::CompilerServices;
|
||||
using namespace System::Runtime::InteropServices;
|
||||
using namespace System::Security::Permissions;
|
||||
|
||||
//
|
||||
// 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:AssemblyTitleAttribute("MT5Connector")];
|
||||
[assembly:AssemblyDescriptionAttribute("")];
|
||||
[assembly:AssemblyConfigurationAttribute("")];
|
||||
[assembly:AssemblyCompanyAttribute("")];
|
||||
[assembly:AssemblyProductAttribute("MT5Connector")];
|
||||
[assembly:AssemblyCopyrightAttribute("Copyright (c) 2013")];
|
||||
[assembly:AssemblyTrademarkAttribute("")];
|
||||
[assembly:AssemblyCultureAttribute("")];
|
||||
|
||||
//
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the value or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly:AssemblyVersionAttribute("1.0.*")];
|
||||
|
||||
[assembly:ComVisible(false)];
|
||||
|
||||
[assembly:CLSCompliantAttribute(true)];
|
||||
|
||||
[assembly:SecurityPermission(SecurityAction::RequestMinimum, UnmanagedCode = true)];
|
||||
Executable
+510
@@ -0,0 +1,510 @@
|
||||
// This is the main DLL file.
|
||||
|
||||
#include "Stdafx.h"
|
||||
|
||||
#include "MT5Connector.h"
|
||||
#include "MT5Handler.h"
|
||||
|
||||
#include "Windows.h"
|
||||
#include < vcclr.h >
|
||||
|
||||
using namespace System;
|
||||
using namespace MTApiService;
|
||||
using namespace System::Runtime::InteropServices;
|
||||
using namespace System::Reflection;
|
||||
using namespace System::Text;
|
||||
using namespace System::Collections::Generic;
|
||||
using namespace System::Diagnostics;
|
||||
using namespace System::Security::Cryptography;
|
||||
using namespace System::Security;
|
||||
|
||||
#pragma pack(push, 1)
|
||||
public struct CMqlRates
|
||||
{
|
||||
__int64 time; // Period start time
|
||||
double open; // Open price
|
||||
double high; // The highest price of the period
|
||||
double low; // The lowest price of the period
|
||||
double close; // Close price
|
||||
__int64 tick_volume; // Tick volume
|
||||
int spread; // Spread
|
||||
__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)
|
||||
|
||||
void convertSystemString(wchar_t* dest, String^ src)
|
||||
{
|
||||
pin_ptr<const wchar_t> wch = PtrToStringChars(src);
|
||||
memcpy(dest, wch, wcslen(wch) * sizeof(wchar_t));
|
||||
dest[wcslen(wch)] = '\0';
|
||||
}
|
||||
|
||||
bool VerifySignature(System::String^ inputData, System::String^ signature, System::String^ publicKey)
|
||||
{
|
||||
bool verifyResult = false;
|
||||
|
||||
try
|
||||
{
|
||||
DSACryptoServiceProvider^ dsa = gcnew DSACryptoServiceProvider();
|
||||
dsa->FromXmlString(publicKey);
|
||||
array<System::Byte>^ data = UTF8Encoding::ASCII->GetBytes(inputData);
|
||||
array<System::Byte>^ signatureData = Convert::FromBase64String(signature);
|
||||
verifyResult = dsa->VerifyData(data, signatureData);
|
||||
}
|
||||
catch(Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MT5Connector:VerifySignature(): failed. " + e->Message);
|
||||
verifyResult = false;
|
||||
}
|
||||
|
||||
return verifyResult;
|
||||
}
|
||||
|
||||
bool g_IsVerified = false;
|
||||
|
||||
void _stdcall verify(int isDemo, wchar_t* accountName, long accountNumber)
|
||||
{
|
||||
if (isDemo != 0)
|
||||
{
|
||||
g_IsVerified = true;
|
||||
return;
|
||||
}
|
||||
|
||||
System::String^ signature = MtRegistryManager::ReadSignatureKey(gcnew String(accountName), accountNumber.ToString());
|
||||
Resources::ResourceManager^ rm = gcnew Resources::ResourceManager(L"MT5Connector.cl", Assembly::GetExecutingAssembly());
|
||||
System::String^ inputData = gcnew System::String(accountName);
|
||||
inputData += accountNumber.ToString();
|
||||
System::String^ publicKey = rm->GetString(L"cl");
|
||||
g_IsVerified = VerifySignature(inputData, gcnew System::String(signature), publicKey);
|
||||
}
|
||||
|
||||
int _stdcall initExpert(int expertHandle, wchar_t* connectionProfile, wchar_t* symbol, double bid, double ask, wchar_t* err)
|
||||
{
|
||||
if (g_IsVerified == false)
|
||||
{
|
||||
System::String^ errorVerified = "Verification is failed!\nPlease contact with support.";
|
||||
convertSystemString(err, errorVerified);
|
||||
Debug::WriteLine("[ERROR] MT5Connector:initExpert(): not verified");
|
||||
return 0;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
MT5Handler^ mtHander = gcnew MT5Handler();
|
||||
MtServerInstance::GetInstance()->InitExpert(expertHandle, gcnew String(connectionProfile), gcnew String(symbol), bid, ask, mtHander);
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
convertSystemString(err, e->Message);
|
||||
Debug::WriteLine("[ERROR] MT5Connector:initExpert(): " + e->Message);
|
||||
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _stdcall deinitExpert(int expertHandle, wchar_t* err)
|
||||
{
|
||||
try
|
||||
{
|
||||
MtServerInstance::GetInstance()->DeinitExpert(expertHandle);
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
convertSystemString(err, e->Message);
|
||||
Debug::WriteLine("[ERROR] MT5Connector:deinitExpert(): " + e->Message);
|
||||
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _stdcall updateQuote(int expertHandle, wchar_t* symbol, double bid, double ask, wchar_t* err)
|
||||
{
|
||||
try
|
||||
{
|
||||
MtServerInstance::GetInstance()->SendQuote(expertHandle, gcnew String(symbol), bid, ask);
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
convertSystemString(err, e->Message);
|
||||
Debug::WriteLine("[ERROR] MT5Connector:updateQuote(): " + e->Message);
|
||||
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _stdcall sendIntResponse(int expertHandle, int response)
|
||||
{
|
||||
try
|
||||
{
|
||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseInt(response));
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MT5Connector:sendIntResponse(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _stdcall sendLongResponse(int expertHandle, __int64 response)
|
||||
{
|
||||
try
|
||||
{
|
||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseLong(response));
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MT5Connector:sendLongResponse(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _stdcall sendULongResponse(int expertHandle, unsigned __int64 response)
|
||||
{
|
||||
try
|
||||
{
|
||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseULong(response));
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MT5Connector:sendLongResponse(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _stdcall sendBooleanResponse(int expertHandle, int response)
|
||||
{
|
||||
try
|
||||
{
|
||||
bool value = (response != 0) ? true : false;
|
||||
|
||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseBool(value));
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MT5Connector:sendBooleanResponse(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _stdcall sendDoubleResponse(int expertHandle, double response)
|
||||
{
|
||||
try
|
||||
{
|
||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseDouble(response));
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MT5Connector:sendDoubleResponse(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _stdcall sendStringResponse(int expertHandle, wchar_t* response)
|
||||
{
|
||||
try
|
||||
{
|
||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseString(gcnew String(response)));
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MT5Connector:sendStringResponse(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _stdcall sendVoidResponse(int expertHandle)
|
||||
{
|
||||
try
|
||||
{
|
||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, nullptr);
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MT5Connector:sendVoidResponse(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _stdcall sendDoubleArrayResponse(int expertHandle, double* values, int size)
|
||||
{
|
||||
try
|
||||
{
|
||||
array<double>^ list = gcnew array<double>(size);
|
||||
|
||||
for(int i = 0; i < size; i++)
|
||||
{
|
||||
list[i] = values[i];
|
||||
}
|
||||
|
||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseDoubleArray(list));
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MT5Connector:sendDoubleArrayResponse(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _stdcall sendIntArrayResponse(int expertHandle, int* values, int size)
|
||||
{
|
||||
try
|
||||
{
|
||||
array<int>^ list = gcnew array<int>(size);
|
||||
|
||||
for(int i = 0; i < size; i++)
|
||||
{
|
||||
list[i] = values[i];
|
||||
}
|
||||
|
||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseIntArray(list));
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MT5Connector:sendIntArrayResponse(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _stdcall sendLongArrayResponse(int expertHandle, __int64* values, int size)
|
||||
{
|
||||
try
|
||||
{
|
||||
array<System::Int64>^ list = gcnew array<System::Int64>(size);
|
||||
|
||||
for(int i = 0; i < size; i++)
|
||||
{
|
||||
list[i] = values[i];
|
||||
}
|
||||
|
||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseLongArray(list));
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MT5Connector:sendLongArrayResponse(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _stdcall sendMqlRatesArrayResponse(int expertHandle, CMqlRates values[], int size)
|
||||
{
|
||||
try
|
||||
{
|
||||
array<MtMqlRates^>^ list = gcnew array<MtMqlRates^>(size);
|
||||
|
||||
for(int i = 0; i < size; i++)
|
||||
{
|
||||
MtMqlRates^ rates = gcnew MtMqlRates();
|
||||
rates->time = values[i].time;
|
||||
rates->open = values[i].open;
|
||||
rates->high = values[i].high;
|
||||
rates->low = values[i].low;
|
||||
rates->close = values[i].close;
|
||||
rates->tick_volume = values[i].tick_volume;
|
||||
rates->spread = values[i].spread;
|
||||
rates->real_volume = values[i].real_volume;
|
||||
|
||||
list[i] = rates;
|
||||
}
|
||||
|
||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseMqlRatesArray(list));
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MT5Connector:sendMqlRatesArrayResponse(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _stdcall sendMqlTickResponse(int expertHandle, CMqlTick* response, int size)
|
||||
{
|
||||
try
|
||||
{
|
||||
MtMqlTick^ mtResponse = gcnew MtMqlTick();
|
||||
|
||||
mtResponse->time = response->time;
|
||||
mtResponse->bid = response->bid;
|
||||
mtResponse->ask = response->ask;
|
||||
mtResponse->last = response->last;
|
||||
mtResponse->volume = response->volume;
|
||||
|
||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseMqlTick(mtResponse));
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MT5Connector:sendMqlTickResponse(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _stdcall sendMqlBookInfoArrayResponse(int expertHandle, CMqlBookInfo values[], int size)
|
||||
{
|
||||
try
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseMqlBookInfoArray(list));
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MT5Connector:sendMqlRatesArrayResponse(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
//----------- get values -------------------------------
|
||||
|
||||
int _stdcall getCommandType(int expertHandle, int* res)
|
||||
{
|
||||
try
|
||||
{
|
||||
*res = MtServerInstance::GetInstance()->GetCommandType(expertHandle);
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MT5Connector:getCommandType(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _stdcall getIntValue(int expertHandle, int paramIndex, int* res)
|
||||
{
|
||||
try
|
||||
{
|
||||
*res = (int)MtServerInstance::GetInstance()->GetCommandParameter(expertHandle, paramIndex);
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MT5Connector:getIntValue(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _stdcall getDoubleValue(int expertHandle, int paramIndex, double* res)
|
||||
{
|
||||
try
|
||||
{
|
||||
*res = (double)MtServerInstance::GetInstance()->GetCommandParameter(expertHandle, paramIndex);
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MT5Connector:getDoubleValue(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _stdcall getStringValue(int expertHandle, int paramIndex, wchar_t* res)
|
||||
{
|
||||
try
|
||||
{
|
||||
convertSystemString(res, (String^)MtServerInstance::GetInstance()->GetCommandParameter(expertHandle, paramIndex));
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MT5Connector:getStringValue(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _stdcall getULongValue(int expertHandle, int paramIndex, unsigned __int64* res)
|
||||
{
|
||||
try
|
||||
{
|
||||
*res = (unsigned long)MtServerInstance::GetInstance()->GetCommandParameter(expertHandle, paramIndex);
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MT5Connector:getULongValue(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _stdcall getLongValue(int expertHandle, int paramIndex, __int64* res)
|
||||
{
|
||||
try
|
||||
{
|
||||
*res = (long)MtServerInstance::GetInstance()->GetCommandParameter(expertHandle, paramIndex);
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MT5Connector:getLongValue(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _stdcall getBooleanValue(int expertHandle, int paramIndex, int* res)
|
||||
{
|
||||
try
|
||||
{
|
||||
bool val = (bool)MtServerInstance::GetInstance()->GetCommandParameter(expertHandle, paramIndex);
|
||||
*res = val == true ? 1 : 0;
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MT5Connector:getBooleanValue(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _stdcall getUIntValue(int expertHandle, int paramIndex, unsigned int* res)
|
||||
{
|
||||
try
|
||||
{
|
||||
*res = (unsigned int)MtServerInstance::GetInstance()->GetCommandParameter(expertHandle, paramIndex);
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MT5Connector:getUIntValue(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
Executable
+27
@@ -0,0 +1,27 @@
|
||||
LIBRARY MT5Connector
|
||||
|
||||
EXPORTS initExpert
|
||||
deinitExpert
|
||||
updateQuote
|
||||
sendIntResponse
|
||||
sendBooleanResponse
|
||||
sendDoubleResponse
|
||||
sendStringResponse
|
||||
sendVoidResponse
|
||||
sendDoubleArrayResponse
|
||||
sendIntArrayResponse
|
||||
sendLongArrayResponse
|
||||
sendMqlRatesArrayResponse
|
||||
sendLongResponse
|
||||
sendULongResponse
|
||||
sendMqlTickResponse
|
||||
sendMqlBookInfoArrayResponse
|
||||
getCommandType
|
||||
getIntValue
|
||||
getUIntValue
|
||||
getDoubleValue
|
||||
getStringValue
|
||||
getLongValue
|
||||
getULongValue
|
||||
getBooleanValue
|
||||
verify
|
||||
Executable
+4
@@ -0,0 +1,4 @@
|
||||
// MT5Connector.h
|
||||
|
||||
#pragma once
|
||||
|
||||
Executable
+168
@@ -0,0 +1,168 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}</ProjectGuid>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<Keyword>ManagedCProj</Keyword>
|
||||
<RootNamespace>MT5Connector</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CLRSupport>true</CLRSupport>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CLRSupport>true</CLRSupport>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<CLRSupport>true</CLRSupport>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<CLRSupport>true</CLRSupport>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>
|
||||
</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>user32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>user32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>.\MT5Connector.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>user32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>.\MT5Connector.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="MT5Connector.h" />
|
||||
<ClInclude Include="MT5Handler.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="Stdafx.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="AssemblyInfo.cpp" />
|
||||
<ClCompile Include="MT5Connector.cpp" />
|
||||
<ClCompile Include="Stdafx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.ico" />
|
||||
<None Include="MT5Connector.def" />
|
||||
<None Include="ReadMe.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="app.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="cl.resx" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MTApiService\MTApiService.csproj">
|
||||
<Project>{de76d5c7-b99c-4467-8408-78173bdd84e0}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
Executable
+61
@@ -0,0 +1,61 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="MT5Connector.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Stdafx.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="resource.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="MT5Handler.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="MT5Connector.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="AssemblyInfo.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Stdafx.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="ReadMe.txt" />
|
||||
<None Include="app.ico">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
<None Include="MT5Connector.def">
|
||||
<Filter>Source Files</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="app.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="cl.resx">
|
||||
<Filter>Resource Files</Filter>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Executable
+24
@@ -0,0 +1,24 @@
|
||||
//MT5Handler.h
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Windows.h>
|
||||
|
||||
using namespace MTApiService;
|
||||
|
||||
ref class MT5Handler: IMetaTraderHandler
|
||||
{
|
||||
public:
|
||||
MT5Handler()
|
||||
{
|
||||
msgId = WM_USER + 4096;
|
||||
}
|
||||
|
||||
virtual void SendTickToMetaTrader(int handle)
|
||||
{
|
||||
PostMessage((HWND)handle, msgId, 0x00000011, 0);
|
||||
}
|
||||
|
||||
private:
|
||||
unsigned int msgId;
|
||||
};
|
||||
Executable
+38
@@ -0,0 +1,38 @@
|
||||
========================================================================
|
||||
DYNAMIC LINK LIBRARY : MT5Connector Project Overview
|
||||
========================================================================
|
||||
|
||||
AppWizard has created this MT5Connector DLL for you.
|
||||
|
||||
This file contains a summary of what you will find in each of the files that
|
||||
make up your MT5Connector application.
|
||||
|
||||
MT5Connector.vcxproj
|
||||
This is the main project file for VC++ projects generated using an Application Wizard.
|
||||
It contains information about the version of Visual C++ that generated the file, and
|
||||
information about the platforms, configurations, and project features selected with the
|
||||
Application Wizard.
|
||||
|
||||
MT5Connector.vcxproj.filters
|
||||
This is the filters file for VC++ projects generated using an Application Wizard.
|
||||
It contains information about the association between the files in your project
|
||||
and the filters. This association is used in the IDE to show grouping of files with
|
||||
similar extensions under a specific node (for e.g. ".cpp" files are associated with the
|
||||
"Source Files" filter).
|
||||
|
||||
MT5Connector.cpp
|
||||
This is the main DLL source file.
|
||||
|
||||
MT5Connector.h
|
||||
This file contains a class declaration.
|
||||
|
||||
AssemblyInfo.cpp
|
||||
Contains custom attributes for modifying assembly metadata.
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
Other notes:
|
||||
|
||||
AppWizard uses "TODO:" to indicate parts of the source code you
|
||||
should add to or customize.
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
// stdafx.cpp : source file that includes just the standard includes
|
||||
// MT5Connector.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
#include "stdafx.h"
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
// stdafx.h : include file for standard system include files,
|
||||
// or project specific include files that are used frequently,
|
||||
// but are changed infrequently
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
Executable
BIN
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
Executable
BIN
Binary file not shown.
Executable
+123
@@ -0,0 +1,123 @@
|
||||
<?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>
|
||||
<data name="cl" xml:space="preserve">
|
||||
<value><DSAKeyValue><P>ov/KsayuBNq5c+tYD0IHzPLCdCh17oWRbbGIGCdZkbq0FAyXSSgOlNDxMbzqPi4nWr9nPI/nKXhcWPVeoXqLBpY6X9hOtmSls/yb8JSbYXO7+01sDKeSAYxSar/bbbqa4EaKNzdN9MFh7zYZzvsYyyIRFungoIurt+8pCzDcmLc=</P><Q>sIURrVKhlxp3+vuvEp9LzNIaqPU=</Q><G>c2Ob03BsU+1NPaWDMaJKQCQ0IHQWpkNP0jANeJRJ3yy8o6h5LA8WPwhj4i0jdhweqg7igCP4SxeZD6/F3pZqDwDW8xCE3HLlK0T/NQuIyw5wX4jwaDE0Gy/N/Udmrjg8T0df7y5Tun3aLOPwxOSZ0tJNzMBwYLS9AA9vdVuGMUg=</G><Y>L6iJfWqzBXe6Y2h4qxZXu3nZFjfNSyaNdmB5kGhrnKYSgvVoqqYCV4iW8zZX0Z69iQyhpWTRyCEJn2b9sARpCU9ScnbcXf12wYrphdAdNiE2YU4M4WAXIbx0TRUYQNxHQU0E9HJOVj6IDHfUn6bah6g3mQlr5VOOZ19722RVBRc=</Y><J>7GQ9hGEhROw7scQBfVBY5EOilGja3Ft3p4IQ8kjq6NqHKev3pxWdyXbGeh23y4jqTawkCBNlmlbcbEZUal1Dsub4L6nQJofTE19eTzD9oOI8uDm2iwbvxqUo72HwRj2tkY0Wr72GrmMI+hwe</J><Seed>cH1I4nPuhbW8MgK5pf4ao5XWNsw=</Seed><PgenCounter>ApM=</PgenCounter></DSAKeyValue></value>
|
||||
</data>
|
||||
</root>
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by app.rc
|
||||
Executable
+15
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace MTApiService
|
||||
{
|
||||
public interface ICommandManager
|
||||
{
|
||||
void EnqueueCommand(MtCommand command);
|
||||
MtCommand DequeueCommand();
|
||||
|
||||
void OnCommandExecuted(MtExpert expert, MtCommand command, MtResponse response);
|
||||
}
|
||||
}
|
||||
Executable
+73
@@ -0,0 +1,73 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.ServiceModel;
|
||||
|
||||
namespace MTApiService
|
||||
{
|
||||
sealed class DisposableChannel<T> : IDisposable
|
||||
{
|
||||
T proxy;
|
||||
bool disposed;
|
||||
|
||||
public DisposableChannel(T proxy)
|
||||
{
|
||||
if (!(proxy is ICommunicationObject)) throw new ArgumentException("object of type ICommunicationObject expected", "proxy");
|
||||
|
||||
this.proxy = proxy;
|
||||
}
|
||||
|
||||
public T Service
|
||||
{
|
||||
get
|
||||
{
|
||||
if (disposed) throw new ObjectDisposedException("DisposableProxy");
|
||||
|
||||
return proxy;
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (!disposed)
|
||||
{
|
||||
Dispose(true);
|
||||
}
|
||||
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
if (proxy != null)
|
||||
{
|
||||
ICommunicationObject ico = null;
|
||||
|
||||
if (proxy is ICommunicationObject)
|
||||
ico = (ICommunicationObject)proxy;
|
||||
|
||||
// This state may change after the test and there's no known way to synchronize
|
||||
// so that's why we just give it our best shot
|
||||
if (ico.State == CommunicationState.Faulted)
|
||||
ico.Abort(); // Known to be faulted
|
||||
else
|
||||
try
|
||||
{
|
||||
ico.Close(); // Attempt to close, this is the nice way and we ought to be nice
|
||||
}
|
||||
catch
|
||||
{
|
||||
ico.Abort(); // Sometimes being nice isn't an option
|
||||
}
|
||||
|
||||
proxy = default(T);
|
||||
}
|
||||
}
|
||||
|
||||
disposed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace MTApiService
|
||||
{
|
||||
public interface IMetaTraderHandler
|
||||
{
|
||||
void SendTickToMetaTrader(int handle);
|
||||
}
|
||||
}
|
||||
Executable
+13
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace MTApiService
|
||||
{
|
||||
public interface IMtApiServer
|
||||
{
|
||||
MtResponse SendCommand(MtCommand command);
|
||||
IEnumerable<MtQuote> GetQuotes();
|
||||
}
|
||||
}
|
||||
Executable
+93
@@ -0,0 +1,93 @@
|
||||
<?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>{DE76D5C7-B99C-4467-8408-78173BDD84E0}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>MTApiService</RootNamespace>
|
||||
<AssemblyName>MTApiService</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile>
|
||||
</TargetFrameworkProfile>
|
||||
</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>
|
||||
</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<AssemblyOriginatorKeyFile>MetaTraderApiKey.pfx</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ICommandManager.cs" />
|
||||
<Compile Include="IMetaTraderHandler.cs" />
|
||||
<Compile Include="MtCommandEventArgs.cs" />
|
||||
<Compile Include="IDisposableChannel.cs" />
|
||||
<Compile Include="IMtApiServer.cs" />
|
||||
<Compile Include="MtApiProxy.cs" />
|
||||
<Compile Include="MtClient.cs" />
|
||||
<Compile Include="MtMqlBookInfo.cs" />
|
||||
<Compile Include="MtMqlRates.cs" />
|
||||
<Compile Include="MtMqlTick.cs" />
|
||||
<Compile Include="MtMqlTradeRequest.cs" />
|
||||
<Compile Include="MtRegistryManager.cs" />
|
||||
<Compile Include="MtConnectionProfile.cs" />
|
||||
<Compile Include="MtExecutorManager.cs" />
|
||||
<Compile Include="MtExpert.cs" />
|
||||
<Compile Include="MtInstrument.cs" />
|
||||
<Compile Include="MtResponse.cs" />
|
||||
<Compile Include="MtServer.cs" />
|
||||
<Compile Include="MtCommand.cs" />
|
||||
<Compile Include="MtServerInstance.cs" />
|
||||
<Compile Include="MtService.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="MetaTraderApiKey.pfx" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
Executable
+80
@@ -0,0 +1,80 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.ServiceModel;
|
||||
using System.ServiceModel.Channels;
|
||||
|
||||
namespace MTApiService
|
||||
{
|
||||
class MtApiProxy : DuplexClientBase<IMtApi>, IMtApi, IDisposable
|
||||
{
|
||||
public MtApiProxy(InstanceContext callbackContext, Binding binding,
|
||||
EndpointAddress remoteAddress)
|
||||
: base(callbackContext, binding, remoteAddress)
|
||||
{
|
||||
base.InnerDuplexChannel.Faulted += new EventHandler(InnerDuplexChannel_Faulted);
|
||||
base.InnerDuplexChannel.Open();
|
||||
}
|
||||
|
||||
#region IMtApi Members
|
||||
|
||||
public bool Connect()
|
||||
{
|
||||
return Channel.Connect();
|
||||
}
|
||||
|
||||
public void Disconnect()
|
||||
{
|
||||
Channel.Disconnect();
|
||||
}
|
||||
|
||||
public MtResponse SendCommand(MtCommand command)
|
||||
{
|
||||
return Channel.SendCommand(command);
|
||||
}
|
||||
|
||||
public IEnumerable<MtQuote> GetQuotes()
|
||||
{
|
||||
return Channel.GetQuotes();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable Members
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
try
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
catch (CommunicationException)
|
||||
{
|
||||
this.Abort();
|
||||
}
|
||||
catch (TimeoutException)
|
||||
{
|
||||
this.Abort();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
this.Abort();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
private void InnerDuplexChannel_Faulted(object sender, EventArgs e)
|
||||
{
|
||||
if (Faulted != null)
|
||||
Faulted(this, e);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
public event EventHandler Faulted;
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Executable
+305
@@ -0,0 +1,305 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Diagnostics;
|
||||
using System.Collections;
|
||||
using System.ServiceModel;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MTApiService
|
||||
{
|
||||
[CallbackBehavior(UseSynchronizationContext = false)]
|
||||
public class MtClient: IMtApiCallback, IDisposable
|
||||
{
|
||||
private static string SERVICE_NAME = "MtApiService";
|
||||
|
||||
// public delegate void MtInstrumentsChangedHandler(string addedInstrument, string removedInstrument);
|
||||
public delegate void MtQuoteHandler(MtQuote quote);
|
||||
|
||||
#region Public Methods
|
||||
public void Open(string host, int port)
|
||||
{
|
||||
Debug.WriteLine("[INFO] MtClient::Open");
|
||||
|
||||
if (string.IsNullOrEmpty(host) == true)
|
||||
throw new ArgumentNullException("host", "host is null or epmty");
|
||||
|
||||
if (port < 0 || port > 65536)
|
||||
throw new ArgumentOutOfRangeException("port", "port value is invalid");
|
||||
|
||||
string urlService = string.Format("net.tcp://{0}:{1}/{2}", host, port, SERVICE_NAME);
|
||||
|
||||
lock (mClientLocker)
|
||||
{
|
||||
if (mProxy != null)
|
||||
return;
|
||||
|
||||
var bind = new NetTcpBinding();
|
||||
bind.MaxReceivedMessageSize = 2147483647;
|
||||
bind.MaxBufferSize = 2147483647;
|
||||
// Commented next statement since it is not required
|
||||
bind.MaxBufferPoolSize = 2147483647;
|
||||
bind.ReaderQuotas.MaxArrayLength = 2147483647;
|
||||
bind.ReaderQuotas.MaxBytesPerRead = 2147483647;
|
||||
bind.ReaderQuotas.MaxDepth = 2147483647;
|
||||
bind.ReaderQuotas.MaxStringContentLength = 2147483647;
|
||||
bind.ReaderQuotas.MaxNameTableCharCount = 2147483647;
|
||||
|
||||
mProxy = new MtApiProxy(new InstanceContext(this), bind, new EndpointAddress(urlService));
|
||||
mProxy.Faulted += mProxy_Faulted;
|
||||
}
|
||||
}
|
||||
|
||||
public void Open(int port)
|
||||
{
|
||||
if (port < 0 || port > 65536)
|
||||
throw new ArgumentOutOfRangeException("port", "port value is invalid");
|
||||
|
||||
string urlService = "net.pipe://localhost/" + SERVICE_NAME + "_" + port.ToString();
|
||||
|
||||
lock (mClientLocker)
|
||||
{
|
||||
if (mProxy != null)
|
||||
return;
|
||||
|
||||
var bind = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None);
|
||||
bind.MaxReceivedMessageSize = 2147483647;
|
||||
bind.MaxBufferSize = 2147483647;
|
||||
// Commented next statement since it is not required
|
||||
bind.MaxBufferPoolSize = 2147483647;
|
||||
bind.ReaderQuotas.MaxArrayLength = 2147483647;
|
||||
bind.ReaderQuotas.MaxBytesPerRead = 2147483647;
|
||||
bind.ReaderQuotas.MaxDepth = 2147483647;
|
||||
bind.ReaderQuotas.MaxStringContentLength = 2147483647;
|
||||
bind.ReaderQuotas.MaxNameTableCharCount = 2147483647;
|
||||
|
||||
mProxy = new MtApiProxy(new InstanceContext(this), bind, new EndpointAddress(urlService));
|
||||
mProxy.Faulted += mProxy_Faulted;
|
||||
}
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
Debug.WriteLine("[INFO] MtClient::Close");
|
||||
|
||||
lock (mClientLocker)
|
||||
{
|
||||
if (mProxy != null)
|
||||
{
|
||||
mProxy.Faulted -= mProxy_Faulted;
|
||||
mProxy.Dispose();
|
||||
mProxy = null;
|
||||
}
|
||||
|
||||
mIsConnected = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void Connect()
|
||||
{
|
||||
Debug.WriteLine("[INFO] MtClient::Connect");
|
||||
|
||||
try
|
||||
{
|
||||
lock (mClientLocker)
|
||||
{
|
||||
if (mProxy != null && mIsConnected == true)
|
||||
return;
|
||||
|
||||
mIsConnected = mProxy.Connect();
|
||||
|
||||
if (mIsConnected == false)
|
||||
throw new Exception("Connected failed");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine("[ERROR] MtClient::Connect: {0}", ex.Message);
|
||||
|
||||
Close();
|
||||
|
||||
throw new CommunicationException(string.Format("Connection failed to service"));
|
||||
}
|
||||
}
|
||||
|
||||
public void Disconnect()
|
||||
{
|
||||
Debug.WriteLine("[INFO] MtClient::Disconnect");
|
||||
|
||||
try
|
||||
{
|
||||
lock (mClientLocker)
|
||||
{
|
||||
mIsConnected = false;
|
||||
|
||||
if (mProxy != null)
|
||||
mProxy.Disconnect();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine("[ERROR] MtClient::Disconnect: {0}", ex.Message);
|
||||
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
||||
public MtResponse SendCommand(int commandType, ArrayList commandParameters)
|
||||
{
|
||||
Debug.WriteLine("[INFO] MtClient::SendCommand: commandType = {0}", commandType);
|
||||
|
||||
MtResponse result = null;
|
||||
|
||||
try
|
||||
{
|
||||
lock (mClientLocker)
|
||||
{
|
||||
if (mProxy != null && mIsConnected == true)
|
||||
result = mProxy.SendCommand(new MtCommand(commandType, commandParameters));
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine("[ERROR] MtClient::SendCommand: {0}", ex.Message);
|
||||
|
||||
Close();
|
||||
|
||||
throw new CommunicationException("Service connection failed! " + ex.Message);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public IEnumerable<MtQuote> GetQuotes()
|
||||
{
|
||||
Debug.WriteLine("[INFO] MtClient::GetQuotes");
|
||||
|
||||
IEnumerable<MtQuote> result = null;
|
||||
|
||||
try
|
||||
{
|
||||
lock (mClientLocker)
|
||||
{
|
||||
if (mProxy != null && mIsConnected == true)
|
||||
result = mProxy.GetQuotes();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine("[ERROR] MtClient::GetQuotes: {0}", ex.Message);
|
||||
|
||||
Close();
|
||||
|
||||
throw new CommunicationException("Service connection failed");
|
||||
}
|
||||
|
||||
return result;;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IMtApiCallback Members
|
||||
|
||||
public void OnQuoteUpdate(MtQuote quote)
|
||||
{
|
||||
if (quote != null)
|
||||
{
|
||||
if (QuoteUpdated != null)
|
||||
{
|
||||
QuoteUpdated(quote);
|
||||
}
|
||||
|
||||
Debug.WriteLine("[INFO] MtClient::OnQuoteUpdate: " + quote);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnQuoteAdded(MtQuote quote)
|
||||
{
|
||||
Debug.WriteLine("[INFO] MtClient::OnQuoteAdded");
|
||||
|
||||
if (QuoteAdded != null)
|
||||
{
|
||||
QuoteAdded(quote);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnQuoteRemoved(MtQuote quote)
|
||||
{
|
||||
Debug.WriteLine("[INFO] MtClient::OnQuoteRemoved");
|
||||
|
||||
if (QuoteRemoved != null)
|
||||
{
|
||||
QuoteRemoved(quote);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnServerStopped()
|
||||
{
|
||||
Debug.WriteLine("[INFO] MtClient::OnServerStopped");
|
||||
|
||||
Close();
|
||||
|
||||
if (ServerDisconnected != null)
|
||||
{
|
||||
ServerDisconnected(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
public bool IsConnected
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (mClientLocker)
|
||||
{
|
||||
return mProxy.State == CommunicationState.Opened && mIsConnected == true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
|
||||
void mProxy_Faulted(object sender, EventArgs e)
|
||||
{
|
||||
Debug.WriteLine("[INFO] MtClient::mProxy_Faulted");
|
||||
|
||||
Close();
|
||||
|
||||
if (ServerFailed != null)
|
||||
{
|
||||
ServerFailed(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable Members
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Debug.WriteLine("[INFO] MtClient::Dispose");
|
||||
|
||||
Close();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
public event MtQuoteHandler QuoteAdded;
|
||||
public event MtQuoteHandler QuoteRemoved;
|
||||
public event MtQuoteHandler QuoteUpdated;
|
||||
public event EventHandler ServerDisconnected;
|
||||
public event EventHandler ServerFailed;
|
||||
#endregion
|
||||
|
||||
#region Fields
|
||||
private readonly object mClientLocker = new object();
|
||||
private MtApiProxy mProxy = null;
|
||||
private bool mIsConnected = false;
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.ServiceModel;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Collections;
|
||||
|
||||
namespace MTApiService
|
||||
{
|
||||
[DataContract]
|
||||
public class MtCommand
|
||||
{
|
||||
public MtCommand(int commandType, ArrayList parameters)
|
||||
{
|
||||
CommandType = commandType;
|
||||
Parameters = parameters;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public int CommandType { get; private set; }
|
||||
|
||||
[DataMember]
|
||||
public ArrayList Parameters { get; private set; }
|
||||
|
||||
}
|
||||
}
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace MTApiService
|
||||
{
|
||||
public class MtCommandExecuteEventArgs: EventArgs
|
||||
{
|
||||
public MtCommand Command { get; private set; }
|
||||
public MtResponse Response { get; private set; }
|
||||
|
||||
public MtCommandExecuteEventArgs(MtCommand command, MtResponse response)
|
||||
{
|
||||
Command = command;
|
||||
Response = response;
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace MTApiService
|
||||
{
|
||||
public class MtConnectionProfile
|
||||
{
|
||||
public MtConnectionProfile(string name)
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
|
||||
public string Name { get; private set; }
|
||||
public string Host { get; set; }
|
||||
public int Port { get; set; }
|
||||
}
|
||||
}
|
||||
Executable
+132
@@ -0,0 +1,132 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
namespace MTApiService
|
||||
{
|
||||
class MtCommandExecutorManager : ICommandManager
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
lock (_locker)
|
||||
{
|
||||
mCommandExecutors.Clear();
|
||||
mCommands.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
public void AddCommandExecutor(MtExpert commandExecutor)
|
||||
{
|
||||
if (commandExecutor == null)
|
||||
return;
|
||||
|
||||
lock (_locker)
|
||||
{
|
||||
if (mCommandExecutors.Contains(commandExecutor) == true)
|
||||
return;
|
||||
|
||||
mCommandExecutors.Add(commandExecutor);
|
||||
|
||||
commandExecutor.CommandManager = this;
|
||||
|
||||
if (mCurrentExecutor == null)
|
||||
{
|
||||
mCurrentExecutor = commandExecutor;
|
||||
mCurrentExecutor.IsCommandExecutor = true;
|
||||
|
||||
if (mCommands.Count > 0)
|
||||
{
|
||||
mCurrentExecutor.NotifyCommandReady();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveCommandExecutor(MtExpert commandExecutor)
|
||||
{
|
||||
if (commandExecutor == null)
|
||||
return;
|
||||
|
||||
lock (_locker)
|
||||
{
|
||||
if (mCommandExecutors.Contains(commandExecutor) == false)
|
||||
return;
|
||||
|
||||
mCommandExecutors.Remove(commandExecutor);
|
||||
|
||||
if (mCurrentExecutor == commandExecutor)
|
||||
{
|
||||
mCurrentExecutor.IsCommandExecutor = false;
|
||||
mCurrentExecutor = mCommandExecutors.Count > 0 ? mCommandExecutors[0] : null;
|
||||
|
||||
if (mCommands.Count > 0)
|
||||
{
|
||||
mCurrentExecutor.NotifyCommandReady();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void EnqueueCommand(MtCommand command)
|
||||
{
|
||||
if (command == null)
|
||||
return;
|
||||
|
||||
lock (_locker)
|
||||
{
|
||||
mCommands.Enqueue(command);
|
||||
|
||||
mCurrentExecutor.NotifyCommandReady();
|
||||
}
|
||||
}
|
||||
|
||||
public MtCommand DequeueCommand()
|
||||
{
|
||||
lock (_locker)
|
||||
{
|
||||
return mCommands.Count > 0 ? mCommands.Dequeue() : null;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnCommandExecuted(MtExpert expert, MtCommand command, MtResponse response)
|
||||
{
|
||||
if (expert == null)
|
||||
return;
|
||||
|
||||
if (CommandExecuted != null)
|
||||
{
|
||||
CommandExecuted(this, new MtCommandExecuteEventArgs(command, response));
|
||||
}
|
||||
|
||||
lock (_locker)
|
||||
{
|
||||
if (expert == mCurrentExecutor)
|
||||
{
|
||||
if (mCommands.Count > 0)
|
||||
{
|
||||
mCurrentExecutor.NotifyCommandReady();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
public event EventHandler<MtCommandExecuteEventArgs> CommandExecuted;
|
||||
#endregion
|
||||
|
||||
#region Private Fields
|
||||
private MtExpert mCurrentExecutor;
|
||||
|
||||
private List<MtExpert> mCommandExecutors = new List<MtExpert>();
|
||||
private Queue<MtCommand> mCommands = new Queue<MtCommand>();
|
||||
|
||||
private readonly object _locker = new object();
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Executable
+157
@@ -0,0 +1,157 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace MTApiService
|
||||
{
|
||||
public class MtExpert
|
||||
{
|
||||
public delegate void MtQuoteHandler(MtExpert expert, MtQuote quote);
|
||||
|
||||
#region Properties
|
||||
private MtQuote _Quote;
|
||||
public MtQuote Quote
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (_locker)
|
||||
{
|
||||
return _Quote;
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
lock(_locker)
|
||||
{
|
||||
_Quote = value;
|
||||
}
|
||||
|
||||
if (QuoteChanged != null)
|
||||
{
|
||||
QuoteChanged(this, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
public int Handle { get; private set; }
|
||||
|
||||
private volatile bool _IsEnable = true;
|
||||
public bool IsEnable
|
||||
{
|
||||
get { return _IsEnable; }
|
||||
private set { _IsEnable = value; }
|
||||
}
|
||||
|
||||
private volatile bool _IsCommandExecutor = true;
|
||||
public bool IsCommandExecutor
|
||||
{
|
||||
get { return _IsCommandExecutor; }
|
||||
set { _IsCommandExecutor = value; }
|
||||
}
|
||||
|
||||
public ICommandManager CommandManager
|
||||
{
|
||||
private get
|
||||
{
|
||||
lock (_locker)
|
||||
{
|
||||
return mCommandManager;
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
lock (_locker)
|
||||
{
|
||||
mCommandManager = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
public MtExpert(int handle, MtQuote quote, IMetaTraderHandler mtHandler)
|
||||
{
|
||||
Quote = quote;
|
||||
Handle = handle;
|
||||
mMtHadler = mtHandler;
|
||||
}
|
||||
|
||||
public void Deinit()
|
||||
{
|
||||
IsEnable = false;
|
||||
|
||||
if (Deinited != null)
|
||||
{
|
||||
Deinited(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
public void SendResponse(MtResponse response)
|
||||
{
|
||||
MtCommand command = mCommand;
|
||||
mCommand = null;
|
||||
|
||||
ICommandManager commandManager = CommandManager;
|
||||
if (commandManager != null)
|
||||
{
|
||||
commandManager.OnCommandExecuted(this, command, response);
|
||||
}
|
||||
}
|
||||
|
||||
public int GetCommandType()
|
||||
{
|
||||
if (IsCommandExecutor)
|
||||
{
|
||||
ICommandManager commandManager = CommandManager;
|
||||
if (mCommandManager != null)
|
||||
{
|
||||
mCommand = mCommandManager.DequeueCommand();
|
||||
}
|
||||
}
|
||||
|
||||
return mCommand != null ? mCommand.CommandType : 0;
|
||||
}
|
||||
|
||||
public object GetCommandParameter(int index)
|
||||
{
|
||||
if (mCommand != null && mCommand.Parameters != null
|
||||
&& index >= 0 && index < mCommand.Parameters.Count)
|
||||
{
|
||||
return mCommand.Parameters[index];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IMtCommandExecutor
|
||||
public void NotifyCommandReady()
|
||||
{
|
||||
SendTickToMetaTrader();
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region Private Methods
|
||||
private void SendTickToMetaTrader()
|
||||
{
|
||||
if (mMtHadler != null)
|
||||
{
|
||||
mMtHadler.SendTickToMetaTrader(Handle);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
public event EventHandler Deinited;
|
||||
public event MtQuoteHandler QuoteChanged;
|
||||
#endregion
|
||||
|
||||
#region Private Fields
|
||||
private readonly IMetaTraderHandler mMtHadler;
|
||||
private MtCommand mCommand;
|
||||
private ICommandManager mCommandManager;
|
||||
private readonly object _locker = new object();
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Executable
+33
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace MTApiService
|
||||
{
|
||||
[DataContract]
|
||||
public class MtQuote
|
||||
{
|
||||
[DataMember]
|
||||
public string Instrument { get; private set; }
|
||||
|
||||
[DataMember]
|
||||
public double Bid { get; private set; }
|
||||
|
||||
[DataMember]
|
||||
public double Ask { get; private set; }
|
||||
|
||||
public MtQuote(string instrument, double bid, double ask)
|
||||
{
|
||||
Instrument = instrument;
|
||||
Bid = bid;
|
||||
Ask = ask;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "Instrument = " + Instrument + ", Bid = " + Bid + ", Ask = " + Ask;
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+21
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
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; }
|
||||
}
|
||||
}
|
||||
Executable
+30
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace MTApiService
|
||||
{
|
||||
[DataContract]
|
||||
public class MtMqlRates
|
||||
{
|
||||
[DataMember]
|
||||
public long time { get; set; } // Period start time
|
||||
[DataMember]
|
||||
public double open { get; set; } // Open price
|
||||
[DataMember]
|
||||
public double high { get; set; } // The highest price of the period
|
||||
[DataMember]
|
||||
public double low { get; set; } // The lowest price of the period
|
||||
[DataMember]
|
||||
public double close { get; set; } // Close price
|
||||
[DataMember]
|
||||
public long tick_volume { get; set; } // Tick volume
|
||||
[DataMember]
|
||||
public int spread { get; set; } // Spread
|
||||
[DataMember]
|
||||
public long real_volume { get; set; } // Trade volume
|
||||
}
|
||||
}
|
||||
Executable
+27
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
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
|
||||
}
|
||||
}
|
||||
Executable
+43
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace MTApiService
|
||||
{
|
||||
[DataContract]
|
||||
public class MtMqlTradeRequest
|
||||
{
|
||||
[DataMember]
|
||||
public int Action { get; set; }
|
||||
[DataMember]
|
||||
public uint Magic { get; set; }
|
||||
[DataMember]
|
||||
public uint Order { get; set; }
|
||||
[DataMember]
|
||||
public string Symbol { get; set; }
|
||||
[DataMember]
|
||||
public double Volume { get; set; }
|
||||
[DataMember]
|
||||
public double Price { get; set; }
|
||||
[DataMember]
|
||||
public double Stoplimit { get; set; }
|
||||
[DataMember]
|
||||
public double Sl { get; set; }
|
||||
[DataMember]
|
||||
public double Tp { get; set; }
|
||||
[DataMember]
|
||||
public uint Deviation { get; set; }
|
||||
[DataMember]
|
||||
public int Type { get; set; }
|
||||
[DataMember]
|
||||
public int Type_filling { get; set; }
|
||||
[DataMember]
|
||||
public int Type_time { get; set; }
|
||||
[DataMember]
|
||||
public DateTime Expiration { get; set; }
|
||||
[DataMember]
|
||||
public string Comment { get; set; }
|
||||
}
|
||||
}
|
||||
Executable
+325
@@ -0,0 +1,325 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Microsoft.Win32;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace MTApiService
|
||||
{
|
||||
public class MtRegistryManager
|
||||
{
|
||||
private const string SOFTWARE = "Software";
|
||||
private const string APP_NAME = "MtApi";
|
||||
private const string PROFILES_REGKEY = "ConnectionProfiles";
|
||||
private const string HOST_REGVALUE_NAME = "Host";
|
||||
private const string PORT_REGVALUE_NAME = "Port";
|
||||
private const string SIGNATURE_REGVALUE_NAME = "MtSignature";
|
||||
|
||||
#region Public Methods
|
||||
public static IEnumerable<MtConnectionProfile> LoadConnectionProfiles()
|
||||
{
|
||||
return LoadConnectionProfilesFromRegisty();
|
||||
}
|
||||
|
||||
public static MtConnectionProfile LoadConnectionProfile(string profileName)
|
||||
{
|
||||
return string.IsNullOrEmpty(profileName) == false ? LoadConnectionProfileFromRegisty(profileName) : null;
|
||||
}
|
||||
|
||||
public static void AddConnectionProfile(MtConnectionProfile profile)
|
||||
{
|
||||
if (profile != null && string.IsNullOrEmpty(profile.Name) == false)
|
||||
{
|
||||
SaveConnectionProfileToRegistry(profile);
|
||||
}
|
||||
}
|
||||
|
||||
public static void RemoveConnectionProfile(string profileName)
|
||||
{
|
||||
if (string.IsNullOrEmpty(profileName) == false)
|
||||
{
|
||||
DeleteConnectionProfileFromRegistry(profileName);
|
||||
}
|
||||
}
|
||||
|
||||
public static string ReadSignatureKey(string accountName, string accountNumber)
|
||||
{
|
||||
if (string.IsNullOrEmpty(accountName)
|
||||
|| string.IsNullOrEmpty(accountNumber))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
string signature = null;
|
||||
|
||||
var softwareRegKey = Registry.CurrentUser.OpenSubKey(SOFTWARE, true);
|
||||
if (softwareRegKey != null)
|
||||
{
|
||||
using (softwareRegKey)
|
||||
{
|
||||
var appRegKey = softwareRegKey.OpenSubKey(APP_NAME, true);
|
||||
if (appRegKey != null)
|
||||
{
|
||||
using (appRegKey)
|
||||
{
|
||||
var accountKey = appRegKey.OpenSubKey(accountName, true);
|
||||
if (accountKey != null)
|
||||
{
|
||||
using (accountKey)
|
||||
{
|
||||
var numberKey = accountKey.OpenSubKey(accountNumber, true);
|
||||
if (numberKey != null)
|
||||
{
|
||||
using (numberKey)
|
||||
{
|
||||
signature = numberKey.GetValue(SIGNATURE_REGVALUE_NAME).ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return signature;
|
||||
}
|
||||
|
||||
public static string SaveSignatureKey(string accountName, string accountNumber, string signature)
|
||||
{
|
||||
if (string.IsNullOrEmpty(accountName)
|
||||
|| string.IsNullOrEmpty(accountNumber))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
RegistryKey softwareRgKey = Registry.CurrentUser.OpenSubKey(SOFTWARE, true);
|
||||
|
||||
if (softwareRgKey == null)
|
||||
return null;
|
||||
|
||||
string retVal = null;
|
||||
|
||||
using (softwareRgKey)
|
||||
{
|
||||
|
||||
//app name
|
||||
var appRegKey = softwareRgKey.OpenSubKey(APP_NAME, true);
|
||||
if (appRegKey == null)
|
||||
{
|
||||
appRegKey = softwareRgKey.CreateSubKey(APP_NAME);
|
||||
}
|
||||
|
||||
using (appRegKey)
|
||||
{
|
||||
//account name
|
||||
var accountKey = appRegKey.OpenSubKey(accountName, true);
|
||||
if (accountKey == null)
|
||||
{
|
||||
accountKey = appRegKey.CreateSubKey(accountName);
|
||||
}
|
||||
|
||||
using (accountKey)
|
||||
{
|
||||
//account number
|
||||
var numberKey = accountKey.OpenSubKey(accountNumber, true);
|
||||
if (numberKey == null)
|
||||
{
|
||||
numberKey = accountKey.CreateSubKey(accountNumber);
|
||||
}
|
||||
|
||||
using (numberKey)
|
||||
{
|
||||
numberKey.SetValue(SIGNATURE_REGVALUE_NAME, signature);
|
||||
|
||||
retVal = numberKey.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
public static bool ExportKey(string RegKey, string SavePath)
|
||||
{
|
||||
string path = "\"" + SavePath + "\"";
|
||||
string key = "\"" + RegKey + "\"";
|
||||
|
||||
Process proc = new Process();
|
||||
try
|
||||
{
|
||||
proc.StartInfo.FileName = "regedit.exe";
|
||||
proc.StartInfo.UseShellExecute = false;
|
||||
proc = Process.Start("regedit.exe", "/e " + path + " " + key + "");
|
||||
|
||||
if (proc != null)
|
||||
proc.WaitForExit();
|
||||
}
|
||||
catch(Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (proc != null)
|
||||
proc.Dispose();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
private static IEnumerable<MtConnectionProfile> LoadConnectionProfilesFromRegisty()
|
||||
{
|
||||
List<MtConnectionProfile> profiles = null;
|
||||
|
||||
var softwareRegKey = Registry.CurrentUser.OpenSubKey(SOFTWARE, true);
|
||||
if (softwareRegKey != null)
|
||||
{
|
||||
using (softwareRegKey)
|
||||
{
|
||||
var appRegKey = softwareRegKey.OpenSubKey(APP_NAME, true);
|
||||
if (appRegKey != null)
|
||||
{
|
||||
using (appRegKey)
|
||||
{
|
||||
var profilesRegKey = appRegKey.OpenSubKey(PROFILES_REGKEY, true);
|
||||
if (profilesRegKey != null)
|
||||
{
|
||||
using (profilesRegKey)
|
||||
{
|
||||
profiles = new List<MtConnectionProfile>();
|
||||
|
||||
foreach (string profileNameKey in profilesRegKey.GetSubKeyNames())
|
||||
{
|
||||
using (RegistryKey tempKey = profilesRegKey.OpenSubKey(profileNameKey))
|
||||
{
|
||||
var profile = new MtConnectionProfile(profileNameKey);
|
||||
|
||||
profile.Host = tempKey.GetValue(HOST_REGVALUE_NAME).ToString();
|
||||
profile.Port = (int)tempKey.GetValue(PORT_REGVALUE_NAME);
|
||||
|
||||
profiles.Add(profile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return profiles;
|
||||
}
|
||||
|
||||
private static MtConnectionProfile LoadConnectionProfileFromRegisty(string profileName)
|
||||
{
|
||||
MtConnectionProfile profile = null;
|
||||
|
||||
var softwareRegKey = Registry.CurrentUser.OpenSubKey(SOFTWARE, true);
|
||||
if (softwareRegKey != null)
|
||||
{
|
||||
using (softwareRegKey)
|
||||
{
|
||||
var appRegKey = softwareRegKey.OpenSubKey(APP_NAME, true);
|
||||
if (appRegKey != null)
|
||||
{
|
||||
using (appRegKey)
|
||||
{
|
||||
var profilesRegKey = appRegKey.OpenSubKey(PROFILES_REGKEY, true);
|
||||
if (profilesRegKey != null)
|
||||
{
|
||||
using (profilesRegKey)
|
||||
{
|
||||
using (RegistryKey tempKey = profilesRegKey.OpenSubKey(profileName))
|
||||
{
|
||||
profile = new MtConnectionProfile(profileName);
|
||||
|
||||
profile.Host = tempKey.GetValue(HOST_REGVALUE_NAME).ToString();
|
||||
profile.Port = (int)tempKey.GetValue(PORT_REGVALUE_NAME);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return profile;
|
||||
}
|
||||
|
||||
private static void SaveConnectionProfileToRegistry(MtConnectionProfile profile)
|
||||
{
|
||||
RegistryKey softwareRgKey = Registry.CurrentUser.OpenSubKey(SOFTWARE, true);
|
||||
|
||||
if (softwareRgKey == null)
|
||||
return;
|
||||
|
||||
using (softwareRgKey)
|
||||
{
|
||||
//app name
|
||||
var appRegKey = softwareRgKey.OpenSubKey(APP_NAME, true);
|
||||
if (appRegKey == null)
|
||||
{
|
||||
appRegKey = softwareRgKey.CreateSubKey(APP_NAME);
|
||||
}
|
||||
|
||||
using (appRegKey)
|
||||
{
|
||||
//ConnectionProfiles key
|
||||
var profilesRegKey = appRegKey.OpenSubKey(PROFILES_REGKEY, true);
|
||||
if (profilesRegKey == null)
|
||||
{
|
||||
profilesRegKey = appRegKey.CreateSubKey(PROFILES_REGKEY);
|
||||
}
|
||||
|
||||
using (profilesRegKey)
|
||||
{
|
||||
var profileKey = profilesRegKey.CreateSubKey(profile.Name);
|
||||
|
||||
using (profileKey)
|
||||
{
|
||||
profileKey.SetValue(HOST_REGVALUE_NAME, profile.Host);
|
||||
profileKey.SetValue(PORT_REGVALUE_NAME, profile.Port);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void DeleteConnectionProfileFromRegistry(string profileName)
|
||||
{
|
||||
var softwareRegKey = Registry.CurrentUser.OpenSubKey(SOFTWARE, true);
|
||||
if (softwareRegKey == null)
|
||||
return;
|
||||
|
||||
using (softwareRegKey)
|
||||
{
|
||||
var appRegKey = softwareRegKey.OpenSubKey(APP_NAME, true);
|
||||
if (appRegKey == null)
|
||||
return;
|
||||
|
||||
using (appRegKey)
|
||||
{
|
||||
var profilesRegKey = appRegKey.OpenSubKey(PROFILES_REGKEY, true);
|
||||
if (profilesRegKey == null)
|
||||
return;
|
||||
|
||||
using (profilesRegKey)
|
||||
{
|
||||
profilesRegKey.DeleteSubKey(profileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Fields
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Executable
+182
@@ -0,0 +1,182 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Collections;
|
||||
|
||||
namespace MTApiService
|
||||
{
|
||||
[DataContract]
|
||||
[KnownType("GetKnownTypes")]
|
||||
public abstract class MtResponse
|
||||
{
|
||||
static IEnumerable<Type> GetKnownTypes()
|
||||
{
|
||||
return new Type[] { typeof(MtResponseInt), typeof(MtResponseDouble),
|
||||
typeof(MtResponseString), typeof(MtResponseBool),
|
||||
typeof(MtResponseLong), typeof(MtResponseULong),
|
||||
typeof(MtResponseDoubleArray), typeof(MtResponseIntArray),
|
||||
typeof(MtResponseLongArray), typeof(MtResponseMqlTick),
|
||||
typeof(MtResponseArrayList), typeof(MtResponseMqlRatesArray),
|
||||
typeof(MtResponseMqlBookInfoArray)};
|
||||
}
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class MtResponseInt: MtResponse
|
||||
{
|
||||
public MtResponseInt(int value)
|
||||
{
|
||||
Value = value;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public int Value { get; private set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class MtResponseLong : MtResponse
|
||||
{
|
||||
public MtResponseLong(long value)
|
||||
{
|
||||
Value = value;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public long Value { get; private set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class MtResponseULong : MtResponse
|
||||
{
|
||||
public MtResponseULong(ulong value)
|
||||
{
|
||||
Value = value;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public ulong Value { get; private set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class MtResponseDouble : MtResponse
|
||||
{
|
||||
public MtResponseDouble(double value)
|
||||
{
|
||||
Value = value;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public double Value { get; private set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class MtResponseString : MtResponse
|
||||
{
|
||||
public MtResponseString(string value)
|
||||
{
|
||||
Value = value;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public string Value { get; private set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class MtResponseBool : MtResponse
|
||||
{
|
||||
public MtResponseBool(bool value)
|
||||
{
|
||||
Value = value;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public bool Value { get; private set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class MtResponseDoubleArray : MtResponse
|
||||
{
|
||||
public MtResponseDoubleArray(double[] value)
|
||||
{
|
||||
Value = value;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public double[] Value { get; private set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class MtResponseIntArray : MtResponse
|
||||
{
|
||||
public MtResponseIntArray(int[] value)
|
||||
{
|
||||
Value = value;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public int[] Value { get; private set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class MtResponseLongArray : MtResponse
|
||||
{
|
||||
public MtResponseLongArray(long[] value)
|
||||
{
|
||||
Value = value;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public long[] Value { get; private set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class MtResponseArrayList : MtResponse
|
||||
{
|
||||
public MtResponseArrayList(ArrayList value)
|
||||
{
|
||||
Value = value;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public ArrayList Value { get; private set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class MtResponseMqlRatesArray : MtResponse
|
||||
{
|
||||
public MtResponseMqlRatesArray(MtMqlRates[] value)
|
||||
{
|
||||
Value = value;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public MtMqlRates[] Value { get; private set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class MtResponseMqlTick : MtResponse
|
||||
{
|
||||
public MtResponseMqlTick(MtMqlTick value)
|
||||
{
|
||||
Value = value;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public MtMqlTick Value { get; private set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class MtResponseMqlBookInfoArray : MtResponse
|
||||
{
|
||||
public MtResponseMqlBookInfoArray(MtMqlBookInfo[] value)
|
||||
{
|
||||
Value = value;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public MtMqlBookInfo[] Value { get; private set; }
|
||||
}
|
||||
|
||||
}
|
||||
Executable
+334
@@ -0,0 +1,334 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.ServiceModel;
|
||||
using System.Net;
|
||||
using System.Diagnostics;
|
||||
using System.ServiceModel.Channels;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace MTApiService
|
||||
{
|
||||
class MtServer : IDisposable, IMtApiServer
|
||||
{
|
||||
#region Constants
|
||||
private const int WAIT_RESPONSE_TIME = 40000; // 40 sec
|
||||
private const int STOP_EXPERT_INTERVAL = 1000; // 1 sec
|
||||
#endregion
|
||||
|
||||
#region ctor
|
||||
public MtServer(MtConnectionProfile profile)
|
||||
{
|
||||
Profile = profile;
|
||||
mService = new MtService(this);
|
||||
|
||||
mExecutorManager = new MtCommandExecutorManager();
|
||||
mExecutorManager.CommandExecuted += mExecutorManager_CommandExecuted;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
public MtConnectionProfile Profile { get; private set; }
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
public void Start()
|
||||
{
|
||||
lock (mHostLocker)
|
||||
{
|
||||
if (mHost != null)
|
||||
return;
|
||||
|
||||
ServiceHost host = new ServiceHost(mService);
|
||||
|
||||
string mServerUrlAdress = CreateConnectionAddress(Profile);
|
||||
Binding mBinding = CreateConnectionBinding(Profile);
|
||||
|
||||
host.AddServiceEndpoint(typeof(IMtApi), mBinding, mServerUrlAdress);
|
||||
host.Open();
|
||||
|
||||
mHost = host;
|
||||
}
|
||||
|
||||
lock (mExpertsLocker)
|
||||
{
|
||||
mExperts = new List<MtExpert>();
|
||||
}
|
||||
}
|
||||
|
||||
public void AddExpert(MtExpert expert)
|
||||
{
|
||||
if (expert != null)
|
||||
{
|
||||
expert.Deinited += new EventHandler(expert_Deinited);
|
||||
expert.QuoteChanged += new MtExpert.MtQuoteHandler(expert_QuoteChanged);
|
||||
|
||||
lock (mExpertsLocker)
|
||||
{
|
||||
mExperts.Add(expert);
|
||||
}
|
||||
|
||||
mExecutorManager.AddCommandExecutor(expert);
|
||||
|
||||
mService.OnQuoteAdded(expert.Quote);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IMtApiServerCallback Members
|
||||
|
||||
public MtResponse SendCommand(MtCommand command)
|
||||
{
|
||||
MtResponse response = null;
|
||||
|
||||
if (command != null)
|
||||
{
|
||||
EventWaitHandle responseWaiter = new AutoResetEvent(false);
|
||||
|
||||
lock (mResponseLocker)
|
||||
{
|
||||
mResponseWaiters[command] = responseWaiter;
|
||||
}
|
||||
|
||||
mExecutorManager.EnqueueCommand(command);
|
||||
|
||||
//wait for execute command in MetaTrader
|
||||
responseWaiter.WaitOne(WAIT_RESPONSE_TIME);
|
||||
|
||||
lock (mResponseLocker)
|
||||
{
|
||||
if (mResponseWaiters.ContainsKey(command) == true)
|
||||
{
|
||||
mResponseWaiters.Remove(command);
|
||||
}
|
||||
|
||||
if (mResponses.ContainsKey(command) == true)
|
||||
{
|
||||
response = mResponses[command];
|
||||
mResponses.Remove(command);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
public IEnumerable<MtQuote> GetQuotes()
|
||||
{
|
||||
lock (mExpertsLocker)
|
||||
{
|
||||
return (from s in mExperts select s.Quote);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
private void stopTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
|
||||
{
|
||||
int expertsCount = 0;
|
||||
|
||||
lock (mExpertsLocker)
|
||||
{
|
||||
expertsCount = mExperts.Count();
|
||||
}
|
||||
|
||||
if (expertsCount == 0)
|
||||
{
|
||||
mService.OnStopServer();
|
||||
|
||||
stop();
|
||||
}
|
||||
|
||||
var stopTimer = sender as System.Timers.Timer;
|
||||
stopTimer.Stop();
|
||||
stopTimer.Elapsed -= stopTimer_Elapsed;
|
||||
}
|
||||
|
||||
private string CreateConnectionAddress(MtConnectionProfile profile)
|
||||
{
|
||||
string connectionAddress = null;
|
||||
|
||||
if (profile != null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(profile.Host))
|
||||
{
|
||||
//by Pipe
|
||||
connectionAddress = "net.pipe://localhost/MtApiService_" + profile.Port.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
//by Socket
|
||||
connectionAddress = "net.tcp://" + profile.Host.ToString() + ":" + profile.Port.ToString() + "/MtApiService";
|
||||
}
|
||||
}
|
||||
|
||||
return connectionAddress;
|
||||
}
|
||||
|
||||
private static Binding CreateConnectionBinding(MtConnectionProfile profile)
|
||||
{
|
||||
Binding connectionBinding = null;
|
||||
|
||||
if (profile != null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(profile.Host))
|
||||
{
|
||||
//by Pipe
|
||||
var bind = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None);
|
||||
bind.MaxReceivedMessageSize = 2147483647;
|
||||
bind.MaxBufferSize = 2147483647;
|
||||
|
||||
// Commented next statement since it is not required
|
||||
bind.MaxBufferPoolSize = 2147483647;
|
||||
bind.ReaderQuotas.MaxArrayLength = 2147483647;
|
||||
bind.ReaderQuotas.MaxBytesPerRead = 2147483647;
|
||||
bind.ReaderQuotas.MaxDepth = 2147483647;
|
||||
bind.ReaderQuotas.MaxStringContentLength = 2147483647;
|
||||
bind.ReaderQuotas.MaxNameTableCharCount = 2147483647;
|
||||
|
||||
connectionBinding = bind;
|
||||
}
|
||||
else
|
||||
{
|
||||
//by Socket
|
||||
var bind = new NetTcpBinding();
|
||||
bind.MaxReceivedMessageSize = 2147483647;
|
||||
bind.MaxBufferSize = 2147483647;
|
||||
|
||||
// Commented next statement since it is not required
|
||||
bind.MaxBufferPoolSize = 2147483647;
|
||||
bind.ReaderQuotas.MaxArrayLength = 2147483647;
|
||||
bind.ReaderQuotas.MaxBytesPerRead = 2147483647;
|
||||
bind.ReaderQuotas.MaxDepth = 2147483647;
|
||||
bind.ReaderQuotas.MaxStringContentLength = 2147483647;
|
||||
bind.ReaderQuotas.MaxNameTableCharCount = 2147483647;
|
||||
|
||||
connectionBinding = bind;
|
||||
}
|
||||
}
|
||||
|
||||
return connectionBinding;
|
||||
}
|
||||
|
||||
private void stop()
|
||||
{
|
||||
mExecutorManager.Stop();
|
||||
|
||||
lock (mHostLocker)
|
||||
{
|
||||
if (mHost == null)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
mHost.Close();
|
||||
}
|
||||
catch (TimeoutException)
|
||||
{
|
||||
mHost.Abort();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
finally
|
||||
{
|
||||
mHost = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (Stopped != null)
|
||||
{
|
||||
Stopped(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
private void expert_Deinited(object sender, EventArgs e)
|
||||
{
|
||||
MtExpert expert = (MtExpert)sender;
|
||||
int expertsCount = 0;
|
||||
|
||||
lock (mExpertsLocker)
|
||||
{
|
||||
mExperts.Remove(expert);
|
||||
|
||||
expertsCount = mExperts.Count();
|
||||
}
|
||||
|
||||
mExecutorManager.RemoveCommandExecutor(expert);
|
||||
|
||||
if (expert != null)
|
||||
{
|
||||
expert.Deinited -= expert_Deinited;
|
||||
expert.QuoteChanged -= expert_QuoteChanged;
|
||||
|
||||
mService.OnQuoteRemoved(expert.Quote);
|
||||
}
|
||||
|
||||
if (expertsCount == 0)
|
||||
{
|
||||
var stopTimer = new System.Timers.Timer();
|
||||
stopTimer.Elapsed += stopTimer_Elapsed;
|
||||
stopTimer.Interval = STOP_EXPERT_INTERVAL;
|
||||
stopTimer.Start();
|
||||
}
|
||||
}
|
||||
|
||||
void mExecutorManager_CommandExecuted(object sender, MtCommandExecuteEventArgs e)
|
||||
{
|
||||
EventWaitHandle responseWaiter = null;
|
||||
|
||||
lock (mResponseLocker)
|
||||
{
|
||||
if (mResponseWaiters.ContainsKey(e.Command) == true)
|
||||
{
|
||||
responseWaiter = mResponseWaiters[e.Command];
|
||||
mResponses[e.Command] = e.Response;
|
||||
}
|
||||
}
|
||||
|
||||
if (responseWaiter != null)
|
||||
{
|
||||
responseWaiter.Set();
|
||||
}
|
||||
}
|
||||
|
||||
private void expert_QuoteChanged(MtExpert expert, MtQuote quote)
|
||||
{
|
||||
mService.QuoteUpdate(quote);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
public event EventHandler Stopped;
|
||||
#endregion
|
||||
|
||||
#region IDispose
|
||||
public void Dispose()
|
||||
{
|
||||
stop();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Fields
|
||||
private readonly MtService mService;
|
||||
private ServiceHost mHost;
|
||||
|
||||
private readonly MtCommandExecutorManager mExecutorManager;
|
||||
private List<MtExpert> mExperts;
|
||||
|
||||
private readonly Dictionary<MtCommand, EventWaitHandle> mResponseWaiters = new Dictionary<MtCommand, EventWaitHandle>();
|
||||
private readonly Dictionary<MtCommand, MtResponse> mResponses = new Dictionary<MtCommand, MtResponse>();
|
||||
|
||||
private readonly object mResponseLocker = new object();
|
||||
private readonly object mHostLocker = new object();
|
||||
private readonly object mExpertsLocker = new object();
|
||||
private readonly object mCommandExecutorsLocker = new object();
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Executable
+190
@@ -0,0 +1,190 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.ServiceModel;
|
||||
using System.Net;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace MTApiService
|
||||
{
|
||||
public class MtServerInstance
|
||||
{
|
||||
#region Init_Instance
|
||||
|
||||
static readonly MtServerInstance mInstance = new MtServerInstance();
|
||||
|
||||
private MtServerInstance()
|
||||
{
|
||||
}
|
||||
|
||||
static MtServerInstance()
|
||||
{
|
||||
}
|
||||
|
||||
public static MtServerInstance GetInstance()
|
||||
{
|
||||
return mInstance;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Public Methods
|
||||
public void InitExpert(int expertHandle, string profileName, string symbol, double bid, double ask, IMetaTraderHandler mtHandler)
|
||||
{
|
||||
Debug.WriteLine("MtApiServerInstance::InitExpert: symbol = {0}, expertHandle = {1}, profileName = {2}", symbol, expertHandle, profileName);
|
||||
|
||||
if (profileName == null)
|
||||
{
|
||||
string errorMessage = string.Format("Connection profile is null or empty");
|
||||
throw new Exception(errorMessage);
|
||||
}
|
||||
|
||||
MtServer server = null;
|
||||
lock (mServersDictionary)
|
||||
{
|
||||
if (mServersDictionary.ContainsKey(profileName))
|
||||
{
|
||||
server = mServersDictionary[profileName];
|
||||
}
|
||||
else
|
||||
{
|
||||
var profile = MtRegistryManager.LoadConnectionProfile(profileName);
|
||||
|
||||
if (profile == null)
|
||||
{
|
||||
string errorMessage = string.Format("Connection profile '{0}' is not found", profileName);
|
||||
throw new Exception(errorMessage);
|
||||
}
|
||||
|
||||
server = new MtServer(profile);
|
||||
server.Stopped += new EventHandler(server_Stopped);
|
||||
|
||||
mServersDictionary[profile.Name] = server;
|
||||
|
||||
server.Start();
|
||||
}
|
||||
}
|
||||
|
||||
var expert = new MtExpert(expertHandle, new MtQuote(symbol, bid, ask), mtHandler);
|
||||
|
||||
lock(mExpertsDictionary)
|
||||
{
|
||||
mExpertsDictionary[expert.Handle] = expert;
|
||||
}
|
||||
|
||||
server.AddExpert(expert);
|
||||
}
|
||||
|
||||
public void DeinitExpert(int expertHandle)
|
||||
{
|
||||
Debug.WriteLine("MtApiServerInstance::DeinitExpert: expertHandle = {0}", expertHandle);
|
||||
|
||||
MtExpert expert = null;
|
||||
|
||||
lock (mExpertsDictionary)
|
||||
{
|
||||
if (mExpertsDictionary.ContainsKey(expertHandle) == true)
|
||||
{
|
||||
expert = mExpertsDictionary[expertHandle];
|
||||
mExpertsDictionary.Remove(expertHandle);
|
||||
}
|
||||
}
|
||||
|
||||
if (expert != null)
|
||||
{
|
||||
expert.Deinit();
|
||||
}
|
||||
}
|
||||
|
||||
public void SendQuote(int expertHandle, string symbol, double bid, double ask)
|
||||
{
|
||||
Debug.WriteLine("MtApiServerInstance::SendQuote: enter. symbol = {0}, bid = {1}, ask = {2}", symbol, bid, ask);
|
||||
|
||||
MtExpert expert = null;
|
||||
lock (mExpertsDictionary)
|
||||
{
|
||||
expert = mExpertsDictionary[expertHandle];
|
||||
}
|
||||
|
||||
if (expert != null)
|
||||
{
|
||||
expert.Quote = new MtQuote(symbol, bid, ask);
|
||||
}
|
||||
|
||||
Debug.WriteLine("MtApiServerInstance::SendQuote: finish.");
|
||||
}
|
||||
|
||||
public void SendResponse(int expertHandle, MtResponse response)
|
||||
{
|
||||
Debug.WriteLine("MtApiServerInstance::SendResponse: id = {0}, response = {1}", expertHandle, response);
|
||||
|
||||
MtExpert expert = null;
|
||||
lock (mExpertsDictionary)
|
||||
{
|
||||
expert = mExpertsDictionary[expertHandle];
|
||||
}
|
||||
|
||||
if (expert != null)
|
||||
{
|
||||
expert.SendResponse(response);
|
||||
}
|
||||
|
||||
Debug.WriteLine("MtApiServerInstance::SendResponse: finish");
|
||||
}
|
||||
|
||||
public int GetCommandType(int expertHandle)
|
||||
{
|
||||
Debug.WriteLine("MtApiServerInstance::GetCommandType: expertHandle = {0}", expertHandle);
|
||||
|
||||
MtExpert expert = null;
|
||||
lock (mExpertsDictionary)
|
||||
{
|
||||
expert = mExpertsDictionary[expertHandle];
|
||||
}
|
||||
|
||||
return (expert != null) ? expert.GetCommandType() : 0;
|
||||
}
|
||||
|
||||
public object GetCommandParameter(int expertHandle, int index)
|
||||
{
|
||||
Debug.WriteLine("MtApiServerInstance::GetCommandParameter: expertHandle = {0}, index = {1}", expertHandle, index);
|
||||
|
||||
MtExpert expert = null;
|
||||
lock (mExpertsDictionary)
|
||||
{
|
||||
expert = mExpertsDictionary[expertHandle];
|
||||
}
|
||||
|
||||
return (expert != null) ? expert.GetCommandParameter(index) : null;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
private void server_Stopped(object sender, EventArgs e)
|
||||
{
|
||||
MtServer server = (MtServer)sender;
|
||||
server.Stopped -= server_Stopped;
|
||||
|
||||
var profile = server.Profile;
|
||||
if (profile != null)
|
||||
{
|
||||
lock (mServersDictionary)
|
||||
{
|
||||
if (mServersDictionary.ContainsKey(profile.Name))
|
||||
{
|
||||
mServersDictionary.Remove(profile.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Fields
|
||||
private readonly MtRegistryManager mConnectionManager = new MtRegistryManager();
|
||||
private readonly Dictionary<string, MtServer> mServersDictionary = new Dictionary<string, MtServer>();
|
||||
private readonly Dictionary<int, MtExpert> mExpertsDictionary = new Dictionary<int, MtExpert>();
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Executable
+303
@@ -0,0 +1,303 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.ServiceModel;
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
|
||||
namespace MTApiService
|
||||
{
|
||||
[ServiceContract(CallbackContract = typeof(IMtApiCallback), SessionMode = SessionMode.Required)]
|
||||
public interface IMtApi
|
||||
{
|
||||
[OperationContract]
|
||||
bool Connect();
|
||||
|
||||
[OperationContract(IsOneWay = true)]
|
||||
void Disconnect();
|
||||
|
||||
[OperationContract]
|
||||
MtResponse SendCommand(MtCommand command);
|
||||
|
||||
[OperationContract]
|
||||
IEnumerable<MtQuote> GetQuotes();
|
||||
}
|
||||
|
||||
public interface IMtApiCallback
|
||||
{
|
||||
[OperationContract(IsOneWay = true)]
|
||||
void OnQuoteUpdate(MtQuote quote);
|
||||
|
||||
[OperationContract(IsOneWay = true)]
|
||||
void OnServerStopped();
|
||||
|
||||
[OperationContract(IsOneWay = true)]
|
||||
void OnQuoteAdded(MtQuote quote);
|
||||
|
||||
[OperationContract(IsOneWay = true)]
|
||||
void OnQuoteRemoved(MtQuote quote);
|
||||
}
|
||||
|
||||
[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple,
|
||||
AutomaticSessionShutdown = true,
|
||||
IncludeExceptionDetailInFaults = true,
|
||||
InstanceContextMode = InstanceContextMode.Single)]
|
||||
public sealed class MtService : IMtApi
|
||||
{
|
||||
public MtService(IMtApiServer serverCallback)
|
||||
{
|
||||
if (serverCallback == null)
|
||||
throw new ArgumentNullException("serverCallback");
|
||||
|
||||
mServer = serverCallback;
|
||||
}
|
||||
|
||||
#region IMtApi
|
||||
public bool Connect()
|
||||
{
|
||||
bool connected = false;
|
||||
|
||||
IMtApiCallback callback = OperationContext.Current.GetCallbackChannel<IMtApiCallback>();
|
||||
|
||||
if (callback != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
mClientsLocker.AcquireWriterLock(10000);
|
||||
|
||||
try
|
||||
{
|
||||
if (mClientCallbacks.Contains(callback) == false)
|
||||
mClientCallbacks.Add(callback);
|
||||
|
||||
connected = true;
|
||||
}
|
||||
finally
|
||||
{
|
||||
mClientsLocker.ReleaseWriterLock();
|
||||
}
|
||||
}
|
||||
catch (ApplicationException)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
return connected;
|
||||
}
|
||||
|
||||
public void Disconnect()
|
||||
{
|
||||
IMtApiCallback callback = OperationContext.Current.GetCallbackChannel<IMtApiCallback>();
|
||||
|
||||
if (callback != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
mClientsLocker.AcquireWriterLock(10000);
|
||||
|
||||
try
|
||||
{
|
||||
mClientCallbacks.Remove(callback);
|
||||
}
|
||||
finally
|
||||
{
|
||||
mClientsLocker.ReleaseWriterLock();
|
||||
}
|
||||
}
|
||||
catch (ApplicationException)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public MtResponse SendCommand(MtCommand command)
|
||||
{
|
||||
return mServer.SendCommand(command);
|
||||
}
|
||||
|
||||
public IEnumerable<MtQuote> GetQuotes()
|
||||
{
|
||||
return mServer.GetQuotes();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
public void OnStopServer()
|
||||
{
|
||||
try
|
||||
{
|
||||
mClientsLocker.AcquireReaderLock(2000);
|
||||
|
||||
try
|
||||
{
|
||||
foreach (var callback in mClientCallbacks)
|
||||
{
|
||||
try
|
||||
{
|
||||
callback.OnServerStopped();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
mClientsLocker.ReleaseReaderLock();
|
||||
}
|
||||
}
|
||||
catch (ApplicationException)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public void QuoteUpdate(MtQuote quote)
|
||||
{
|
||||
try
|
||||
{
|
||||
mClientsLocker.AcquireReaderLock(200);
|
||||
|
||||
List<IMtApiCallback> crashedClientsCallback = null;
|
||||
|
||||
try
|
||||
{
|
||||
foreach (var callback in mClientCallbacks)
|
||||
{
|
||||
try
|
||||
{
|
||||
callback.OnQuoteUpdate(quote);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
if (crashedClientsCallback == null)
|
||||
crashedClientsCallback = new List<IMtApiCallback>();
|
||||
|
||||
crashedClientsCallback.Add(callback);
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
mClientsLocker.ReleaseReaderLock();
|
||||
}
|
||||
|
||||
removeCrashedClientCallbacks(crashedClientsCallback);
|
||||
}
|
||||
catch (ApplicationException)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public void OnQuoteAdded(MtQuote quote)
|
||||
{
|
||||
try
|
||||
{
|
||||
mClientsLocker.AcquireReaderLock(2000);
|
||||
|
||||
List<IMtApiCallback> crashedClientsCallback = null;
|
||||
|
||||
try
|
||||
{
|
||||
foreach (var callback in mClientCallbacks)
|
||||
{
|
||||
try
|
||||
{
|
||||
callback.OnQuoteAdded(quote);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
if (crashedClientsCallback == null)
|
||||
crashedClientsCallback = new List<IMtApiCallback>();
|
||||
|
||||
crashedClientsCallback.Add(callback);
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
mClientsLocker.ReleaseReaderLock();
|
||||
}
|
||||
|
||||
removeCrashedClientCallbacks(crashedClientsCallback);
|
||||
}
|
||||
catch (ApplicationException)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public void OnQuoteRemoved(MtQuote quote)
|
||||
{
|
||||
try
|
||||
{
|
||||
mClientsLocker.AcquireReaderLock(2000);
|
||||
|
||||
List<IMtApiCallback> crashedClientsCallback = null;
|
||||
|
||||
try
|
||||
{
|
||||
foreach (var callback in mClientCallbacks)
|
||||
{
|
||||
try
|
||||
{
|
||||
callback.OnQuoteRemoved(quote);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
if (crashedClientsCallback == null)
|
||||
crashedClientsCallback = new List<IMtApiCallback>();
|
||||
|
||||
crashedClientsCallback.Add(callback);
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
mClientsLocker.ReleaseReaderLock();
|
||||
}
|
||||
|
||||
removeCrashedClientCallbacks(crashedClientsCallback);
|
||||
}
|
||||
catch (ApplicationException)
|
||||
{
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void removeCrashedClientCallbacks(List<IMtApiCallback> crashedClientCallbacks)
|
||||
{
|
||||
if (crashedClientCallbacks != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
mClientsLocker.AcquireWriterLock(200);
|
||||
|
||||
try
|
||||
{
|
||||
foreach (var crashedCallback in crashedClientCallbacks)
|
||||
{
|
||||
mClientCallbacks.Remove(crashedCallback);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
mClientsLocker.ReleaseWriterLock();
|
||||
}
|
||||
}
|
||||
catch (ApplicationException)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Fields
|
||||
private readonly IMtApiServer mServer;
|
||||
private readonly List<IMtApiCallback> mClientCallbacks = new List<IMtApiCallback>();
|
||||
private readonly ReaderWriterLock mClientsLocker = new ReaderWriterLock();
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Executable
+36
@@ -0,0 +1,36 @@
|
||||
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("MTApiService")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("DW")]
|
||||
[assembly: AssemblyProduct("MTApiService")]
|
||||
[assembly: AssemblyCopyright("Copyright © DW 2011")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("f1cc1516-9352-4ddd-811a-c5fc842b12d4")]
|
||||
|
||||
// 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.12.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.12.0")]
|
||||
Executable
+40
@@ -0,0 +1,40 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
using namespace System;
|
||||
using namespace System::Reflection;
|
||||
using namespace System::Runtime::CompilerServices;
|
||||
using namespace System::Runtime::InteropServices;
|
||||
using namespace System::Security::Permissions;
|
||||
|
||||
//
|
||||
// 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:AssemblyTitleAttribute("MTConnector")];
|
||||
[assembly:AssemblyDescriptionAttribute("")];
|
||||
[assembly:AssemblyConfigurationAttribute("")];
|
||||
[assembly:AssemblyCompanyAttribute("DW")];
|
||||
[assembly:AssemblyProductAttribute("MTConnector")];
|
||||
[assembly:AssemblyCopyrightAttribute("Copyright (c) DW 2011")];
|
||||
[assembly:AssemblyTrademarkAttribute("")];
|
||||
[assembly:AssemblyCultureAttribute("")];
|
||||
|
||||
//
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the value or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly:AssemblyVersionAttribute("1.0.*")];
|
||||
|
||||
[assembly:ComVisible(false)];
|
||||
|
||||
[assembly:CLSCompliantAttribute(true)];
|
||||
|
||||
[assembly:SecurityPermission(SecurityAction::RequestMinimum, UnmanagedCode = true)];
|
||||
Executable
+6
@@ -0,0 +1,6 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "FastMtServer.h"
|
||||
|
||||
using namespace System;
|
||||
|
||||
Executable
+84
@@ -0,0 +1,84 @@
|
||||
// FastMtServer.h
|
||||
|
||||
#pragma once
|
||||
|
||||
using namespace MetaTraderApi;
|
||||
|
||||
public class FastMtServer
|
||||
{
|
||||
public:
|
||||
static FastMtServer& const Instance()
|
||||
{
|
||||
static FastMtServer theSingleInstance;
|
||||
return theSingleInstance;
|
||||
}
|
||||
|
||||
public void Init(string user, int accountId, int connectionAttemt);
|
||||
public void Start(string symbol, double bid, double ask);
|
||||
public void Stop();
|
||||
public void SendQuote(string symbol, double bid, double ask);
|
||||
|
||||
private:
|
||||
FastMtServer(){}
|
||||
FastMtServer(OnlyOne& root){}
|
||||
|
||||
|
||||
public void Init(string user, int accountId, int connectionAttemt)
|
||||
{
|
||||
Logger.Instance.Write("FastMtQuoteServer::Init");
|
||||
|
||||
if (_mtServer == null)
|
||||
{
|
||||
var initServerName = user + accountId.ToString();
|
||||
_mtServer = new QuoteServer(initServerName, connectionAttemt);
|
||||
_mtServer.ConnectionStatusUpdated +=new ConnectionStatusEventHandler(_mtServer_ConnectionStatusUpdated);
|
||||
}
|
||||
}
|
||||
|
||||
public void Start(string symbol, double bid, double ask)
|
||||
{
|
||||
Logger.Instance.Write("FastMtQuoteServer::Start");
|
||||
|
||||
_startSymbol = symbol;
|
||||
_startBid = bid;
|
||||
_startAsk = ask;
|
||||
|
||||
_mtServer.Start();
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
Logger.Instance.Write("FastMtQuoteServer::Init");
|
||||
|
||||
_mtServer.Stop();
|
||||
}
|
||||
|
||||
public void SendQuote(string symbol, double bid, double ask)
|
||||
{
|
||||
Logger.Instance.Write("FastMtQuoteServer::SendQuote");
|
||||
|
||||
_mtServer.SendNewQuote(symbol, bid, ask);
|
||||
}
|
||||
|
||||
void _mtServer_ConnectionStatusUpdated(object sender, ConnectionStatusType connectionStatus)
|
||||
{
|
||||
Logger.Instance.Write("FastMtQuoteServer::_mtServer_ConnectionStatusUpdated: status = " + connectionStatus.ToString());
|
||||
|
||||
if (connectionStatus == ConnectionStatusType.Connected && _mtServer != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
SendQuote(_startSymbol, _startBid, _startAsk);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Instance.Write("FastMtQuoteServer::_mtServer_ConnectionStatusUpdated: Error = " + ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private QuoteServer _mtServer;
|
||||
private string _startSymbol = string.Empty;
|
||||
private double _startBid;
|
||||
private double _startAsk;
|
||||
}
|
||||
Executable
+24
@@ -0,0 +1,24 @@
|
||||
//MT4Handler.h
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Windows.h>
|
||||
|
||||
using namespace MTApiService;
|
||||
|
||||
ref class MT4Handler: IMetaTraderHandler
|
||||
{
|
||||
public:
|
||||
MT4Handler()
|
||||
{
|
||||
msgId = RegisterWindowMessage("MetaTrader4_Internal_Message");
|
||||
}
|
||||
|
||||
virtual void SendTickToMetaTrader(int handle)
|
||||
{
|
||||
PostMessage((HWND)handle, msgId, 2, 1);
|
||||
}
|
||||
|
||||
private:
|
||||
unsigned int msgId;
|
||||
};
|
||||
Executable
+253
@@ -0,0 +1,253 @@
|
||||
// This is the main DLL file.
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "MT4Handler.h"
|
||||
#include "Windows.h"
|
||||
|
||||
using namespace System;
|
||||
using namespace MTApiService;
|
||||
using namespace System::Runtime::InteropServices;
|
||||
using namespace System::Reflection;
|
||||
using namespace System::Security::Cryptography;
|
||||
using namespace System::Security;
|
||||
using namespace System::Text;
|
||||
using namespace System::IO;
|
||||
using namespace System::Collections::Generic;
|
||||
using namespace System::Diagnostics;
|
||||
|
||||
struct MqlStr
|
||||
{
|
||||
};
|
||||
|
||||
void mqlStrFromNetStr(MqlStr* dst, String^ src)
|
||||
{
|
||||
char* numPtr2 = *((char**) (dst + 4));
|
||||
char* numPtr = (char*) Marshal::StringToHGlobalAnsi(src).ToPointer();
|
||||
int num = strlen(numPtr);
|
||||
int num2 = 0x80;
|
||||
if (num >= num2)
|
||||
{
|
||||
num = num2 - 1;
|
||||
}
|
||||
strncpy_s(numPtr2, (unsigned int) num2, numPtr, (unsigned int) num);
|
||||
Marshal::FreeHGlobal((IntPtr) numPtr);
|
||||
*((int*) dst) = num;
|
||||
}
|
||||
|
||||
int _stdcall initExpert(int expertHandle, char* connectionProfile, char* symbol, double bid, double ask, MqlStr* err)
|
||||
{
|
||||
try
|
||||
{
|
||||
MT4Handler^ mtHandler = gcnew MT4Handler();
|
||||
|
||||
MtServerInstance::GetInstance()->InitExpert(expertHandle, gcnew String(connectionProfile), gcnew String(symbol), bid, ask, mtHandler);
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
mqlStrFromNetStr(err, e->Message);
|
||||
Debug::WriteLine("[ERROR] MTConnector:initExpert(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _stdcall deinitExpert(int expertHandle, MqlStr* err)
|
||||
{
|
||||
try
|
||||
{
|
||||
MtServerInstance::GetInstance()->DeinitExpert(expertHandle);
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
mqlStrFromNetStr(err, e->Message);
|
||||
Debug::WriteLine("[ERROR] MTConnector:deinitExpert(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _stdcall updateQuote(int expertHandle, char* symbol, double bid, double ask, MqlStr* err)
|
||||
{
|
||||
try
|
||||
{
|
||||
MtServerInstance::GetInstance()->SendQuote(expertHandle, gcnew String(symbol), bid, ask);
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
mqlStrFromNetStr(err, e->Message);
|
||||
Debug::WriteLine("[ERROR] MTConnector:updateQuote(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _stdcall sendIntResponse(int expertHandle, int response)
|
||||
{
|
||||
try
|
||||
{
|
||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseInt(response));
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MTConnector:sendIntResponse(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _stdcall sendBooleanResponse(int expertHandle, int response)
|
||||
{
|
||||
try
|
||||
{
|
||||
bool value = (response != 0) ? true : false;
|
||||
|
||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseBool(value));
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MTConnector:sendBooleanResponse(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _stdcall sendDoubleResponse(int expertHandle, double response)
|
||||
{
|
||||
try
|
||||
{
|
||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseDouble(response));
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MTConnector:sendDoubleResponse(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _stdcall sendStringResponse(int expertHandle, char* response)
|
||||
{
|
||||
try
|
||||
{
|
||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseString(gcnew String(response)));
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MTConnector:sendStringResponse(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _stdcall sendVoidResponse(int expertHandle)
|
||||
{
|
||||
try
|
||||
{
|
||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, nullptr);
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MTConnector:sendVoidResponse(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _stdcall sendDoubleArrayResponse(int expertHandle, double* values, int size)
|
||||
{
|
||||
try
|
||||
{
|
||||
array<double>^ list = gcnew array<double>(size);
|
||||
|
||||
for(int i = 0; i < size; i++)
|
||||
{
|
||||
list[i] = values[i];
|
||||
}
|
||||
|
||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseDoubleArray(list));
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MTConnector:sendDoubleArrayResponse(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _stdcall sendIntArrayResponse(int expertHandle, int* values, int size)
|
||||
{
|
||||
try
|
||||
{
|
||||
array<int>^ list = gcnew array<int>(size);
|
||||
|
||||
for(int i = 0; i < size; i++)
|
||||
{
|
||||
list[i] = values[i];
|
||||
}
|
||||
|
||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseIntArray(list));
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MTConnector:sendIntArrayResponse(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _stdcall getCommandType(int expertHandle, int* res)
|
||||
{
|
||||
try
|
||||
{
|
||||
*res = MtServerInstance::GetInstance()->GetCommandType(expertHandle);
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MTConnector:getCommandType(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _stdcall getIntValue(int expertHandle, int paramIndex, int* res)
|
||||
{
|
||||
try
|
||||
{
|
||||
*res = (int)MtServerInstance::GetInstance()->GetCommandParameter(expertHandle, paramIndex);
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MTConnector:getIntValue(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _stdcall getDoubleValue(int expertHandle, int paramIndex, double* res)
|
||||
{
|
||||
try
|
||||
{
|
||||
*res = (double)MtServerInstance::GetInstance()->GetCommandParameter(expertHandle, paramIndex);
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MTConnector:getDoubleValue(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _stdcall getStringValue(int expertHandle, int paramIndex, MqlStr* res)
|
||||
{
|
||||
try
|
||||
{
|
||||
mqlStrFromNetStr(res, (String^)MtServerInstance::GetInstance()->GetCommandParameter(expertHandle, paramIndex));
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MTConnector:getStringValue(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
Executable
+16
@@ -0,0 +1,16 @@
|
||||
LIBRARY MTConnector
|
||||
|
||||
EXPORTS initExpert
|
||||
deinitExpert
|
||||
updateQuote
|
||||
sendIntResponse
|
||||
sendBooleanResponse
|
||||
sendDoubleResponse
|
||||
sendStringResponse
|
||||
sendVoidResponse
|
||||
sendDoubleArrayResponse
|
||||
sendIntArrayResponse
|
||||
getCommandType
|
||||
getIntValue
|
||||
getDoubleValue
|
||||
getStringValue
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
// MTInterface.h
|
||||
|
||||
#pragma once
|
||||
Executable
+176
@@ -0,0 +1,176 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{2BE5FAC1-7FB7-45C3-9215-31A5BC4B964F}</ProjectGuid>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<Keyword>ManagedCProj</Keyword>
|
||||
<RootNamespace>MTConnector</RootNamespace>
|
||||
<ProjectName>MTConnector</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CLRSupport>true</CLRSupport>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CLRSupport>true</CLRSupport>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<CLRSupport>true</CLRSupport>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<CLRSupport>true</CLRSupport>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>user32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>.\MTConnector.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>
|
||||
</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>.\MTConnector.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>user32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>.\MTConnector.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>
|
||||
</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>.\MTConnector.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="MT4Handler.h" />
|
||||
<ClInclude Include="MTConnector.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="Stdafx.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="AssemblyInfo.cpp" />
|
||||
<ClCompile Include="MTConnector.cpp" />
|
||||
<ClCompile Include="Stdafx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.ico" />
|
||||
<None Include="MTConnector.def" />
|
||||
<None Include="ReadMe.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="app.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="cl.resx" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MTApiService\MTApiService.csproj">
|
||||
<Project>{de76d5c7-b99c-4467-8408-78173bdd84e0}</Project>
|
||||
<Private>true</Private>
|
||||
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
<LinkLibraryDependencies>true</LinkLibraryDependencies>
|
||||
<UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
Executable
+61
@@ -0,0 +1,61 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Stdafx.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="resource.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="MTConnector.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="MT4Handler.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="AssemblyInfo.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Stdafx.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="MTConnector.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="ReadMe.txt" />
|
||||
<None Include="app.ico">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
<None Include="MTConnector.def">
|
||||
<Filter>Source Files</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="app.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="cl.resx">
|
||||
<Filter>Resource Files</Filter>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Executable
+38
@@ -0,0 +1,38 @@
|
||||
========================================================================
|
||||
DYNAMIC LINK LIBRARY : MTInterface Project Overview
|
||||
========================================================================
|
||||
|
||||
AppWizard has created this MTInterface DLL for you.
|
||||
|
||||
This file contains a summary of what you will find in each of the files that
|
||||
make up your MTInterface application.
|
||||
|
||||
MTConnector.vcxproj
|
||||
This is the main project file for VC++ projects generated using an Application Wizard.
|
||||
It contains information about the version of Visual C++ that generated the file, and
|
||||
information about the platforms, configurations, and project features selected with the
|
||||
Application Wizard.
|
||||
|
||||
MTConnector.vcxproj.filters
|
||||
This is the filters file for VC++ projects generated using an Application Wizard.
|
||||
It contains information about the association between the files in your project
|
||||
and the filters. This association is used in the IDE to show grouping of files with
|
||||
similar extensions under a specific node (for e.g. ".cpp" files are associated with the
|
||||
"Source Files" filter).
|
||||
|
||||
MTConnector.cpp
|
||||
This is the main DLL source file.
|
||||
|
||||
MTConnector.h
|
||||
This file contains a class declaration.
|
||||
|
||||
AssemblyInfo.cpp
|
||||
Contains custom attributes for modifying assembly metadata.
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
Other notes:
|
||||
|
||||
AppWizard uses "TODO:" to indicate parts of the source code you
|
||||
should add to or customize.
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
// stdafx.cpp : source file that includes just the standard includes
|
||||
// MTInterface.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
#include "stdafx.h"
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
// stdafx.h : include file for standard system include files,
|
||||
// or project specific include files that are used frequently,
|
||||
// but are changed infrequently
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
Executable
BIN
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
Executable
BIN
Binary file not shown.
Executable
+123
@@ -0,0 +1,123 @@
|
||||
<?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>
|
||||
<data name="cl" xml:space="preserve">
|
||||
<value><DSAKeyValue><P>zsWGfys+BVgKRGGHRomUNxqW8ZxFO5lyM7Ympezl1bnPt0omadp1cuNvj4tZeyl2f48R0JBTO+Mb0to8llcNM7OPsXsQ/OFx5ZLtqYXfJZa1bkAo6/oxMCwfnV38RoL+uD+ReYapxz103lb+uPs0YD0P4C309mT8A5Waw+8pgA0=</P><Q>xQJuBVwVQIfUua94ecd23ut/5cM=</Q><G>ckHcaUplSwxE4zYHzmvH5tWI/Vfqg5ICZJd2cs4/F9UK3ozwPZBB45wzlmUyq+k/OvlcU6yVU7rE5xkuQ8SNmbbWuUlYps2l433Shb+gfqlTx+9EpL5A+JyQgLpCBbXgTom8qaXxSli8qEgrCL2AhAwa13L69H6SBhS+nEGpiDo=</G><Y>UubhL21SLPxwDe7Ut6FjiijZJqHsA273kPAb/naCjMj3yEHfKohNm9VKrVGgkThHxFzaKR3e3tdxG1mabNaFw71ymb2U4xRIQWd+MHlAJ9kfzErvWhMKIWhYRDRXkE3P3jbUkGhqGzwf2hQcA/DnuvnHPm2mSysFD2WXhgegDxg=</Y><J>AAAAAQyvZjXFTgVFhj3r0I//mU8F/id3SMwSukACFdh5MAHaltgG5vAFLleynZ3+oMUkBGu5jocNU9WDk0NimfV5hznwWANikMo52tW5RdeYiwaTWVcAuKm7VKq/b2cXSEtMzqSjL3S8FDwjKPrjBA==</J><Seed>RxdWNxdlKyI6FxK1n64fJJPJrgA=</Seed><PgenCounter>Dw==</PgenCounter></DSAKeyValue></value>
|
||||
</data>
|
||||
</root>
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by app.rc
|
||||
Executable
+300
@@ -0,0 +1,300 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestServer", "TestServer\TestServer.csproj", "{220F01DF-8489-44F3-9C79-D5AFFCE94D6B}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestApiClientUI", "TestApiClientUI\TestApiClientUI.csproj", "{663CC515-EAAE-47D4-8933-5008C2DA1160}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Licensing", "Licensing\Licensing.csproj", "{21FA6E21-EE5D-4A84-B0ED-E1D8876B41FB}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MTApiService", "MTApiService\MTApiService.csproj", "{DE76D5C7-B99C-4467-8408-78173BDD84E0}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MTConnector", "MTConnector\MTConnector.vcxproj", "{2BE5FAC1-7FB7-45C3-9215-31A5BC4B964F}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MtApi", "MtApi\MtApi.csproj", "{7A76C388-A8FB-4949-8170-24D4742E934E}"
|
||||
EndProject
|
||||
Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "MtApiSetup", "MtApiSetup\MtApiSetup.vdproj", "{8643FC04-7FD6-45E8-B341-3775F57C3B6D}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MtApi5", "MtApi5\MtApi5.csproj", "{AC8B5010-DA75-477E-9CA5-547C649E12D8}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MT5Connector", "MT5Connector\MT5Connector.vcxproj", "{CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MtApi5TestClient", "MtApi5TestClient\MtApi5TestClient.csproj", "{38B9C657-BC2F-44F0-8824-54B31F2A64F5}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConnectionsManager", "ConnectionsManager\ConnectionsManager.csproj", "{C8751BA1-6A85-468C-87BD-758F37B8C0DD}"
|
||||
EndProject
|
||||
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "TestMtApi", "TestMtApi\TestMtApi\TestMtApi.vbproj", "{EB7C228D-9494-4985-845E-B8312450DF3D}"
|
||||
EndProject
|
||||
Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "MtApi5Setup_x64", "MtApi5Setup_x64\MtApi5Setup_x64.vdproj", "{E86F9CEB-2255-40D0-AF59-E89DEF6752BE}"
|
||||
EndProject
|
||||
Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "MtApi5Setup_x86", "MtApi5Setup_x86\MtApi5Setup_x86.vdproj", "{84516D9A-0CEC-4C64-B200-E9D78BBA52FD}"
|
||||
EndProject
|
||||
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "MtApiInstaller", "MtApiInstaller\MtApiInstaller.wixproj", "{78B94552-DB17-40EC-B7C6-23D32DB85DC1}"
|
||||
EndProject
|
||||
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "MtApi5Installer", "MtApi5Installer\MtApi5Installer.wixproj", "{A9ED070F-AB4D-4380-9DDE-5D931AC71333}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|Mixed Platforms = Debug|Mixed Platforms
|
||||
Debug|Win32 = Debug|Win32
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|Mixed Platforms = Release|Mixed Platforms
|
||||
Release|Win32 = Release|Win32
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{220F01DF-8489-44F3-9C79-D5AFFCE94D6B}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||
{220F01DF-8489-44F3-9C79-D5AFFCE94D6B}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
|
||||
{220F01DF-8489-44F3-9C79-D5AFFCE94D6B}.Debug|Mixed Platforms.Build.0 = Debug|x86
|
||||
{220F01DF-8489-44F3-9C79-D5AFFCE94D6B}.Debug|Win32.ActiveCfg = Debug|x86
|
||||
{220F01DF-8489-44F3-9C79-D5AFFCE94D6B}.Debug|x64.ActiveCfg = Debug|x86
|
||||
{220F01DF-8489-44F3-9C79-D5AFFCE94D6B}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{220F01DF-8489-44F3-9C79-D5AFFCE94D6B}.Debug|x86.Build.0 = Debug|x86
|
||||
{220F01DF-8489-44F3-9C79-D5AFFCE94D6B}.Release|Any CPU.ActiveCfg = Release|x86
|
||||
{220F01DF-8489-44F3-9C79-D5AFFCE94D6B}.Release|Mixed Platforms.ActiveCfg = Release|x86
|
||||
{220F01DF-8489-44F3-9C79-D5AFFCE94D6B}.Release|Mixed Platforms.Build.0 = Release|x86
|
||||
{220F01DF-8489-44F3-9C79-D5AFFCE94D6B}.Release|Win32.ActiveCfg = Release|x86
|
||||
{220F01DF-8489-44F3-9C79-D5AFFCE94D6B}.Release|x64.ActiveCfg = Release|x86
|
||||
{220F01DF-8489-44F3-9C79-D5AFFCE94D6B}.Release|x86.ActiveCfg = Release|x86
|
||||
{220F01DF-8489-44F3-9C79-D5AFFCE94D6B}.Release|x86.Build.0 = Release|x86
|
||||
{663CC515-EAAE-47D4-8933-5008C2DA1160}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||
{663CC515-EAAE-47D4-8933-5008C2DA1160}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
|
||||
{663CC515-EAAE-47D4-8933-5008C2DA1160}.Debug|Mixed Platforms.Build.0 = Debug|x86
|
||||
{663CC515-EAAE-47D4-8933-5008C2DA1160}.Debug|Win32.ActiveCfg = Debug|x86
|
||||
{663CC515-EAAE-47D4-8933-5008C2DA1160}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{663CC515-EAAE-47D4-8933-5008C2DA1160}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{663CC515-EAAE-47D4-8933-5008C2DA1160}.Debug|x86.Build.0 = Debug|x86
|
||||
{663CC515-EAAE-47D4-8933-5008C2DA1160}.Release|Any CPU.ActiveCfg = Release|x86
|
||||
{663CC515-EAAE-47D4-8933-5008C2DA1160}.Release|Mixed Platforms.ActiveCfg = Release|x86
|
||||
{663CC515-EAAE-47D4-8933-5008C2DA1160}.Release|Mixed Platforms.Build.0 = Release|x86
|
||||
{663CC515-EAAE-47D4-8933-5008C2DA1160}.Release|Win32.ActiveCfg = Release|x86
|
||||
{663CC515-EAAE-47D4-8933-5008C2DA1160}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{663CC515-EAAE-47D4-8933-5008C2DA1160}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{21FA6E21-EE5D-4A84-B0ED-E1D8876B41FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{21FA6E21-EE5D-4A84-B0ED-E1D8876B41FB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{21FA6E21-EE5D-4A84-B0ED-E1D8876B41FB}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{21FA6E21-EE5D-4A84-B0ED-E1D8876B41FB}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{21FA6E21-EE5D-4A84-B0ED-E1D8876B41FB}.Debug|Win32.ActiveCfg = Debug|Any CPU
|
||||
{21FA6E21-EE5D-4A84-B0ED-E1D8876B41FB}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{21FA6E21-EE5D-4A84-B0ED-E1D8876B41FB}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{21FA6E21-EE5D-4A84-B0ED-E1D8876B41FB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{21FA6E21-EE5D-4A84-B0ED-E1D8876B41FB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{21FA6E21-EE5D-4A84-B0ED-E1D8876B41FB}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{21FA6E21-EE5D-4A84-B0ED-E1D8876B41FB}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{21FA6E21-EE5D-4A84-B0ED-E1D8876B41FB}.Release|Win32.ActiveCfg = Release|Any CPU
|
||||
{21FA6E21-EE5D-4A84-B0ED-E1D8876B41FB}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{21FA6E21-EE5D-4A84-B0ED-E1D8876B41FB}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{DE76D5C7-B99C-4467-8408-78173BDD84E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{DE76D5C7-B99C-4467-8408-78173BDD84E0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DE76D5C7-B99C-4467-8408-78173BDD84E0}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{DE76D5C7-B99C-4467-8408-78173BDD84E0}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{DE76D5C7-B99C-4467-8408-78173BDD84E0}.Debug|Win32.ActiveCfg = Debug|Any CPU
|
||||
{DE76D5C7-B99C-4467-8408-78173BDD84E0}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{DE76D5C7-B99C-4467-8408-78173BDD84E0}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{DE76D5C7-B99C-4467-8408-78173BDD84E0}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{DE76D5C7-B99C-4467-8408-78173BDD84E0}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{DE76D5C7-B99C-4467-8408-78173BDD84E0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DE76D5C7-B99C-4467-8408-78173BDD84E0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{DE76D5C7-B99C-4467-8408-78173BDD84E0}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{DE76D5C7-B99C-4467-8408-78173BDD84E0}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{DE76D5C7-B99C-4467-8408-78173BDD84E0}.Release|Win32.ActiveCfg = Release|Any CPU
|
||||
{DE76D5C7-B99C-4467-8408-78173BDD84E0}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{DE76D5C7-B99C-4467-8408-78173BDD84E0}.Release|x64.Build.0 = Release|Any CPU
|
||||
{DE76D5C7-B99C-4467-8408-78173BDD84E0}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{DE76D5C7-B99C-4467-8408-78173BDD84E0}.Release|x86.Build.0 = Release|Any CPU
|
||||
{2BE5FAC1-7FB7-45C3-9215-31A5BC4B964F}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||
{2BE5FAC1-7FB7-45C3-9215-31A5BC4B964F}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||
{2BE5FAC1-7FB7-45C3-9215-31A5BC4B964F}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
||||
{2BE5FAC1-7FB7-45C3-9215-31A5BC4B964F}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{2BE5FAC1-7FB7-45C3-9215-31A5BC4B964F}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{2BE5FAC1-7FB7-45C3-9215-31A5BC4B964F}.Debug|x64.ActiveCfg = Debug|Win32
|
||||
{2BE5FAC1-7FB7-45C3-9215-31A5BC4B964F}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{2BE5FAC1-7FB7-45C3-9215-31A5BC4B964F}.Debug|x86.Build.0 = Debug|Win32
|
||||
{2BE5FAC1-7FB7-45C3-9215-31A5BC4B964F}.Release|Any CPU.ActiveCfg = Release|Win32
|
||||
{2BE5FAC1-7FB7-45C3-9215-31A5BC4B964F}.Release|Mixed Platforms.ActiveCfg = Release|x64
|
||||
{2BE5FAC1-7FB7-45C3-9215-31A5BC4B964F}.Release|Mixed Platforms.Build.0 = Release|x64
|
||||
{2BE5FAC1-7FB7-45C3-9215-31A5BC4B964F}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{2BE5FAC1-7FB7-45C3-9215-31A5BC4B964F}.Release|Win32.Build.0 = Release|Win32
|
||||
{2BE5FAC1-7FB7-45C3-9215-31A5BC4B964F}.Release|x64.ActiveCfg = Release|Win32
|
||||
{2BE5FAC1-7FB7-45C3-9215-31A5BC4B964F}.Release|x86.ActiveCfg = Release|Win32
|
||||
{2BE5FAC1-7FB7-45C3-9215-31A5BC4B964F}.Release|x86.Build.0 = Release|Win32
|
||||
{7A76C388-A8FB-4949-8170-24D4742E934E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{7A76C388-A8FB-4949-8170-24D4742E934E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{7A76C388-A8FB-4949-8170-24D4742E934E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{7A76C388-A8FB-4949-8170-24D4742E934E}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{7A76C388-A8FB-4949-8170-24D4742E934E}.Debug|Win32.ActiveCfg = Debug|Any CPU
|
||||
{7A76C388-A8FB-4949-8170-24D4742E934E}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{7A76C388-A8FB-4949-8170-24D4742E934E}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{7A76C388-A8FB-4949-8170-24D4742E934E}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{7A76C388-A8FB-4949-8170-24D4742E934E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{7A76C388-A8FB-4949-8170-24D4742E934E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{7A76C388-A8FB-4949-8170-24D4742E934E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{7A76C388-A8FB-4949-8170-24D4742E934E}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{7A76C388-A8FB-4949-8170-24D4742E934E}.Release|Win32.ActiveCfg = Release|Any CPU
|
||||
{7A76C388-A8FB-4949-8170-24D4742E934E}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{7A76C388-A8FB-4949-8170-24D4742E934E}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{7A76C388-A8FB-4949-8170-24D4742E934E}.Release|x86.Build.0 = Release|Any CPU
|
||||
{8643FC04-7FD6-45E8-B341-3775F57C3B6D}.Debug|Any CPU.ActiveCfg = Debug
|
||||
{8643FC04-7FD6-45E8-B341-3775F57C3B6D}.Debug|Any CPU.Build.0 = Debug
|
||||
{8643FC04-7FD6-45E8-B341-3775F57C3B6D}.Debug|Mixed Platforms.ActiveCfg = Debug
|
||||
{8643FC04-7FD6-45E8-B341-3775F57C3B6D}.Debug|Mixed Platforms.Build.0 = Debug
|
||||
{8643FC04-7FD6-45E8-B341-3775F57C3B6D}.Debug|Win32.ActiveCfg = Debug
|
||||
{8643FC04-7FD6-45E8-B341-3775F57C3B6D}.Debug|Win32.Build.0 = Debug
|
||||
{8643FC04-7FD6-45E8-B341-3775F57C3B6D}.Debug|x64.ActiveCfg = Debug
|
||||
{8643FC04-7FD6-45E8-B341-3775F57C3B6D}.Debug|x86.ActiveCfg = Debug
|
||||
{8643FC04-7FD6-45E8-B341-3775F57C3B6D}.Debug|x86.Build.0 = Debug
|
||||
{8643FC04-7FD6-45E8-B341-3775F57C3B6D}.Release|Any CPU.ActiveCfg = Release
|
||||
{8643FC04-7FD6-45E8-B341-3775F57C3B6D}.Release|Any CPU.Build.0 = Release
|
||||
{8643FC04-7FD6-45E8-B341-3775F57C3B6D}.Release|Mixed Platforms.ActiveCfg = Release
|
||||
{8643FC04-7FD6-45E8-B341-3775F57C3B6D}.Release|Win32.ActiveCfg = Release
|
||||
{8643FC04-7FD6-45E8-B341-3775F57C3B6D}.Release|Win32.Build.0 = Release
|
||||
{8643FC04-7FD6-45E8-B341-3775F57C3B6D}.Release|x64.ActiveCfg = Release
|
||||
{8643FC04-7FD6-45E8-B341-3775F57C3B6D}.Release|x86.ActiveCfg = Release
|
||||
{8643FC04-7FD6-45E8-B341-3775F57C3B6D}.Release|x86.Build.0 = Release
|
||||
{AC8B5010-DA75-477E-9CA5-547C649E12D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AC8B5010-DA75-477E-9CA5-547C649E12D8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AC8B5010-DA75-477E-9CA5-547C649E12D8}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{AC8B5010-DA75-477E-9CA5-547C649E12D8}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{AC8B5010-DA75-477E-9CA5-547C649E12D8}.Debug|Win32.ActiveCfg = Debug|Any CPU
|
||||
{AC8B5010-DA75-477E-9CA5-547C649E12D8}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{AC8B5010-DA75-477E-9CA5-547C649E12D8}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{AC8B5010-DA75-477E-9CA5-547C649E12D8}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{AC8B5010-DA75-477E-9CA5-547C649E12D8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AC8B5010-DA75-477E-9CA5-547C649E12D8}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AC8B5010-DA75-477E-9CA5-547C649E12D8}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{AC8B5010-DA75-477E-9CA5-547C649E12D8}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{AC8B5010-DA75-477E-9CA5-547C649E12D8}.Release|Win32.ActiveCfg = Release|Any CPU
|
||||
{AC8B5010-DA75-477E-9CA5-547C649E12D8}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{AC8B5010-DA75-477E-9CA5-547C649E12D8}.Release|x64.Build.0 = Release|Any CPU
|
||||
{AC8B5010-DA75-477E-9CA5-547C649E12D8}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{AC8B5010-DA75-477E-9CA5-547C649E12D8}.Release|x86.Build.0 = Release|Any CPU
|
||||
{CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||
{CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||
{CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
||||
{CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}.Debug|x64.Build.0 = Debug|x64
|
||||
{CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}.Release|Any CPU.ActiveCfg = Release|Win32
|
||||
{CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}.Release|Mixed Platforms.ActiveCfg = Release|x64
|
||||
{CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}.Release|Mixed Platforms.Build.0 = Release|x64
|
||||
{CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}.Release|Win32.Build.0 = Release|Win32
|
||||
{CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}.Release|x64.ActiveCfg = Release|x64
|
||||
{CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}.Release|x64.Build.0 = Release|x64
|
||||
{CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}.Release|x86.ActiveCfg = Release|Win32
|
||||
{CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}.Release|x86.Build.0 = Release|Win32
|
||||
{38B9C657-BC2F-44F0-8824-54B31F2A64F5}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||
{38B9C657-BC2F-44F0-8824-54B31F2A64F5}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
|
||||
{38B9C657-BC2F-44F0-8824-54B31F2A64F5}.Debug|Mixed Platforms.Build.0 = Debug|x86
|
||||
{38B9C657-BC2F-44F0-8824-54B31F2A64F5}.Debug|Win32.ActiveCfg = Debug|x86
|
||||
{38B9C657-BC2F-44F0-8824-54B31F2A64F5}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{38B9C657-BC2F-44F0-8824-54B31F2A64F5}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{38B9C657-BC2F-44F0-8824-54B31F2A64F5}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{38B9C657-BC2F-44F0-8824-54B31F2A64F5}.Release|Any CPU.ActiveCfg = Release|x86
|
||||
{38B9C657-BC2F-44F0-8824-54B31F2A64F5}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{38B9C657-BC2F-44F0-8824-54B31F2A64F5}.Release|Win32.ActiveCfg = Release|x86
|
||||
{38B9C657-BC2F-44F0-8824-54B31F2A64F5}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{38B9C657-BC2F-44F0-8824-54B31F2A64F5}.Release|x86.ActiveCfg = Release|x86
|
||||
{C8751BA1-6A85-468C-87BD-758F37B8C0DD}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||
{C8751BA1-6A85-468C-87BD-758F37B8C0DD}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
|
||||
{C8751BA1-6A85-468C-87BD-758F37B8C0DD}.Debug|Mixed Platforms.Build.0 = Debug|x86
|
||||
{C8751BA1-6A85-468C-87BD-758F37B8C0DD}.Debug|Win32.ActiveCfg = Debug|x86
|
||||
{C8751BA1-6A85-468C-87BD-758F37B8C0DD}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{C8751BA1-6A85-468C-87BD-758F37B8C0DD}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{C8751BA1-6A85-468C-87BD-758F37B8C0DD}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{C8751BA1-6A85-468C-87BD-758F37B8C0DD}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{C8751BA1-6A85-468C-87BD-758F37B8C0DD}.Release|Any CPU.ActiveCfg = Release|x86
|
||||
{C8751BA1-6A85-468C-87BD-758F37B8C0DD}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{C8751BA1-6A85-468C-87BD-758F37B8C0DD}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{C8751BA1-6A85-468C-87BD-758F37B8C0DD}.Release|Win32.ActiveCfg = Release|x86
|
||||
{C8751BA1-6A85-468C-87BD-758F37B8C0DD}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{C8751BA1-6A85-468C-87BD-758F37B8C0DD}.Release|x64.Build.0 = Release|Any CPU
|
||||
{C8751BA1-6A85-468C-87BD-758F37B8C0DD}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{C8751BA1-6A85-468C-87BD-758F37B8C0DD}.Release|x86.Build.0 = Release|Any CPU
|
||||
{EB7C228D-9494-4985-845E-B8312450DF3D}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||
{EB7C228D-9494-4985-845E-B8312450DF3D}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
|
||||
{EB7C228D-9494-4985-845E-B8312450DF3D}.Debug|Mixed Platforms.Build.0 = Debug|x86
|
||||
{EB7C228D-9494-4985-845E-B8312450DF3D}.Debug|Win32.ActiveCfg = Debug|x86
|
||||
{EB7C228D-9494-4985-845E-B8312450DF3D}.Debug|x64.ActiveCfg = Debug|x86
|
||||
{EB7C228D-9494-4985-845E-B8312450DF3D}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{EB7C228D-9494-4985-845E-B8312450DF3D}.Debug|x86.Build.0 = Debug|x86
|
||||
{EB7C228D-9494-4985-845E-B8312450DF3D}.Release|Any CPU.ActiveCfg = Release|x86
|
||||
{EB7C228D-9494-4985-845E-B8312450DF3D}.Release|Mixed Platforms.ActiveCfg = Release|x86
|
||||
{EB7C228D-9494-4985-845E-B8312450DF3D}.Release|Mixed Platforms.Build.0 = Release|x86
|
||||
{EB7C228D-9494-4985-845E-B8312450DF3D}.Release|Win32.ActiveCfg = Release|x86
|
||||
{EB7C228D-9494-4985-845E-B8312450DF3D}.Release|x64.ActiveCfg = Release|x86
|
||||
{EB7C228D-9494-4985-845E-B8312450DF3D}.Release|x86.ActiveCfg = Release|x86
|
||||
{EB7C228D-9494-4985-845E-B8312450DF3D}.Release|x86.Build.0 = Release|x86
|
||||
{E86F9CEB-2255-40D0-AF59-E89DEF6752BE}.Debug|Any CPU.ActiveCfg = Debug
|
||||
{E86F9CEB-2255-40D0-AF59-E89DEF6752BE}.Debug|Any CPU.Build.0 = Debug
|
||||
{E86F9CEB-2255-40D0-AF59-E89DEF6752BE}.Debug|Mixed Platforms.ActiveCfg = Debug
|
||||
{E86F9CEB-2255-40D0-AF59-E89DEF6752BE}.Debug|Mixed Platforms.Build.0 = Debug
|
||||
{E86F9CEB-2255-40D0-AF59-E89DEF6752BE}.Debug|Win32.ActiveCfg = Debug
|
||||
{E86F9CEB-2255-40D0-AF59-E89DEF6752BE}.Debug|Win32.Build.0 = Debug
|
||||
{E86F9CEB-2255-40D0-AF59-E89DEF6752BE}.Debug|x64.ActiveCfg = Debug
|
||||
{E86F9CEB-2255-40D0-AF59-E89DEF6752BE}.Debug|x86.ActiveCfg = Debug
|
||||
{E86F9CEB-2255-40D0-AF59-E89DEF6752BE}.Release|Any CPU.ActiveCfg = Release
|
||||
{E86F9CEB-2255-40D0-AF59-E89DEF6752BE}.Release|Any CPU.Build.0 = Release
|
||||
{E86F9CEB-2255-40D0-AF59-E89DEF6752BE}.Release|Mixed Platforms.ActiveCfg = Release
|
||||
{E86F9CEB-2255-40D0-AF59-E89DEF6752BE}.Release|Mixed Platforms.Build.0 = Release
|
||||
{E86F9CEB-2255-40D0-AF59-E89DEF6752BE}.Release|Win32.ActiveCfg = Release
|
||||
{E86F9CEB-2255-40D0-AF59-E89DEF6752BE}.Release|Win32.Build.0 = Release
|
||||
{E86F9CEB-2255-40D0-AF59-E89DEF6752BE}.Release|x64.ActiveCfg = Release
|
||||
{E86F9CEB-2255-40D0-AF59-E89DEF6752BE}.Release|x64.Build.0 = Release
|
||||
{E86F9CEB-2255-40D0-AF59-E89DEF6752BE}.Release|x86.ActiveCfg = Release
|
||||
{84516D9A-0CEC-4C64-B200-E9D78BBA52FD}.Debug|Any CPU.ActiveCfg = Debug
|
||||
{84516D9A-0CEC-4C64-B200-E9D78BBA52FD}.Debug|Any CPU.Build.0 = Debug
|
||||
{84516D9A-0CEC-4C64-B200-E9D78BBA52FD}.Debug|Mixed Platforms.ActiveCfg = Debug
|
||||
{84516D9A-0CEC-4C64-B200-E9D78BBA52FD}.Debug|Mixed Platforms.Build.0 = Debug
|
||||
{84516D9A-0CEC-4C64-B200-E9D78BBA52FD}.Debug|Win32.ActiveCfg = Debug
|
||||
{84516D9A-0CEC-4C64-B200-E9D78BBA52FD}.Debug|Win32.Build.0 = Debug
|
||||
{84516D9A-0CEC-4C64-B200-E9D78BBA52FD}.Debug|x64.ActiveCfg = Debug
|
||||
{84516D9A-0CEC-4C64-B200-E9D78BBA52FD}.Debug|x86.ActiveCfg = Debug
|
||||
{84516D9A-0CEC-4C64-B200-E9D78BBA52FD}.Release|Any CPU.ActiveCfg = Release
|
||||
{84516D9A-0CEC-4C64-B200-E9D78BBA52FD}.Release|Any CPU.Build.0 = Release
|
||||
{84516D9A-0CEC-4C64-B200-E9D78BBA52FD}.Release|Mixed Platforms.ActiveCfg = Release
|
||||
{84516D9A-0CEC-4C64-B200-E9D78BBA52FD}.Release|Mixed Platforms.Build.0 = Release
|
||||
{84516D9A-0CEC-4C64-B200-E9D78BBA52FD}.Release|Win32.ActiveCfg = Release
|
||||
{84516D9A-0CEC-4C64-B200-E9D78BBA52FD}.Release|Win32.Build.0 = Release
|
||||
{84516D9A-0CEC-4C64-B200-E9D78BBA52FD}.Release|x64.ActiveCfg = Release
|
||||
{84516D9A-0CEC-4C64-B200-E9D78BBA52FD}.Release|x86.ActiveCfg = Release
|
||||
{84516D9A-0CEC-4C64-B200-E9D78BBA52FD}.Release|x86.Build.0 = Release
|
||||
{78B94552-DB17-40EC-B7C6-23D32DB85DC1}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||
{78B94552-DB17-40EC-B7C6-23D32DB85DC1}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
|
||||
{78B94552-DB17-40EC-B7C6-23D32DB85DC1}.Debug|Mixed Platforms.Build.0 = Debug|x86
|
||||
{78B94552-DB17-40EC-B7C6-23D32DB85DC1}.Debug|Win32.ActiveCfg = Debug|x86
|
||||
{78B94552-DB17-40EC-B7C6-23D32DB85DC1}.Debug|x64.ActiveCfg = Debug|x86
|
||||
{78B94552-DB17-40EC-B7C6-23D32DB85DC1}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{78B94552-DB17-40EC-B7C6-23D32DB85DC1}.Debug|x86.Build.0 = Debug|x86
|
||||
{78B94552-DB17-40EC-B7C6-23D32DB85DC1}.Release|Any CPU.ActiveCfg = Release|x86
|
||||
{78B94552-DB17-40EC-B7C6-23D32DB85DC1}.Release|Mixed Platforms.ActiveCfg = Release|x86
|
||||
{78B94552-DB17-40EC-B7C6-23D32DB85DC1}.Release|Mixed Platforms.Build.0 = Release|x86
|
||||
{78B94552-DB17-40EC-B7C6-23D32DB85DC1}.Release|Win32.ActiveCfg = Release|x86
|
||||
{78B94552-DB17-40EC-B7C6-23D32DB85DC1}.Release|x64.ActiveCfg = Release|x86
|
||||
{78B94552-DB17-40EC-B7C6-23D32DB85DC1}.Release|x86.ActiveCfg = Release|x86
|
||||
{78B94552-DB17-40EC-B7C6-23D32DB85DC1}.Release|x86.Build.0 = Release|x86
|
||||
{A9ED070F-AB4D-4380-9DDE-5D931AC71333}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||
{A9ED070F-AB4D-4380-9DDE-5D931AC71333}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
|
||||
{A9ED070F-AB4D-4380-9DDE-5D931AC71333}.Debug|Mixed Platforms.Build.0 = Debug|x86
|
||||
{A9ED070F-AB4D-4380-9DDE-5D931AC71333}.Debug|Win32.ActiveCfg = Debug|x86
|
||||
{A9ED070F-AB4D-4380-9DDE-5D931AC71333}.Debug|x64.ActiveCfg = Debug|x86
|
||||
{A9ED070F-AB4D-4380-9DDE-5D931AC71333}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{A9ED070F-AB4D-4380-9DDE-5D931AC71333}.Debug|x86.Build.0 = Debug|x86
|
||||
{A9ED070F-AB4D-4380-9DDE-5D931AC71333}.Release|Any CPU.ActiveCfg = Release|x86
|
||||
{A9ED070F-AB4D-4380-9DDE-5D931AC71333}.Release|Mixed Platforms.ActiveCfg = Release|x86
|
||||
{A9ED070F-AB4D-4380-9DDE-5D931AC71333}.Release|Mixed Platforms.Build.0 = Release|x86
|
||||
{A9ED070F-AB4D-4380-9DDE-5D931AC71333}.Release|Win32.ActiveCfg = Release|x86
|
||||
{A9ED070F-AB4D-4380-9DDE-5D931AC71333}.Release|x64.ActiveCfg = Release|x86
|
||||
{A9ED070F-AB4D-4380-9DDE-5D931AC71333}.Release|x86.ActiveCfg = Release|x86
|
||||
{A9ED070F-AB4D-4380-9DDE-5D931AC71333}.Release|x86.Build.0 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
Executable
+21
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace MtApi
|
||||
{
|
||||
public enum ChartPeriod
|
||||
{
|
||||
ZERO = 0,
|
||||
PERIOD_M1 = 1,
|
||||
PERIOD_M5 = 5,
|
||||
PERIOD_M15 = 15,
|
||||
PERIOD_M30 = 30,
|
||||
PERIOD_H1 = 60,
|
||||
PERIOD_H4 = 240,
|
||||
PERIOD_D1 = 1440,
|
||||
PERIOD_W1 = 10080,
|
||||
PERIOD_MN1 = 43200
|
||||
}
|
||||
}
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace MtApi
|
||||
{
|
||||
static class ExtensionMethods
|
||||
{
|
||||
#region Event Methods
|
||||
public static void FireEvent(this EventHandler eventHandler, object sender)
|
||||
{
|
||||
if (eventHandler != null)
|
||||
{
|
||||
eventHandler(sender, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
public static void FireEvent<T>(this EventHandler<T> eventHandler, object sender, T e)
|
||||
where T : EventArgs
|
||||
{
|
||||
if (eventHandler != null)
|
||||
{
|
||||
eventHandler(sender, e);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public static MtQuote Parse(this MTApiService.MtQuote quote)
|
||||
{
|
||||
return (quote != null) ? new MtQuote(quote.Instrument, quote.Bid, quote.Ask) : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+39
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace MtApi
|
||||
{
|
||||
public enum MarketInfoModeType
|
||||
{
|
||||
MODE_LOW = 1,
|
||||
MODE_HIGH = 2,
|
||||
MODE_TIME = 5,
|
||||
MODE_BID = 9,
|
||||
MODE_ASK = 10,
|
||||
MODE_POINT = 11,
|
||||
MODE_DIGITS = 12,
|
||||
MODE_SPREAD = 13,
|
||||
MODE_STOPLEVEL = 14,
|
||||
MODE_LOTSIZE = 15,
|
||||
MODE_TICKVALUE = 16,
|
||||
MODE_TICKSIZE = 17,
|
||||
MODE_SWAPLONG = 18,
|
||||
MODE_SWAPSHORT = 19,
|
||||
MODE_STARTING = 20,
|
||||
MODE_EXPIRATION = 21,
|
||||
MODE_TRADEALLOWED = 22,
|
||||
MODE_MINLOT = 23,
|
||||
MODE_LOTSTEP = 24,
|
||||
MODE_MAXLOT = 25,
|
||||
MODE_SWAPTYPE = 26,
|
||||
MODE_PROFITCALCMODE = 27,
|
||||
MODE_MARGINCALCMODE = 28,
|
||||
MODE_MARGININIT = 29,
|
||||
MODE_MARGINMAINTENANCE = 30,
|
||||
MODE_MARGINHEDGED = 31,
|
||||
MODE_MARGINREQUIRED = 32,
|
||||
MODE_FREEZELEVEL = 33
|
||||
}
|
||||
}
|
||||
Executable
+89
@@ -0,0 +1,89 @@
|
||||
<?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>{7A76C388-A8FB-4949-8170-24D4742E934E}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>MtApi</RootNamespace>
|
||||
<AssemblyName>MtApi</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile>
|
||||
</TargetFrameworkProfile>
|
||||
</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>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignAssembly>false</SignAssembly>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<AssemblyOriginatorKeyFile>
|
||||
</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<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="ChartPeriod.cs" />
|
||||
<Compile Include="ExtensionMethods.cs" />
|
||||
<Compile Include="MtConnectionEventArgs.cs" />
|
||||
<Compile Include="MtConnectionState.cs" />
|
||||
<Compile Include="MtCommandType.cs" />
|
||||
<Compile Include="MtQuote.cs" />
|
||||
<Compile Include="MtQuoteEventArgs.cs" />
|
||||
<Compile Include="PriceConstantsType.cs" />
|
||||
<Compile Include="MarketInfoModeType.cs" />
|
||||
<Compile Include="MtApiClient.cs" />
|
||||
<Compile Include="MtApiColorConverter.cs" />
|
||||
<Compile Include="OrderSelectMode.cs" />
|
||||
<Compile Include="OrderSelectSource.cs" />
|
||||
<Compile Include="SeriesIdentifier.cs" />
|
||||
<Compile Include="TradeOperation.cs" />
|
||||
<Compile Include="MtApiTimeConverter.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MTApiService\MTApiService.csproj">
|
||||
<Project>{DE76D5C7-B99C-4467-8408-78173BDD84E0}</Project>
|
||||
<Name>MTApiService</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<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>
|
||||
Executable
+1301
File diff suppressed because it is too large
Load Diff
Executable
+21
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
|
||||
namespace MtApi
|
||||
{
|
||||
class MtApiColorConverter
|
||||
{
|
||||
public static Color ConvertFromMtColor(int color)
|
||||
{
|
||||
return Color.FromArgb(color);
|
||||
}
|
||||
|
||||
public static int ConvertToMtColor(Color color)
|
||||
{
|
||||
return color == Color.Empty ? 0xffffff : (color.ToArgb() & 0xffffff);
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+27
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace MtApi
|
||||
{
|
||||
class MtApiTimeConverter
|
||||
{
|
||||
public static DateTime ConvertFromMtTime(int time)
|
||||
{
|
||||
DateTime tmpTime = new DateTime(1970, 1, 1);
|
||||
return new DateTime(tmpTime.Ticks + (time * 0x989680L));
|
||||
}
|
||||
|
||||
public static int ConvertToMtTime(DateTime time)
|
||||
{
|
||||
int result = 0;
|
||||
if (time != DateTime.MinValue)
|
||||
{
|
||||
DateTime tmpTime = new DateTime(1970, 1, 1);
|
||||
result = (int)((time.Ticks - tmpTime.Ticks) / 0x989680L);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+186
@@ -0,0 +1,186 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace MtApi
|
||||
{
|
||||
enum MtCommandType
|
||||
{
|
||||
//NoCommand = 0
|
||||
|
||||
//trade operations
|
||||
OrderSend = 1,
|
||||
OrderClose = 2,
|
||||
OrderCloseBy = 3,
|
||||
OrderClosePrice = 4,
|
||||
OrderClosePriceByTicket = 1004,
|
||||
OrderCloseTime = 5,
|
||||
OrderComment = 6,
|
||||
OrderCommission = 7,
|
||||
OrderDelete = 8,
|
||||
OrderExpiration = 9,
|
||||
OrderLots = 10,
|
||||
OrderMagicNumber = 11,
|
||||
OrderModify = 12,
|
||||
OrderOpenPrice = 13,
|
||||
OrderOpenPriceByTicket = 1013,
|
||||
OrderOpenTime = 14,
|
||||
OrderPrint = 15,
|
||||
OrderProfit = 16,
|
||||
OrderSelect = 17,
|
||||
OrdersHistoryTotal = 18,
|
||||
OrderStopLoss = 19,
|
||||
OrdersTotal = 20,
|
||||
OrderSwap = 21,
|
||||
OrderSymbol = 22,
|
||||
OrderTakeProfit = 23,
|
||||
OrderTicket = 24,
|
||||
OrderType = 25,
|
||||
|
||||
//Check Status
|
||||
GetLastError = 26,
|
||||
IsConnected = 27,
|
||||
IsDemo = 28,
|
||||
IsDllsAllowed = 29,
|
||||
IsExpertEnabled = 30,
|
||||
IsLibrariesAllowed = 31,
|
||||
IsOptimization = 32,
|
||||
IsStopped = 33,
|
||||
IsTesting = 34,
|
||||
IsTradeAllowed = 35,
|
||||
IsTradeContextBusy = 36,
|
||||
IsVisualMode = 37,
|
||||
UninitializeReason = 38,
|
||||
ErrorDescription = 39,
|
||||
|
||||
//Account Information
|
||||
AccountBalance = 40,
|
||||
AccountCredit = 41,
|
||||
AccountCompany = 42,
|
||||
AccountCurrency = 43,
|
||||
AccountEquity = 44,
|
||||
AccountFreeMargin = 45,
|
||||
AccountFreeMarginCheck = 46,
|
||||
AccountFreeMarginMode = 47,
|
||||
AccountLeverage = 48,
|
||||
AccountMargin = 49,
|
||||
AccountName = 50,
|
||||
AccountNumber = 51,
|
||||
AccountProfit = 52,
|
||||
AccountServer = 53,
|
||||
AccountStopoutLevel = 54,
|
||||
AccountStopoutMode = 55,
|
||||
|
||||
//Common Commands
|
||||
Alert = 56,
|
||||
Comment = 57,
|
||||
GetTickCount = 58,
|
||||
MarketInfo = 59,
|
||||
MessageBox = 60,
|
||||
MessageBoxA = 61,
|
||||
PlaySound = 62,
|
||||
Print = 63,
|
||||
SendFTP = 64,
|
||||
SendFTPA = 65,
|
||||
SendMail = 66,
|
||||
Sleep = 67,
|
||||
|
||||
//Client Terminal
|
||||
TerminalCompany = 68,
|
||||
TerminalName = 69,
|
||||
TerminalPath = 70,
|
||||
|
||||
//Date and Time
|
||||
Day = 71,
|
||||
DayOfWeek = 72,
|
||||
DayOfYear = 73,
|
||||
Hour = 74,
|
||||
Minute = 75,
|
||||
Month = 76,
|
||||
Seconds = 77,
|
||||
TimeCurrent = 78,
|
||||
TimeDay = 79,
|
||||
TimeDayOfWeek = 80,
|
||||
TimeDayOfYear = 81,
|
||||
TimeHour = 82,
|
||||
TimeLocal = 83,
|
||||
TimeMinute = 84,
|
||||
TimeMonth = 85,
|
||||
TimeSeconds = 86,
|
||||
TimeYear = 87,
|
||||
Year = 88,
|
||||
|
||||
//Global Variables
|
||||
GlobalVariableCheck = 89,
|
||||
GlobalVariableDel = 90,
|
||||
GlobalVariableGet = 91,
|
||||
GlobalVariableName = 92,
|
||||
GlobalVariableSet = 93,
|
||||
GlobalVariableSetOnCondition = 94,
|
||||
GlobalVariablesDeleteAll = 95,
|
||||
GlobalVariablesTotal = 96,
|
||||
|
||||
//Technical Indicators
|
||||
iAC = 97,
|
||||
iAD = 98,
|
||||
iAlligator = 99,
|
||||
iADX = 100,
|
||||
iATR = 101,
|
||||
iAO = 102,
|
||||
iBearsPower = 103,
|
||||
iBands = 104,
|
||||
iBandsOnArray = 105,
|
||||
iBullsPower = 106,
|
||||
iCCI = 107,
|
||||
iCCIOnArray = 108,
|
||||
iCustom = 109,
|
||||
iCustom_d = 10109,
|
||||
iDeMarker = 110,
|
||||
iEnvelopes = 111,
|
||||
iEnvelopesOnArray = 112,
|
||||
iForce = 113,
|
||||
iFractals = 114,
|
||||
iGator = 115,
|
||||
iIchimoku = 116,
|
||||
iBWMFI = 117,
|
||||
iMomentum = 118,
|
||||
iMomentumOnArray = 119,
|
||||
iMFI = 120,
|
||||
iMA = 121,
|
||||
iMAOnArray = 122,
|
||||
iOsMA = 123,
|
||||
iMACD = 124,
|
||||
iOBV = 125,
|
||||
iSAR = 126,
|
||||
iRSI = 127,
|
||||
iRSIOnArray = 128,
|
||||
iRVI = 129,
|
||||
iStdDev = 130,
|
||||
iStdDevOnArray = 131,
|
||||
iStochastic = 132,
|
||||
iWPR = 133,
|
||||
|
||||
//Timeseries access
|
||||
iBars = 134,
|
||||
iBarShift = 135,
|
||||
iClose = 136,
|
||||
iHigh = 137,
|
||||
iHighest = 138,
|
||||
iLow = 139,
|
||||
iLowest = 140,
|
||||
iOpen = 141,
|
||||
iTime = 142,
|
||||
iVolume = 143,
|
||||
|
||||
iCloseArray = 144,
|
||||
iHighArray = 145,
|
||||
iLowArray = 146,
|
||||
iOpenArray = 147,
|
||||
iVolumeArray = 148,
|
||||
iTimeArray = 149,
|
||||
|
||||
//
|
||||
RefreshRates = 150
|
||||
}
|
||||
}
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace MtApi
|
||||
{
|
||||
public class MtConnectionEventArgs: EventArgs
|
||||
{
|
||||
public MtConnectionState Status { get; private set; }
|
||||
public String ConnectionMessage { get; private set; }
|
||||
|
||||
public MtConnectionEventArgs(MtConnectionState status, string message)
|
||||
{
|
||||
Status = status;
|
||||
ConnectionMessage = message;
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+15
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace MtApi
|
||||
{
|
||||
public enum MtConnectionState
|
||||
{
|
||||
Connecting,
|
||||
Connected,
|
||||
Disconnected,
|
||||
Failed
|
||||
}
|
||||
}
|
||||
Executable
+21
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace MtApi
|
||||
{
|
||||
public class MtQuote
|
||||
{
|
||||
public string Instrument { get; private set; }
|
||||
public double Bid { get; private set; }
|
||||
public double Ask { get; private set; }
|
||||
|
||||
public MtQuote(string instrument, double bid, double ask)
|
||||
{
|
||||
Instrument = instrument;
|
||||
Bid = bid;
|
||||
Ask = ask;
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace MtApi
|
||||
{
|
||||
public class MtQuoteEventArgs : EventArgs
|
||||
{
|
||||
public MtQuote Quote { get; private set; }
|
||||
|
||||
public MtQuoteEventArgs(MtQuote quote)
|
||||
{
|
||||
Quote = quote;
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+13
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace MtApi
|
||||
{
|
||||
public enum OrderSelectMode
|
||||
{
|
||||
SELECT_BY_POS = 0,
|
||||
SELECT_BY_TICKET = 1
|
||||
}
|
||||
}
|
||||
Executable
+13
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace MtApi
|
||||
{
|
||||
public enum OrderSelectSource
|
||||
{
|
||||
MODE_TRADES = 0,
|
||||
MODE_HISTORY = 1
|
||||
}
|
||||
}
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace MtApi
|
||||
{
|
||||
public enum PriceConstantsType
|
||||
{
|
||||
PRICE_CLOSE = 0,
|
||||
PRICE_OPEN = 1,
|
||||
PRICE_HIGH = 2,
|
||||
PRICE_LOW = 3,
|
||||
PRICE_MEDIAN = 4,
|
||||
PRICE_TYPICAL = 5,
|
||||
PRICE_WEIGHTED = 6
|
||||
}
|
||||
}
|
||||
Executable
+36
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("MtApi")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("DW")]
|
||||
[assembly: AssemblyProduct("MtApi")]
|
||||
[assembly: AssemblyCopyright("Copyright © DW 2011")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("650e3c56-dbce-45d4-a844-94bbe9f9a3bf")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.15.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.15.0")]
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace MtApi
|
||||
{
|
||||
public enum SeriesIdentifier
|
||||
{
|
||||
MODE_OPEN = 0,
|
||||
MODE_LOW = 1,
|
||||
MODE_HIGH = 2,
|
||||
MODE_CLOSE = 3,
|
||||
MODE_VOLUME = 4,
|
||||
MODE_TIME = 5
|
||||
}
|
||||
}
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace MtApi
|
||||
{
|
||||
public enum TradeOperation
|
||||
{
|
||||
OP_BUY = 0,
|
||||
OP_SELL = 1,
|
||||
OP_BUYLIMIT = 2,
|
||||
OP_SELLLIMIT = 3,
|
||||
OP_BUYSTOP = 4,
|
||||
OP_SELLSTOP = 5
|
||||
}
|
||||
}
|
||||
Executable
+30
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace MtApi5
|
||||
{
|
||||
static class ExtensionMethods
|
||||
{
|
||||
#region Event Methods
|
||||
public static void FireEvent(this EventHandler eventHandler, object sender)
|
||||
{
|
||||
if (eventHandler != null)
|
||||
{
|
||||
eventHandler(sender, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
public static void FireEvent<T>(this EventHandler<T> eventHandler, object sender, T e)
|
||||
where T : EventArgs
|
||||
{
|
||||
if (eventHandler != null)
|
||||
{
|
||||
eventHandler(sender, e);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Executable
+21
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace MtApi5
|
||||
{
|
||||
public class MqlBookInfo
|
||||
{
|
||||
public MqlBookInfo(ENUM_BOOK_TYPE type, double price, long volume)
|
||||
{
|
||||
this.type = type;
|
||||
this.price = price;
|
||||
this.volume = volume;
|
||||
}
|
||||
|
||||
public ENUM_BOOK_TYPE type { get; private set; } // Order type from ENUM_BOOK_TYPE enumeration
|
||||
public double price { get; private set; } // Price
|
||||
public long volume { get; private set; } // Volume
|
||||
}
|
||||
}
|
||||
Executable
+31
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace MtApi5
|
||||
{
|
||||
public class MqlRates
|
||||
{
|
||||
public MqlRates(DateTime time, double open, double high, double low, double close, long tick_volume, int spread, long real_volume)
|
||||
{
|
||||
this.time = time;
|
||||
this.open = open;
|
||||
this.high = high;
|
||||
this.low = low;
|
||||
this.close = close;
|
||||
this.tick_volume = tick_volume;
|
||||
this.spread = spread;
|
||||
this.real_volume = real_volume;
|
||||
}
|
||||
|
||||
public DateTime time { get; private set; } // Period start time
|
||||
public double open { get; private set; } // Open price
|
||||
public double high { get; private set; } // The highest price of the period
|
||||
public double low { get; private set; } // The lowest price of the period
|
||||
public double close { get; private set; } // Close price
|
||||
public long tick_volume { get; private set; } // Tick volume
|
||||
public int spread { get; private set; } // Spread
|
||||
public long real_volume { get; private set; } // Trade volume
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user