Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 10 additions & 13 deletions Console/Obfuscar.Console.csproj
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<Target Name="RepackWithILOnWindows" AfterTargets="Build" Condition="'$(Configuration)' == 'Release' AND '$(OS)' == 'Windows_NT'">
<Exec Command="rename Obfuscar.Console.exe Obfuscar.exe" WorkingDirectory="$(TargetDir)" />
<Exec Command="&quot;$(ILRepack)&quot; /t:exe /out:Obfuscar.Console.exe Obfuscar.exe Baml.dll Mono.Cecil.dll Mono.Cecil.Pdb.dll Mono.Cecil.Rocks.dll Mono.Options.dll Obfuscar.dll Rollbar.dll Newtonsoft.Json.dll" WorkingDirectory="$(TargetDir)" />
<Exec Command="del Baml.dll Mono.Cecil.dll Mono.Cecil.Pdb.dll Mono.Cecil.Rocks.dll Mono.Options.dll Obfuscar.dll Rollbar.dll Obfuscar.exe Newtonsoft.Json.dll" WorkingDirectory="$(TargetDir)" />
<Exec Command="rename Obfuscar.Console.exe Obfuscar.exe" WorkingDirectory="$(TargetDir)"/>
</Target>

<Target Name="RepackWithILOnNonWindows" AfterTargets="Build" Condition="'$(Configuration)' == 'Release' AND '$(OS)' != 'Windows_NT'">
<Exec Command="mv Obfuscar.Console.exe Obfuscar.exe" WorkingDirectory="$(TargetDir)" />
<Exec Command="&quot;$(ILRepack)&quot; /t:exe /out:Obfuscar.Console.exe Obfuscar.exe Baml.dll Mono.Cecil.dll Mono.Cecil.Pdb.dll Mono.Cecil.Rocks.dll Mono.Options.dll Obfuscar.dll Rollbar.dll Newtonsoft.Json.dll" WorkingDirectory="$(TargetDir)" />
<Exec Command="rm Baml.dll Mono.Cecil.dll Mono.Cecil.Pdb.dll Mono.Cecil.Rocks.dll Mono.Options.dll Obfuscar.dll Rollbar.dll Obfuscar.exe Newtonsoft.Json.dll" WorkingDirectory="$(TargetDir)" />
<Exec Command="mv Obfuscar.Console.exe Obfuscar.exe" WorkingDirectory="$(TargetDir)"/>
</Target>

<PropertyGroup>
<ProductVersion>9.0.21022</ProductVersion>
<ProjectGuid>{275B3EED-7E70-4460-950F-96EDCA099BD4}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>Obfuscar</RootNamespace>
<TargetFramework>net48</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<FileUpgradeFlags />
<UpgradeBackupLocation />
<PublishUrl>publish\</PublishUrl>
Expand All @@ -37,6 +33,7 @@
<BootstrapperEnabled>true</BootstrapperEnabled>
<ApplicationIcon>..\Raindropmemory-Legendora-Potion.ico</ApplicationIcon>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AnalysisMode>Minimum</AnalysisMode>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugType>full</DebugType>
Expand All @@ -53,9 +50,6 @@
<PropertyGroup>
<StartupObject>Obfuscar.Program</StartupObject>
</PropertyGroup>
<ItemGroup>
<Reference Include="System.Windows.Forms" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Obfuscar\Obfuscar.csproj" />
</ItemGroup>
Expand All @@ -67,8 +61,11 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="ILRepack" Version="2.0.18" />
<PackageReference Include="Mono.Options" Version="6.6.0.161" />
<PackageReference Include="Rollbar" Version="3.14.0" />
<PackageReference Include="ILRepack" Version="2.0.38">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Mono.Options" Version="6.12.0.148" />
<PackageReference Include="Rollbar" Version="5.2.2" />
</ItemGroup>
</Project>
21 changes: 7 additions & 14 deletions Console/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using System.Threading.Tasks;
using System.Windows.Forms;
using Mono.Options;
using Rollbar;
using Rollbar.DTOs;
Expand Down Expand Up @@ -136,22 +135,16 @@ private static void RegisterRollbar()
Console.WriteLine("Note that Rollbar API is enabled by default to collect crashes. If you want to opt out, please run with -s switch");
var version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
RollbarLocator.RollbarInstance.Configure(
new RollbarConfig("1dd3cf880c5a46eeb4338dbea73f9620")
new RollbarLoggerConfig("1dd3cf880c5a46eeb4338dbea73f9620", "production")
{
RollbarPayloadAdditionOptions =
{
Environment = "production",
Transform = payload =>
Person = new Person(version)
{
payload.Data.Person = new Person(version)
{
UserName = $"{version}"
};
UserName = version,
}
});

Application.ThreadException += (sender, args) =>
{
RollbarLocator.RollbarInstance.Error(args.Exception);
};
}
});

