Skip to content

Commit

Permalink
Added Newtonsoft.Json As Embedded Assembly
Browse files Browse the repository at this point in the history
  • Loading branch information
Ni1kko committed Oct 3, 2019
1 parent 7d92bd7 commit dddd481
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 12 deletions.
Binary file not shown.
10 changes: 7 additions & 3 deletions infiBanChecker/infiBanChecker/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Threading.Tasks;

namespace infiBanChecker
Expand All @@ -9,12 +9,16 @@ internal sealed class Program
// Major Version
// Minor Version
// Build Number
internal const string version = "1.1.0";
internal const string version = "2.0.0";
#endregion

#region EntryPoint
private static async Task Main()
{
{
#region Subscibe AssemblyResolve to resolve embedded assemblies
AppDomain.CurrentDomain.AssemblyResolve += Utils.Helpers.CurrentDomain_AssemblyResolve;
#endregion

#region Setup the console window parameters
Utils.Helpers.setupConsole(
$"{Utils.Helpers._assembly.GetName().Name}",
Expand Down
1 change: 0 additions & 1 deletion infiBanChecker/infiBanChecker/Properties/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net48" />
</packages>
18 changes: 14 additions & 4 deletions infiBanChecker/infiBanChecker/Utils/Helpers.cs
Original file line number Diff line number Diff line change
@@ -1,24 +1,34 @@
using System;
using System.IO;
using System.Net.Http;
using System.Net.Http;
using System.Runtime.InteropServices;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;

namespace infiBanChecker.Utils
{
internal sealed class Helpers
{
#region Reference Data Types
internal static System.Reflection.Assembly _assembly = System.Reflection.Assembly.GetExecutingAssembly();
internal static System.Reflection.Assembly _assembly = typeof(Helpers).Assembly;
internal static API api;
internal static readonly string _config = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"{ _assembly.GetName().Name}.json");
private static string APIErrorMessage;
private static bool isUrlParametersValid, isGlobalBanned, isSteam64Error, isTokenOk = false;
private static HttpResponseMessage APIresponse;
#endregion

#region Resolve Embedded Assemblies
internal static System.Reflection.Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{
var stream = _assembly.GetManifestResourceStream("infiBanChecker.EmbeddedAssemblies.Newtonsoft.Json.dll");
var assemblyData = new Byte[stream.Length];
stream.Read(assemblyData, 0, assemblyData.Length);
return System.Reflection.Assembly.Load(assemblyData);
}
#endregion

#region Read Steam64 from Console
private static string readSid64FromConsole
{
Expand Down
11 changes: 7 additions & 4 deletions infiBanChecker/infiBanChecker/infiBanChecker.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
<Reference Include="Newtonsoft.Json">
<HintPath>EmbeddedAssemblies\Newtonsoft.Json.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand All @@ -53,10 +54,12 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Utils\InfiBanCheck.cs" />
</ItemGroup>
<ItemGroup>
<ItemGroup>
<None Include="Properties\App.config" />
<None Include="Properties\packages.config" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<EmbeddedResource Include="EmbeddedAssemblies\Newtonsoft.Json.dll" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeEditing/Localization/Localizable/@EntryValue">Yes</s:String></wpf:ResourceDictionary>

0 comments on commit dddd481

Please sign in to comment.