Skip to content

Commit

Permalink
Merge pull request #92 from sunnamed434/dev
Browse files Browse the repository at this point in the history
Bump new version 0.10.0-alpha.19
  • Loading branch information
sunnamed434 authored Feb 13, 2023
2 parents e3ee949 + 8ae330b commit 7bbe55d
Show file tree
Hide file tree
Showing 52 changed files with 362 additions and 165 deletions.
2 changes: 2 additions & 0 deletions .github/ISSUE_TEMPLATE/BUG_REPORT.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ body:
options:
- CLI
- GUI
- Other
validations:
required: false
- type: dropdown
Expand All @@ -85,5 +86,6 @@ body:
- Windows
- Linux
- Mac
- Other
validations:
required: false
34 changes: 1 addition & 33 deletions .github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,6 @@
name: "💡 Feature Request"
description: Create a new ticket for a new feature request.
body:
- type: textarea
id: implementation_pr
attributes:
label: "Implementation PR"
description: Pull request used
placeholder: "#Pull Request ID"
validations:
required: false
- type: textarea
id: reference_issues
attributes:
label: "Reference Issues"
description: Common issues
placeholder: "#Issues IDs"
validations:
required: false
- type: textarea
id: summary
attributes:
Expand All @@ -32,20 +16,4 @@ body:
description: Indicate here some basic examples of your feature.
placeholder: A few specific words about your feature request.
validations:
required: true
- type: textarea
id: drawbacks
attributes:
label: "Drawbacks"
description: What are the drawbacks/impacts of your feature request ?
placeholder: Identify the drawbacks and impacts while being neutral on your feature request
validations:
required: true
- type: textarea
id: unresolved_question
attributes:
label: "Unresolved questions"
description: What questions still remain unresolved ?
placeholder: Identify any unresolved issues.
validations:
required: false
required: true
8 changes: 0 additions & 8 deletions .idea/.idea.BitMono/.idea/indexLayout.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/.idea.BitMono/.idea/vcs.xml

This file was deleted.

