1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-07-25 19:59:03 +02:00
TweetDuck/Core/Utils/WindowsUtils.cs

34 lines
893 B
C#

using System.Diagnostics;
using System.IO;
namespace TweetDck.Core.Utils{
static class WindowsUtils{
public static bool CheckFolderWritePermission(string path){
string testFile = Path.Combine(path, ".test");
try{
Directory.CreateDirectory(path);
using(File.Create(testFile)){}
File.Delete(testFile);
return true;
}catch{
return false;
}
}
public static Process StartProcess(string file, string arguments, bool runElevated){
ProcessStartInfo processInfo = new ProcessStartInfo{
FileName = file,
Arguments = arguments
};
if (runElevated){
processInfo.Verb = "runas";
}
return Process.Start(processInfo);
}
}
}