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

Added bomb and win_team to CS:GO datamodel

Autorun now creates a task that doesn't prompt an UAC dialog
This commit is contained in:
SpoinkyNL 2017-11-12 18:26:16 +01:00
parent 1812b2a019
commit 079170e0ae
8 changed files with 65 additions and 25 deletions

View File

@ -45,6 +45,7 @@
<CreateDesktopShortcut>true</CreateDesktopShortcut>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled>
<HockeyAppResourceId>38ead84566f241de8f334abe173b1038</HockeyAppResourceId>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>x64</PlatformTarget>
@ -195,6 +196,9 @@
<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.6.5.0, Culture=neutral, PublicKeyToken=c416bc1b32d97233, processorArchitecture=MSIL">
<HintPath>..\packages\TaskScheduler.2.6.5\lib\net452\Microsoft.Win32.TaskScheduler.dll</HintPath>
</Reference>
<Reference Include="Mono.Cecil, Version=0.9.6.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<HintPath>..\packages\Mono.Cecil.0.9.6.4\lib\net45\Mono.Cecil.dll</HintPath>
<Private>True</Private>
@ -1094,6 +1098,7 @@
<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" />
<Content Include="Resources\CounterStrike\csgoGamestateConfiguration.txt" />
</ItemGroup>
<ItemGroup>

View File

@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
@ -18,8 +15,6 @@ using Artemis.ViewModels;
using Caliburn.Micro;
using Newtonsoft.Json;
using Ninject;
using NLog;
using LogManager = NLog.LogManager;
namespace Artemis
{
@ -41,7 +36,7 @@ namespace Artemis
AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException;
}
private void CurrentDomainOnUnhandledException(object sender, UnhandledExceptionEventArgs unhandledExceptionEventArgs)
{
// Get rid of the keyboard hook in case of a crash, otherwise input freezes up system wide until Artemis is gone
@ -57,10 +52,10 @@ namespace Artemis
var e = ctx.EventArgs as MouseEventArgs;
// If there is an image control, get the scaled position
if ((img != null) && (e != null))
if (img != null && e != null)
{
var position = e.GetPosition(img);
return (int) (img.Source.Width*(position.X/img.ActualWidth));
return (int) (img.Source.Width * (position.X / img.ActualWidth));
}
// If there is another type of of IInputControl get the non-scaled position - or do some processing to get a scaled position, whatever needs to happen
@ -77,14 +72,14 @@ namespace Artemis
var e = ctx.EventArgs as MouseEventArgs;
// If there is an image control, get the scaled position
if ((img != null) && (e != null))
if (img != null && e != null)
{
var position = e.GetPosition(img);
return (int) (img.Source.Width*(position.Y/img.ActualWidth));
return (int) (img.Source.Width * (position.Y / img.ActualWidth));
}
// If there is another type of of IInputControl get the non-scaled position - or do some processing to get a scaled position, whatever needs to happen
if ((e != null) && (input != null))
if (e != null && input != null)
return e.GetPosition(input).Y;
// Return 0 if no processing could be done
@ -94,14 +89,6 @@ namespace Artemis
protected override void Configure()
{
// Sleep for a while if ran from autorun to allow full system boot
if (Environment.GetCommandLineArgs().Contains("--autorun"))
{
var logger = LogManager.GetCurrentClassLogger();
logger.Info("Artemis was run using the autorun shortcut, sleeping for 15 sec.");
Thread.Sleep(15000);
}
_kernel = new StandardKernel(new BaseModules(), new ManagerModules());
_kernel.Bind<IWindowManager>().To<WindowManager>().InSingletonScope();
@ -151,4 +138,4 @@ namespace Artemis
InputHook.Start();
}
}
}
}

View File

@ -51,6 +51,8 @@ namespace Artemis.Modules.Games.CounterStrike
public class Round
{
public string phase { get; set; }
public string bomb { get; set; }
public string win_team { get; set; }
}
[MoonSharpUserData]

