Refactored MtApi4 (MT4) for working with new architecture

This commit is contained in:
Viacheslav Demydiuk
2024-06-16 13:57:50 +03:00
parent 6dd5e0190f
commit a830dc11a6
89 changed files with 1648 additions and 2390 deletions
+29 -32
View File
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Windows.Forms;
using Microsoft.Deployment.WindowsInstaller;
using WixToolset.Dtf.WindowsInstaller;
namespace MtApiSetupActions
{
@@ -20,38 +15,40 @@ namespace MtApiSetupActions
{
session.Log("Begin action InstallEx4File...");
var appDataFolder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
//Directory.CreateDirectory("c:\\dw");
var metaquotesFolder = appDataFolder + TerminalFolder;
//var appDataFolder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
if (Directory.Exists(metaquotesFolder))
{
var foldersFound = Directory.GetDirectories(metaquotesFolder, Mql4Folder, SearchOption.AllDirectories);
Console.WriteLine(string.Join("\n", foldersFound));
//var metaquotesFolder = appDataFolder + TerminalFolder;
foreach (var folder in foldersFound)
{
var srcFile = session[InstalledExpertFolderProperty] + MtApiFile;
var destFile = folder + DestinationExpertFolder + MtApiFile;
//if (Directory.Exists(metaquotesFolder))
//{
// var foldersFound = Directory.GetDirectories(metaquotesFolder, Mql4Folder, SearchOption.AllDirectories);
// Console.WriteLine(string.Join("\n", foldersFound));
session.Log(string.Format("Try to copy from {0} to {1}", srcFile, destFile));
// foreach (var folder in foldersFound)
// {
// var srcFile = session[InstalledExpertFolderProperty] + MtApiFile;
// var destFile = folder + DestinationExpertFolder + MtApiFile;
try
{
File.Copy(srcFile, destFile, true);
}
catch (Exception e)
{
session.Log(string.Format("Failed to copy MtApi4.ex4. {0}", e.Message));
}
// session.Log(string.Format("Try to copy from {0} to {1}", srcFile, destFile));
session.Log(string.Format("MtApi.ex4 has been coppied to {0}", destFile));
}
}
else
{
session.Log("MetaTrader is not installed");
}
// try
// {
// File.Copy(srcFile, destFile, true);
// }
// catch (Exception e)
// {
// session.Log(string.Format("Failed to copy MtApi4.ex4. {0}", e.Message));
// }
// session.Log(string.Format("MtApi.ex4 has been coppied to {0}", destFile));
// }
//}
//else
//{
// session.Log("MetaTrader is not installed");
//}
return ActionResult.Success;
}
+11 -51
View File
@@ -1,52 +1,12 @@
<?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>{10800F37-F71B-4818-8351-8CF744295F80}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MtApiSetupActions</RootNamespace>
<AssemblyName>MtApiSetupActions</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<WixCATargetsPath Condition=" '$(WixCATargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.CA.targets</WixCATargetsPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.Deployment.WindowsInstaller">
<Private>True</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="CustomAction.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Content Include="CustomAction.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(WixCATargetsPath)" />
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<BaseOutputPath>$(SolutionDir)build\products</BaseOutputPath>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="WixToolset.Dtf.CustomAction" Version="5.0.0" />
</ItemGroup>
</Project>
@@ -1,35 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("MtApiSetupActions")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MtApiSetupActions")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c0ee9849-c0cd-4f67-8423-fe334565b863")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]