Commit 6974ab70 authored by Gianni's avatar Gianni

Mise à jour Version 64 bit pour P3D V4

parent 3da430be

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
# Visual Studio 15
VisualStudioVersion = 15.0.26430.13
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FFS2Play", "ffs2play\FFS2Play.csproj", "{6947B26B-8E81-486A-A863-AD8C0436AB0A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
P3D-Debug|x64 = P3D-Debug|x64
P3D-Debug|x86 = P3D-Debug|x86
P3D-Release|x64 = P3D-Release|x64
P3D-Release|x86 = P3D-Release|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{6947B26B-8E81-486A-A863-AD8C0436AB0A}.Debug|x64.ActiveCfg = Debug|x64
{6947B26B-8E81-486A-A863-AD8C0436AB0A}.Debug|x64.Build.0 = Debug|x64
{6947B26B-8E81-486A-A863-AD8C0436AB0A}.Debug|x86.ActiveCfg = Debug|Any CPU
{6947B26B-8E81-486A-A863-AD8C0436AB0A}.Debug|x86.Build.0 = Debug|Any CPU
{6947B26B-8E81-486A-A863-AD8C0436AB0A}.P3D-Debug|x64.ActiveCfg = P3D-Debug|x64
{6947B26B-8E81-486A-A863-AD8C0436AB0A}.P3D-Debug|x64.Build.0 = P3D-Debug|x64
{6947B26B-8E81-486A-A863-AD8C0436AB0A}.P3D-Debug|x86.ActiveCfg = P3D-Debug|x86
{6947B26B-8E81-486A-A863-AD8C0436AB0A}.P3D-Debug|x86.Build.0 = P3D-Debug|x86
{6947B26B-8E81-486A-A863-AD8C0436AB0A}.P3D-Release|x64.ActiveCfg = P3D-Release|x64
{6947B26B-8E81-486A-A863-AD8C0436AB0A}.P3D-Release|x64.Build.0 = P3D-Release|x64
{6947B26B-8E81-486A-A863-AD8C0436AB0A}.P3D-Release|x86.ActiveCfg = P3D-Release|x86
{6947B26B-8E81-486A-A863-AD8C0436AB0A}.P3D-Release|x86.Build.0 = P3D-Release|x86
{6947B26B-8E81-486A-A863-AD8C0436AB0A}.Release|x64.ActiveCfg = Release|x64
{6947B26B-8E81-486A-A863-AD8C0436AB0A}.Release|x64.Build.0 = Release|x64
{6947B26B-8E81-486A-A863-AD8C0436AB0A}.Release|x86.ActiveCfg = Release|Any CPU
{6947B26B-8E81-486A-A863-AD8C0436AB0A}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
......
......@@ -98,6 +98,12 @@
<setting name="MetarAutoEnable" serializeAs="String">
<value>False</value>
</setting>
<setting name="AIScanFoldersP3DV4" serializeAs="Xml">
<value>
<ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
</value>
</setting>
</ffs2play.Properties.Settings>
</userSettings>
<startup>
......
......@@ -95,6 +95,9 @@
<Reference Include="ESystem.Extensions">
<HintPath>..\..\..\..\Downloads\METAR_NET_2.2.4521.24430\Tutorial\bin\Debug\ESystem.Extensions.dll</HintPath>
</Reference>
<Reference Include="LockheedMartin.Prepar3D.SimConnect">
<HintPath>D:\Program Files\Lockheed Martin\Prepar3D v4 SDK 4.0.23.21468\lib\SimConnect\managed\LockheedMartin.Prepar3D.SimConnect.dll</HintPath>
</Reference>
<Reference Include="Microsoft.FlightSimulator.SimConnect, Version=10.0.62615.0, Culture=neutral, PublicKeyToken=5f523ae7e6e1b389, processorArchitecture=x86">
<SpecificVersion>False</SpecificVersion>
<HintPath>.\Microsoft.FlightSimulator.SimConnect.dll</HintPath>
......@@ -157,7 +160,7 @@
<SignManifests>false</SignManifests>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DefineConstants>TRACE;DEBUG</DefineConstants>
<DefineConstants>TRACE;DEBUG;PLATFORM_X86</DefineConstants>
<PlatformTarget>x86</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
......@@ -167,6 +170,74 @@
<PropertyGroup>
<SignAssembly>false</SignAssembly>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;NET45</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE;PLATFORM_X86</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'P3D-Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\P3D-Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;NET45</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'P3D-Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\P3D-Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;P3D PLATFORM_X86</DefineConstants>
<PlatformTarget>x86</PlatformTarget>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'P3D-Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\P3D-Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;P3D PLATFORM_X64</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'P3D-Release|AnyCPU'">
<OutputPath>bin\P3D-Release\</OutputPath>
<DefineConstants>TRACE;NET45</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'P3D-Release|x86'">
<OutputPath>bin\x86\P3D-Release\</OutputPath>
<PlatformTarget>x86</PlatformTarget>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<DefineConstants>TRACE;P3D PLATFORM_X86</DefineConstants>
<Optimize>true</Optimize>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'P3D-Release|x64'">
<OutputPath>bin\x64\P3D-Release\</OutputPath>
<DefineConstants>TRACE;P3D PLATFORM_X64</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Compile Include="Gui\AboutBox.cs">
<SubType>Form</SubType>
......@@ -315,7 +386,12 @@
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>cd "$(ProjectDir)"
if $(ConfigurationName) == Release Publication.bat</PostBuildEvent>
if $(ConfigurationName) == Release (
PublicationFSX.bat
) else if $(ConfigurationName) == P3D-Release (
PublicationP3D.bat
)</PostBuildEvent>
</PropertyGroup>
<Import Project="..\packages\System.Data.SQLite.Core.1.0.105.2\build\net451\System.Data.SQLite.Core.targets" Condition="Exists('..\packages\System.Data.SQLite.Core.1.0.105.2\build\net451\System.Data.SQLite.Core.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
......
; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "FFSTracker P3D"
!getdllversion ".\bin\x64\P3D-Release\ffs2play.exe" expv_
!define PRODUCT_VERSION "${expv_1}.${expv_2}.${expv_3}"
!define PRODUCT_PUBLISHER "ffsimulateur2.fr (c)2017"
!define PRODUCT_WEB_SITE "http://www.ffsimulateur2.fr"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\FFS2PlayP3D"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
!define PRODUCT_STARTMENU_REGVAL "NSIS:StartMenuDir"
; MUI 1.67 compatible ------
!include "MUI2.nsh"
!include "FileAssociation.nsh"
!include "PostExec.nsh"
; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON ".\images\ffstracker_48x48.ico"
!define MUI_UNICON ".\images\ffstracker_48x48.ico"
!define MUI_WELCOMEFINISHPAGE_BITMAP ".\images\splash.bmp"
; Language Selection Dialog Settings
!define MUI_LANGDLL_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
!define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
;!define MUI_LANGDLL_REGISTRY_VALUENAME "NSIS:Language"
; Welcome page
!insertmacro MUI_PAGE_WELCOME
; License page
!define MUI_LICENSEPAGE_CHECKBOX
!insertmacro MUI_PAGE_LICENSE ".\readme.txt"
; Directory page
!insertmacro MUI_PAGE_DIRECTORY
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!define MUI_FINISHPAGE_RUN "$INSTDIR\ffs2play.exe"
!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\readme.txt"
!insertmacro MUI_PAGE_FINISH
; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES
; Language files
!insertmacro MUI_LANGUAGE "French"
; MUI end ------
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
!define OutFile "FFS2PlayP3D_${expv_1}_${expv_2}_${expv_3}.exe"
OutFile ${OUTFILE}
InstallDir "$PROGRAMFILES64\FFS2PlayP3D"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
ShowInstDetails show
ShowUnInstDetails show
Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd
Section "SectionPrincipale" SEC01
SetOutPath "$INSTDIR"
SetOverwrite on
File ".\bin\x64\P3D-Release\ffs2play.exe"
CreateDirectory "$SMPROGRAMS\FFS2PlayP3D"
CreateShortCut "$SMPROGRAMS\FFS2PlayP3D\ffstracker.lnk" "$INSTDIR\ffs2play.exe"
CreateShortCut "$DESKTOP\FFS2PlayP3D.lnk" "$INSTDIR\ffs2play.exe"
File ".\bin\x64\P3D-Release\LockheedMartin.Prepar3D.SimConnect.dll"
File ".\bin\x64\P3D-Release\Open.Nat.dll"
File ".\bin\x64\P3D-Release\System.Data.SQLite.dll"
File ".\bin\x64\P3D-Release\x64\SQLite.Interop.dll"
File ".\bin\x64\P3D-Release\SharpCompress.dll"
File ".\bin\x64\P3D-Release\protobuf-net.dll"
File ".\bin\x64\P3D-Release\ENG.WMOCodes.Decoders.dll"
File ".\bin\x64\P3D-Release\ENG.WMOCodes.dll"
File ".\bin\x64\P3D-Release\ENG.WMOCodes.Downloaders.dll"
File ".\bin\x64\P3D-Release\ENG.WMOCodes.Formatters.dll"
File ".\bin\x64\P3D-Release\ENG.WMOCodes.Formatters.InfoFormatter.dll"
File ".\bin\x64\P3D-Release\ENG.WMOCodes.Formatters.ShortInfo.dll"
File ".\bin\x64\P3D-Release\ESystem.dll"
File ".\bin\x64\P3D-Release\ESystem.Extensions.dll"
File "readme.txt"
${registerExtension} "$INSTDIR\ffstracker.exe" ".pirep" "FFSTracker pirep"
SectionEnd
Section -AdditionalIcons
WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
CreateShortCut "$SMPROGRAMS\FFS2PlayP3D\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
CreateShortCut "$SMPROGRAMS\FFS2PlayP3D\Uninstall.lnk" "$INSTDIR\uninst.exe"
SectionEnd
Section -Post
WriteUninstaller "$INSTDIR\uninst.exe"
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\ffs2play.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\ffs2play.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
SectionEnd
Function un.onUninstSuccess
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) a été désinstallé avec succès de votre ordinateur."
FunctionEnd
Function un.onInit
!insertmacro MUI_UNGETLANGUAGE
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Êtes-vous certains de vouloir désinstaller totalement $(^Name) et tous ses composants ?" IDYES +2
Abort
FunctionEnd
Section Uninstall
RMDir /r "$SMPROGRAMS\FFS2PlayP3D"
RMDir /r "$INSTDIR"
;${unregisterExtension} ".pirep" "FFSTracker pirep"
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
SetAutoClose true
SectionEnd
!finalize '7z.exe a -mx9 "FFS2PlayP3D_${expv_1}_${expv_2}_${expv_3}.zip" ${OUTFILE}'
\ No newline at end of file
......@@ -6,13 +6,18 @@ namespace ffs2play
{
partial class AboutBox : Form
{
public AboutBox()
#if PLATFORM_X86
private const string Platform = "X86";
#elif PLATFORM_X64
private const string Platform = "X64";
#endif
public AboutBox()
{
InitializeComponent();
InitializeComponent();
AssemblyInfo entryAssemblyInfo = new AssemblyInfo(Assembly.GetEntryAssembly());
this.Text = String.Format("À propos de {0}", entryAssemblyInfo.ProductTitle);
this.labelProductName.Text = entryAssemblyInfo.Product;
this.labelVersion.Text = String.Format("Version {0}", entryAssemblyInfo.Version);
this.labelVersion.Text = String.Format("Version {0}", entryAssemblyInfo.Version) + " " + Platform;
this.labelCopyright.Text = entryAssemblyInfo.Copyright;
this.labelCompanyName.Text = "http://www.ffsimulateur2.fr";
this.textBoxDescription.Text = entryAssemblyInfo.Description;
......
......@@ -33,6 +33,6 @@ using System.Resources;
// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
// en utilisant '*', comme indiqué ci-dessous :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.2.0")]
[assembly: AssemblyFileVersion("1.0.2.0")]
[assembly: AssemblyVersion("1.0.3.0")]
[assembly: AssemblyFileVersion("1.0.3.0")]
[assembly: NeutralResourcesLanguageAttribute("fr")]
......@@ -303,5 +303,18 @@ namespace ffs2play.Properties {
this["MetarAutoEnable"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("<?xml version=\"1.0\" encoding=\"utf-16\"?>\r\n<ArrayOfString xmlns:xsi=\"http://www.w3." +
"org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" />")]
public global::System.Collections.Specialized.StringCollection AIScanFoldersP3DV4 {
get {
return ((global::System.Collections.Specialized.StringCollection)(this["AIScanFoldersP3DV4"]));
}
set {
this["AIScanFoldersP3DV4"] = value;
}
}
}
}
......@@ -76,5 +76,9 @@
<Setting Name="MetarAutoEnable" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="AIScanFoldersP3DV4" Type="System.Collections.Specialized.StringCollection" Scope="User">
<Value Profile="(Default)">&lt;?xml version="1.0" encoding="utf-16"?&gt;
&lt;ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" /&gt;</Value>
</Setting>
</Settings>
</SettingsFile>
\ No newline at end of file
del "FFS2PlayP3D*.zip"
makensis.exe /X"SetCompressor /SOLID /FINAL zlib" FFS2PlayP3D.nsi
del "*.exe"
\ No newline at end of file
......@@ -66,7 +66,7 @@ namespace ffs2play
m_SC.OnSCReceiveOpen += OnSCReceiveOpen;
// On localise l'installateur de chaque simulateur
string BaseRegistryPath = "";
BaseInstallation = new string[4];
BaseInstallation = new string[5];
Object Valeur = null;
RegistryKey registryKey = null;
/// todo : inverser la priorité lockeed wow6432 pour prioriser une nouvelle install
......@@ -162,7 +162,27 @@ namespace ffs2play
}
}
}
}
if (Properties.Settings.Default.AIScanFoldersP3DV4.Count < 1)
{
registryKey = Registry.LocalMachine.OpenSubKey(BaseRegistryPath + "Lockheed Martin\\Prepar3D v4");
if (registryKey != null)
{
Valeur = registryKey.GetValue("SetupPath");
if (Valeur == null) Valeur = registryKey.GetValue("AppPath");
if (Valeur != null)
{
BaseInstallation[4] = (string)Valeur;
if (!BaseInstallation[4].EndsWith("\\")) BaseInstallation[4] += "\\";
Properties.Settings.Default.AIScanFoldersP3DV4.Add(BaseInstallation[4] + "SimObjects\\Airplanes");
Properties.Settings.Default.AIScanFoldersP3DV4.Add(BaseInstallation[4] + "SimObjects\\Rotorcraft");
Properties.Settings.Default.Save();
#if DEBUG
Log.LogMessage("AIMapping : Répertoire d'installation Prepar3D v4 trouvé : = " + BaseInstallation[4], Color.DarkBlue, 1);
#endif
}
}
}
}
private void OnSCReceiveOpen(object sender, SCManagerEventOpen e)
{
......@@ -182,7 +202,10 @@ namespace ffs2play
break;
case SIM_VERSION.P3D_V3:
m_AircraftPath = Properties.Settings.Default.AIScanFoldersP3DV3;
break;
break;
case SIM_VERSION.P3D_V4:
m_AircraftPath = Properties.Settings.Default.AIScanFoldersP3DV4;
break;
}
#if DEBUG
Log.LogMessage("AIMapping : Simulateur détecté: " + m_Table, Color.DarkOliveGreen, 1);
......
......@@ -336,35 +336,17 @@ namespace ffs2play
if (flag)
{
if (m_bUPNP) return;
#if NET45
var t = Task.Run(async () =>
{
#endif
var nat = new NatDiscoverer();
var cts = new CancellationTokenSource();
#if NET45
var nat = new NatDiscoverer();
var cts = new CancellationTokenSource();
try
{
Device = await nat.DiscoverDeviceAsync(PortMapper.Upnp, cts);
#else
cts.CancelAfter(3000);
Device = null;
Task<NatDevice> Discoverer = nat.DiscoverDeviceAsync(PortMapper.Upnp, cts);
try
{
Discoverer.Wait();
#endif
#if DEBUG
Log.LogMessage("P2PManager: Routeur UPNP détecté", Color.DarkBlue, 1);
#endif
#if NET45
await Device.CreatePortMapAsync(new Mapping(Open.Nat.Protocol.Udp, m_Port, m_Port, 0, "ffs2playP3D"));
#else
Device = Discoverer.Result;
Task OpenPort = Device.CreatePortMapAsync(new Mapping(Open.Nat.Protocol.Udp, m_Port, m_Port, 0, "ffs2play"));
OpenPort.Wait();
#endif
await Device.CreatePortMapAsync(new Mapping(Open.Nat.Protocol.Udp, m_Port, m_Port, 0, "ffs2playP3D"));
#if DEBUG
Log.LogMessage("P2PManager: Ouverture du port UPNP ok", Color.DarkBlue, 1);
#endif
......@@ -387,45 +369,34 @@ namespace ffs2play
});
}
m_bUPNP = true;
#if NET45
});
#endif
}
else
{
if ((!m_bUPNP) || (Device==null)) return;
#if NET45
var t = Task.Run(async () =>
{
#endif
try
{
#if NET45
try
{
await Device.DeletePortMapAsync(new Mapping(Open.Nat.Protocol.Udp, m_Port, m_Port));
#else
Task ClosePort = Device.DeletePortMapAsync(new Mapping(Open.Nat.Protocol.Udp, m_Port, m_Port));
ClosePort.Wait();
#endif
#if DEBUG
Log.LogMessage("P2PManager: Fermeture du port UPNP ok", Color.DarkBlue, 1);
#endif
}
catch (AggregateException ae)
{
ae.Handle((x) =>
{
if (x is MappingException)
{
Log.LogMessage("P2PManager: Erreur lors de la fermetur du port", Color.DarkViolet);
return true;
}
return false;
});
}
m_bUPNP = false;
#if NET45
}
catch (AggregateException ae)
{
ae.Handle((x) =>
{
if (x is MappingException)
{
Log.LogMessage("P2PManager: Erreur lors de la fermetur du port", Color.DarkViolet);
return true;
}
return false;
});
}
m_bUPNP = false;
});
#endif
}
}
......
......@@ -18,6 +18,7 @@ namespace ffs2play
FSX_STEAM,
P3D_V2,
P3D_V3,
P3D_V4,
UNKNOWN
}
......@@ -369,6 +370,8 @@ namespace ffs2play
return SIM_VERSION.P3D_V2;
case 3:
return SIM_VERSION.P3D_V3;
case 4:
return SIM_VERSION.P3D_V4;
case 10:
return SIM_VERSION.FSX;
default:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment