添加部分功能,以及等高线模型
This commit is contained in:
1 parent
663efa5c75
commit
512b1814e1
108 files changed
+239
-240
No files matched your search
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
|
||||
namespace GC.Services;
|
||||
|
||||
public static class Shell
|
||||
{
|
||||
public static void OpenFolder(string path)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(path)) return;
|
||||
try
|
||||
{
|
||||
if (!Directory.Exists(path)) Directory.CreateDirectory(path);
|
||||
StartWith(path);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.Error.WriteLine($"打开目录失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>用系统默认浏览器打开一个 URL。</summary>
|
||||
public static void OpenUrl(string url)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(url)) return;
|
||||
try
|
||||
{
|
||||
StartWith(url);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.Error.WriteLine($"打开链接失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private static void StartWith(string argument)
|
||||
{
|
||||
var info = new ProcessStartInfo
|
||||
{
|
||||
FileName = OperatingSystem.IsWindows() ? "explorer.exe"
|
||||
: OperatingSystem.IsMacOS() ? "open"
|
||||
: "xdg-open",
|
||||
UseShellExecute = false
|
||||
};
|
||||
info.ArgumentList.Add(argument);
|
||||
Process.Start(info);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user