Exemplo n.º 1
0
        private void PipeServerOnPipeMessage(string msg)
        {
            // Ensure it's Light FX JSON
            if (!msg.Contains("lightFxState"))
            {
                return;
            }

            // Deserialize and data
            try
            {
                JsonConvert.PopulateObject(msg, DataModel);
            }
            catch (Exception ex)
            {
                Logger?.Error(ex, "Failed to deserialize LightFX JSON");
                throw;
            }

            // Setup process name
            var processName = Path.GetFileNameWithoutExtension(((LightFxDataModel)DataModel).LightFxState.game);

            if (!ProcessNames.Contains(processName))
            {
                ProcessNames.Add(processName);
            }
        }
Exemplo n.º 2
0
        public override string ToString()
        {
            string text;

            if (string.IsNullOrWhiteSpace(Name))
            {
                if (ProcessNames == null || !ProcessNames.Any())
                {
                    return("[Unused]");
                }
                text = string.Join(",", ProcessNames);
            }
            else
            {
                text = Name;
            }

            if (Shortcut == '\0')
            {
                return(text);
            }

            text = $"&{Shortcut}. {text}";

            return(text);
        }
Exemplo n.º 3
0
 public void AddProcessName(string name)
 {
     if (!ProcessNames.Contains(name))
     {
         ProcessNames.Add(name);
     }
 }
Exemplo n.º 4
0
        public GtaVModel(DeviceManager deviceManager, LuaManager luaManager, PipeServer pipeServer) : base(deviceManager, luaManager)
        {
            _pipeServer = pipeServer;

            Settings  = SettingsProvider.Load <GtaVSettings>();
            DataModel = new GtaVDataModel();
            ProcessNames.Add("GTA5");
        }
Exemplo n.º 5
0
        public TheDivisionModel(DeviceManager deviceManager, LuaManager luaManager, PipeServer pipeServer)
            : base(deviceManager, luaManager)
        {
            _pipeServer = pipeServer;

            Settings  = SettingsProvider.Load <TheDivisionSettings>();
            DataModel = new TheDivisionDataModel();
            ProcessNames.Add("TheDivision");
        }
Exemplo n.º 6
0
        public Witcher3Model(DeviceManager deviceManager, LuaManager luaManager) : base(deviceManager, luaManager)
        {
            _updateSw    = new Stopwatch();
            _configRegex = new Regex("\\[Artemis\\](.+?)\\[", RegexOptions.Singleline);

            Settings  = SettingsProvider.Load <Witcher3Settings>();
            DataModel = new Witcher3DataModel();
            ProcessNames.Add("witcher3");
        }
Exemplo n.º 7
0
        public LightFxModel(DeviceManager deviceManager, LuaManager luaManager, PipeServer pipeServer)
            : base(deviceManager, luaManager)
        {
            Settings  = SettingsProvider.Load <LightFxSettings>();
            DataModel = new LightFxDataModel();
            ProcessNames.Add("LoL");

            // This model can enable itself by changing its process name to the currently running Light FX game.
            pipeServer.PipeMessage += PipeServerOnPipeMessage;
        }
Exemplo n.º 8
0
        public EurotruckSimulator2Model(DeviceManager deviceManager, LuaManager luaManager,
                                        MetroDialogService dialogService) : base(deviceManager, luaManager)
        {
            _dialogService = dialogService;

            Settings  = SettingsProvider.Load <EurotruckSimulator2Settings>();
            DataModel = new EurotruckSimulator2DataModel();
            ProcessNames.Add("eurotrucks2");
            ProcessNames.Add("amtrucks");

            FindEts2GameDir();
            FindAtsGameDir();
        }
Exemplo n.º 9
0
        public CounterStrikeModel(DeviceManager deviceManager, LuaManager luaManager, MetroDialogService dialogService,
                                  GameStateWebServer gameStateWebServer) : base(deviceManager, luaManager)
        {
            _gameStateWebServer = gameStateWebServer;
            _dialogService      = dialogService;

            Settings  = SettingsProvider.Load <CounterStrikeSettings>();
            DataModel = new CounterStrikeDataModel();
            ProcessNames.Add("csgo");

            FindGameDir();
            PlaceConfigFile();
        }
Exemplo n.º 10
0
        public Dota2Model(DeviceManager deviceManager, LuaManager luaManager, MetroDialogService dialogService,
                          GameStateWebServer gameStateWebServer) : base(deviceManager, luaManager)
        {
            _gameStateWebServer = gameStateWebServer;
            _dialogService      = dialogService;

            Settings  = SettingsProvider.Load <Dota2Settings>();
            DataModel = new Dota2DataModel();
            ProcessNames.Add("dota2");

            FindGameDir();
            PlaceConfigFile();
        }