AppDomain.CurrentDomain.UnhandledException += (sender, args) =>
{
Expand Down
2 changes: 1 addition & 1 deletion GlobalTools/GlobalTools.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net60-windows</TargetFrameworks>
<TargetFrameworks>net6.0-windows;net8.0-windows</TargetFrameworks>

<PackAsTool>true</PackAsTool>
<ToolCommandName>obfuscar.console</ToolCommandName>
Expand Down
11 changes: 5 additions & 6 deletions GlobalTools/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,14 @@ private static void RegisterRollbar()
Console.WriteLine("Note that Rollbar API is enabled by default to collect crashes. If you want to opt out, please run with -s switch");
var version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
RollbarLocator.RollbarInstance.Configure(
new RollbarConfig("1dd3cf880c5a46eeb4338dbea73f9620")
new RollbarLoggerConfig("1dd3cf880c5a46eeb4338dbea73f9620", "production")
{
Environment = "production",
Transform = payload =>
RollbarPayloadAdditionOptions =
{
payload.Data.Person = new Person(version)
Person = new Person(version)
{
UserName = $"{version}"
};
UserName = version,
}
}
});

Expand Down
21 changes: 17 additions & 4 deletions Obfuscar/Obfuscar.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net60-windows;net48</TargetFrameworks>
<TargetFrameworks>net6.0-windows;net8.0-windows;net48</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand All @@ -14,9 +15,21 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Mono.Cecil" Version="0.11.5" />
<PackageReference Include="Rollbar" Version="3.14.0" />
<PackageReference Include="System.Runtime.Caching" Version="5.0.0" />
<PackageReference Include="Mono.Cecil" Version="0.11.6" />
<PackageReference Include="Rollbar" Version="5.2.2" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.12.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net48'">
<PackageReference Include="System.Runtime.Caching" Version="4.5.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net6.0-windows'">
<PackageReference Include="System.Runtime.Caching" Version="6.0.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net8.0-windows'">
<PackageReference Include="System.Runtime.Caching" Version="8.0.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net60-windows;net48</TargetFrameworks>
<TargetFrameworks>net6.0-windows;net8.0-windows;net48</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand All @@ -16,7 +16,7 @@

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Mono.Cecil" Version="0.11.5" />
<PackageReference Include="Mono.Cecil" Version="0.11.6" />
</ItemGroup>

</Project>
10 changes: 5 additions & 5 deletions ObfuscarTest/ObfuscarTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Mono.Cecil" Version="0.11.5" />
<PackageReference Include="System.CodeDom" Version="4.7.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.console" Version="2.4.1">
<PackageReference Include="Mono.Cecil" Version="0.11.6" />
<PackageReference Include="System.CodeDom" Version="8.0.0" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.console" Version="2.9.3">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.2">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions ObfuscarTest/TestHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ public static void CleanInput()
// clean out inputPath
try
{
//foreach (string file in Directory.GetFiles(InputPath, "*.dll"))
//File.Delete(file);
foreach (string file in Directory.GetFiles(InputPath, "*.dll"))
File.Delete(file);
}
catch
{
Expand Down
3 changes: 3 additions & 0 deletions ObfuscarTestNet/CollectionExpressionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ public void CheckCollectionExpression()
var assembly2 = Assembly.LoadFrom(Path.GetFullPath(Path.Combine(outputPath, "AssemblyWithCollectionExpression.dll")));
var obfuscatedClass = output.Mapping.ClassMap.First(c => c.Key.Name == "ObfuscarTestNet.Input.AssemblyWithCollectionExpression");
var obfuscatedClassName = obfuscatedClass.Value.StatusText;
#if NET6_0_OR_GREATER
obfuscatedClassName = obfuscatedClassName[(obfuscatedClassName.IndexOf(']') + 1)..];
#endif
obfuscatedClassName = obfuscatedClassName.Substring(obfuscatedClassName.IndexOf(']') + 1);
var type = assembly2.GetType(obfuscatedClassName) ?? throw new Exception($"Test class {obfuscatedClassName} not found");
var instance = Activator.CreateInstance(type);

Expand Down
16 changes: 8 additions & 8 deletions ObfuscarTestNet/ObfuscarTestNet.csproj
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>

<TargetFrameworks>net6.0-windows;net8.0-windows;net48</TargetFrameworks>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<ItemGroup>
<Compile Remove="Input\**" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.9.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.1.1" />
<PackageReference Include="MSTest.TestFramework" Version="3.1.1" />
<PackageReference Include="coverlet.collector" Version="6.0.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
<PackageReference Include="MSTest" Version="3.8.0" />
</ItemGroup>

<ItemGroup>
Expand Down