mirror of
https://github.com/BeyondDimension/SteamTools.git
synced 2026-10-28 23:19:53 +08:00
save
This commit is contained in:
+35
-19
@@ -44,42 +44,58 @@ namespace System.Application.Services.Implementation
|
||||
stream.Flush();
|
||||
stream.Close();
|
||||
}
|
||||
using var p = new Process();
|
||||
p.StartInfo.FileName = "/bin/bash";
|
||||
p.StartInfo.Arguments = $"\"{file.FullName}\"";
|
||||
p.StartInfo.UseShellExecute = false;
|
||||
p.StartInfo.RedirectStandardOutput = true;
|
||||
p.Exited += (object? _, EventArgs _) =>
|
||||
using (var p = new Process())
|
||||
{
|
||||
p.StartInfo.FileName = "/bin/bash";
|
||||
p.StartInfo.Arguments = $"\"{file.FullName}\"";
|
||||
p.StartInfo.UseShellExecute = false;
|
||||
p.StartInfo.RedirectStandardOutput = true;
|
||||
p.Exited += (object? _, EventArgs _) =>
|
||||
{
|
||||
if (file.Exists)
|
||||
file.Delete();
|
||||
if (p.ExitCode != 0)
|
||||
{
|
||||
((IPlatformService)this).AdminShell(shell);
|
||||
}
|
||||
};
|
||||
p.Start();
|
||||
var ret = p.StandardOutput.ReadToEnd();
|
||||
p.Kill();
|
||||
if (file.Exists)
|
||||
file.Delete();
|
||||
if (p.ExitCode != 0)
|
||||
{
|
||||
((IPlatformService)this).AdminShell(shell);
|
||||
}
|
||||
};
|
||||
p.Start();
|
||||
var ret = p.StandardOutput.ReadToEnd();
|
||||
p.Kill();
|
||||
if (file.Exists)
|
||||
file.Delete();
|
||||
}
|
||||
}
|
||||
public string GetCommandLineArgs(Process process)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public const string xdg = "xdg-open";
|
||||
public void OpenFolder(string dirPath)
|
||||
{
|
||||
if (IOPath.IsDirectory(dirPath))
|
||||
{
|
||||
IDesktopPlatformService.Instance.StartProcess(xdg, dirPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
var path = new FileInfo(dirPath);
|
||||
if (!string.IsNullOrWhiteSpace(path.DirectoryName))
|
||||
IDesktopPlatformService.Instance.StartProcess(xdg, path.DirectoryName);
|
||||
}
|
||||
}
|
||||
|
||||
public const string kate = "kate";
|
||||
public const string vi = "vi";
|
||||
const string VSC = "code";
|
||||
|
||||
public string? GetFileName(TextReaderProvider provider)
|
||||
public string? GetFileName(TextReaderProvider provider) => provider switch
|
||||
{
|
||||
return vi;
|
||||
}
|
||||
TextReaderProvider.VSCode => VSC,
|
||||
TextReaderProvider.Notepad => kate,
|
||||
_ => null,
|
||||
};
|
||||
|
||||
public void SetSystemSessionEnding(Action action)
|
||||
{
|
||||
|
||||
@@ -7,6 +7,7 @@ using System.Application.Services;
|
||||
using System.Application.UI.Resx;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Properties;
|
||||
using System.Reactive;
|
||||
@@ -56,7 +57,7 @@ namespace System.Application.UI.ViewModels
|
||||
//});
|
||||
OpenCertificateDirCommand = ReactiveCommand.Create(() =>
|
||||
{
|
||||
DI.Get<IDesktopPlatformService>().OpenFolder(IOPath.AppDataDirectory + @$"\{ThisAssembly.AssemblyProduct}.Certificate.cer");
|
||||
DI.Get<IDesktopPlatformService>().OpenFolder(Path.Combine(IOPath.AppDataDirectory, $"{ThisAssembly.AssemblyProduct}.Certificate.cer"));
|
||||
});
|
||||
ProxySettingsCommand = ReactiveCommand.Create(() =>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user