@@ -26,6 +26,7 @@ class Program
2626
2727 private const string OUTPUT_PATH = "Output/" ;
2828 private static string PATH_PREFIX = "/Game/Mods/" ;
29+ private static string ORIGINAL_PATH = "/Game/Mods/" ;
2930
3031 /// <summary>
3132 /// List of all read files
@@ -48,9 +49,12 @@ class Program
4849 /// <param name="args"></param>
4950 public static void Main ( string [ ] args )
5051 {
52+
5153 var path = Directory . GetCurrentDirectory ( ) ;
5254 var modFolder = path . Split ( '\\ ' ) . Last ( ) ;
53- PATH_PREFIX += modFolder ;
55+ var modId = GetValidModFolder ( modFolder ) ;
56+ ORIGINAL_PATH += modFolder ;
57+ PATH_PREFIX += modId ;
5458
5559 Console . WriteLine ( Environment . NewLine ) ;
5660 WriteColor ( @"[$$$$$$$$\ $$\ $$\ $$$$$$\ $$\]" , ConsoleColor . DarkGreen ) ;
@@ -68,7 +72,8 @@ public static void Main(string[] args)
6872 WriteColor ( $ "[// Autor:] { Assembly . GetEntryAssembly ( ) . GetCustomAttribute < AssemblyCopyrightAttribute > ( ) . Copyright } ", ConsoleColor . DarkGreen ) ;
6973 WriteColor ( @"[//--Settings-----------------------------------------------------]" , ConsoleColor . DarkGreen ) ;
7074 WriteColor ( $ "[// Output folder:] { OUTPUT_PATH } ", ConsoleColor . DarkGreen ) ;
71- WriteColor ( $ "[// Mod folder name:] { modFolder } (Absolute path: { PATH_PREFIX } )", ConsoleColor . DarkGreen ) ;
75+ WriteColor ( $ "[// Mod Id folder name:] { modId } (Absolute path: { PATH_PREFIX } )", ConsoleColor . DarkGreen ) ;
76+ WriteColor ( $ "[// Mod folder name:] { modFolder } (Absolute path: { ORIGINAL_PATH } )", ConsoleColor . DarkGreen ) ;
7277 WriteColor ( @"[//---------------------------------------------------------------]" , ConsoleColor . DarkGreen ) ;
7378 WriteColor ( $ "[// Blueprints:] To read blueprints they must begin with BP_", ConsoleColor . DarkGreen ) ;
7479 WriteColor ( $ "[// Engrams:] To read engrams they must begin with EngramEntry", ConsoleColor . DarkGreen ) ;
@@ -104,6 +109,39 @@ public static void Main(string[] args)
104109 Console . ReadKey ( ) ;
105110 }
106111
112+ /// <summary>
113+ /// Check if the folder is a mod id. If then try to read a modmeta.info file to get the original name
114+ /// </summary>
115+ /// <param name="baseFolder">Foldername of the mod</param>
116+ /// <returns>Original name of the mod folder</returns>
117+ static string GetValidModFolder ( string baseFolder )
118+ {
119+ int modId ;
120+ string modName = "" ;
121+ bool isMod = int . TryParse ( baseFolder , out modId ) ;
122+
123+ if ( ! isMod )
124+ {
125+ return baseFolder ;
126+ }
127+
128+ foreach ( var file in Directory . GetFiles ( "./" ) )
129+ {
130+ var filename = file . Split ( '\\ ' ) . Last ( ) ;
131+
132+ if ( filename . Equals ( "./modmeta.info" ) )
133+ {
134+ var parts = File . ReadAllText ( filename ) . Split ( '/' ) ;
135+ if ( parts . Count ( ) >= 3 )
136+ {
137+ modName = parts [ 3 ] ;
138+ }
139+ }
140+ }
141+
142+ return string . IsNullOrEmpty ( modName ) ? baseFolder : modName ;
143+ }
144+
107145 /// <summary>
108146 /// Parse all files and save them into list of strings
109147 /// </summary>
@@ -165,7 +203,7 @@ static void ParseFiles()
165203 spawncodeItemsFile . Add ( s ) ;
166204 continue ;
167205 }
168- if ( filename . StartsWith ( "Character_BP" ) )
206+ if ( filename . Contains ( "Character_BP" ) )
169207 {
170208 var s = "admincheat SpawnDino " + ( ( char ) 34 ) + "Blueprint'" + item . Replace ( path , PATH_PREFIX ) . Replace ( ".uasset" , "." + filename ) . Replace ( @"\" , "/" ) + "'" + ( ( char ) 34 ) + " 500 0 0 120" ;
171209 var ss = "admincheat GMSummon " + ( ( char ) 34 ) + filename + ( ( char ) 34 ) + " 120" ;
0 commit comments