Exemplo n.º 11
0
        public async Task InitialiseProcessListAsync()
        {
            var winList = Win32.GetWindowsByZOrder();

            var processList = GetProcessList();

            foreach (var item in processList)
            {
                var matched = winList.FirstOrDefault(x => x.Value.ToInt32() == item.WindowHandle.ToInt32());
                var empty   = default(KeyValuePair <int, IntPtr>);

                if (!matched.Equals(empty))
                {
                    item.ZOrder = winList.First(x => x.Value.ToInt32() == item.WindowHandle.ToInt32()).Key;
                }
            }

            if (_processList == null)
            {
                _processList = new List <ProcessItem>();
                _processList.AddRange(processList);
            }
            else
            {
                _processList.RemoveAll(x => x.Category == "chrome");
                ResyncProcessState(processList);
            }

            var currentProcessItem =
                _processList.FirstOrDefault(x => x.WindowHandle.ToInt32() == ShellView.ClientHwnd.ToInt32())
                ?? _processList.FirstOrDefault(x => x.WindowHandle.ToInt32() == winList.First().Value.ToInt32());

            if (currentProcessItem != null)
            {
                currentProcessItem.IsEnabled = false;
            }

            //            await AddChromeTabs(_processList).ConfigureAwait(true);
            lock (_gate)
            {
                if (_chromeTabs.Any())
                {
                    _processList.AddRange(_chromeTabs);
                }
            }

            ProcessNames.Clear();
            ProcessNames.AddRange(_processList.OrderBy(x => x.ZOrder));
            await EnhanceWithIconAsync(_mainCancellationTokenSource.Token);
        }
Exemplo n.º 12
0
        public OverwatchModel(DeviceManager deviceManager, LuaManager luaManager, PipeServer pipeServer,
                              MetroDialogService dialogService, DebugViewModel debugViewModel) : base(deviceManager, luaManager)
        {
            _pipeServer     = pipeServer;
            _dialogService  = dialogService;
            _debugViewModel = debugViewModel;

            Settings  = SettingsProvider.Load <OverwatchSettings>();
            DataModel = new OverwatchDataModel();
            ProcessNames.Add("Overwatch");

            LoadOverwatchCharacters();
            FindOverwatch();
        }
 public void Execute(Action <string> logAppender)
 {
     if (!ProcessNames.Any())
     {
         logAppender?.Invoke($"Skipping process names un/registration: {nameof(ProcessNames)} collection is empty.");
     }
     else if (!BizTalkFactoryManagementDbExists())
     {
         logAppender?.Invoke($"Skipping process names un/registration: '{MANAGEMENT_DATABASE_NAME}' database does not exist.");
     }
     else
     {
         ExecuteCore(logAppender);
     }
 }
Exemplo n.º 14
0
        public UnrealTournamentModel(DeviceManager deviceManager, LuaManager luaManager, PipeServer pipeServer,
                                     MetroDialogService dialogService) : base(deviceManager, luaManager)
        {
            _pipeServer    = pipeServer;
            _dialogService = dialogService;

            Settings  = SettingsProvider.Load <UnrealTournamentSettings>();
            DataModel = new UnrealTournamentDataModel();
            ProcessNames.Add("UE4-Win64-Shipping");

            _killTimer          = new Timer(3500);
            _killTimer.Elapsed += KillTimerOnElapsed;

            FindGame();
        }
Exemplo n.º 15
0
        private void UserCommand_OnPreviewKeyUp(object sender, KeyEventArgs e)
        {
            if (e.Key != Key.Down || ProcessNames.Items.Count <= 0)
            {
                return;
            }

            ProcessNames.Focus();
            ProcessNames.SelectedIndex = 0;

            ProcessNames.UpdateLayout();
            var matchedItem = (ListBoxItem)ProcessNames.ItemContainerGenerator.ContainerFromItem(ProcessNames.SelectedItem);

            matchedItem.Focus();
        }
Exemplo n.º 16
0
        public WoWModel(DeviceManager deviceManager, LuaManager luaManager, WowPacketScanner packetScanner, MetroDialogService dialogService) : base(deviceManager, luaManager)
        {
            Settings  = SettingsProvider.Load <WoWSettings>();
            DataModel = new WoWDataModel();
            ProcessNames.Add("Wow-64");

            _packetScanner = packetScanner;
            _dialogService = dialogService;
            _packetScanner.RaiseDataReceived += (sender, args) => HandleGameData(args.Command, args.Data);

            FindWoW();

            // I simply cannot be sure wether this addon will bring people's accounts in trouble so
            // lets remove it whenever Artemis isn't running the WoW module.
            // (This also means the addon isnt left behind should the user uninstall Artemis.)
            RemoveAddon();
        }
