Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 90dc08c

Browse files
committed
Fix UWP UserSwitch
1 parent 8303b96 commit 90dc08c

3 files changed

Lines changed: 13 additions & 4 deletions

File tree

src/ST.Client.Desktop.Windows/Services/Implementation/WindowsDesktopPlatformServiceImpl.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,18 @@ public string GetLastSteamLoginUserName()
217217

218218
public void SetCurrentUser(string userName)
219219
{
220-
Registry.CurrentUser.AddOrUpdate(SteamRegistryPath, "AutoLoginUser", userName, RegistryValueKind.String);
220+
if (DesktopBridge.IsRunningAsUwp)
221+
{
222+
var reg = $"Windows Registry Editor Version 5.00{Environment.NewLine}[HKEY_CURRENT_USER\\Software\\Valve\\Steam]{Environment.NewLine}\"AutoLoginUser\"=\"{userName}\"";
223+
var path = Path.Combine(IOPath.CacheDirectory, "switchuser.reg");
224+
File.WriteAllText(path, reg, Text.Encoding.UTF8);
225+
226+
Process2.Start("regedit", $"/s \"{path}\"", true);
227+
}
228+
else
229+
{
230+
Registry.CurrentUser.AddOrUpdate(SteamRegistryPath, "AutoLoginUser", userName, RegistryValueKind.String);
231+
}
221232
}
222233

223234
static string GetMachineSecretKey()

src/ST.Client.Desktop/Services/Implementation/SteamServiceImpl.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public void StartSteam(string? arguments = null)
132132
{
133133
if (!string.IsNullOrEmpty(SteamProgramPath))
134134
{
135-
Process2.Start(SteamProgramPath, arguments);
135+
Process2.Start(SteamProgramPath, arguments, workingDirectory: SteamDirPath);
136136
}
137137
}
138138

src/ST.Client/Services/Implementation/HttpProxyServiceImpl.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -577,8 +577,6 @@ public bool StartProxy()
577577
{
578578
if (OperatingSystem2.IsWindows)
579579
{
580-
//proxyServer.SetAsSystemHttpProxy(explicitProxyEndPoint);
581-
//proxyServer.SetAsSystemHttpsProxy(explicitProxyEndPoint);
582580
proxyServer.SetAsSystemProxy(explicitProxyEndPoint, ProxyProtocolType.AllHttp);
583581
}
584582
else if (OperatingSystem2.IsMacOS)

0 commit comments

Comments
 (0)