Fixed profile ZIP

Added some error handling to WoW module
This commit is contained in:
SpoinkyNL committed 2017-12-03 19:19:06 +01:00
1 parent efa2d6614d
commit a11b50a081
10 files changed
+281 -13

No files matched your search

+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
</startup>
</configuration>
@@ -0,0 +1,89 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{5A5633E8-FB73-4A32-9161-F1C0BAA1FA12}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>Artemis.Intermediate</RootNamespace>
<AssemblyName>Artemis</AssemblyName>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="DeltaCompressionDotNet, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1d14d6e5194e7f4a, processorArchitecture=MSIL">
<HintPath>..\packages\DeltaCompressionDotNet.1.0.0\lib\net45\DeltaCompressionDotNet.dll</HintPath>
</Reference>
<Reference Include="DeltaCompressionDotNet.MsDelta, Version=1.0.0.0, Culture=neutral, PublicKeyToken=46b2138a390abf55, processorArchitecture=MSIL">
<HintPath>..\packages\DeltaCompressionDotNet.1.0.0\lib\net45\DeltaCompressionDotNet.MsDelta.dll</HintPath>
</Reference>
<Reference Include="DeltaCompressionDotNet.PatchApi, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3e8888ee913ed789, processorArchitecture=MSIL">
<HintPath>..\packages\DeltaCompressionDotNet.1.0.0\lib\net45\DeltaCompressionDotNet.PatchApi.dll</HintPath>
</Reference>
<Reference Include="ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\squirrel.windows.1.4.4\lib\Net45\ICSharpCode.SharpZipLib.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.1\lib\net45\Mono.Cecil.dll</HintPath>
</Reference>
<Reference Include="Mono.Cecil.Mdb, Version=0.9.6.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<HintPath>..\packages\Mono.Cecil.0.9.6.1\lib\net45\Mono.Cecil.Mdb.dll</HintPath>
</Reference>
<Reference Include="Mono.Cecil.Pdb, Version=0.9.6.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<HintPath>..\packages\Mono.Cecil.0.9.6.1\lib\net45\Mono.Cecil.Pdb.dll</HintPath>
</Reference>
<Reference Include="Mono.Cecil.Rocks, Version=0.9.6.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<HintPath>..\packages\Mono.Cecil.0.9.6.1\lib\net45\Mono.Cecil.Rocks.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="NuGet.Squirrel, Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\squirrel.windows.1.4.4\lib\Net45\NuGet.Squirrel.dll</HintPath>
</Reference>
<Reference Include="Splat, Version=1.6.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Splat.1.6.2\lib\Net45\Splat.dll</HintPath>
</Reference>
<Reference Include="Squirrel, Version=1.4.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\squirrel.windows.1.4.4\lib\Net45\Squirrel.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
+73
View File
@@ -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<string>().StartsWith("artemis-setup") &&
c["name"].Value<string>().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<string>()}");
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<string>()}..");
var setupBytes = downloadClient.DownloadData(releaseFile["browser_download_url"].Value<string>());
// Ensure the update folder exists
var updateFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\Artemis\\updates";
var updatePath = updateFolder + "\\" + releaseFile["name"].Value<string>();
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");
}
}
}
@@ -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")]
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="DeltaCompressionDotNet" version="1.0.0" targetFramework="net46" />
<package id="Mono.Cecil" version="0.9.6.1" targetFramework="net46" />
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net46" />
<package id="Splat" version="1.6.2" targetFramework="net46" />
<package id="squirrel.windows" version="1.4.4" targetFramework="net46" />
</packages>
+32
View File
@@ -17,6 +17,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LightFX2Artemis", "LightFX2
EndProject EndProject
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "Artemis.Installer", "Artemis.Installer\Artemis.Installer.wixproj", "{A34F9047-8464-4423-89EF-A2F43E089E93}" Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "Artemis.Installer", "Artemis.Installer\Artemis.Installer.wixproj", "{A34F9047-8464-4423-89EF-A2F43E089E93}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Artemis.Intermediate", "Artemis.Intermediate\Artemis.Intermediate.csproj", "{5A5633E8-FB73-4A32-9161-F1C0BAA1FA12}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
CD_ROM|Any CPU = CD_ROM|Any CPU 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|x64.Build.0 = Release|x86
{A34F9047-8464-4423-89EF-A2F43E089E93}.SingleImage|x86.ActiveCfg = Release|x86 {A34F9047-8464-4423-89EF-A2F43E089E93}.SingleImage|x86.ActiveCfg = Release|x86
{A34F9047-8464-4423-89EF-A2F43E089E93}.SingleImage|x86.Build.0 = 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 EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@@ -27,7 +27,7 @@ namespace Artemis.DeviceProviders.Corsair
Logger = logger; Logger = logger;
Name = "Corsair RGB Keyboard"; Name = "Corsair RGB Keyboard";
CantEnableText = "Couldn't connect to your Corsair keyboard.\n" + 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" + "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."; "If needed, you can select a different keyboard in Artemis under settings.";
} }
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Artemis.Services;
using Ninject.Extensions.Logging; using Ninject.Extensions.Logging;
using PcapDotNet.Core; using PcapDotNet.Core;
using PcapDotNet.Packets; using PcapDotNet.Packets;
@@ -14,11 +15,13 @@ namespace Artemis.Modules.Games.WoW
private const string MsgStart = "\u0001"; private const string MsgStart = "\u0001";
private const string MsgNext = "\u0002"; private const string MsgNext = "\u0002";
private const string MsgLast = "\u0003"; private const string MsgLast = "\u0003";
private readonly MetroDialogService _dialogService;
private PacketCommunicator _communicator; private PacketCommunicator _communicator;
private string _dataParts; private string _dataParts;
public WowPacketScanner(ILogger logger) public WowPacketScanner(ILogger logger, MetroDialogService dialogService)
{ {
_dialogService = dialogService;
Logger = logger; Logger = logger;
} }
@@ -42,24 +45,45 @@ namespace Artemis.Modules.Games.WoW
PacketDevice selectedDevice = allDevices.First(); PacketDevice selectedDevice = allDevices.First();
// Open the device // Open the device
_communicator = selectedDevice.Open(65536, PacketDeviceOpenAttributes.Promiscuous, 40); try
Logger.Debug("Listening on " + selectedDevice.Description + " for WoW packets");
// Compile the filter
using (var filter = _communicator.CreateFilter("tcp"))
{ {
// Set the filter _communicator = selectedDevice.Open(65536, PacketDeviceOpenAttributes.Promiscuous, 40);
_communicator.SetFilter(filter); 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()); Task.Run(() => ReceivePackets());
} }
public void Stop() public void Stop()
{ {
_communicator?.Break(); try
_communicator?.Dispose(); {
_communicator = null; _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() private void ReceivePackets()
+1 -1
View File
@@ -85,7 +85,7 @@ namespace Artemis.Utilities
dialog.SetIndeterminate(); dialog.SetIndeterminate();
// Download the release file, it's the one starting with "artemis-setup" // Download the release file, it's the one starting with "artemis-setup"
var releaseFile = release["assets"].Children().FirstOrDefault(c => c["name"].Value<string>().StartsWith("artemis-setup") && var releaseFile = release["assets"].Children().FirstOrDefault(c => c["name"].Value<string>().StartsWith("artemis-setup") &&
c["name"].Value<string>().EndsWith(".exe")); c["name"].Value<string>().EndsWith(".msi"));
// If there's no matching release it means whoever published the new version fucked up, can't do much about that // If there's no matching release it means whoever published the new version fucked up, can't do much about that
if (releaseFile == null) if (releaseFile == null)
{ {