|
|
|
@ -21,7 +21,7 @@ namespace UMC.Host
|
|
|
|
|
{
|
|
|
|
|
public static void Main(string[] args)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AppDomain.CurrentDomain.UnhandledException += UnhandledException;
|
|
|
|
|
var variable = System.Environment.GetEnvironmentVariable("UMC");
|
|
|
|
|
|
|
|
|
@ -92,28 +92,33 @@ namespace UMC.Host
|
|
|
|
|
|
|
|
|
|
public static bool IsRun()
|
|
|
|
|
{
|
|
|
|
|
var ls = Utility.Reader(UMC.Data.Utility.MapPath(".lock"));
|
|
|
|
|
if (String.IsNullOrEmpty(ls) == false)
|
|
|
|
|
using (var pipeClient = new NamedPipeClientStream(".", $"APIUMC", PipeDirection.InOut))
|
|
|
|
|
{
|
|
|
|
|
var hs = JSON.Deserialize<Hashtable>(ls);
|
|
|
|
|
if (hs != null)
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var id = hs["Id"] as string;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var prc = System.Diagnostics.Process.GetProcessById(Convert.ToInt32(id));
|
|
|
|
|
if (prc != null)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
var key = UMC.Data.Utility.Parse36Encode(UMC.Data.Utility.IntParse(new Guid(UMC.Data.Utility.MD5(UMC.Data.Utility.MapPath("~"))))); ;
|
|
|
|
|
|
|
|
|
|
pipeClient.Connect(10);
|
|
|
|
|
pipeClient.Write(System.Text.Encoding.UTF8.GetBytes($"check {key}"));
|
|
|
|
|
var ls = new byte[0x200];
|
|
|
|
|
var l = pipeClient.Read(ls, 0, ls.Length);
|
|
|
|
|
if (l > 0)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
Console.ForegroundColor = ConsoleColor.DarkRed;
|
|
|
|
|
Console.WriteLine(System.Text.Encoding.UTF8.GetString(ls, 0, l));
|
|
|
|
|
Console.WriteLine();
|
|
|
|
|
Console.ResetColor();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
pipeClient.Close();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void Write(params string[] args)
|
|
|
|
@ -121,7 +126,7 @@ namespace UMC.Host
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var key = UMC.Data.Utility.Parse36Encode(UMC.Data.Utility.IntParse(new Guid(UMC.Data.Utility.MD5(UMC.Data.Utility.MapPath("~"))))); ;
|
|
|
|
|
using (var pipeClient = new NamedPipeClientStream(".", $"UMC.{key}", PipeDirection.InOut))
|
|
|
|
|
using (var pipeClient = new NamedPipeClientStream(".", $"APIUMC", PipeDirection.InOut))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -387,17 +392,22 @@ namespace UMC.Host
|
|
|
|
|
stream.Flush();
|
|
|
|
|
stream.Close();
|
|
|
|
|
stream.Dispose();
|
|
|
|
|
|
|
|
|
|
System.IO.Compression.ZipFile.ExtractToDirectory(downloadFile, UMC.Data.Utility.MapPath("/"), true);
|
|
|
|
|
if (native.EndsWith("exe"))
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
Utility.Move(UMC.Data.Utility.MapPath("/cavif.exe"), file);
|
|
|
|
|
System.IO.Compression.ZipFile.ExtractToDirectory(downloadFile, UMC.Data.Utility.MapPath("/"), true);
|
|
|
|
|
if (native.EndsWith("exe"))
|
|
|
|
|
{
|
|
|
|
|
Utility.Move(UMC.Data.Utility.MapPath("/cavif.exe"), file);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Utility.Move(UMC.Data.Utility.MapPath("/cavif"), file);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
Utility.Move(UMC.Data.Utility.MapPath("/cavif"), file);
|
|
|
|
|
Console.WriteLine($"图片组件下载失败,影响图片功能");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
File.Delete(downloadFile);
|
|
|
|
|
mre.Set();
|
|
|
|
|
}
|
|
|
|
|