Skip to content

Commit

Permalink
Add and log JSON of new apps
Browse files Browse the repository at this point in the history
  • Loading branch information
ocdtrekkie committed Jun 21, 2024
1 parent 103d8a7 commit 15f24c8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion modSystem.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text.Json;
using Microsoft.Win32;

namespace XRFAgent
Expand All @@ -24,7 +25,7 @@ public static string GetInstalledSoftware()
List<RegistryKey> UninstallKeys = new List<RegistryKey>() { Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"), Registry.LocalMachine.OpenSubKey(@"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall") };
RegistryKey SoftwareKey;
string SoftwareKeyName;
string NewSoftware = "";
string NewSoftware = ""; string NewSoftwareJSON = "{\"newsoftware\":[";
int count = 0;
int result = 0;
modDatabase.InstalledSoftware SoftwareObj;
Expand All @@ -43,6 +44,7 @@ public static string GetInstalledSoftware()
if (result == 0)
{
NewSoftware = NewSoftware + SoftwareKeyName + ", ";
NewSoftwareJSON = NewSoftwareJSON + JsonSerializer.Serialize(SoftwareObj) + ",";
result = modDatabase.AddSoftware(SoftwareObj);
}
count++;
Expand All @@ -53,7 +55,9 @@ public static string GetInstalledSoftware()
if (NewSoftware != "")
{
NewSoftware = NewSoftware.Substring(0, NewSoftware.Length - 2);
NewSoftwareJSON = NewSoftwareJSON.Substring(0, NewSoftwareJSON.Length - 1) + "]}";
modLogging.LogEvent("Detected new software installed: " + NewSoftware, EventLogEntryType.Information, 6051);
modLogging.LogEvent(NewSoftwareJSON, EventLogEntryType.Information, 6051);
}
return "Installed Applications: " + count.ToString();
}
Expand Down

0 comments on commit 15f24c8

Please sign in to comment.