mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-30 01:07:21 +13:00
If run as admin already then open DNS changer directly
This commit is contained in:
parent
e543eace40
commit
228b8bd9bf
2 changed files with 14 additions and 1 deletions
|
@ -39,6 +39,7 @@ You should have received a copy of the GNU General Public License
|
|||
using System.Resources;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using System.Security.Principal;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
|
@ -847,5 +848,10 @@ public static string GetAbsolutePath(string path)
|
|||
|
||||
return Path.GetFullPath(path);
|
||||
}
|
||||
|
||||
public static bool IsAdministrator()
|
||||
{
|
||||
return new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -645,9 +645,16 @@ public static void OpenMonitorTest()
|
|||
}
|
||||
|
||||
public static void OpenDNSChanger()
|
||||
{
|
||||
if (Helpers.IsAdministrator())
|
||||
{
|
||||
new DNSChangerForm().Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
RunShareXAsAdmin("-dnschanger");
|
||||
}
|
||||
}
|
||||
|
||||
public static void RunShareXAsAdmin(string arguments)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue