1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Got rid of false positive yey

This commit is contained in:
SpoinkyNL 2017-11-24 22:30:59 +01:00
parent bce85a8e7a
commit 758739ebda
9 changed files with 118 additions and 108 deletions

View File

@ -104,7 +104,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
@ -141,24 +141,23 @@
<HintPath>..\packages\Betwixt.1.4.1\lib\net35\Betwixt.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Caliburn.Micro, Version=3.0.3.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">
<HintPath>..\packages\Caliburn.Micro.Core.3.1.0\lib\net45\Caliburn.Micro.dll</HintPath>
<Reference Include="Caliburn.Micro, Version=3.2.0.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">
<HintPath>..\packages\Caliburn.Micro.Core.3.2.0\lib\net45\Caliburn.Micro.dll</HintPath>
</Reference>
<Reference Include="Caliburn.Micro.Platform, Version=3.0.3.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">
<HintPath>..\packages\Caliburn.Micro.3.1.0\lib\net45\Caliburn.Micro.Platform.dll</HintPath>
<Reference Include="Caliburn.Micro.Platform, Version=3.2.0.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">
<HintPath>..\packages\Caliburn.Micro.3.2.0\lib\net45\Caliburn.Micro.Platform.dll</HintPath>
</Reference>
<Reference Include="Caliburn.Micro.Platform.Core, Version=3.0.3.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">
<HintPath>..\packages\Caliburn.Micro.3.1.0\lib\net45\Caliburn.Micro.Platform.Core.dll</HintPath>
<Reference Include="Caliburn.Micro.Platform.Core, Version=3.2.0.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">
<HintPath>..\packages\Caliburn.Micro.3.2.0\lib\net45\Caliburn.Micro.Platform.Core.dll</HintPath>
</Reference>
<Reference Include="Corale.Colore, Version=5.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Colore.5.1.0\lib\net35\Corale.Colore.dll</HintPath>
<Private>True</Private>
<Reference Include="Corale.Colore, Version=5.2.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Colore.5.2.0\lib\net35\Corale.Colore.dll</HintPath>
</Reference>
<Reference Include="CSCore, Version=1.2.1.2, Culture=neutral, PublicKeyToken=5a08f2b6f4415dea, processorArchitecture=MSIL">
<HintPath>..\packages\CSCore.1.2.1.2\lib\net35-client\CSCore.dll</HintPath>
</Reference>
<Reference Include="CUE.NET, Version=1.1.3.1, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\CUE.NET.1.1.3.1\lib\net45\CUE.NET.dll</HintPath>
<Reference Include="CUE.NET, Version=1.2.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\CUE.NET.1.2.0\lib\net45\CUE.NET.dll</HintPath>
</Reference>
<Reference Include="DynamicExpresso.Core, Version=1.3.4.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\DynamicExpresso.Core.1.3.4.7\lib\net40\DynamicExpresso.Core.dll</HintPath>
@ -182,9 +181,6 @@
<Reference Include="MahApps.Metro, Version=1.4.3.0, Culture=neutral, PublicKeyToken=f4fb5a3c4d1e5b4f, processorArchitecture=MSIL">
<HintPath>..\packages\MahApps.Metro.1.4.3\lib\net45\MahApps.Metro.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Win32.TaskScheduler, Version=2.7.0.0, Culture=neutral, PublicKeyToken=c416bc1b32d97233, processorArchitecture=MSIL">
<HintPath>..\packages\TaskScheduler.2.7.0\lib\net452\Microsoft.Win32.TaskScheduler.dll</HintPath>
</Reference>
<Reference Include="MoonSharp.Interpreter, Version=2.0.0.0, Culture=neutral, PublicKeyToken=921e73ce94aa17f8, processorArchitecture=MSIL">
<HintPath>..\packages\MoonSharp.2.0.0.0\lib\net40-client\MoonSharp.Interpreter.dll</HintPath>
<Private>True</Private>
@ -234,7 +230,7 @@
<HintPath>..\packages\SharpDX.Direct3D9.4.0.1\lib\net45\SharpDX.Direct3D9.dll</HintPath>
</Reference>
<Reference Include="SpotifyAPI, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SpotifyAPI-NET.2.16.1\lib\SpotifyAPI.dll</HintPath>
<HintPath>..\packages\SpotifyAPI-NET.2.17.0\lib\SpotifyAPI.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
@ -247,7 +243,7 @@
<Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\MahApps.Metro.1.4.3\lib\net45\System.Windows.Interactivity.dll</HintPath>
<HintPath>..\packages\Caliburn.Micro.3.2.0\lib\net45\System.Windows.Interactivity.dll</HintPath>
</Reference>
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
@ -1060,7 +1056,9 @@
<None Include="Modules\Games\WoW\Resources\Addon source\Libs\AceConsole-3.0\AceConsole-3.0.xml" />
<None Include="Modules\Games\WoW\Resources\Addon source\Libs\AceEvent-3.0\AceEvent-3.0.xml" />
<None Include="Modules\Games\WoW\Resources\Addon source\Libs\AceTimer-3.0\AceTimer-3.0.xml" />
<Resource Include="Resources\Artemis autorun.xml" />
<Resource Include="Resources\Artemis autorun.xml">
<SubType>Designer</SubType>
</Resource>
<Content Include="Resources\CounterStrike\csgoGamestateConfiguration.txt" />
</ItemGroup>
<ItemGroup>
@ -1086,12 +1084,12 @@
<Folder Include="Resources\Lua\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\CUE.NET.1.1.3.1\build\net45\CUE.NET.targets" Condition="Exists('..\packages\CUE.NET.1.1.3.1\build\net45\CUE.NET.targets')" />
<Import Project="..\packages\CUE.NET.1.2.0\build\net45\CUE.NET.targets" Condition="Exists('..\packages\CUE.NET.1.2.0\build\net45\CUE.NET.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\CUE.NET.1.1.3.1\build\net45\CUE.NET.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\CUE.NET.1.1.3.1\build\net45\CUE.NET.targets'))" />
<Error Condition="!Exists('..\packages\CUE.NET.1.2.0\build\net45\CUE.NET.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\CUE.NET.1.2.0\build\net45\CUE.NET.targets'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -27,7 +27,7 @@ namespace Artemis.DeviceProviders.Corsair
{
CanUse = CanInitializeSdk();
if (CanUse && !CueSDK.IsInitialized)
CueSDK.Initialize();
CueSDK.Initialize(true);
}
catch (Exception)
{

View File

@ -45,7 +45,7 @@ namespace Artemis.DeviceProviders.Corsair
public override void Enable()
{
if (!CueSDK.IsInitialized)
CueSDK.Initialize();
CueSDK.Initialize(true);
CueSDK.UpdateMode = UpdateMode.Manual;
_keyboard = CueSDK.KeyboardSDK;
@ -97,8 +97,7 @@ namespace Artemis.DeviceProviders.Corsair
{
try
{
if (CueSDK.IsInitialized)
CueSDK.Reinitialize();
CueSDK.Reset();
}
catch (WrapperException e)
{

View File

@ -27,7 +27,7 @@ namespace Artemis.DeviceProviders.Corsair
{
CanUse = CanInitializeSdk();
if (CanUse && !CueSDK.IsInitialized)
CueSDK.Initialize();
CueSDK.Initialize(true);
}
catch (Exception)
{

View File

@ -27,7 +27,7 @@ namespace Artemis.DeviceProviders.Corsair
{
CanUse = CanInitializeSdk();
if (CanUse && !CueSDK.IsInitialized)
CueSDK.Initialize();
CueSDK.Initialize(true);
}
catch (Exception)
{

View File

@ -10,7 +10,7 @@ using Artemis.Utilities;
using Artemis.Utilities.ActiveWindowDetection;
using Caliburn.Micro;
using MahApps.Metro;
using Microsoft.Win32.TaskScheduler;
//using Microsoft.Win32.TaskScheduler;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
@ -21,7 +21,6 @@ namespace Artemis.Settings
public GeneralSettings()
{
ThemeManager.AddAccent("CorsairYellow", new Uri("pack://application:,,,/Styles/Accents/CorsairYellow.xaml"));
ApplyAutorun();
}
[DefaultValue("GeneralProfile")]
@ -109,32 +108,24 @@ namespace Artemis.Settings
public void ApplyAutorun()
{
using (var ts = new TaskService())
if (Autorun)
{
var existing = ts.FindTask("Artemis autorun");
if (Autorun)
{
// Overwrite any existing tasks in case the installation folder changed
var path = Path.GetTempFileName();
var artemisPath = AppDomain.CurrentDomain.BaseDirectory.Substring(0, AppDomain.CurrentDomain.BaseDirectory.Length - 1);
var xml = Resources.Artemis_autorun
.Replace("{{artemisPath}}", AppDomain.CurrentDomain.BaseDirectory)
.Replace("{{author}}", System.Security.Principal.WindowsIdentity.GetCurrent().Name);
File.WriteAllText(path, xml);
// Overwrite any existing tasks in case the installation folder changed
var path = Path.GetTempFileName();
var artemisPath = AppDomain.CurrentDomain.BaseDirectory.Substring(0, AppDomain.CurrentDomain.BaseDirectory.Length - 1);
var xml = Resources.Artemis_autorun
.Replace("{{artemisPath}}", artemisPath)
.Replace("{{userId}}", System.Security.Principal.WindowsIdentity.GetCurrent().User?.Value)
.Replace("{{author}}", System.Security.Principal.WindowsIdentity.GetCurrent().Name);
var task = ts.RootFolder.ImportTask(null, path);
task.Definition.Principal.UserId = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
task.Definition.Principal.LogonType = TaskLogonType.InteractiveToken;
task.Definition.Principal.RunLevel = TaskRunLevel.Highest;
task.RegisterChanges();
File.Delete(path);
}
else if (existing != null)
{
// Remove the task if it is present
ts.RootFolder.DeleteTask("Artemis autorun");
}
File.WriteAllText(path, xml);
RunWithoutWindow(Environment.SystemDirectory + "\\schtasks.exe", $"/Create /XML \"{path}\" /tn \"Artemis\"");
File.Delete(path);
}
else
{
// Remove the task if it is present
RunWithoutWindow(Environment.SystemDirectory + "\\schtasks.exe", "/Delete /TN Artemis /f");
}
}
@ -168,5 +159,25 @@ namespace Artemis.Settings
{
ScreenCaptureManager.UpdateRate = 1.0 / ScreenCaptureFPS;
}
private void RunWithoutWindow(string fileName, string arguments)
{
var process = new System.Diagnostics.Process
{
StartInfo =
{
RedirectStandardOutput = true,
UseShellExecute = false,
CreateNoWindow = true,
Verb = "runas",
FileName = fileName,
Arguments = arguments
}
};
// Go
process.Start();
process.WaitForExit();
}
}
}

View File

@ -2,9 +2,7 @@
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using Artemis.DAL;
using Artemis.Events;
using Artemis.Managers;
using Artemis.Services;
using Artemis.Settings;
@ -24,8 +22,8 @@ namespace Artemis.ViewModels
private string _activeIcon;
private bool _checked;
private bool _enabled;
private string _toggleText;
private bool _exiting;
private string _toggleText;
public ShellViewModel(IKernel kernel, MainManager mainManager, MetroDialogService metroDialogService,
FlyoutSettingsViewModel flyoutSettings)
@ -36,6 +34,7 @@ namespace Artemis.ViewModels
MetroDialogService = metroDialogService;
DisplayName = "Artemis";
ActiveIcon = "../Resources/logo-disabled.ico";
GeneralSettings = SettingsProvider.Load<GeneralSettings>();
Flyouts = new BindableCollection<FlyoutBaseViewModel>
{
@ -47,7 +46,54 @@ namespace Artemis.ViewModels
// This gets updated automatically but during startup lets quickly preset it
Enabled = GeneralSettings.Suspended;
}
public Mutex Mutex { get; set; }
public MainManager MainManager { get; set; }
public MetroDialogService MetroDialogService { get; set; }
public IObservableCollection<FlyoutBaseViewModel> Flyouts { get; set; }
public GeneralSettings GeneralSettings { get; set; }
private MetroWindow Window => (MetroWindow) GetView();
public bool CanShowWindow => Window != null && (Window != null || !Window.IsVisible);
public bool CanHideWindow => Window != null && Window.IsVisible;
public bool Enabled
{
get => _enabled;
set
{
if (value == _enabled)
return;
_enabled = value;
ToggleText = _enabled ? "Disable Artemis" : "Enable Artemis";
ActiveIcon = _enabled ? "../Resources/logo.ico" : "../Resources/logo-disabled.ico";
NotifyOfPropertyChange(() => Enabled);
}
}
public string ActiveIcon
{
get => _activeIcon;
set
{
_activeIcon = value;
NotifyOfPropertyChange();
}
}
public string ToggleText
{
get => _toggleText;
set
{
if (value == _toggleText)
return;
_toggleText = value;
NotifyOfPropertyChange(() => ToggleText);
}
}
protected override void OnViewReady(object view)
{
base.OnViewReady(view);
@ -69,51 +115,6 @@ namespace Artemis.ViewModels
MainManager.EnableProgram();
}
public Mutex Mutex { get; set; }
public MainManager MainManager { get; set; }
public MetroDialogService MetroDialogService { get; set; }
public IObservableCollection<FlyoutBaseViewModel> Flyouts { get; set; }
public GeneralSettings GeneralSettings { get; set; }
private MetroWindow Window => (MetroWindow) GetView();
public bool CanShowWindow => Window != null && (Window != null || !Window.IsVisible);
public bool CanHideWindow => Window != null && Window.IsVisible;
public bool Enabled
{
get { return _enabled; }
set
{
if (value == _enabled) return;
_enabled = value;
ToggleText = _enabled ? "Disable Artemis" : "Enable Artemis";
ActiveIcon = _enabled ? "../Resources/logo.ico" : "../Resources/logo-disabled.ico";
NotifyOfPropertyChange(() => Enabled);
}
}
public string ActiveIcon
{
get { return _activeIcon; }
set
{
_activeIcon = value;
NotifyOfPropertyChange();
}
}
public string ToggleText
{
get { return _toggleText; }
set
{
if (value == _toggleText) return;
_toggleText = value;
NotifyOfPropertyChange(() => ToggleText);
}
}
public override void CanClose(Action<bool> callback)
{
if (CanHideWindow)
@ -128,11 +129,13 @@ namespace Artemis.ViewModels
public void ShowWindow()
{
if (CanShowWindow)
{
Window?.Dispatcher.Invoke(() =>
{
Window.Show();
Window.Activate();
});
}
GeneralSettings.ApplyTheme();
@ -249,4 +252,4 @@ namespace Artemis.ViewModels
"If so, please make sure Artemis isn't already running");
}
}
}
}

View File

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Betwixt" version="1.4.1" targetFramework="net461" />
<package id="Caliburn.Micro" version="3.1.0" targetFramework="net461" />
<package id="Caliburn.Micro.Core" version="3.1.0" targetFramework="net461" />
<package id="Colore" version="5.1.0" targetFramework="net461" />
<package id="Caliburn.Micro" version="3.2.0" targetFramework="net461" />
<package id="Caliburn.Micro.Core" version="3.2.0" targetFramework="net461" />
<package id="Colore" version="5.2.0" targetFramework="net461" />
<package id="CSCore" version="1.2.1.2" targetFramework="net461" />
<package id="CUE.NET" version="1.1.3.1" targetFramework="net461" />
<package id="CUE.NET" version="1.2.0" targetFramework="net461" />
<package id="DynamicExpresso.Core" version="1.3.4.7" targetFramework="net461" />
<package id="gong-wpf-dragdrop" version="0.1.4.3" targetFramework="net461" />
<package id="Hardcodet.NotifyIcon.Wpf" version="1.0.8" targetFramework="net452" />
@ -25,7 +25,6 @@
<package id="Process.NET" version="1.0.8" targetFramework="net461" />
<package id="SharpDX" version="4.0.1" targetFramework="net461" />
<package id="SharpDX.Direct3D9" version="4.0.1" targetFramework="net461" />
<package id="SpotifyAPI-NET" version="2.16.1" targetFramework="net461" />
<package id="TaskScheduler" version="2.7.0" targetFramework="net461" />
<package id="SpotifyAPI-NET" version="2.17.0" targetFramework="net461" />
<package id="WpfExceptionViewer" version="1.0.0.0" targetFramework="net452" />
</packages>