mirror of
https://github.com/immense/Remotely.git
synced 2025-10-26 11:27:15 +00:00
Working on desktop app.
This commit is contained in:
parent
6af992a7f4
commit
e5f23ec0dd
@ -285,12 +285,11 @@ namespace Remotely_Agent.Services
|
||||
}
|
||||
try
|
||||
{
|
||||
var filePath = ExtractScreenCasterEXE();
|
||||
|
||||
// Start ScreenCast.
|
||||
if (OSUtils.IsWindows)
|
||||
{
|
||||
|
||||
var filePath = ExtractScreenCasterEXE();
|
||||
|
||||
if (Program.IsDebug)
|
||||
{
|
||||
Process.Start(filePath, $"-mode Unattended -requester {requesterID} -serviceid {serviceID} -host {Utilities.GetConnectionInfo().Host} -relaunch true -desktop default -viewers {String.Join(",", viewerIDs)}");
|
||||
|
||||
@ -6,7 +6,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Remotely_Agent.Client
|
||||
namespace Remotely_Agent.Services
|
||||
{
|
||||
public static class Logger
|
||||
{
|
||||
|
||||
@ -4,6 +4,26 @@
|
||||
xmlns:local="clr-namespace:Remotely_Desktop"
|
||||
StartupUri="MainWindow.xaml">
|
||||
<Application.Resources>
|
||||
|
||||
<Style x:Key="TitlebarButton" TargetType="Button">
|
||||
<Setter Property="DockPanel.Dock" Value="Right"></Setter>
|
||||
<Setter Property="HorizontalAlignment" Value="Right"></Setter>
|
||||
<Setter Property="BorderBrush" Value="{x:Null}"></Setter>
|
||||
<Setter Property="Background" Value="{x:Null}"></Setter>
|
||||
<Setter Property="Foreground" Value="White"></Setter>
|
||||
<Setter Property="FontWeight" Value="Bold"></Setter>
|
||||
<Setter Property="Height" Value="30"></Setter>
|
||||
<Setter Property="Width" Value="30"></Setter>
|
||||
<Setter Property="Cursor" Value="Hand"></Setter>
|
||||
<Setter Property="Margin" Value="5,0,5,0"></Setter>
|
||||
</Style>
|
||||
<Style x:Key="SectionHeader" TargetType="TextBlock">
|
||||
<Setter Property="FontWeight" Value="Bold"></Setter>
|
||||
<Setter Property="FontSize" Value="18"></Setter>
|
||||
</Style>
|
||||
<Style x:Key="NormalButton" TargetType="Button">
|
||||
<Setter Property="Background" Value="White"></Setter>
|
||||
<Setter Property="BorderThickness" Value="1"></Setter>
|
||||
<Setter Property="BorderBrush" Value="Black"></Setter>
|
||||
</Style>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
|
||||
5
Remotely_Desktop/FodyWeavers.xml
Normal file
5
Remotely_Desktop/FodyWeavers.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
|
||||
<Costura />
|
||||
<PropertyChanged />
|
||||
</Weavers>
|
||||
140
Remotely_Desktop/FodyWeavers.xsd
Normal file
140
Remotely_Desktop/FodyWeavers.xsd
Normal file
@ -0,0 +1,140 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
|
||||
<xs:element name="Weavers">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="Costura" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element minOccurs="0" maxOccurs="1" name="ExcludeAssemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element minOccurs="0" maxOccurs="1" name="IncludeAssemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged32Assemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with line breaks.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged64Assemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of unmanaged 64 bit assembly names to include, delimited with line breaks.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element minOccurs="0" maxOccurs="1" name="PreloadOrder" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>The order of preloaded assemblies, delimited with line breaks.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
</xs:all>
|
||||
<xs:attribute name="CreateTemporaryAssemblies" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>This will copy embedded files to disk before loading them into memory. This is helpful for some scenarios that expected an assembly to be loaded from a physical file.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="IncludeDebugSymbols" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Controls if .pdbs for reference assemblies are also embedded.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="DisableCompression" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="DisableCleanup" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="LoadAtModuleInit" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Costura by default will load as part of the module initialization. This flag disables that behavior. Make sure you call CosturaUtility.Initialize() somewhere in your code.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="IgnoreSatelliteAssemblies" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Costura will by default use assemblies with a name like 'resources.dll' as a satellite resource and prepend the output path. This flag disables that behavior.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="ExcludeAssemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with |</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="IncludeAssemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="Unmanaged32Assemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with |.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="Unmanaged64Assemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of unmanaged 64 bit assembly names to include, delimited with |.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="PreloadOrder" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>The order of preloaded assemblies, delimited with |.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="PropertyChanged" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="InjectOnPropertyNameChanged" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Used to control if the On_PropertyName_Changed feature is enabled.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="EventInvokerNames" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Used to change the name of the method that fires the notify event. This is a string that accepts multiple values in a comma separated form.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="CheckForEquality" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Used to control if equality checks should be inserted. If false, equality checking will be disabled for the project.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="CheckForEqualityUsingBaseEquals" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Used to control if equality checks should use the Equals method resolved from the base class.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="UseStaticEqualsFromBase" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Used to control if equality checks should use the static Equals method resolved from the base class.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:all>
|
||||
<xs:attribute name="VerifyAssembly" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="GenerateXsd" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
@ -1,12 +1,52 @@
|
||||
<Window x:Class="Remotely_Desktop.MainWindow"
|
||||
<Window
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:Remotely_Desktop"
|
||||
xmlns:ViewModels="clr-namespace:Remotely_Desktop.ViewModels" x:Class="Remotely_Desktop.MainWindow"
|
||||
mc:Ignorable="d"
|
||||
Title="MainWindow" Height="450" Width="800">
|
||||
<Grid>
|
||||
|
||||
</Grid>
|
||||
Title="Remotely" Height="350" Width="400" MouseLeftButtonDown="Window_MouseLeftButtonDown" WindowStyle="None" ResizeMode="NoResize" Icon="favicon.ico">
|
||||
<Window.DataContext>
|
||||
<ViewModels:MainWindowViewModel/>
|
||||
</Window.DataContext>
|
||||
<StackPanel>
|
||||
<Border Height="50" Background="#FF535353">
|
||||
<DockPanel Margin="10,0,0,0">
|
||||
<StackPanel>
|
||||
<TextBlock Foreground="DeepSkyBlue" FontWeight="Bold" FontSize="20" Margin="0,2,0,0">Remotely</TextBlock>
|
||||
<TextBlock Foreground="White" FontSize="10"><Run Text="Do IT Remotely"/></TextBlock>
|
||||
</StackPanel>
|
||||
<Button Style="{StaticResource TitlebarButton}" Click="CloseButton_Click" Content="X"/>
|
||||
<Button Style="{StaticResource TitlebarButton}" Click="MinimizeButton_Click" Content="_"/>
|
||||
</DockPanel>
|
||||
</Border>
|
||||
<Grid Margin="10,15,10,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0" Margin="0,0,15,0">
|
||||
<TextBlock Style="{StaticResource SectionHeader}"><Run Text="Share Screen"/></TextBlock>
|
||||
<TextBlock FontSize="16" Margin="0,10,0,5"><Run Text="Your Session ID:"/></TextBlock>
|
||||
<TextBox FontSize="16" Text="{Binding SessionID}" IsReadOnly="True"/>
|
||||
<Grid Margin="0,10,0,0">
|
||||
<TextBlock VerticalAlignment="Center">
|
||||
Invite Link:
|
||||
</TextBlock>
|
||||
<Button HorizontalAlignment="Right" Style="{StaticResource NormalButton}" Width="50" Height="25">
|
||||
Copy
|
||||
</Button>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="1" Margin="15,0,0,0">
|
||||
<TextBlock Style="{StaticResource SectionHeader}"><Run Text="Viewers"/></TextBlock>
|
||||
<ListBox Height="200" Margin="0,5,0,0" ItemsSource="{Binding Viewers}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate/>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Window>
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Remotely_Desktop.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@ -23,6 +24,27 @@ namespace Remotely_Desktop
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = new MainWindowViewModel();
|
||||
}
|
||||
|
||||
private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
DragMove();
|
||||
}
|
||||
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void CloseButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
App.Current.Shutdown();
|
||||
}
|
||||
|
||||
private void MinimizeButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.WindowState = WindowState.Minimized;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
15
Remotely_Desktop/Models/Viewer.cs
Normal file
15
Remotely_Desktop/Models/Viewer.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Remotely_Desktop.Models
|
||||
{
|
||||
public class Viewer
|
||||
{
|
||||
public string ConnectionId { get; set; }
|
||||
public string Name { get; set; }
|
||||
public bool HasControl { get; set; }
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\packages\Costura.Fody.3.3.2\build\Costura.Fody.props" Condition="Exists('..\packages\Costura.Fody.3.3.2\build\Costura.Fody.props')" />
|
||||
<Import Project="..\packages\PropertyChanged.Fody.2.6.0\build\PropertyChanged.Fody.props" Condition="Exists('..\packages\PropertyChanged.Fody.2.6.0\build\PropertyChanged.Fody.props')" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
@ -14,6 +16,8 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
@ -34,9 +38,22 @@
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>favicon.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Costura, Version=3.3.2.0, Culture=neutral, PublicKeyToken=9919ef960d84173d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Costura.Fody.3.3.2\lib\net40\Costura.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PropertyChanged, Version=2.6.0.0, Culture=neutral, PublicKeyToken=ee3ee20bcf148ddd, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\PropertyChanged.Fody.2.6.0\lib\net452\PropertyChanged.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Core" />
|
||||
@ -55,6 +72,9 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="Services\Config.cs" />
|
||||
<Compile Include="Services\Logger.cs" />
|
||||
<Compile Include="ViewModels\MainWindowViewModel.cs" />
|
||||
<Page Include="MainWindow.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
@ -69,6 +89,7 @@
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Models\Viewer.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
@ -86,6 +107,7 @@
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
@ -94,5 +116,24 @@
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="FodyWeavers.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Resources\Remotely_ScreenCast.exe" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="favicon.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\PropertyChanged.Fody.2.6.0\build\PropertyChanged.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\PropertyChanged.Fody.2.6.0\build\PropertyChanged.Fody.props'))" />
|
||||
<Error Condition="!Exists('..\packages\Costura.Fody.3.3.2\build\Costura.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Costura.Fody.3.3.2\build\Costura.Fody.props'))" />
|
||||
<Error Condition="!Exists('..\packages\Fody.4.0.2\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.4.0.2\build\Fody.targets'))" />
|
||||
</Target>
|
||||
<Import Project="..\packages\Fody.4.0.2\build\Fody.targets" Condition="Exists('..\packages\Fody.4.0.2\build\Fody.targets')" />
|
||||
</Project>
|
||||
BIN
Remotely_Desktop/Resources/Remotely_ScreenCast.exe
Normal file
BIN
Remotely_Desktop/Resources/Remotely_ScreenCast.exe
Normal file
Binary file not shown.
51
Remotely_Desktop/Services/Config.cs
Normal file
51
Remotely_Desktop/Services/Config.cs
Normal file
@ -0,0 +1,51 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization.Json;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Remotely_Desktop.Services
|
||||
{
|
||||
public class Config
|
||||
{
|
||||
private static string ConfigFolder => Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Remotely");
|
||||
private static string ConfigFile => Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Remotely", "Config.json");
|
||||
|
||||
public static Config GetConfig()
|
||||
{
|
||||
if (Directory.Exists(ConfigFolder))
|
||||
{
|
||||
return new Config();
|
||||
}
|
||||
|
||||
if (File.Exists(ConfigFile))
|
||||
{
|
||||
var serializer = new DataContractJsonSerializer(typeof(Config));
|
||||
try
|
||||
{
|
||||
return JsonConvert.DeserializeObject<Config>(File.ReadAllText(ConfigFile));
|
||||
}
|
||||
catch
|
||||
{
|
||||
return new Config();
|
||||
}
|
||||
}
|
||||
return new Config();
|
||||
}
|
||||
|
||||
public static void SaveConfig(Config config)
|
||||
{
|
||||
try
|
||||
{
|
||||
File.WriteAllText(ConfigFile, JsonConvert.SerializeObject(config));
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
public string Host { get; set; }
|
||||
}
|
||||
}
|
||||
66
Remotely_Desktop/Services/Logger.cs
Normal file
66
Remotely_Desktop/Services/Logger.cs
Normal file
@ -0,0 +1,66 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
57
Remotely_Desktop/ViewModels/MainWindowViewModel.cs
Normal file
57
Remotely_Desktop/ViewModels/MainWindowViewModel.cs
Normal file
@ -0,0 +1,57 @@
|
||||
using Remotely_Desktop.Models;
|
||||
using Remotely_Desktop.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Remotely_Desktop.ViewModels
|
||||
{
|
||||
public class MainWindowViewModel
|
||||
{
|
||||
public ObservableCollection<Viewer> Viewers { get; set; }
|
||||
public string SessionID { get; set; } = "Retrieving...";
|
||||
|
||||
private Process LaunchScreenCaster()
|
||||
{
|
||||
var filePath = ExtractScreenCasterEXE();
|
||||
return Process.Start(filePath, $"-mode Normal -host {Config.GetConfig().Host}");
|
||||
}
|
||||
private string ExtractScreenCasterEXE()
|
||||
{
|
||||
// Cleanup old files.
|
||||
foreach (var file in Directory.GetFiles(Path.GetTempPath(), "Remotely_ScreenCast*"))
|
||||
{
|
||||
try
|
||||
{
|
||||
File.Delete(file);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
// Get temp file name.
|
||||
var count = 0;
|
||||
var filePath = Path.Combine(Path.GetTempPath(), "Remotely_ScreenCast.exe");
|
||||
while (File.Exists(filePath))
|
||||
{
|
||||
filePath = Path.Combine(Path.GetTempPath(), $"Remotely_ScreenCast{count}.exe");
|
||||
count++;
|
||||
}
|
||||
|
||||
// Extract ScreenCast.
|
||||
using (var mrs = Assembly.GetExecutingAssembly().GetManifestResourceStream("Remotely_Desktop.Resources.Remotely_ScreenCast.exe"))
|
||||
{
|
||||
using (var fs = new FileStream(filePath, FileMode.Create))
|
||||
{
|
||||
mrs.CopyTo(fs);
|
||||
}
|
||||
}
|
||||
return filePath;
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
Remotely_Desktop/favicon.ico
Normal file
BIN
Remotely_Desktop/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 103 KiB |
7
Remotely_Desktop/packages.config
Normal file
7
Remotely_Desktop/packages.config
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Costura.Fody" version="3.3.2" targetFramework="net472" />
|
||||
<package id="Fody" version="4.0.2" targetFramework="net472" developmentDependency="true" />
|
||||
<package id="Newtonsoft.Json" version="12.0.1" targetFramework="net472" />
|
||||
<package id="PropertyChanged.Fody" version="2.6.0" targetFramework="net472" />
|
||||
</packages>
|
||||
@ -60,7 +60,7 @@ namespace Remotely_ScreenCast
|
||||
if (desktopName.ToLower() != CurrentDesktopName.ToLower())
|
||||
{
|
||||
CurrentDesktopName = desktopName;
|
||||
Logger.Write($"Relaunching in desktop {desktopName}.");
|
||||
Logger.Write($"Setting initial desktop to {desktopName}.");
|
||||
argDict["desktop"] = desktopName;
|
||||
var openProcessString = Assembly.GetExecutingAssembly().Location;
|
||||
foreach (var arg in argDict)
|
||||
@ -81,6 +81,7 @@ namespace Remotely_ScreenCast
|
||||
|
||||
if (argDict.ContainsKey("relaunch"))
|
||||
{
|
||||
Logger.Write($"Resuming after relaunch in desktop {desktopName}.");
|
||||
var viewersString = argDict["viewers"];
|
||||
var viewerIDs = viewersString.Split(",".ToCharArray());
|
||||
OutgoingMessages.NotifyViewersRelaunchedScreenCasterReady(viewerIDs).Wait();
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=600, user-scalable=no" />
|
||||
<meta name="viewport" content="width=550, user-scalable=no" />
|
||||
<link rel="icon" href="~/favicon.ico" />
|
||||
<title>@ViewData["Title"] - Remotely</title>
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
|
||||
@ -76,7 +76,7 @@ namespace Remotely_Server.Services
|
||||
if (ViewerList.Count > 0)
|
||||
{
|
||||
await RCBrowserHub.Clients.Clients(ViewerList).SendAsync("Reconnecting");
|
||||
await DeviceHub.Clients.Client(ServiceID).SendAsync("RestartScreenCaster", ViewerList, ServiceID, Context.ConnectionId);
|
||||
await DeviceHub.Clients.Client(ServiceID).SendAsync("RestartScreenCaster", ViewerList, ServiceID, Context.ConnectionId);
|
||||
}
|
||||
}
|
||||
await base.OnDisconnectedAsync(exception);
|
||||
|
||||
@ -1 +1 @@
|
||||
2019.03.12.1040
|
||||
2019.03.13.1044
|
||||
|
||||
@ -38,7 +38,7 @@ button.navbar-toggler:hover {
|
||||
}
|
||||
|
||||
.table-hover > tbody > .record-row.row-selected {
|
||||
background-color: rgb(75, 75, 75);
|
||||
color: limegreen;
|
||||
}
|
||||
|
||||
#consoleStatusDiv select {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user