View File

@ -70,6 +70,29 @@ namespace Artemis.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-16&quot;?&gt;
///&lt;Task version=&quot;1.4&quot; xmlns=&quot;http://schemas.microsoft.com/windows/2004/02/mit/task&quot;&gt;
/// &lt;RegistrationInfo&gt;
/// &lt;Date&gt;2017-11-12T17:45:45.4993602&lt;/Date&gt;
/// &lt;Author&gt;SpoinkyNL&lt;/Author&gt;
/// &lt;Description&gt;Task to run Artemis on PC startup without showing a UAC dialog&lt;/Description&gt;
/// &lt;URI&gt;\Artemis autorun&lt;/URI&gt;
/// &lt;/RegistrationInfo&gt;
/// &lt;Triggers&gt;
/// &lt;LogonTrigger&gt;
/// &lt;Enabled&gt;true&lt;/Enabled&gt;
/// &lt;Delay&gt;PT30S&lt;/Delay&gt;
/// &lt;/LogonTrigger&gt;
/// &lt;/Triggers&gt;
/// &lt;Set [rest of string was truncated]&quot;;.
/// </summary>
internal static string Artemis_autorun {
get {
return ResourceManager.GetString("Artemis_autorun", resourceCulture);
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>

View File

@ -226,4 +226,7 @@
<data name="wow_addon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Modules\Games\WoW\Resources\wow-addon.zip;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="Artemis_autorun" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Artemis autorun.xml;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16</value>
</data>
</root>

Binary file not shown.

View File

@ -4,10 +4,12 @@ using System.IO;
using System.Windows;
using Artemis.DAL;
using Artemis.Profiles.Layers.Types.AmbientLight.ScreenCapturing;
using Artemis.Properties;
using Artemis.Utilities;
using Artemis.Utilities.ActiveWindowDetection;
using Caliburn.Micro;
using MahApps.Metro;
using Microsoft.Win32.TaskScheduler;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Squirrel;
@ -111,10 +113,8 @@ namespace Artemis.Settings
{
try
{
if (Autorun)
mgr.CreateShortcutsForExecutable("Artemis.exe", ShortcutLocation.Startup, false, "--autorun");
else
mgr.RemoveShortcutsForExecutable("Artemis.exe", ShortcutLocation.Startup);
// Clean up the shortcut used by the old method
mgr.RemoveShortcutsForExecutable("Artemis.exe", ShortcutLocation.Startup);
}
catch (FileNotFoundException)
{
@ -125,6 +125,25 @@ namespace Artemis.Settings
// Ignored, only happens when running from VS
}
using (var ts = new TaskService())
{
var existing = ts.FindTask("Artemis autorun");
if (Autorun)
{
// Overwrite any existing tasks in case the installation folder changed
var path = Path.GetTempFileName();
var xml = Resources.Artemis_autorun.Replace("{{executablePath}}", mgr.RootAppDirectory + "\\Update.exe");
File.WriteAllText(path, xml);
ts.RootFolder.ImportTask(null, path);
File.Delete(path);
}
else if (existing != null)
{
// Remove the task if it is present
ts.RootFolder.DeleteTask("Artemis autorun");
}
}
}
}
@ -159,4 +178,4 @@ namespace Artemis.Settings
ScreenCaptureManager.UpdateRate = 1.0 / ScreenCaptureFPS;
}
}
}
}

View File

@ -30,5 +30,6 @@
<package id="Splat" version="2.0.0" targetFramework="net461" />
<package id="SpotifyAPI-NET" version="2.16.1" targetFramework="net461" />
<package id="squirrel.windows" version="1.4.4" targetFramework="net461" />
<package id="TaskScheduler" version="2.6.5" targetFramework="net461" />
<package id="WpfExceptionViewer" version="1.0.0.0" targetFramework="net452" />
</packages>