Wrapper working.

This commit is contained in:
Jared Goodwin 2020-04-22 21:44:20 -07:00
parent c1252507fb
commit d11ce7ca72
4 changed files with 55 additions and 14 deletions

View File

@ -84,6 +84,8 @@
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.IO.Compression.FileSystem" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />

View File

@ -1,4 +1,5 @@
[System.IO.Directory]::CreateDirectory("$env:AppData\Remotely")
Invoke-WebRequest -Uri "https://dot.net/v1/dotnet-install.ps1" -OutFile "$env:AppData\Remotely\dotnet-install.ps1"
&"$env:AppData\Remotely\dotnet-install.ps1" -Runtime dotnet
&"$env:AppData\Remotely\dotnet-install.ps1" -Runtime windowsdesktop
&"$env:AppData\Remotely\dotnet-install.ps1" -Runtime windowsdesktop
Start-Process -FilePath "dotnet.exe" -ArgumentList "$PSScriptRoot\Remotely_Desktop.dll" -WindowStyle Hidden

View File

@ -1,6 +1,10 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
@ -12,6 +16,7 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using PathIO = System.IO.Path;
namespace Remotely.Desktop.Win.Wrapper
{
@ -20,6 +25,7 @@ namespace Remotely.Desktop.Win.Wrapper
/// </summary>
public partial class MainWindow : Window
{
private readonly string tempDir = Directory.CreateDirectory(PathIO.Combine(PathIO.GetTempPath(), "Remotely_Desktop")).FullName;
public MainWindow()
{
InitializeComponent();
@ -45,27 +51,59 @@ namespace Remotely.Desktop.Win.Wrapper
ExtractRemotely();
ExtractInstallScript();
RunInstallScript();
RunRemotely();
}
private void RunRemotely()
{
StatusText.Text = "Starting up...";
Close();
}
private void ExtractRemotely()
{
StatusText.Text = "Extracting files...";
try
{
StatusText.Text = "Extracting files...";
var zipPath = PathIO.Combine(tempDir, "Remotely_Desktop.zip");
using (var mrs = Assembly.GetExecutingAssembly()
.GetManifestResourceStream("Remotely.Desktop.Win.Wrapper.Remotely_Desktop.zip"))
{
using (var fs = new FileStream(zipPath, FileMode.Create))
{
mrs.CopyTo(fs);
}
}
ZipFile.ExtractToDirectory(zipPath, tempDir);
}
catch { }
}
private void RunInstallScript()
{
StatusText.Text = "Updating .NET Core runtime...";
try
{
StatusText.Text = "Updating .NET Core runtime...";
var installPath = PathIO.Combine(tempDir, "Install.ps1");
Process.Start(new ProcessStartInfo()
{
FileName = "powershell.exe",
Arguments = $"-executionpolicy bypass -f \"{installPath}\"",
WindowStyle = ProcessWindowStyle.Hidden
});
}
catch { }
}
private void ExtractInstallScript()
{
try
{
var installPath = PathIO.Combine(tempDir, "Install.ps1");
using (var mrs = Assembly.GetExecutingAssembly()
.GetManifestResourceStream("Remotely.Desktop.Win.Wrapper.Install.ps1"))
{
using (var fs = new FileStream(installPath, FileMode.Create))
{
mrs.CopyTo(fs);
}
}
}
catch { }
}
}
}

View File

@ -9,20 +9,20 @@
<div class="text-info col-sm-12 pl-0 mb-2">
Instant desktop sharing. No account required.
</div>
<div class="col-sm-6 mb-3">
@*<div class="col-sm-6 mb-3">
<h6>Windows (64-Bit)</h6>
<p>
<strong>Download:</strong>
<br />
<a href="~/Downloads/Win-x64/Remotely_Desktop.exe">Windows EXE</a>
</p>
</div>
</div>*@
<div class="col-sm-6">
<h6>Windows (32-Bit)</h6>
<h6>Windows (64/32-Bit)</h6>
<p>
<strong>Download:</strong>
<br />
<a href="~/Downloads/Win-x86/Remotely_Desktop.exe">Windows EXE</a>
<a href="~/Downloads/Remotely_Desktop.exe">Windows EXE</a>
</p>
</div>
<div class="col-sm-6 mb-3">