7 changes: 7 additions & 0 deletions BitMono.sln
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BitMono.Core.TestCases.Meth
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BitMono.Core.TestCases.Types", "test\TestBinaries\DotNet\BitMono.Core.TestCases.Types\BitMono.Core.TestCases.Types.csproj", "{5DC793B1-F82B-4BC7-99C9-FE8C1545E1F7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BitMono.Core.TestCases.Reflection", "test\TestBinaries\DotNet\BitMono.Core.TestCases.Reflection\BitMono.Core.TestCases.Reflection.csproj", "{1683308C-36D4-49B1-8CCE-9DDE09336856}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -138,6 +140,10 @@ Global
{5DC793B1-F82B-4BC7-99C9-FE8C1545E1F7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5DC793B1-F82B-4BC7-99C9-FE8C1545E1F7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5DC793B1-F82B-4BC7-99C9-FE8C1545E1F7}.Release|Any CPU.Build.0 = Release|Any CPU
{1683308C-36D4-49B1-8CCE-9DDE09336856}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1683308C-36D4-49B1-8CCE-9DDE09336856}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1683308C-36D4-49B1-8CCE-9DDE09336856}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1683308C-36D4-49B1-8CCE-9DDE09336856}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -163,6 +169,7 @@ Global
{1D6B1BA7-496F-4F91-A115-EF5E5DC6E6C2} = {A431DCB4-6EF9-4BEF-8902-FA704D62624E}
{4166AC73-6969-406A-ADD0-67CB70A76D9C} = {A431DCB4-6EF9-4BEF-8902-FA704D62624E}
{5DC793B1-F82B-4BC7-99C9-FE8C1545E1F7} = {A431DCB4-6EF9-4BEF-8902-FA704D62624E}
{1683308C-36D4-49B1-8CCE-9DDE09336856} = {A431DCB4-6EF9-4BEF-8902-FA704D62624E}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {7DA0BB43-C1D4-4688-BE43-A9ED2D6F78EE}
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
| Versions: |
| - |
| [v0.10.0-alpha](#v0100-alpha19) |
| [v0.9.0-alpha](#v090-alpha18) |
| [v0.8.0-alpha](#v080-alpha17) |
| [v0.7.0-alpha](#v070-alpha16) |
Expand All @@ -20,6 +21,11 @@
| [v0.1.0](#v010) |

---
### v0.10.0-alpha.19:
2023-02-013
#### Added:
* Command line arguments [#82](https://github.com/sunnamed434/BitMono/issues/82)

### v0.9.0-alpha.18:
2023-02-09
#### Changed:
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
[![Build status][image_appveyor_main_badge]][appveyor_main_build]
[![Test status][image_test]][test]
[![Codefactor][image_codefactor]][codefactor]
[![DeepSource][image_deepsource]][deepsource]
[![Gitter Chat][image_gitter]][gitter]
[![MIT License][image_license]][license]

Expand Down Expand Up @@ -85,6 +86,7 @@ Credits

[test]: https://ci.appveyor.com/project/sunnamed434/bitmono/branch/main/tests
[codefactor]: https://www.codefactor.io/repository/github/sunnamed434/bitmono/overview/main
[deepsource]: https://deepsource.io/gh/sunnamed434/BitMono/?ref=repository-badge
[gitter]: https://gitter.im/BitMonoSpeech/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
[license]: https://github.com/sunnamed434/BitMono/blob/main/LICENSE
[asmresolver]: https://github.com/Washi1337/AsmResolver
Expand All @@ -107,6 +109,7 @@ Credits
[image_build]: https://ci.appveyor.com/api/projects/status/8jh35hfno6riq25j?svg=true&style=plastic
[image_test]: https://img.shields.io/appveyor/tests/sunnamed434/bitmono/main
[image_codefactor]: https://www.codefactor.io/repository/github/sunnamed434/bitmono/badge/main
[image_deepsource]: https://deepsource.io/gh/sunnamed434/BitMono.svg/?label=active+issues&show_trend=true&token=_FJf25YbtCpPyX7SRveXCaGd
[image_gitter]: https://badges.gitter.im/BitMonoSpeech/community.svg?style=plastic
[image_license]: https://img.shields.io/github/license/sunnamed434/bitmono
[image_appveyor_main_badge]: https://ci.appveyor.com/api/projects/status/8jh35hfno6riq25j/branch/main?svg=true
Expand Down
6 changes: 3 additions & 3 deletions props/SharedProjectProps.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/sunnamed434/BitMono</PackageProjectUrl>
<PackageOwners>sunnamed434</PackageOwners>
<PackageVersion>0.9.0-alpha.18</PackageVersion>
<PackageVersion>0.10.0-alpha.19</PackageVersion>
<RepositoryUrl>https://github.com/sunnamed434/BitMono</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<Authors>sunnamed434</Authors>
<Version>0.9.0-alpha.18</Version>
<InformationalVersion>0.9.0-alpha.18</InformationalVersion>
<Version>0.10.0-alpha.19</Version>
<InformationalVersion>0.10.0-alpha.19</InformationalVersion>
<Company>BitMono</Company>
<Copyright>sunnamed434</Copyright>
<LangVersion>10</LangVersion>
Expand Down
1 change: 1 addition & 0 deletions src/BitMono.CLI/BitMono.CLI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<Import Project="$(MSBuildThisFileDirectory)..\..\props\SharedProjectProps.props" />

<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.9.1" />
<PackageReference Include="Costura.Fody" Version="5.7.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
2 changes: 2 additions & 0 deletions src/BitMono.CLI/GlobalUsings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@
global using System;
global using System.Collections.Generic;
global using System.Diagnostics;
global using System.Diagnostics.CodeAnalysis;
global using System.IO;
global using System.Linq;
global using System.Threading;
global using System.Threading.Tasks;
global using BitMono.Core.Extensions;
global using BitMono.Host.Extensions;
global using BitMono.Shared.Models;
global using CommandLine;
global using Microsoft.Extensions.Options;
global using Pocket.Extensions;
global using Serilog;
Expand Down
3 changes: 1 addition & 2 deletions src/BitMono.CLI/Modules/CLIObfuscationNeedsFactory.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
namespace BitMono.CLI.Modules;

[SuppressMessage("ReSharper", "InconsistentNaming")]
public class CLIObfuscationNeedsFactory : IObfuscationNeedsFactory
{
private readonly string[] m_Args;
Expand Down Expand Up @@ -87,9 +88,7 @@ public ObfuscationNeeds Create()

return new ObfuscationNeeds
{
#pragma warning disable CS8601
FileName = fileName,
#pragma warning restore CS8601
FileBaseDirectory = fileBaseDirectory,
DependenciesDirectoryName = dependenciesDirectoryName,
OutputDirectoryName = outputDirectoryName
Expand Down
15 changes: 15 additions & 0 deletions src/BitMono.CLI/Modules/CLIOptions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace BitMono.CLI.Modules;

[SuppressMessage("ReSharper", "InconsistentNaming")]
[SuppressMessage("ReSharper", "ClassNeverInstantiated.Global")]
public class CLIOptions
{
[Option('f', "file", Required = true, HelpText = "Set file path.")]
public string? File { get; set; }

[Option('l', "libraries", Required = false, HelpText = "Set libraries path.")]
public string? Libraries { get; set; }

[Option('o', "output", Required = false, HelpText = "Set output path.")]
public string? Output { get; set; }
}
50 changes: 50 additions & 0 deletions src/BitMono.CLI/Modules/CLIOptionsObfuscationNeedsFactory.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#pragma warning disable CS8604
namespace BitMono.CLI.Modules;

[SuppressMessage("ReSharper", "InconsistentNaming")]
public class CLIOptionsObfuscationNeedsFactory : IObfuscationNeedsFactory
{
private readonly string[] m_Args;

public CLIOptionsObfuscationNeedsFactory(string[] args)
{
m_Args = args;
}

[SuppressMessage("ReSharper", "AssignNullToNotNullAttribute")]
public ObfuscationNeeds? Create()
{
var parser = new Parser(with =>
{
with.EnableDashDash = true;
with.HelpWriter = Console.Error;
});
var parserResult = parser.ParseArguments<CLIOptions>(m_Args);
if (parserResult.Errors.IsEmpty() == false)
{
return null;
}
var options = parserResult.Value;
if (File.Exists(options.File) == false)
{
Console.WriteLine("File cannot be found, please, try again!");
return null;
}
var fileBaseDirectory = Path.GetDirectoryName(options.File);
var needs = new ObfuscationNeeds
{
FileName = options.File,
FileBaseDirectory = fileBaseDirectory,
DependenciesDirectoryName = options.Libraries.IsNullOrEmpty() == false
? options.Libraries
: Path.Combine(fileBaseDirectory, "libs"),
OutputDirectoryName = options.Output.IsNullOrEmpty() == false
? options.Output
: Path.Combine(fileBaseDirectory, "output")
};

Directory.CreateDirectory(needs.OutputDirectoryName);
Directory.CreateDirectory(needs.DependenciesDirectoryName);
return needs;
}
}
17 changes: 13 additions & 4 deletions src/BitMono.CLI/Program.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
namespace BitMono.CLI;
#pragma warning disable CS8604
namespace BitMono.CLI;

internal class Program
{
private static async Task Main(string[] args)
{
try
{
var needs = new CLIObfuscationNeedsFactory(args).Create();
ObfuscationNeeds? needs = null;
needs = args.IsEmpty()
? new CLIObfuscationNeedsFactory(args).Create()
: new CLIOptionsObfuscationNeedsFactory(args).Create();
if (needs == null)
{
return;
}

Console.Clear();
Console.WriteLine("File: {0}", needs.FileName);
Console.WriteLine("Dependencies (libs): {0}", needs.DependenciesDirectoryName);
Console.WriteLine("Everything is seems to be good, starting obfuscation..");
Console.WriteLine("Everything is seems to be ok, starting obfuscation..");

var module = new BitMonoModule(
configureContainer => configureContainer.AddProtections(),
Expand All @@ -33,7 +42,7 @@ private static async Task Main(string[] args)
.ToList();
var logger = serviceProvider.LifetimeScope
.Resolve<ILogger>()
.ForContextFile();
.ForContext<Program>();

var cancellationTokenSource = new CancellationTokenSource();
var engine = new BitMonoEngine(obfuscationAttributeResolver, obfuscateAssemblyAttributeResolver,
Expand Down
4 changes: 2 additions & 2 deletions src/BitMono.Core/Extensions/EnvironmentRuntimeInformation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ public class EnvironmentRuntimeInformation
public Version? NetFrameworkVersion { get; set; }
public OperatingSystem? OperatingSystem { get; set; }
public int? Bits { get; set; }
public bool? HasMono { get; set; }
public bool HasMono { get; set; }
public Type? MonoType { get; set; }
public string? MonoDisplayName { get; set; }

public override string ToString()
{
return
$"Running on {OperatingSystem}, {(HasMono == false ? $"{DotNetRuntimeInfo.NetFramework} v{NetFrameworkVersion}" : MonoDisplayName)}, x{Bits} bits";
$"Running on {OperatingSystem}, {(HasMono == false ? $"{DotNetRuntimeInfo.NetFramework} v{NetFrameworkVersion}" : $"Mono: {MonoDisplayName}")}, x{Bits} bits";
}
}
26 changes: 26 additions & 0 deletions src/BitMono.Core/Extensions/ProtectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,32 @@ public static bool TryGetDoNotResolveAttribute<TProtection>(out DoNotResolveAttr
{
return typeof(TProtection).TryGetDoNotResolveAttribute(out attribute);
}
public static bool TryGetRuntimeMonikerAttribute(this Type source, out RuntimeMonikerAttribute? attribute, bool inherit = false)
{
attribute = source.GetCustomAttribute<RuntimeMonikerAttribute>(inherit);
if (attribute == null)
{
return false;
}
return true;
}
public static bool TryGetRuntimeMonikerAttribute(this IProtection source, out RuntimeMonikerAttribute? attribute)
{
return source.GetType().TryGetRuntimeMonikerAttribute(out attribute);
}
public static bool TryGetObsoleteAttribute(this Type source, out ObsoleteAttribute? attribute, bool inherit = false)
{
attribute = source.GetCustomAttribute<ObsoleteAttribute>(inherit);
if (attribute == null)
{
return false;
}
return true;
}
public static bool TryGetObsoleteAttribute(this IProtection source, out ObsoleteAttribute? attribute)
{
return source.GetType().TryGetObsoleteAttribute(out attribute);
}
public static string GetName(this Type source, bool inherit = false)
{
var protectionNameAttribute = source.GetCustomAttribute<ProtectionNameAttribute>(inherit);
Expand Down
14 changes: 0 additions & 14 deletions src/BitMono.Core/Extensions/SerilogContextCallerExtensions.cs

This file was deleted.

1 change: 1 addition & 0 deletions src/BitMono.Core/GlobalUsings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
global using System;
global using System.Collections.Generic;
global using System.Diagnostics;
global using System.Diagnostics.CodeAnalysis;
global using System.Linq;
global using System.Reflection;
global using System.Runtime.CompilerServices;
Expand Down
Loading

0 comments on commit 7bbe55d

Please sign in to comment.