Merge pull request #212 from kwsch/f/clickonce-compile

Added project configuration for ClickOnce deployments
This commit is contained in:
Kaphotics 2016-09-17 12:43:32 -07:00 committed by GitHub
commit 0508ad58ed
4 changed files with 62 additions and 1 deletions

View file

@ -11,14 +11,24 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{7C0598C9
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
ClickOnce-Debug|x86 = ClickOnce-Debug|x86
ClickOnce-Release|x86 = ClickOnce-Release|x86
Debug|x86 = Debug|x86
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B4EFF030-C75A-49F9-A4BC-738D1B61C4AF}.ClickOnce-Debug|x86.ActiveCfg = ClickOnce-Debug|x86
{B4EFF030-C75A-49F9-A4BC-738D1B61C4AF}.ClickOnce-Debug|x86.Build.0 = ClickOnce-Debug|x86
{B4EFF030-C75A-49F9-A4BC-738D1B61C4AF}.ClickOnce-Release|x86.ActiveCfg = ClickOnce-Release|x86
{B4EFF030-C75A-49F9-A4BC-738D1B61C4AF}.ClickOnce-Release|x86.Build.0 = ClickOnce-Release|x86
{B4EFF030-C75A-49F9-A4BC-738D1B61C4AF}.Debug|x86.ActiveCfg = Debug|x86
{B4EFF030-C75A-49F9-A4BC-738D1B61C4AF}.Debug|x86.Build.0 = Debug|x86
{B4EFF030-C75A-49F9-A4BC-738D1B61C4AF}.Release|x86.ActiveCfg = Release|x86
{B4EFF030-C75A-49F9-A4BC-738D1B61C4AF}.Release|x86.Build.0 = Release|x86
{8E2499BC-C11A-4809-8737-66D35A625425}.ClickOnce-Debug|x86.ActiveCfg = Debug|x86
{8E2499BC-C11A-4809-8737-66D35A625425}.ClickOnce-Debug|x86.Build.0 = Debug|x86
{8E2499BC-C11A-4809-8737-66D35A625425}.ClickOnce-Release|x86.ActiveCfg = Release|x86
{8E2499BC-C11A-4809-8737-66D35A625425}.ClickOnce-Release|x86.Build.0 = Release|x86
{8E2499BC-C11A-4809-8737-66D35A625425}.Debug|x86.ActiveCfg = Debug|x86
{8E2499BC-C11A-4809-8737-66D35A625425}.Debug|x86.Build.0 = Debug|x86
{8E2499BC-C11A-4809-8737-66D35A625425}.Release|x86.ActiveCfg = Release|x86

View file

@ -215,7 +215,7 @@ namespace PKHeX
#region Path Variables
public static string WorkingDirectory => Environment.CurrentDirectory;
public static string WorkingDirectory => Util.IsClickonceDeployed ? Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "PKHeX") : Environment.CurrentDirectory;
public static string DatabasePath => Path.Combine(WorkingDirectory, "db");
public static string WC6DatabasePath => Path.Combine(WorkingDirectory, "wc6");
private static string BackupPath => Path.Combine(WorkingDirectory, "bak");

View file

@ -58,6 +58,28 @@
<PropertyGroup>
<StartupObject>PKHeX.Program</StartupObject>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ClickOnce-Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\ClickOnce-Debug\</OutputPath>
<DefineConstants>DEBUG;CLICKONCE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<LangVersion>6</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ClickOnce-Release|x86'">
<DefineConstants>CLICKONCE</DefineConstants>
<OutputPath>bin\x86\ClickOnce-Release\</OutputPath>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<LangVersion>6</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
@ -67,6 +89,12 @@
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup Condition="'$(Configuration)|$(Platform)' == 'ClickOnce-Debug|x86'">
<Reference Include="System.Deployment" />
</ItemGroup>
<ItemGroup Condition="'$(Configuration)|$(Platform)' == 'ClickOnce-Release|x86'">
<Reference Include="System.Deployment" />
</ItemGroup>
<ItemGroup>
<Compile Include="Legality\Analysis.cs" />
<Compile Include="Legality\Checks.cs" />
@ -337,6 +365,7 @@
<Compile Include="Util\ByteUtil.cs" />
<Compile Include="Util\DataUtil.cs" />
<Compile Include="Util\DateUtil.cs" />
<Compile Include="Util\DeployUtil.cs" />
<Compile Include="Util\FormUtil.cs" />
<Compile Include="Util\ImageUtil.cs" />
<Compile Include="Util\NetUtil.cs" />

22
PKHeX/Util/DeployUtil.cs Normal file
View file

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace PKHeX
{
public partial class Util
{
public static bool IsClickonceDeployed
{
get
{
#if CLICKONCE
return System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed;
#else
return false;
#endif
}
}
}
}