-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainWindow.xaml.cs
46 lines (41 loc) · 1.63 KB
/
MainWindow.xaml.cs
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
40
41
42
43
44
45
46
using System;
using System.IO;
using System.Windows;
using Microsoft.Web.WebView2.Core;
using System.Diagnostics;
namespace SSIRewritten
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
InitializeWebView();
}
private async void InitializeWebView()
{
await webView.EnsureCoreWebView2Async(null);
var htmlFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "web", "index.html");
webView.Source = new Uri(htmlFilePath, UriKind.Absolute);
webView.CoreWebView2.WebMessageReceived += WebView_WebMessageReceived;
}
private void WebView_WebMessageReceived(object sender, CoreWebView2WebMessageReceivedEventArgs e)
{
var message = e.WebMessageAsJson;
dynamic json = Newtonsoft.Json.JsonConvert.DeserializeObject(message);
if (json.action == "install")
{
bool installSpicetify = json.installSpicetify;
if (installSpicetify)
{
MessageBox.Show("the script will ask you to install the marketplace!.. -~-*(# 3#)/*-~-");
Process.Start(new ProcessStartInfo("powershell", "-Command \"iwr -useb https://raw.githubusercontent.com/spicetify/cli/main/install.ps1 | iex\"")).StandardOutput.ReadToEnd();
}
else
{
MessageBox.Show("you need to select at least 1 option.. -~-*(@//@)/*-~-");
}
}
}
}
}