11using NativeFileDialogSharp ;
22using System ;
33using System . IO ;
4+ using System . Linq ;
45using System . Threading ;
56
67public class Program
78{
8- static string OutputLibPath = AppDomain . CurrentDomain . SetupInformation . ApplicationBase . Replace ( "RL2.ModLoader.DevSetup \\ ", "" ) + "lib \\ " ;
9+ static string OutputPath = string . Join ( ' \\ ' , AppDomain . CurrentDomain . SetupInformation . ApplicationBase ! . Split ( " \\ ") . SkipLast ( 1 ) ) ;
910
1011 public static void Main ( string [ ] args ) {
1112 Console . WriteLine ( "Welcome to the RL2.ModLoader.DevSetup" ) ;
12- Console . WriteLine ( "Choose your games installation directory " ) ;
13+ Console . WriteLine ( "Choose your game's .exe file " ) ;
1314 Thread . Sleep ( 500 ) ;
1415
15- DialogResult result = Dialog . FolderPicker ( ) ;
16- string DataPath = result . Path + "\\ Rogue Legacy 2_Data" ;
16+ DialogResult result = Dialog . FileOpen ( ) ;
17+ string directory = result . Path . Replace ( "\\ Rogue Legacy 2.exe" , "" ) ;
18+ string DataPath = directory + "\\ Rogue Legacy 2_Data" ;
1719 string ManagedPath = DataPath + "\\ Managed" ;
1820
19- if ( ! Directory . Exists ( DataPath ) || ! Directory . Exists ( ManagedPath ) ) {
21+ if ( ! File . Exists ( directory + " \\ Rogue Legacy 2.exe" ) ) {
2022 Console . WriteLine ( "The provided path is incorrect" ) ;
23+ Console . WriteLine ( "The selected folder should contain the 'Rogue Legacy 2.exe' file" ) ;
2124 return ;
2225 }
2326
24- if ( ! Directory . Exists ( OutputLibPath ) ) {
25- Directory . CreateDirectory ( OutputLibPath ) ;
26- }
27+ File . WriteAllText ( OutputPath + "RL2.ModLoader.targets" , $ """
28+ <Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
29+ <!-- MSBuild variables -->
30+ <PropertyGroup>
31+ <RL2_Path>{ directory } </RL2_Path>
32+ <RL2_DataPath>{ DataPath } </RL2_DataPathPath>
33+ <RL2_LibPath>{ DataPath } </RL2_LibPath>
34+ </PropertyGroup>
2735
28- Console . WriteLine ( "\n Start copying libs..." ) ;
29- DirectoryInfo librariesDirectory = new DirectoryInfo ( ManagedPath ) ;
30- foreach ( FileInfo fileInfo in librariesDirectory . GetFiles ( "**.dll" ) ) {
31- if ( fileInfo . Name == "RL2.ModLoader.dll" || fileInfo . Name == "RL2.API.dll" ) {
32- continue ;
33- }
34- Console . WriteLine ( fileInfo . Name ) ;
35- File . Copy ( fileInfo . FullName , OutputLibPath + fileInfo . Name , true ) ;
36- }
37- Console . WriteLine ( "Press any key to exit..." ) ;
38- Console . ReadKey ( ) ;
36+ <!-- Shared references -->
37+ <ItemGroup>
38+ <Reference Include="{ ManagedPath } \*.dll" />
39+ </ItemGroup>
40+ </Project>
41+ """ ) ;
42+
43+ Console . WriteLine ( $ "RL2.ModLoader.targets created in { OutputPath } ") ;
44+ Console . WriteLine ( "Closing in 2 seconds..." ) ;
45+ Thread . Sleep ( 2_000 ) ;
3946 }
4047}
0 commit comments