Skip to content

Commit

Permalink
Set exit code according to exit status
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Byass committed Jan 22, 2021
1 parent d44a5d7 commit df3ba85
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions Cpp2IL/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ internal class Options
private static List<AssemblyDefinition> Assemblies = new List<AssemblyDefinition>();
internal static Options? CommandLineOptions;

public static void Main(string[] args)
public static int Main(string[] args)
{
Console.WriteLine("===Cpp2IL by Samboy063===");
Console.WriteLine("A Tool to Reverse Unity's \"il2cpp\" Build Process.");
Expand All @@ -66,7 +66,7 @@ public static void Main(string[] args)
if (CommandLineOptions == null)
{
Console.WriteLine("Invalid command line. Exiting.");
return;
return 1;
}

var baseGamePath = CommandLineOptions.GamePath;
Expand All @@ -76,7 +76,7 @@ public static void Main(string[] args)
if (!Directory.Exists(baseGamePath))
{
Console.WriteLine("Specified game-path does not exist: " + baseGamePath);
return;
return 2;
}

var assemblyPath = Path.Combine(baseGamePath, "GameAssembly.dll");
Expand All @@ -102,7 +102,8 @@ public static void Main(string[] args)
$"\t{assemblyPath}\n" +
$"\t{unityPlayerPath}\n" +
$"\t{metadataPath}\n");
return;

return 2;
}

#endregion
Expand Down Expand Up @@ -145,7 +146,7 @@ public static void Main(string[] args)
if (unityVerUseful[0] <= 4)
{
Console.WriteLine("Unable to determine a valid unity version. Aborting.");
return;
return 1;
}

#endregion
Expand All @@ -155,7 +156,7 @@ public static void Main(string[] args)
if (!LibCpp2IlMain.LoadFromFile(assemblyPath, metadataPath, unityVerUseful))
{
Console.WriteLine("Initialization with LibCpp2IL failed.");
return;
return 1;
}

Console.WriteLine(LibCpp2IlReflection.GetType("String", "System").DeclaringAssembly.Name);
Expand Down Expand Up @@ -468,8 +469,10 @@ public static void Main(string[] args)

// Console.WriteLine("[Finished. Press enter to exit]");
// Console.ReadLine();

return 0;
}

#if DUMP_PACKAGE_SUCCESS_DATA
private static string GetPackageName(string fullName)
{
Expand Down

0 comments on commit df3ba85

Please sign in to comment.