🎉 every thing
This commit is contained in:
@@ -23,6 +23,10 @@ namespace GeekDesk.Plugins.EveryThing
|
|||||||
private static long pageCount = 20;
|
private static long pageCount = 20;
|
||||||
private static UInt32 ui = 0;
|
private static UInt32 ui = 0;
|
||||||
|
|
||||||
|
private static Process serviceProcess = null;
|
||||||
|
private static Process exeProcess = null;
|
||||||
|
|
||||||
|
|
||||||
public static void EnableEveryThing()
|
public static void EnableEveryThing()
|
||||||
{
|
{
|
||||||
string pluginsPath = Constants.PLUGINS_PATH;
|
string pluginsPath = Constants.PLUGINS_PATH;
|
||||||
@@ -52,33 +56,29 @@ namespace GeekDesk.Plugins.EveryThing
|
|||||||
if (!enabled)
|
if (!enabled)
|
||||||
{
|
{
|
||||||
//启动服务
|
//启动服务
|
||||||
using (Process p = new Process())
|
serviceProcess = new Process();
|
||||||
{
|
serviceProcess.StartInfo.FileName = everyThingPath;
|
||||||
p.StartInfo.FileName = everyThingPath;
|
serviceProcess.StartInfo.UseShellExecute = true;
|
||||||
p.StartInfo.UseShellExecute = true;
|
serviceProcess.StartInfo.Verb = "runas";
|
||||||
p.StartInfo.Verb = "runas";
|
serviceProcess.StartInfo.Arguments = " -svc";
|
||||||
p.StartInfo.Arguments = " -svc";
|
serviceProcess.Start();
|
||||||
p.Start();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Thread.Sleep(2000);
|
Thread.Sleep(2000);
|
||||||
processList = Process.GetProcesses();
|
processList = Process.GetProcesses();
|
||||||
|
|
||||||
//启动程序
|
//启动程序
|
||||||
using (Process p = new Process())
|
exeProcess = new Process();
|
||||||
|
exeProcess.StartInfo.FileName = everyThingPath;
|
||||||
|
exeProcess.Start();
|
||||||
|
int waitTime = 5000;
|
||||||
|
while (true && waitTime > 0)
|
||||||
{
|
{
|
||||||
p.StartInfo.FileName = everyThingPath;
|
Thread.Sleep(100);
|
||||||
p.Start();
|
waitTime -= 100;
|
||||||
int waitTime = 5000;
|
exeProcess.CloseMainWindow();
|
||||||
while (true && waitTime > 0)
|
|
||||||
{
|
|
||||||
Thread.Sleep(100);
|
|
||||||
waitTime -= 100;
|
|
||||||
p.CloseMainWindow();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e)
|
} catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -102,6 +102,8 @@ namespace GeekDesk.Plugins.EveryThing
|
|||||||
EveryThing32.Everything_Exit();
|
EveryThing32.Everything_Exit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (exeProcess != null) exeProcess.Kill();
|
||||||
|
if (serviceProcess != null) serviceProcess.Kill();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user