diff --git a/Artemis/Artemis.Intermediate/App.config b/Artemis/Artemis.Intermediate/App.config new file mode 100644 index 000000000..8324aa6ff --- /dev/null +++ b/Artemis/Artemis.Intermediate/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Artemis/Artemis.Intermediate/Artemis.Intermediate.csproj b/Artemis/Artemis.Intermediate/Artemis.Intermediate.csproj new file mode 100644 index 000000000..c7956bc32 --- /dev/null +++ b/Artemis/Artemis.Intermediate/Artemis.Intermediate.csproj @@ -0,0 +1,89 @@ + + + + + Debug + AnyCPU + {5A5633E8-FB73-4A32-9161-F1C0BAA1FA12} + Exe + Artemis.Intermediate + Artemis + v4.6 + 512 + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\DeltaCompressionDotNet.1.0.0\lib\net45\DeltaCompressionDotNet.dll + + + ..\packages\DeltaCompressionDotNet.1.0.0\lib\net45\DeltaCompressionDotNet.MsDelta.dll + + + ..\packages\DeltaCompressionDotNet.1.0.0\lib\net45\DeltaCompressionDotNet.PatchApi.dll + + + ..\packages\squirrel.windows.1.4.4\lib\Net45\ICSharpCode.SharpZipLib.dll + + + ..\packages\Mono.Cecil.0.9.6.1\lib\net45\Mono.Cecil.dll + + + ..\packages\Mono.Cecil.0.9.6.1\lib\net45\Mono.Cecil.Mdb.dll + + + ..\packages\Mono.Cecil.0.9.6.1\lib\net45\Mono.Cecil.Pdb.dll + + + ..\packages\Mono.Cecil.0.9.6.1\lib\net45\Mono.Cecil.Rocks.dll + + + ..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll + + + ..\packages\squirrel.windows.1.4.4\lib\Net45\NuGet.Squirrel.dll + + + ..\packages\Splat.1.6.2\lib\Net45\Splat.dll + + + ..\packages\squirrel.windows.1.4.4\lib\Net45\Squirrel.dll + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Artemis/Artemis.Intermediate/Program.cs b/Artemis/Artemis.Intermediate/Program.cs new file mode 100644 index 000000000..e284ebbe1 --- /dev/null +++ b/Artemis/Artemis.Intermediate/Program.cs @@ -0,0 +1,73 @@ +using System; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Net; +using Newtonsoft.Json.Linq; + +namespace Artemis.Intermediate +{ + public class Program + { + private static void Main(string[] args) + { + Console.WriteLine("Updating Artemis...\n"); + // Check GitHub for a new version + var jsonClient = new WebClient(); + + // GitHub trips if we don't add a user agent + jsonClient.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)"); + + // Random number to get around cache issues + var rand = new Random(DateTime.Now.Millisecond); + // Grab the latest and greatest off of GitHub, it won't use Squirrel anymore. + var json = jsonClient.DownloadString("https://api.github.com/repos/SpoinkyNL/Artemis/releases/latest?random=" + rand.Next()); + + var release = JObject.Parse(json); + + // Download the release file, it's the one starting with "artemis-setup" + var releaseFile = release["assets"].Children().FirstOrDefault(c => c["name"].Value().StartsWith("artemis-setup") && + c["name"].Value().EndsWith(".msi")); + // If there's no matching release it means whoever published the new version fucked up, can't do much about that + if (releaseFile == null) + { + Console.WriteLine("Couldn't find the update file. Please install the latest version manually, sorry!"); + return; + } + + Console.WriteLine($"Found release: {release["tag_name"].Value()}"); + var downloadClient = new WebClient(); + downloadClient.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)"); + + Console.WriteLine($"Downloading {releaseFile["browser_download_url"].Value()}.."); + var setupBytes = downloadClient.DownloadData(releaseFile["browser_download_url"].Value()); + + // Ensure the update folder exists + var updateFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\Artemis\\updates"; + var updatePath = updateFolder + "\\" + releaseFile["name"].Value(); + if (!Directory.Exists(updateFolder)) + Directory.CreateDirectory(updateFolder); + + // Store the bytes + File.WriteAllBytes(updatePath, setupBytes); + // Create a bat file that'll take care of the installation (Artemis gets shut down during install) the bat file will + // carry forth our legacy (read that in an heroic tone) + Console.WriteLine("Running setup.."); + var updateScript = "ECHO OFF\r\n" + + "CLS\r\n" + + $"\"{updatePath}\""; + File.WriteAllText(updateFolder + "\\updateScript.bat", updateScript); + var psi = new ProcessStartInfo + { + FileName = updateFolder + "\\updateScript.bat", + Verb = "runas" + }; + + var process = new Process {StartInfo = psi}; + process.Start(); + process.WaitForExit(); + Console.WriteLine("\nDone! You can now close this window and start Artemis using the start menu shortcut."); + Console.WriteLine("Note: This updater will be removed automatically the next time you run Artemis"); + } + } +} diff --git a/Artemis/Artemis.Intermediate/Properties/AssemblyInfo.cs b/Artemis/Artemis.Intermediate/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..4dabdb4ba --- /dev/null +++ b/Artemis/Artemis.Intermediate/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Artemis.Intermediate")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Artemis.Intermediate")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("5a5633e8-fb73-4a32-9161-f1c0baa1fa12")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Artemis/Artemis.Intermediate/packages.config b/Artemis/Artemis.Intermediate/packages.config new file mode 100644 index 000000000..6d75e8423 --- /dev/null +++ b/Artemis/Artemis.Intermediate/packages.config @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/Artemis/Artemis.sln b/Artemis/Artemis.sln index bf3546036..b44261667 100644 --- a/Artemis/Artemis.sln +++ b/Artemis/Artemis.sln @@ -17,6 +17,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LightFX2Artemis", "LightFX2 EndProject Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "Artemis.Installer", "Artemis.Installer\Artemis.Installer.wixproj", "{A34F9047-8464-4423-89EF-A2F43E089E93}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Artemis.Intermediate", "Artemis.Intermediate\Artemis.Intermediate.csproj", "{5A5633E8-FB73-4A32-9161-F1C0BAA1FA12}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution CD_ROM|Any CPU = CD_ROM|Any CPU @@ -236,6 +238,36 @@ Global {A34F9047-8464-4423-89EF-A2F43E089E93}.SingleImage|x64.Build.0 = Release|x86 {A34F9047-8464-4423-89EF-A2F43E089E93}.SingleImage|x86.ActiveCfg = Release|x86 {A34F9047-8464-4423-89EF-A2F43E089E93}.SingleImage|x86.Build.0 = Release|x86 + {5A5633E8-FB73-4A32-9161-F1C0BAA1FA12}.CD_ROM|Any CPU.ActiveCfg = Release|Any CPU + {5A5633E8-FB73-4A32-9161-F1C0BAA1FA12}.CD_ROM|Any CPU.Build.0 = Release|Any CPU + {5A5633E8-FB73-4A32-9161-F1C0BAA1FA12}.CD_ROM|x64.ActiveCfg = Release|Any CPU + {5A5633E8-FB73-4A32-9161-F1C0BAA1FA12}.CD_ROM|x64.Build.0 = Release|Any CPU + {5A5633E8-FB73-4A32-9161-F1C0BAA1FA12}.CD_ROM|x86.ActiveCfg = Release|Any CPU + {5A5633E8-FB73-4A32-9161-F1C0BAA1FA12}.CD_ROM|x86.Build.0 = Release|Any CPU + {5A5633E8-FB73-4A32-9161-F1C0BAA1FA12}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5A5633E8-FB73-4A32-9161-F1C0BAA1FA12}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5A5633E8-FB73-4A32-9161-F1C0BAA1FA12}.Debug|x64.ActiveCfg = Debug|Any CPU + {5A5633E8-FB73-4A32-9161-F1C0BAA1FA12}.Debug|x64.Build.0 = Debug|Any CPU + {5A5633E8-FB73-4A32-9161-F1C0BAA1FA12}.Debug|x86.ActiveCfg = Debug|Any CPU + {5A5633E8-FB73-4A32-9161-F1C0BAA1FA12}.Debug|x86.Build.0 = Debug|Any CPU + {5A5633E8-FB73-4A32-9161-F1C0BAA1FA12}.DVD-5|Any CPU.ActiveCfg = Debug|Any CPU + {5A5633E8-FB73-4A32-9161-F1C0BAA1FA12}.DVD-5|Any CPU.Build.0 = Debug|Any CPU + {5A5633E8-FB73-4A32-9161-F1C0BAA1FA12}.DVD-5|x64.ActiveCfg = Debug|Any CPU + {5A5633E8-FB73-4A32-9161-F1C0BAA1FA12}.DVD-5|x64.Build.0 = Debug|Any CPU + {5A5633E8-FB73-4A32-9161-F1C0BAA1FA12}.DVD-5|x86.ActiveCfg = Debug|Any CPU + {5A5633E8-FB73-4A32-9161-F1C0BAA1FA12}.DVD-5|x86.Build.0 = Debug|Any CPU + {5A5633E8-FB73-4A32-9161-F1C0BAA1FA12}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5A5633E8-FB73-4A32-9161-F1C0BAA1FA12}.Release|Any CPU.Build.0 = Release|Any CPU + {5A5633E8-FB73-4A32-9161-F1C0BAA1FA12}.Release|x64.ActiveCfg = Release|Any CPU + {5A5633E8-FB73-4A32-9161-F1C0BAA1FA12}.Release|x64.Build.0 = Release|Any CPU + {5A5633E8-FB73-4A32-9161-F1C0BAA1FA12}.Release|x86.ActiveCfg = Release|Any CPU + {5A5633E8-FB73-4A32-9161-F1C0BAA1FA12}.Release|x86.Build.0 = Release|Any CPU + {5A5633E8-FB73-4A32-9161-F1C0BAA1FA12}.SingleImage|Any CPU.ActiveCfg = Release|Any CPU + {5A5633E8-FB73-4A32-9161-F1C0BAA1FA12}.SingleImage|Any CPU.Build.0 = Release|Any CPU + {5A5633E8-FB73-4A32-9161-F1C0BAA1FA12}.SingleImage|x64.ActiveCfg = Release|Any CPU + {5A5633E8-FB73-4A32-9161-F1C0BAA1FA12}.SingleImage|x64.Build.0 = Release|Any CPU + {5A5633E8-FB73-4A32-9161-F1C0BAA1FA12}.SingleImage|x86.ActiveCfg = Release|Any CPU + {5A5633E8-FB73-4A32-9161-F1C0BAA1FA12}.SingleImage|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Artemis/Artemis/DeviceProviders/Corsair/CorsairKeyboard.cs b/Artemis/Artemis/DeviceProviders/Corsair/CorsairKeyboard.cs index 92af0fab2..c00d7173d 100644 --- a/Artemis/Artemis/DeviceProviders/Corsair/CorsairKeyboard.cs +++ b/Artemis/Artemis/DeviceProviders/Corsair/CorsairKeyboard.cs @@ -27,7 +27,7 @@ namespace Artemis.DeviceProviders.Corsair Logger = logger; Name = "Corsair RGB Keyboard"; CantEnableText = "Couldn't connect to your Corsair keyboard.\n" + - "Please check your cables and/or drivers (could be outdated) and that Corsair Utility Engine is running.\n" + + "Please check your cables and/or drivers (could be outdated, you need the latest CUE 2.x) and that Corsair Utility Engine is running.\n" + "In CUE, make sure \"Enable SDK\" is checked under Global Settings.\n\n" + "If needed, you can select a different keyboard in Artemis under settings."; } diff --git a/Artemis/Artemis/Modules/Games/WoW/WoWPacketScanner.cs b/Artemis/Artemis/Modules/Games/WoW/WoWPacketScanner.cs index df4b85e3b..17064d22f 100644 --- a/Artemis/Artemis/Modules/Games/WoW/WoWPacketScanner.cs +++ b/Artemis/Artemis/Modules/Games/WoW/WoWPacketScanner.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Artemis.Services; using Ninject.Extensions.Logging; using PcapDotNet.Core; using PcapDotNet.Packets; @@ -14,11 +15,13 @@ namespace Artemis.Modules.Games.WoW private const string MsgStart = "\u0001"; private const string MsgNext = "\u0002"; private const string MsgLast = "\u0003"; + private readonly MetroDialogService _dialogService; private PacketCommunicator _communicator; private string _dataParts; - public WowPacketScanner(ILogger logger) + public WowPacketScanner(ILogger logger, MetroDialogService dialogService) { + _dialogService = dialogService; Logger = logger; } @@ -42,24 +45,45 @@ namespace Artemis.Modules.Games.WoW PacketDevice selectedDevice = allDevices.First(); // Open the device - _communicator = selectedDevice.Open(65536, PacketDeviceOpenAttributes.Promiscuous, 40); - Logger.Debug("Listening on " + selectedDevice.Description + " for WoW packets"); - - // Compile the filter - using (var filter = _communicator.CreateFilter("tcp")) + try { - // Set the filter - _communicator.SetFilter(filter); + _communicator = selectedDevice.Open(65536, PacketDeviceOpenAttributes.Promiscuous, 40); + Logger.Debug("Listening on " + selectedDevice.Description + " for WoW packets"); + + // Compile the filter + using (var filter = _communicator.CreateFilter("tcp")) + { + // Set the filter + _communicator.SetFilter(filter); + } } + catch (Exception e) + { + _dialogService.ShowErrorMessageBox("Cannot start the WoW module, maybe an antivirus is interfering.\n\n" + + $"Try whitelisting '{AppDomain.CurrentDomain.BaseDirectory}' in your virus " + + "scanner and reinstalling Artemis."); + Logger.Warn(e, "Cannot start the WoW module, maybe an antivirus is interfering."); + } + Task.Run(() => ReceivePackets()); } public void Stop() { - _communicator?.Break(); - _communicator?.Dispose(); - _communicator = null; + try + { + _communicator?.Break(); + _communicator?.Dispose(); + _communicator = null; + } + catch (Exception e) + { + _dialogService.ShowErrorMessageBox("Cannot start the WoW module, maybe an antivirus is interfering.\n\n" + + $"Try whitelisting '{AppDomain.CurrentDomain.BaseDirectory}' in your virus scanner " + + "and reinstalling Artemis."); + Logger.Warn(e, "Cannot start the WoW module, maybe an antivirus is interfering."); + } } private void ReceivePackets() diff --git a/Artemis/Artemis/Resources/Keyboards/default-profiles.zip b/Artemis/Artemis/Resources/Keyboards/default-profiles.zip index b61bb43d6..d6a596675 100644 Binary files a/Artemis/Artemis/Resources/Keyboards/default-profiles.zip and b/Artemis/Artemis/Resources/Keyboards/default-profiles.zip differ diff --git a/Artemis/Artemis/Utilities/Updater.cs b/Artemis/Artemis/Utilities/Updater.cs index b5d6ce37f..3d400787d 100644 --- a/Artemis/Artemis/Utilities/Updater.cs +++ b/Artemis/Artemis/Utilities/Updater.cs @@ -85,7 +85,7 @@ namespace Artemis.Utilities dialog.SetIndeterminate(); // Download the release file, it's the one starting with "artemis-setup" var releaseFile = release["assets"].Children().FirstOrDefault(c => c["name"].Value().StartsWith("artemis-setup") && - c["name"].Value().EndsWith(".exe")); + c["name"].Value().EndsWith(".msi")); // If there's no matching release it means whoever published the new version fucked up, can't do much about that if (releaseFile == null) {