mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Merged with development
This commit is contained in:
commit
1643efcc3f
@ -1,92 +1,93 @@
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows;
|
using System.Reflection;
|
||||||
using System.Windows.Controls;
|
using System.Windows;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Controls;
|
||||||
using Artemis.ViewModels;
|
using System.Windows.Forms;
|
||||||
using Autofac;
|
using Artemis.ViewModels;
|
||||||
using Caliburn.Micro;
|
using Autofac;
|
||||||
using Caliburn.Micro.Autofac;
|
using Caliburn.Micro;
|
||||||
using Application = System.Windows.Application;
|
using Caliburn.Micro.Autofac;
|
||||||
using MessageBox = System.Windows.Forms.MessageBox;
|
using Application = System.Windows.Application;
|
||||||
|
using MessageBox = System.Windows.Forms.MessageBox;
|
||||||
namespace Artemis
|
|
||||||
{
|
namespace Artemis
|
||||||
public class ArtemisBootstrapper : AutofacBootstrapper<SystemTrayViewModel>
|
{
|
||||||
{
|
public class ArtemisBootstrapper : AutofacBootstrapper<SystemTrayViewModel>
|
||||||
public ArtemisBootstrapper()
|
{
|
||||||
{
|
public ArtemisBootstrapper()
|
||||||
CheckDuplicateInstances();
|
{
|
||||||
|
CheckDuplicateInstances();
|
||||||
Initialize();
|
|
||||||
|
Initialize();
|
||||||
MessageBinder.SpecialValues.Add("$scaledmousex", (ctx) =>
|
|
||||||
{
|
MessageBinder.SpecialValues.Add("$scaledmousex", (ctx) =>
|
||||||
var img = ctx.Source as Image;
|
{
|
||||||
var input = ctx.Source as IInputElement;
|
var img = ctx.Source as Image;
|
||||||
var e = ctx.EventArgs as System.Windows.Input.MouseEventArgs;
|
var input = ctx.Source as IInputElement;
|
||||||
|
var e = ctx.EventArgs as System.Windows.Input.MouseEventArgs;
|
||||||
// If there is an image control, get the scaled position
|
|
||||||
if (img != null && e != null)
|
// If there is an image control, get the scaled position
|
||||||
{
|
if (img != null && e != null)
|
||||||
Point position = e.GetPosition(img);
|
{
|
||||||
return (int)(img.Source.Width * (position.X / img.ActualWidth));
|
Point position = e.GetPosition(img);
|
||||||
}
|
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
|
|
||||||
if (e != null && input != null)
|
// 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
|
||||||
return e.GetPosition(input).X;
|
if (e != null && input != null)
|
||||||
|
return e.GetPosition(input).X;
|
||||||
// Return 0 if no processing could be done
|
|
||||||
return 0;
|
// Return 0 if no processing could be done
|
||||||
});
|
return 0;
|
||||||
MessageBinder.SpecialValues.Add("$scaledmousey", (ctx) =>
|
});
|
||||||
{
|
MessageBinder.SpecialValues.Add("$scaledmousey", (ctx) =>
|
||||||
var img = ctx.Source as Image;
|
{
|
||||||
var input = ctx.Source as IInputElement;
|
var img = ctx.Source as Image;
|
||||||
var e = ctx.EventArgs as System.Windows.Input.MouseEventArgs;
|
var input = ctx.Source as IInputElement;
|
||||||
|
var e = ctx.EventArgs as System.Windows.Input.MouseEventArgs;
|
||||||
// If there is an image control, get the scaled position
|
|
||||||
if (img != null && e != null)
|
// If there is an image control, get the scaled position
|
||||||
{
|
if (img != null && e != null)
|
||||||
Point position = e.GetPosition(img);
|
{
|
||||||
return (int)(img.Source.Width * (position.Y / img.ActualWidth));
|
Point position = e.GetPosition(img);
|
||||||
}
|
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 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
|
||||||
return e.GetPosition(input).Y;
|
if (e != null && input != null)
|
||||||
|
return e.GetPosition(input).Y;
|
||||||
// Return 0 if no processing could be done
|
|
||||||
return 0;
|
// Return 0 if no processing could be done
|
||||||
});
|
return 0;
|
||||||
}
|
});
|
||||||
|
}
|
||||||
protected override void ConfigureContainer(ContainerBuilder builder)
|
|
||||||
{
|
protected override void ConfigureContainer(ContainerBuilder builder)
|
||||||
base.ConfigureContainer(builder);
|
{
|
||||||
|
base.ConfigureContainer(builder);
|
||||||
// create a window manager instance to be used by everyone asking for one (including Caliburn.Micro)
|
|
||||||
builder.RegisterInstance<IWindowManager>(new WindowManager());
|
// create a window manager instance to be used by everyone asking for one (including Caliburn.Micro)
|
||||||
builder.RegisterType<SystemTrayViewModel>();
|
builder.RegisterInstance<IWindowManager>(new WindowManager());
|
||||||
builder.RegisterType<ShellViewModel>();
|
builder.RegisterType<SystemTrayViewModel>();
|
||||||
}
|
builder.RegisterType<ShellViewModel>();
|
||||||
|
}
|
||||||
protected override void OnStartup(object sender, StartupEventArgs e)
|
|
||||||
{
|
protected override void OnStartup(object sender, StartupEventArgs e)
|
||||||
DisplayRootViewFor<SystemTrayViewModel>();
|
{
|
||||||
}
|
DisplayRootViewFor<SystemTrayViewModel>();
|
||||||
|
}
|
||||||
private void CheckDuplicateInstances()
|
|
||||||
{
|
private void CheckDuplicateInstances()
|
||||||
var processes = Process.GetProcesses();
|
{
|
||||||
if (processes.Count(p => p.ProcessName == "Artemis") < 2)
|
if (Process.GetProcesses().Count(p => p.ProcessName.Contains(Assembly.GetExecutingAssembly()
|
||||||
return;
|
.FullName.Split(',')[0]) && !p.Modules[0].FileName.Contains("vshost")) < 2)
|
||||||
|
return;
|
||||||
MessageBox.Show("An instance of Artemis is already running (check your system tray).",
|
|
||||||
"Artemis (╯°□°)╯︵ ┻━┻", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
MessageBox.Show("An instance of Artemis is already running (check your system tray).",
|
||||||
Application.Current.Shutdown();
|
"Artemis (╯°□°)╯︵ ┻━┻", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||||
}
|
Application.Current.Shutdown();
|
||||||
|
}
|
||||||
}
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -2,17 +2,17 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"Game":"RocketLeague",
|
"Game":"RocketLeague",
|
||||||
"GameVersion":"1.15",
|
"GameVersion":"1.16",
|
||||||
"GameAddresses":[
|
"GameAddresses":[
|
||||||
{
|
{
|
||||||
"Description":"Boost",
|
"Description":"Boost",
|
||||||
"BasePointer":{
|
"BasePointer":{
|
||||||
"value":22555396
|
"value":22411984
|
||||||
},
|
},
|
||||||
"Offsets":[
|
"Offsets":[
|
||||||
180,
|
1632,
|
||||||
260,
|
64,
|
||||||
800,
|
1636,
|
||||||
1800,
|
1800,
|
||||||
540
|
540
|
||||||
]
|
]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user