Files
netch/Netch/Utils/Utils.cs
2020-01-27 14:55:29 +08:00

45 lines
903 B
C#

using System.Diagnostics;
using System.IO;
namespace Netch.Utils
{
public static class Utils
{
public static bool OpenUrl(string path)
{
try
{
new Process
{
StartInfo = new ProcessStartInfo(path)
{
UseShellExecute = true
}
}.Start();
return true;
}
catch
{
return false;
}
}
public static bool OpenDir(string dir)
{
if (Directory.Exists(dir))
{
try
{
return OpenUrl(dir);
}
catch
{
// ignored
}
}
return false;
}
}
}