Skip to content
This repository has been archived by the owner on Aug 19, 2022. It is now read-only.

Commit

Permalink
bug fix of rdp name with blank.
Browse files Browse the repository at this point in the history
  • Loading branch information
VShawn committed Aug 15, 2020
1 parent a7a5c80 commit 0f4796f
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 28 deletions.
2 changes: 1 addition & 1 deletion PRM.Core/Languages/en-us.xaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion PRM.Core/Languages/zh-cn.xaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion PRM.Core/PRMVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public static class PRMVersion
public const int Major = 0;
public const int Minor = 4;
public const int Build = 8;
public const int ReleaseDate = 2008141416;
public const int ReleaseDate = 2008150945;
public static string Version => $"{Major}.{Minor}.{Build}.{ReleaseDate}";
}
}
43 changes: 20 additions & 23 deletions PRemoteM/Model/RemoteWindowPool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,53 +89,50 @@ public void ShowRemoteHost(uint serverId)
{
if (server.IsConnWithFullScreen())
{
// for those people using 2+ monitor which are in different scale factors, we will try "mstsc.exe" instead of "PRemoteM".
// for those people using 2+ monitors in different scale factors, we will try "mstsc.exe" instead of "PRemoteM".
if (Screen.AllScreens.Length > 1
&& server is ProtocolServerRDP rdp
&& rdp.RdpFullScreenFlag == ERdpFullScreenFlag.EnableFullAllScreens)
{
int factor = (int)(new ScreenInfoEx(Screen.PrimaryScreen).ScaleFactor * 100);
// check if screens are in different scale factors
bool differentScaleFactorFlag = Screen.AllScreens.Select(screen => (int)(new ScreenInfoEx(screen).ScaleFactor * 100)).Any(factor2 => factor != factor2);
if (differentScaleFactorFlag)
if (differentScaleFactorFlag || true)
{
var tmp = Path.GetTempPath();
var dp = rdp.DispName;
var rdpFileName = $"{rdp.DispName}_{rdp.Port}_{rdp.UserName}";
var invalid = new string(Path.GetInvalidFileNameChars()) +
new string(Path.GetInvalidPathChars());
dp = invalid.Aggregate(dp, (current, c) => current.Replace(c.ToString(), ""));
var rdpFile = Path.Combine(tmp, dp + ".rdp");
rdpFileName = invalid.Aggregate(rdpFileName, (current, c) => current.Replace(c.ToString(), ""));
var rdpFile = Path.Combine(tmp, rdpFileName + ".rdp");
try
{
File.WriteAllText(rdpFile, rdp.ToRdpConfig().ToString());
var p = new Process
{
StartInfo =
{
FileName = "cmd.exe",
UseShellExecute = false,
RedirectStandardInput = true,
RedirectStandardOutput = true,
RedirectStandardError = true,
CreateNoWindow = true
}
{
FileName = "cmd.exe",
UseShellExecute = false,
RedirectStandardInput = true,
RedirectStandardOutput = true,
RedirectStandardError = true,
CreateNoWindow = true
}
};
p.Start();
p.StandardInput.WriteLine("mstsc -admin " + rdpFile);
p.StandardInput.WriteLine("mstsc -admin \"" + rdpFile + "\"");
p.StandardInput.WriteLine("exit");
}
catch (Exception)
{
throw;
}
finally
{
// delete tmp rdp file, ETA 10s
var t = new Task(() =>
{
Thread.Sleep(1000 * 10);
if (File.Exists(rdpFile))
File.Delete(rdpFile);
});
{
Thread.Sleep(1000 * 10);
if (File.Exists(rdpFile))
File.Delete(rdpFile);
});
t.Start();
}
return;
Expand Down
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ PRemoteM is a utility that helps you manage remote sessions with HiDpi multi-scr
- [Password can be encrypted by RSA](https://github.com/VShawn/PRemoteM#Encryption)

# Lastet
Latest Version: 0.4.8.2008141135
Latest Version: 0.4.8.2008150945

- [Download](https://github.com/VShawn/PRemoteM/releases/tag/0.4.8.2008141135)
- [Download](https://github.com/VShawn/PRemoteM/releases/tag/0.4.8.2008150945)

## Requirements
----
Expand Down

0 comments on commit 0f4796f

Please sign in to comment.