Exemplo n.º 17
0
        public WoWModel(DeviceManager deviceManager, LuaManager luaManager) : base(deviceManager, luaManager)
        {
            Settings  = SettingsProvider.Load <WoWSettings>();
            DataModel = new WoWDataModel();
            ProcessNames.Add("Wow-64");

            // Currently WoW is locked behind a hidden trigger (obviously not that hidden since you're reading this)
            // It is using memory reading and lets first try to contact Blizzard
            var settings = SettingsProvider.Load <GeneralSettings>();

            Settings.IsEnabled = settings.GamestatePort == 62575 && Settings.IsEnabled;

            _pointer = SettingsProvider.Load <OffsetSettings>().WorldOfWarcraft;
            //_pointer = new GamePointersCollection
            //{
            //    Game = "WorldOfWarcraft",
            //    GameVersion = "7.0.3.22810",
            //    GameAddresses = new List<GamePointer>
            //    {
            //        new GamePointer
            //        {
            //            Description = "ObjectManager",
            //            BasePointer = new IntPtr(0x1578070)
            //        },
            //        new GamePointer
            //        {
            //            Description = "LocalPlayer",
            //            BasePointer = new IntPtr(0x169DF10)
            //        },
            //        new GamePointer
            //        {
            //            Description = "NameCache",
            //            BasePointer = new IntPtr(0x151DCE8)
            //        },
            //        new GamePointer
            //        {
            //            Description = "TargetGuid",
            //            BasePointer = new IntPtr(0x179C940)
            //        }
            //    }
            //};
            //var res = JsonConvert.SerializeObject(_pointer, Formatting.Indented);
        }
        private bool IsProcessName()
        {
            if (ProcessNames != null && ProcessNames.Count > 0)
            {
                var handle   = GetForegroundWindow();
                var threadId = GetWindowThreadProcessId(handle, out var processId);

                var hnd = OpenProcess(0x0400 | 0x0010, false, processId);

                var buffer2 = new StringBuilder(255);
                GetModuleFileNameEx(hnd, IntPtr.Zero, buffer2, (uint)buffer2.Capacity);

                CloseHandle(hnd);

                var fullPath = buffer2.ToString().ToLower();

                return(ProcessNames.Contains(fullPath));
            }

            return(true);
        }
Exemplo n.º 19
0
        public void Release()
        {
            OnActionSnapshotBackup  = null;
            OnActionSnapshotRestore = null;

            OnClosing     = null;
            OnInitialized = null;
            OnLoaded      = null;
            OnOpened      = null;
            OnClosed      = null;

            SnapshotsFolder = null;
            LastSnapshot    = null;

            Watcher = null;

            foreach (var category in Categories)
            {
                category.OnEquals   = null;
                category.OnToString = null;
            }

            Categories.Clear();

            foreach (var snapshot in Snapshots)
            {
                foreach (var pair in snapshot.CustomValues)
                {
                    pair.Value.OnToString = null;
                }

                snapshot.OnEquals = null;
            }

            Snapshots.Clear();

            SnapshotColumnsDefinition.Clear();

            ProcessNames.Clear();
        }
Exemplo n.º 20
0
        public static void StopMiner(bool manually = false)
        {
            if (!process?.HasExited == true)
            {
                ManuallyStoped = true;
            }

            if (manually)
            {
                inactivity = false;
                InactivityTimer?.Invoke(-1);
            }
            else
            {
                WachdogInactivity();
            }

            Waching = false;
            WachdogDelayTimer?.Invoke(-1);
            LowHashrate = false;
            LowHashrateTimer?.Invoke(-1);

            //Kill miner
            var processes = Process.GetProcesses().
                            Where(p => ProcessNames.Contains(p.ProcessName));
            var res = Parallel.ForEach(processes, p =>
            {
                while (!p.HasExited)
                {
                    try { p.Kill(); } catch { }
                }
            });

            while (!res.IsCompleted)
            {
                Thread.Sleep(50);
            }
        }
