mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-30 01:07:21 +13:00
Remove now obsolete code from DesktopBridgeHelper
This commit is contained in:
parent
df8712d888
commit
2866c3e032
3 changed files with 3 additions and 84 deletions
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/>
|
||||
</startup>
|
||||
</configuration>
|
|
@ -26,74 +26,16 @@ You should have received a copy of the GNU General Public License
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.ApplicationModel;
|
||||
|
||||
namespace DesktopBridgeHelper
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
private const string TaskID = "ShareX";
|
||||
|
||||
private static int Main(string[] args)
|
||||
{
|
||||
return MainAsync(args).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
private async static Task<int> MainAsync(string[] args)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (args.Length > 0)
|
||||
{
|
||||
string argument = args[0];
|
||||
|
||||
if (argument.Equals("-StartupState", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
return (int)await GetStartupState();
|
||||
}
|
||||
else if (argument.Equals("-StartupEnable", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
return (int)await SetStartupState(true);
|
||||
}
|
||||
else if (argument.Equals("-StartupDisable", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
return (int)await SetStartupState(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string path = GetAbsolutePath("ShareX.exe");
|
||||
Process.Start(path, "-silent");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
private async static Task<StartupTaskState> GetStartupState()
|
||||
{
|
||||
StartupTask startupTask = await StartupTask.GetAsync(TaskID);
|
||||
return startupTask.State;
|
||||
}
|
||||
|
||||
private async static Task<StartupTaskState> SetStartupState(bool enable)
|
||||
{
|
||||
StartupTask startupTask = await StartupTask.GetAsync(TaskID);
|
||||
|
||||
if (enable)
|
||||
{
|
||||
return await startupTask.RequestEnableAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
startupTask.Disable();
|
||||
return StartupTaskState.Disabled;
|
||||
}
|
||||
string path = GetAbsolutePath("ShareX.exe");
|
||||
Process.Start(path, "-silent");
|
||||
return 0;
|
||||
}
|
||||
|
||||
private static string GetAbsolutePath(string path)
|
||||
|
|
|
@ -37,27 +37,10 @@
|
|||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Runtime.WindowsRuntime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\System.Runtime.WindowsRuntime.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Windows, Version=255.255.255.255, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>C:\Program Files (x86)\Windows Kits\10\UnionMetadata\Facade\Windows.WinMD</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Windows.ApplicationModel.StartupTaskContract">
|
||||
<HintPath>C:\Program Files (x86)\Windows Kits\10\References\10.0.15063.0\Windows.ApplicationModel.StartupTaskContract\1.0.0.0\Windows.ApplicationModel.StartupTaskContract.winmd</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Windows.Foundation.FoundationContract">
|
||||
<HintPath>C:\Program Files (x86)\Windows Kits\10\References\10.0.15063.0\Windows.Foundation.FoundationContract\3.0.0.0\Windows.Foundation.FoundationContract.winmd</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
Loading…
Reference in a new issue