mirror of
https://github.com/immense/Remotely.git
synced 2025-10-26 11:27:15 +00:00
Linux updater (again).
This commit is contained in:
parent
413f28afad
commit
f07d9002dd
@ -62,18 +62,7 @@ namespace Remotely_Agent.Services
|
||||
if (OSUtils.IsWindows)
|
||||
{
|
||||
ZipFile.ExtractToDirectory(tempFile, tempFolder, true);
|
||||
}
|
||||
else if (OSUtils.IsLinux)
|
||||
{
|
||||
Process.Start("sudo", "apt-get install unzip").WaitForExit();
|
||||
Process.Start("sudo", $"unzip -o {tempFile} -d {tempFolder}").WaitForExit();
|
||||
Process.Start("sudo", $"chmod -R 777 {tempFolder}").WaitForExit();
|
||||
Process.Start("sudo", $"chmod +x {Path.Combine(Path.GetTempPath(), "Remotely_Update", "Remotely_Agent")}").WaitForExit();
|
||||
}
|
||||
|
||||
Logger.Write($"Service Updater: Launching extracted process to perform update.");
|
||||
if (OSUtils.IsWindows)
|
||||
{
|
||||
Logger.Write($"Service Updater: Launching extracted process to perform update.");
|
||||
var psi = new ProcessStartInfo()
|
||||
{
|
||||
FileName = Path.Combine(Path.GetTempPath(), "Remotely_Update", OSUtils.ClientExecutableFileName),
|
||||
@ -84,7 +73,11 @@ namespace Remotely_Agent.Services
|
||||
}
|
||||
else if (OSUtils.IsLinux)
|
||||
{
|
||||
Process.Start("sudo", $"{Path.Combine(Path.GetTempPath(), "Remotely_Update", "Remotely_Agent")} -update true & disown");
|
||||
Process.Start("sudo", "apt-get install unzip").WaitForExit();
|
||||
Process.Start("sudo", $"unzip -o {tempFile} -d /usr/local/bin/Remotely/").WaitForExit();
|
||||
Process.Start("sudo", "chmod +x /usr/local/bin/Remotely/Remotely_Agent").WaitForExit();
|
||||
Logger.Write($"Service Updater: Update complete. Restarting service.");
|
||||
Process.Start("sudo", "systemctl restart remotely-agent");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -44,38 +44,48 @@ namespace Remotely_Server.Services
|
||||
|
||||
internal void StartProcessing()
|
||||
{
|
||||
while (FrameQueue.Count > 0)
|
||||
try
|
||||
{
|
||||
if (FrameQueue.TryDequeue(out var frame))
|
||||
while (FrameQueue.Count > 0)
|
||||
{
|
||||
if (!CumulativeFrames.ContainsKey(frame.ViewerID))
|
||||
if (FrameQueue.TryDequeue(out var frame))
|
||||
{
|
||||
CumulativeFrames[frame.ViewerID] = new Bitmap(frame.Width, frame.Height);
|
||||
}
|
||||
|
||||
var saveDir = Directory.CreateDirectory(GetSaveFolder(frame));
|
||||
|
||||
var saveFile = Path.Combine(
|
||||
saveDir.FullName,
|
||||
$"frame-{(Directory.GetFiles(saveDir.FullName).Length + 1).ToString()}.jpg");
|
||||
|
||||
var bitmap = CumulativeFrames[frame.ViewerID] as Bitmap;
|
||||
using (var graphics = Graphics.FromImage(bitmap))
|
||||
{
|
||||
using (var ms = new MemoryStream(frame.FrameBytes))
|
||||
if (!CumulativeFrames.ContainsKey(frame.ViewerID))
|
||||
{
|
||||
using (var saveImage = Image.FromStream(ms))
|
||||
CumulativeFrames[frame.ViewerID] = new Bitmap(frame.Width, frame.Height);
|
||||
}
|
||||
|
||||
var saveDir = Directory.CreateDirectory(GetSaveFolder(frame));
|
||||
|
||||
var saveFile = Path.Combine(
|
||||
saveDir.FullName,
|
||||
$"frame-{(Directory.GetFiles(saveDir.FullName).Length + 1).ToString()}.jpg");
|
||||
|
||||
var bitmap = CumulativeFrames[frame.ViewerID] as Bitmap;
|
||||
using (var graphics = Graphics.FromImage(bitmap))
|
||||
{
|
||||
using (var ms = new MemoryStream(frame.FrameBytes))
|
||||
{
|
||||
graphics.DrawImage(saveImage, frame.Left, frame.Top);
|
||||
using (var saveImage = Image.FromStream(ms))
|
||||
{
|
||||
graphics.DrawImage(saveImage, frame.Left, frame.Top);
|
||||
}
|
||||
}
|
||||
}
|
||||
bitmap.Save(saveFile, ImageFormat.Jpeg);
|
||||
}
|
||||
bitmap.Save(saveFile, ImageFormat.Jpeg);
|
||||
}
|
||||
}
|
||||
lock (LockObject)
|
||||
catch(Exception ex)
|
||||
{
|
||||
IsProcessing = false;
|
||||
DataService.WriteEvent(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
lock (LockObject)
|
||||
{
|
||||
IsProcessing = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -98,8 +108,8 @@ namespace Remotely_Server.Services
|
||||
HostingEnv.ContentRootPath,
|
||||
"Recordings",
|
||||
DateTime.Now.Year.ToString().PadLeft(4, '0'),
|
||||
DateTime.Now.Month.ToString().PadLeft(2, '0')),
|
||||
viewerID,
|
||||
DateTime.Now.Month.ToString().PadLeft(2, '0')),
|
||||
viewerID,
|
||||
SearchOption.AllDirectories);
|
||||
|
||||
foreach (var dir in recordingDirs)
|
||||
|
||||
@ -1 +1 @@
|
||||
2019.03.18.1822
|
||||
2019.03.18.2104
|
||||
|
||||
Loading…
Reference in New Issue
Block a user