Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch from python to exe #46

Merged
merged 3 commits into from
Jul 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions Si_Logging/Si_Logging.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ You should have received a copy of the GNU General Public License
using System.Text;
using System.Runtime.CompilerServices;

[assembly: MelonInfo(typeof(HL_Logging), "Half-Life Logger", "1.4.4", "databomb&zawedcvg", "https://github.com/data-bomb/Silica")]
[assembly: MelonInfo(typeof(HL_Logging), "Half-Life Logger", "1.4.5", "databomb&zawedcvg", "https://github.com/data-bomb/Silica")]
[assembly: MelonGame("Bohemia Interactive", "Silica")]
[assembly: MelonOptionalDependencies("Admin Mod")]

Expand All @@ -59,20 +59,18 @@ public class HL_Logging : MelonMod
static MelonPreferences_Category _modCategory = null!;
static MelonPreferences_Entry<bool> Pref_Log_Damage = null!;
static MelonPreferences_Entry<bool> Pref_Log_Kills_Include_AI_vs_Player = null!;
static MelonPreferences_Entry<string> Pref_Log_ParserFile = null!;
static MelonPreferences_Entry<string> Pref_Log_PythonExe = null!;
static MelonPreferences_Entry<string> Pref_Log_ParserExe = null!;
public static MelonPreferences_Entry<float> Pref_Log_PerfMonitor_Interval = null!;
public static MelonPreferences_Entry<bool> Pref_Log_PerfMonitor_Enable = null!;
public static MelonPreferences_Entry<bool> Pref_Log_PlayerConsole_Enable = null!;

public static bool ParserFilePresent()
public static bool ParserExePresent()
{
return System.IO.File.Exists(GetParserPath());
}

public static string GetParserPath()
{
return System.IO.Path.Combine(MelonEnvironment.UserDataDirectory, Pref_Log_ParserFile.Value);
return System.IO.Path.Combine(MelonEnvironment.UserDataDirectory, Pref_Log_ParserExe.Value);
}

public static void PrintLogLine(string LogMessage, bool suppressConsoleOutput = false)
Expand Down Expand Up @@ -147,8 +145,7 @@ public override void OnInitializeMelon()
_modCategory ??= MelonPreferences.CreateCategory("Silica");
Pref_Log_Damage ??= _modCategory.CreateEntry<bool>("Logging_LogDamage", false);
Pref_Log_Kills_Include_AI_vs_Player ??= _modCategory.CreateEntry<bool>("Logging_LogKills_IncludeAIvsPlayer", true);
Pref_Log_ParserFile ??= _modCategory.CreateEntry<string>("Logging_LogParserPath", "inserting_info.py");
Pref_Log_PythonExe ??= _modCategory.CreateEntry<string>("Logging_PythonExePath", "C:\\Users\\A\\Mods\\Silica\\ranked\\venv\\Scripts\\python.exe");
Pref_Log_ParserExe ??= _modCategory.CreateEntry<string>("Logging_ParserExePath", "parser.exe");
Pref_Log_PerfMonitor_Interval ??= _modCategory.CreateEntry<float>("Logging_PerfMonitor_LogInterval", 60f);
Pref_Log_PerfMonitor_Enable ??= _modCategory.CreateEntry<bool>("Logging_PerfMonitor_Enable", true);
Pref_Log_PlayerConsole_Enable ??= _modCategory.CreateEntry<bool>("Logging_PlayerConsole_Enable", true);
Expand Down Expand Up @@ -838,7 +835,7 @@ public static void Postfix(MusicJukeboxHandler __instance, GameMode __0, Team __
PrintLogLine(RoundWinLogLine);

// call parser
if (!ParserFilePresent())
if (!ParserExePresent())
{
MelonLogger.Msg("Parser file not present.");
return;
Expand All @@ -847,8 +844,8 @@ public static void Postfix(MusicJukeboxHandler __instance, GameMode __0, Team __
// launch parser
MelonLogger.Msg("Launching parser.");
ProcessStartInfo start = new ProcessStartInfo();
start.FileName = Pref_Log_PythonExe.Value;
string arguments = string.Format("\"{0}\" \"{1}\"", GetParserPath(), GetLogFileDirectory());
start.FileName = Path.GetFullPath(GetParserPath());
string arguments = string.Format("\"{0}", GetLogFileDirectory());
start.Arguments = arguments;
start.UseShellExecute = false;
start.RedirectStandardOutput = false;
Expand Down
Loading