Exemplo n.º 21
0
        /// <summary>
        /// Finds the process by name and sets the main window to the foreground.
        /// Note: Process name is the cli executable excluding ".exe" e.g. "WFN" instead of "WFN.exe".
        /// </summary>
        /// <param name="processName">Known process from enum</param>
        public static void StartOrRestoreToForeground(ProcessNames processName)
        {
            // TODO: check NullPointerRef
            Process bProcess = Process.GetProcessesByName(processName.ProcessName).FirstOrDefault();

            // check if the process is running
            if (bProcess != null)
            {
                // check if the window is hidden / minimized
                if (bProcess.MainWindowHandle == IntPtr.Zero)
                {
                    // the window is hidden so try to restore it before setting focus.
                    NativeMethods.ShowWindow(bProcess.Handle, NativeMethods.ShowWindowEnum.Restore);
                }

                // set user the focus to the window
                _ = NativeMethods.SetForegroundWindow(bProcess.MainWindowHandle);
            }
            else
            {
                _ = Process.Start(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, processName.FileName));
            }
        }
Exemplo n.º 22
0
        public RocketLeagueModel(DeviceManager deviceManager, LuaManager luaManager) : base(deviceManager, luaManager)
        {
            Settings  = SettingsProvider.Load <RocketLeagueSettings>();
            DataModel = new RocketLeagueDataModel();
            ProcessNames.Add("RocketLeague");

            // Generate a new offset when the game is updated
            //var offset = new GamePointersCollection
            //{
            //    Game = "RocketLeague",
            //    GameVersion = "1.27",
            //    GameAddresses = new List<GamePointer>
            //    {
            //        new GamePointer
            //        {
            //            Description = "Boost",
            //            BasePointer = new IntPtr(0x016D5084),
            //            Offsets = new[] {0xC4, 0x214, 0x320, 0x73C, 0x224}
            //        }
            //    }
            //};
            //var res = JsonConvert.SerializeObject(offset, Formatting.Indented);
        }
Exemplo n.º 23
0
        public TerrariaModel(DeviceManager deviceManager, LuaManager luaManager) : base(deviceManager, luaManager)
        {
            Settings  = SettingsProvider.Load <TerrariaSettings>();
            DataModel = new TerrariaDataModel();
            ProcessNames.Add("Terraria");

            // Generate a new offset when the game is updated
            //_pointer = new GamePointersCollection
            //{
            //    Game = "Terraria",
            //    GameVersion = "1.3.4.4",
            //    GameAddresses = new List<GamePointer>
            //    {
            //        new GamePointer
            //        {
            //            Description = "PlayerBase",
            //            BasePointer = new IntPtr(0x0039C078),
            //            Offsets = new[] {0x280, 0x6C0, 0x674, 0x3C}
            //        }
            //    }
            //};
            //var res = JsonConvert.SerializeObject(_pointer, Formatting.Indented);
        }
Exemplo n.º 24
0
        public RocketLeagueModel(DeviceManager deviceManager, LuaManager luaManager) : base(deviceManager, luaManager)
        {
            Settings  = SettingsProvider.Load <RocketLeagueSettings>();
            DataModel = new RocketLeagueDataModel();
            ProcessNames.Add("RocketLeague");

            // Generate a new offset when the game is updated
            var offset = new GamePointersCollection
            {
                Game          = "RocketLeague",
                GameVersion   = "1.30",
                GameAddresses = new List <GamePointer>
                {
                    new GamePointer
                    {
                        Description = "Boost",
                        BasePointer = new IntPtr(0x016E00B4),
                        Offsets     = new[] { 0xC4, 0x18, 0x388, 0x73C, 0x224 }
                    }
                }
            };
            var res = JsonConvert.SerializeObject(offset, Formatting.Indented);
        }
Exemplo n.º 25
0
 public bool EnableForProcess(Process process)
 {
     return(ProcessNames.Any(s => Regex.IsMatch(process.ProcessName, s)));
 }
Exemplo n.º 26
0
 static Bminer()
 {
     ProcessNames.Add("bminer");
 }
Exemplo n.º 27
0
 static Gminer()
 {
     ProcessNames.Add("miner");
 }
Exemplo n.º 28
0
 static Claymore()
 {
     ProcessNames.Add("EthDcrMiner64");
 }
Exemplo n.º 29
0
 public ProjectCarsModel(DeviceManager deviceManager, LuaManager luaManager) : base(deviceManager, luaManager)
 {
     Settings  = SettingsProvider.Load <ProjectCarsSettings>();
     DataModel = new ProjectCarsDataModel();
     ProcessNames.Add("pCARS64");
 }
Exemplo n.º 30
0
 public AssettoCorsaModel(DeviceManager deviceManager, LuaManager luaManager) : base(deviceManager, luaManager)
 {
     Settings  = SettingsProvider.Load <AssettoCorsaSettings>();
     DataModel = new AssettoCorsaDataModel();
     ProcessNames.Add("AssettoCorsa");
 }