-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathNotification.cs
More file actions
39 lines (34 loc) · 1.58 KB
/
Copy pathNotification.cs
File metadata and controls
39 lines (34 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using System.Diagnostics;
namespace TSKHook;
public class Notification
{
public static void Popup(string title, string text)
{
var script = string.Format("$headlineText = '{0}';", title) +
string.Format("$bodyText = '{0}';", text) +
"$ToastText02 = [Windows.UI.Notifications.ToastTemplateType, Windows.UI.Notifications, ContentType = WindowsRuntime]::ToastText02;" +
"$TemplateContent = [Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime]::GetTemplateContent($ToastText02);" +
"$TemplateContent.SelectSingleNode('//text[@id=\"1\"]').InnerText = $headlineText;" +
"$TemplateContent.SelectSingleNode('//text[@id=\"2\"]').InnerText = $bodyText;" +
"$AppId = 'Twinkle Star Knight';" +
"[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier($AppId).Show($TemplateContent);";
var start = new ProcessStartInfo("powershell.exe")
{
UseShellExecute = false,
CreateNoWindow = true,
Arguments = script
};
Process.Start(start);
}
public static void SsPopup(string location)
{
var scriptArgs = "-ExecutionPolicy Bypass -F ./BepInEx/plugins/SS_Notification.ps1 " + location + "";
var start = new ProcessStartInfo("powershell.exe")
{
UseShellExecute = false,
CreateNoWindow = true,
Arguments = scriptArgs
};
Process.Start(start);
}
}