mirror of
https://github.com/immense/Remotely.git
synced 2025-10-26 11:27:15 +00:00
Fixed line endings on sh scripts. Removed test code. Refactored ScreenCaster method.
This commit is contained in:
parent
3a0d9e1e02
commit
5ab7cf5af7
@ -1,8 +1,10 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@ -13,7 +15,14 @@ namespace Remotely_Agent.Services
|
||||
public static void Write(string message)
|
||||
{
|
||||
var path = Path.Combine(Path.GetTempPath(), "Remotely_Logs.txt");
|
||||
|
||||
if (!File.Exists(path))
|
||||
{
|
||||
File.Create(path).Close();
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
||||
{
|
||||
Process.Start("sudo", $"chmod 666 {path}").WaitForExit();
|
||||
}
|
||||
}
|
||||
var jsoninfo = new
|
||||
{
|
||||
Type = "Info",
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
using Remotely_Desktop.Services;
|
||||
using Remotely_Desktop.ViewModels;
|
||||
using Remotely_ScreenCast.Core.Utilities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
|
||||
@ -80,7 +80,6 @@
|
||||
<DependentUpon>HostNamePrompt.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Services\Config.cs" />
|
||||
<Compile Include="Services\Logger.cs" />
|
||||
<Compile Include="ViewModels\HostNamePromptViewModel.cs" />
|
||||
<Compile Include="ViewModels\MainWindowViewModel.cs" />
|
||||
<Page Include="Controls\HostNamePrompt.xaml">
|
||||
|
||||
@ -1,66 +0,0 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Remotely_Desktop.Services
|
||||
{
|
||||
public static class Logger
|
||||
{
|
||||
public static void Write(string message)
|
||||
{
|
||||
var path = Path.Combine(Path.GetTempPath(), "Remotely_Logs.txt");
|
||||
|
||||
var jsoninfo = new
|
||||
{
|
||||
Type = "Info",
|
||||
Timestamp = DateTime.Now.ToString(),
|
||||
Message = message
|
||||
};
|
||||
if (File.Exists(path))
|
||||
{
|
||||
var fi = new FileInfo(path);
|
||||
while (fi.Length > 1000000)
|
||||
{
|
||||
var content = File.ReadAllLines(path);
|
||||
File.WriteAllLines(path, content.Skip(10));
|
||||
fi = new FileInfo(path);
|
||||
}
|
||||
}
|
||||
File.AppendAllText(path, JsonConvert.SerializeObject(jsoninfo) + Environment.NewLine);
|
||||
}
|
||||
|
||||
public static void Write(Exception ex)
|
||||
{
|
||||
var exception = ex;
|
||||
var path = Path.Combine(Path.GetTempPath(), "Remotely_Logs.txt");
|
||||
|
||||
while (exception != null)
|
||||
{
|
||||
var jsonError = new
|
||||
{
|
||||
Type = "Error",
|
||||
Timestamp = DateTime.Now.ToString(),
|
||||
Message = exception?.Message,
|
||||
Source = exception?.Source,
|
||||
StackTrace = exception?.StackTrace,
|
||||
};
|
||||
if (File.Exists(path))
|
||||
{
|
||||
var fi = new FileInfo(path);
|
||||
while (fi.Length > 1000000)
|
||||
{
|
||||
var content = File.ReadAllLines(path);
|
||||
File.WriteAllLines(path, content.Skip(10));
|
||||
fi = new FileInfo(path);
|
||||
}
|
||||
}
|
||||
File.AppendAllText(path, JsonConvert.SerializeObject(jsonError) + Environment.NewLine);
|
||||
exception = exception.InnerException;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3,6 +3,7 @@ using Remotely_Desktop.Services;
|
||||
using Remotely_ScreenCast.Core;
|
||||
using Remotely_ScreenCast.Core.Capture;
|
||||
using Remotely_ScreenCast.Core.Models;
|
||||
using Remotely_ScreenCast.Core.Utilities;
|
||||
using Remotely_ScreenCast.Win;
|
||||
using Remotely_ScreenCast.Win.Capture;
|
||||
using Remotely_ScreenCast.Win.Input;
|
||||
@ -177,7 +178,7 @@ namespace Remotely_Desktop.ViewModels
|
||||
capturer = new BitBltCapture();
|
||||
}
|
||||
await Conductor.OutgoingMessages.SendCursorChange(CursorIconWatcher.GetCurrentCursor(), new List<string>() { viewerAndRequester.Item1 });
|
||||
ScreenCaster.BeginScreenCasting(viewerAndRequester.Item1, viewerAndRequester.Item2, Conductor.OutgoingMessages, capturer, Conductor);
|
||||
ScreenCaster.BeginScreenCasting(viewerAndRequester.Item1, viewerAndRequester.Item2, capturer, Conductor);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@ -16,7 +16,6 @@ namespace Remotely_ScreenCast.Core.Capture
|
||||
{
|
||||
public static async void BeginScreenCasting(string viewerID,
|
||||
string requesterName,
|
||||
OutgoingMessages outgoingMessages,
|
||||
ICapturer capturer,
|
||||
Conductor conductor)
|
||||
{
|
||||
@ -46,16 +45,16 @@ namespace Remotely_ScreenCast.Core.Capture
|
||||
conductor.ViewerAdded?.Invoke(null, viewer);
|
||||
}
|
||||
|
||||
await outgoingMessages.SendScreenCount(
|
||||
await conductor.OutgoingMessages.SendScreenCount(
|
||||
capturer.SelectedScreen,
|
||||
capturer.GetScreenCount(),
|
||||
viewerID);
|
||||
|
||||
await outgoingMessages.SendScreenSize(capturer.CurrentScreenBounds.Width, capturer.CurrentScreenBounds.Height, viewerID);
|
||||
await conductor.OutgoingMessages.SendScreenSize(capturer.CurrentScreenBounds.Width, capturer.CurrentScreenBounds.Height, viewerID);
|
||||
|
||||
capturer.ScreenChanged += async (sender, bounds) =>
|
||||
{
|
||||
await outgoingMessages.SendScreenSize(bounds.Width, bounds.Height, viewerID);
|
||||
await conductor.OutgoingMessages.SendScreenSize(bounds.Width, bounds.Height, viewerID);
|
||||
};
|
||||
|
||||
// TODO: SetThradDesktop causes issues with input after switching.
|
||||
@ -124,7 +123,7 @@ namespace Remotely_ScreenCast.Core.Capture
|
||||
|
||||
if (encodedImageBytes?.Length > 0)
|
||||
{
|
||||
await outgoingMessages.SendScreenCapture(encodedImageBytes, viewerID, diffArea.Left, diffArea.Top, diffArea.Width, diffArea.Height, DateTime.UtcNow);
|
||||
await conductor.OutgoingMessages.SendScreenCapture(encodedImageBytes, viewerID, diffArea.Left, diffArea.Top, diffArea.Width, diffArea.Height, DateTime.UtcNow);
|
||||
viewer.PendingFrames++;
|
||||
}
|
||||
// TODO: Even after disposing of the bitmap, GC doesn't collect in time. Memory usage soars quickly.
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@ -13,7 +15,14 @@ namespace Remotely_ScreenCast.Core.Utilities
|
||||
public static void Write(string message)
|
||||
{
|
||||
var path = Path.Combine(Path.GetTempPath(), "Remotely_Logs.txt");
|
||||
|
||||
if (!File.Exists(path))
|
||||
{
|
||||
File.Create(path).Close();
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
||||
{
|
||||
Process.Start("sudo", $"chmod 666 {path}").WaitForExit();
|
||||
}
|
||||
}
|
||||
var jsoninfo = new
|
||||
{
|
||||
Type = "Info",
|
||||
@ -48,6 +57,15 @@ namespace Remotely_ScreenCast.Core.Utilities
|
||||
var exception = ex;
|
||||
var path = Path.Combine(Path.GetTempPath(), "Remotely_Logs.txt");
|
||||
|
||||
if (!File.Exists(path))
|
||||
{
|
||||
File.Create(path).Close();
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
||||
{
|
||||
Process.Start("sudo", $"chmod 666 {path}").WaitForExit();
|
||||
}
|
||||
}
|
||||
|
||||
while (exception != null)
|
||||
{
|
||||
var jsonError = new
|
||||
|
||||
@ -19,7 +19,6 @@ namespace Remotely_ScreenCast.Linux
|
||||
{
|
||||
try
|
||||
{
|
||||
ScreenCastInitiated(null, new Tuple<string, string>("asdf", "asdf"));
|
||||
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
||||
Conductor = new Conductor();
|
||||
Conductor.ProcessArgs(args);
|
||||
@ -49,7 +48,7 @@ namespace Remotely_ScreenCast.Linux
|
||||
{
|
||||
capturer = new X11Capture();
|
||||
//await Conductor.OutgoingMessages.SendCursorChange(CursorIconWatcher.GetCurrentCursor(), new List<string>() { viewerAndRequester.Item1 });
|
||||
ScreenCaster.BeginScreenCasting(viewerAndRequester.Item1, viewerAndRequester.Item2, Conductor.OutgoingMessages, capturer, Conductor);
|
||||
ScreenCaster.BeginScreenCasting(viewerAndRequester.Item1, viewerAndRequester.Item2, capturer, Conductor);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@ -89,7 +89,7 @@ namespace Remotely_ScreenCast.Win
|
||||
capturer = new BitBltCapture();
|
||||
}
|
||||
await Conductor.OutgoingMessages.SendCursorChange(CursorIconWatcher.GetCurrentCursor(), new List<string>() { viewerAndRequester.Item1 });
|
||||
ScreenCaster.BeginScreenCasting(viewerAndRequester.Item1, viewerAndRequester.Item2, Conductor.OutgoingMessages, capturer, Conductor);
|
||||
ScreenCaster.BeginScreenCasting(viewerAndRequester.Item1, viewerAndRequester.Item2, capturer, Conductor);
|
||||
}
|
||||
|
||||
public static async void CursorIconWatcher_OnChange(object sender, CursorInfo cursor)
|
||||
|
||||
@ -1 +1 @@
|
||||
2019.03.28.1441
|
||||
2019.03.29.0908
|
||||
|
||||
@ -6,6 +6,8 @@ The output directory is the app root path. This would typically be in /var/www/[
|
||||
read -p "Enter app root path: " appRoot
|
||||
read -p "Enter server host (e.g. example.com): " serverHost
|
||||
|
||||
apt-get install acl
|
||||
|
||||
setfacl -R -m u:www-data:rwx $appRoot
|
||||
|
||||
# Install .NET Core Runtime.
|
||||
@ -17,6 +19,7 @@ apt-get update
|
||||
apt-get install -y aspnetcore-runtime-2.2
|
||||
rm packages-microsoft-prod.deb
|
||||
|
||||
|
||||
# Install Nginx
|
||||
apt-get update
|
||||
apt-get install -y nginx
|
||||
|
||||
Loading…
Reference in New Issue
Block a user