diff options
Diffstat (limited to 'src/TrainerMod')
-rw-r--r-- | src/TrainerMod/TrainerMod.cs | 20 | ||||
-rw-r--r-- | src/TrainerMod/TrainerMod.csproj | 53 |
2 files changed, 21 insertions, 52 deletions
diff --git a/src/TrainerMod/TrainerMod.cs b/src/TrainerMod/TrainerMod.cs index f0c7549f..c76bb78c 100644 --- a/src/TrainerMod/TrainerMod.cs +++ b/src/TrainerMod/TrainerMod.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using Microsoft.Xna.Framework; using StardewModdingAPI; @@ -108,6 +109,9 @@ namespace TrainerMod Command.RegisterCommand("world_setseason", "Sets the season to the specified value | world_setseason <value>", new[] { "(winter, spring, summer, fall)<value> The target season" }).CommandFired += this.HandleWorldSetSeason; Command.RegisterCommand("world_downminelevel", "Goes down one mine level? | world_downminelevel", new[] { "" }).CommandFired += this.HandleWorldDownMineLevel; Command.RegisterCommand("world_setminelevel", "Sets mine level? | world_setminelevel", new[] { "(Int32)<value> The target level" }).CommandFired += this.HandleWorldSetMineLevel; + + Command.RegisterCommand("show_game_files", "Opens the game folder. | show_game_files").CommandFired += this.HandleShowGameFiles; + Command.RegisterCommand("show_data_files", "Opens the folder containing the save and log files. | show_data_files").CommandFired += this.HandleShowDataFiles; } /**** @@ -695,6 +699,22 @@ namespace TrainerMod this.LogValueNotSpecified(); } + /// <summary>The event raised when the 'show_game_files' command is triggered.</summary> + /// <param name="sender">The event sender.</param> + /// <param name="e">The event arguments.</param> + private void HandleShowGameFiles(object sender, EventArgsCommand e) + { + Process.Start(Constants.ExecutionPath); + } + + /// <summary>The event raised when the 'show_data_files' command is triggered.</summary> + /// <param name="sender">The event sender.</param> + /// <param name="e">The event arguments.</param> + private void HandleShowDataFiles(object sender, EventArgsCommand e) + { + Process.Start(Constants.DataPath); + } + /**** ** Helpers ****/ diff --git a/src/TrainerMod/TrainerMod.csproj b/src/TrainerMod/TrainerMod.csproj index e262e135..1457ac2b 100644 --- a/src/TrainerMod/TrainerMod.csproj +++ b/src/TrainerMod/TrainerMod.csproj @@ -37,54 +37,6 @@ <CheckForOverflowUnderflow>true</CheckForOverflowUnderflow> <PlatformTarget>x86</PlatformTarget> </PropertyGroup> - <PropertyGroup> - <!-- Linux paths --> - <GamePath Condition="!Exists('$(GamePath)')">$(HOME)/GOG Games/Stardew Valley/game</GamePath> - <GamePath Condition="!Exists('$(GamePath)')">$(HOME)/.local/share/Steam/steamapps/common/Stardew Valley</GamePath> - <!-- Mac paths --> - <GamePath Condition="!Exists('$(GamePath)')">$(HOME)/Library/Application Support/Steam/steamapps/common/Stardew Valley/Contents/MacOS</GamePath> - <!-- Windows paths --> - <GamePath Condition="!Exists('$(GamePath)')">C:\Program Files (x86)\GalaxyClient\Games\Stardew Valley</GamePath> - <GamePath Condition="!Exists('$(GamePath)')">C:\Program Files (x86)\Steam\steamapps\common\Stardew Valley</GamePath> - </PropertyGroup> - <Choose> - <When Condition="$(OS) == 'Windows_NT'"> - <ItemGroup> - <Reference Include="Microsoft.Xna.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86"> - <Private>False</Private> - </Reference> - <Reference Include="Microsoft.Xna.Framework.Game, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86"> - <Private>False</Private> - </Reference> - <Reference Include="Stardew Valley"> - <HintPath>$(GamePath)\Stardew Valley.exe</HintPath> - <Private>False</Private> - </Reference> - <Reference Include="xTile, Version=2.0.4.0, Culture=neutral, processorArchitecture=x86"> - <HintPath>$(GamePath)\xTile.dll</HintPath> - <Private>False</Private> - <SpecificVersion>False</SpecificVersion> - </Reference> - </ItemGroup> - </When> - <Otherwise> - <ItemGroup> - <Reference Include="MonoGame.Framework"> - <HintPath>$(GamePath)\MonoGame.Framework.dll</HintPath> - <Private>False</Private> - <SpecificVersion>False</SpecificVersion> - </Reference> - <Reference Include="StardewValley"> - <HintPath>$(GamePath)\StardewValley.exe</HintPath> - <Private>False</Private> - </Reference> - <Reference Include="xTile"> - <HintPath>$(GamePath)\xTile.dll</HintPath> - <Private>False</Private> - </Reference> - </ItemGroup> - </Otherwise> - </Choose> <ItemGroup> <Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath> @@ -123,15 +75,12 @@ </None> <None Include="packages.config" /> </ItemGroup> + <Import Project="$(SolutionDir)\crossplatform.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <PropertyGroup> <PostBuildEvent> </PostBuildEvent> </PropertyGroup> - <Target Name="BeforeBuild"> - <!-- if game path is invalid, show one user-friendly error instead of a slew of reference errors --> - <Error Condition="!Exists('$(GamePath)')" Text="Failed to find the game install path automatically; edit the *.csproj file and manually add a <GamePath> setting with the full directory path containing the Stardew Valley executable." /> - </Target> <Target Name="AfterBuild" Condition="$(Configuration) == 'Debug'"> <Copy SourceFiles="$(TargetDir)\$(TargetName).dll" DestinationFolder="$(GamePath)\Mods\TrainerMod" /> <Copy SourceFiles="$(TargetDir)\$(TargetName).dll.mdb" DestinationFolder="$(GamePath)\Mods\TrainerMod" Condition="$(OS) != 'Windows_NT'" /> |