Make wrapper for un-elevated process start

This commit is contained in:
Travis Nickles 2020-03-31 21:49:40 -05:00
parent 0cb8a2b3d5
commit 4d57a8bb34
3 changed files with 30 additions and 18 deletions

View File

@ -145,6 +145,18 @@ namespace DS4Windows
}
}
public static void StartProcessHelper(string path)
{
if (!Global.IsAdministrator())
{
Process.Start(path);
}
else
{
StartProcessInExplorer(path);
}
}
public static void StartProcessInExplorer(string path)
{
string tmpPath = Path.Combine(Path.GetTempPath(), "urlopener.bat");

View File

@ -18,87 +18,87 @@ namespace DS4WinWPF.DS4Forms
private void ChangeLogLink_Click(object sender, RoutedEventArgs e)
{
Util.StartProcessInExplorer("https://docs.google.com/document/d/1CovpH08fbPSXrC6TmEprzgPwCe0tTjQ_HTFfDotpmxk/edit?usp=sharing");
Util.StartProcessHelper("https://docs.google.com/document/d/1CovpH08fbPSXrC6TmEprzgPwCe0tTjQ_HTFfDotpmxk/edit?usp=sharing");
}
private void PaypalLink_Click(object sender, RoutedEventArgs e)
{
Util.StartProcessInExplorer("https://paypal.me/ryochan7");
Util.StartProcessHelper("https://paypal.me/ryochan7");
}
private void PatreonLink_Click(object sender, RoutedEventArgs e)
{
Util.StartProcessInExplorer("https://patreon.com/user?u=501036");
Util.StartProcessHelper("https://patreon.com/user?u=501036");
}
private void SubscribeStartLink_Click(object sender, RoutedEventArgs e)
{
Util.StartProcessInExplorer("https://subscribestar.com/ryochan7");
Util.StartProcessHelper("https://subscribestar.com/ryochan7");
}
private void SiteLink_Click(object sender, RoutedEventArgs e)
{
Util.StartProcessInExplorer("https://ryochan7.github.io/ds4windows-site/");
Util.StartProcessHelper("https://ryochan7.github.io/ds4windows-site/");
}
private void SourceLink_Click(object sender, RoutedEventArgs e)
{
Util.StartProcessInExplorer("https://github.com/Ryochan7/DS4Windows");
Util.StartProcessHelper("https://github.com/Ryochan7/DS4Windows");
}
private void Jays2KingsLink_Click(object sender, RoutedEventArgs e)
{
Util.StartProcessInExplorer("https://github.com/Jays2Kings/");
Util.StartProcessHelper("https://github.com/Jays2Kings/");
}
private void InhexSTERLink_Click(object sender, RoutedEventArgs e)
{
Util.StartProcessInExplorer("https://code.google.com/p/ds4-tool/");
Util.StartProcessHelper("https://code.google.com/p/ds4-tool/");
}
private void ElectrobrainsLink_Click(object sender, RoutedEventArgs e)
{
Util.StartProcessInExplorer("https://code.google.com/r/brianfundakowskifeldman-ds4windows/");
Util.StartProcessHelper("https://code.google.com/r/brianfundakowskifeldman-ds4windows/");
}
private void YoutubeSocialBtn_Click(object sender, RoutedEventArgs e)
{
Util.StartProcessInExplorer("https://www.youtube.com/channel/UCIoUA_XLlCSZbvZGeg3Byeg");
Util.StartProcessHelper("https://www.youtube.com/channel/UCIoUA_XLlCSZbvZGeg3Byeg");
}
private void BitchuteSocialBtn_Click(object sender, RoutedEventArgs e)
{
Util.StartProcessInExplorer("https://www.bitchute.com/channel/uE2CbiV96u1k/");
Util.StartProcessHelper("https://www.bitchute.com/channel/uE2CbiV96u1k/");
}
private void BittubeSocialBtn_Click(object sender, RoutedEventArgs e)
{
Util.StartProcessInExplorer("https://bittube.tv/profile/ds4windows");
Util.StartProcessHelper("https://bittube.tv/profile/ds4windows");
}
private void LbrySocialBtn_Click(object sender, RoutedEventArgs e)
{
Util.StartProcessInExplorer("https://lbry.tv/@ds4windows");
Util.StartProcessHelper("https://lbry.tv/@ds4windows");
}
private void TwitterSocialBtn_Click(object sender, RoutedEventArgs e)
{
Util.StartProcessInExplorer("https://twitter.com/ds4windows");
Util.StartProcessHelper("https://twitter.com/ds4windows");
}
private void MastodonSocialBtn_Click(object sender, RoutedEventArgs e)
{
Util.StartProcessInExplorer("https://fosstodon.org/@ds4windows");
Util.StartProcessHelper("https://fosstodon.org/@ds4windows");
}
private void MindsSocialBtn_Click(object sender, RoutedEventArgs e)
{
Util.StartProcessInExplorer("https://www.minds.com/ds4windows/");
Util.StartProcessHelper("https://www.minds.com/ds4windows/");
}
private void DiscordSocialBtn_Click(object sender, RoutedEventArgs e)
{
Util.StartProcessInExplorer("https://discord.gg/zrpPgyN");
Util.StartProcessHelper("https://discord.gg/zrpPgyN");
}
}
}

View File

@ -1356,7 +1356,7 @@ Suspend support not enabled.", true);
private void Html5GameBtn_Click(object sender, RoutedEventArgs e)
{
Util.StartProcessInExplorer("https://html5gamepad.com/");
Util.StartProcessHelper("https://html5gamepad.com/");
}
}
}