Skip to content

Commit

Permalink
Added Global Tools project.
Browse files Browse the repository at this point in the history
  • Loading branch information
lextm committed Dec 23, 2018
1 parent 8334527 commit 792e017
Show file tree
Hide file tree
Showing 15 changed files with 260 additions and 204 deletions.
Binary file modified .nuget/NuGet.exe
Binary file not shown.
62 changes: 7 additions & 55 deletions Baml/Baml.csproj
Original file line number Diff line number Diff line change
@@ -1,46 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{25EE08C8-0C9D-49E3-86FE-A331E9D4F12A}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Baml</RootNamespace>
<AssemblyName>Baml</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<TargetFramework>net45</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<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' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="PresentationCore" />
<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.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup>

<ItemGroup>
<Compile Include="..\ilspy\ILSpy.BamlDecompiler\CecilDependencyPropertyDescriptor.cs">
<Link>CecilDependencyPropertyDescriptor.cs</Link>
Expand Down Expand Up @@ -111,21 +74,10 @@
<Compile Include="..\ilspy\ILSpy.BamlDecompiler\Ricciolo.StylesExplorer.MarkupReflection\XmlToClrNamespaceMapping.cs">
<Link>XmlToClrNamespaceMapping.cs</Link>
</Compile>
<Compile Include="Helper.cs" />
<Compile Include="Helper.Unix.cs" Condition=" '$(OS)' != 'Windows_NT' " />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Mono.Cecil">
<Version>0.10.1</Version>
</PackageReference>
<PackageReference Include="Mono.Cecil" Version="0.10.1" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->

</Project>
6 changes: 0 additions & 6 deletions Baml/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@
// 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("Baml")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Baml")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
Expand All @@ -32,5 +28,3 @@
// 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")]
2 changes: 1 addition & 1 deletion Console/Obfuscar.Console.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
<Version>5.3.0.1</Version>
</PackageReference>
<PackageReference Include="Rollbar">
<Version>2.0.0</Version>
<Version>2.0.1</Version>
</PackageReference>
</ItemGroup>
<PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion Console/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ internal static class Program
private static void ShowHelp(OptionSet optionSet)
{
Console.WriteLine("Obfuscar is available at https://www.obfuscar.com");
Console.WriteLine("(C) 2007-2017, Ryan Williams and other contributors.");
Console.WriteLine("(C) 2007-2018, Ryan Williams and other contributors.");
Console.WriteLine();
Console.WriteLine("obfuscar [Options] [project_file] [project_file]");
Console.WriteLine("Options:");
Expand Down
37 changes: 37 additions & 0 deletions GlobalTools/GlobalTools.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>

<PackAsTool>true</PackAsTool>
<ToolCommandName>obfuscar</ToolCommandName>
<PackageOutputPath>..</PackageOutputPath>

<PackageId>Obfuscar.GlobalTool</PackageId>
<Version>1.0.0-beta3</Version>
<Authors>Ryan Williams, and other contributors.</Authors>
<Company>LeXtudio</Company>
<Product>Obfuscar Global Tools build</Product>
<Description>Obfuscar is a basic obfuscator for .NET assemblies. It uses massive overloading to rename metadata in .NET assemblies (including the names of methods, properties, events, fields, types and namespaces) to a minimal set, distinguishable in most cases only by signature.</Description>
<PackageReleaseNotes>https://github.com/obfuscar/obfuscar/releases</PackageReleaseNotes>
<RepositoryUrl>https://github.com/obfuscar/obfuscar</RepositoryUrl>
<PackageProjectUrl>https://github.com/obfuscar/obfuscar</PackageProjectUrl>
<PackageIconUrl>https://github.com/obfuscar/obfuscar/raw/master/Potion-icon.png</PackageIconUrl>
<PackageLicenseUrl>https://github.com/obfuscar/obfuscar/blob/master/LICENSE</PackageLicenseUrl>
<Copyright>Copyright (c) 2007 Ryan Williams Copyright (c) 2009-2018 Calvin Rien, Lex Li, RemObjects and other contributors</Copyright>
<RepositoryType>git</RepositoryType>
<PackageTags>obfuscar,obfuscation</PackageTags>
<AssemblyVersion>1.0.0.1</AssemblyVersion>
<FileVersion>1.0.0.1</FileVersion>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Obfuscar\Obfuscar.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Mono.Options" Version="5.3.0.1" />
</ItemGroup>

</Project>
161 changes: 161 additions & 0 deletions GlobalTools/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
#region Copyright (c) 2007 Ryan Williams <drcforbin@gmail.com>

/// <copyright>
/// Copyright (c) 2007 Ryan Williams <drcforbin@gmail.com>
///
/// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentation files (the "Software"), to deal
/// in the Software without restriction, including without limitation the rights
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
/// copies of the Software, and to permit persons to whom the Software is
/// furnished to do so, subject to the following conditions:
///
/// The above copyright notice and this permission notice shall be included in
/// all copies or substantial portions of the Software.
///
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
/// THE SOFTWARE.
/// </copyright>

#endregion

using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using System.Threading.Tasks;
using Mono.Options;
using Rollbar;
using Rollbar.DTOs;

namespace Obfuscar
{
[SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1027:TabsMustNotBeUsed", Justification =
"Reviewed. Suppression is OK here.")]
internal static class Program
{
private static void ShowHelp(OptionSet optionSet)
{
Console.WriteLine("Obfuscar for .NET Core is available at https://www.obfuscar.com");
Console.WriteLine("(C) 2007-2018, Ryan Williams and other contributors.");
Console.WriteLine();
Console.WriteLine("obfuscar [Options] [project_file] [project_file]");
Console.WriteLine("Options:");
optionSet.WriteOptionDescriptions(Console.Out);
}

[SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1027:TabsMustNotBeUsed", Justification =
"Reviewed. Suppression is OK here.")]
private static int Main(string[] args)
{
bool showHelp = false;
bool showVersion = false;
bool suppress = false;

OptionSet p = new OptionSet()
.Add("h|?|help", "Print this help information.", delegate (string v) { showHelp = v != null; })
.Add("s|suppress", "Suppress Rollbar crash report.", delegate (string v) { suppress = v != null; })
.Add("V|version", "Display version number of this application.",
delegate (string v) { showVersion = v != null; });

if (args.Length == 0)
{
ShowHelp(p);
return 0;
}

List<string> extra;
try
{
extra = p.Parse(args);
}
catch (OptionException ex)
{
Console.WriteLine(ex.Message);
return 1;
}

if (showHelp)
{
ShowHelp(p);
return 0;
}

if (showVersion)
{
Console.WriteLine(Assembly.GetExecutingAssembly().GetName().Version);
return 0;
}

if (extra.Count < 1)
{
ShowHelp(p);
return 1;
}

if (!suppress)
{
RegisterRollbar();
}

int start = Environment.TickCount;
foreach (var project in extra)
{
try
{
Console.Write("Loading project {0}...", project);
Obfuscator obfuscator = new Obfuscator(project);
Console.WriteLine("Done.");

obfuscator.RunRules();

Console.WriteLine("Completed, {0:f2} secs.", (Environment.TickCount - start) / 1000.0);
}
catch (ObfuscarException e)
{
Console.WriteLine();
Console.Error.WriteLine("An error occurred during processing:");
Console.Error.WriteLine(e.Message);
if (e.InnerException != null)
Console.Error.WriteLine(e.InnerException.Message);
return 1;
}
}

return 0;
}

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")
{
Environment = "production",
Transform = payload =>
{
payload.Data.Person = new Person(version)
{
UserName = $"{version}"
};
}
});

AppDomain.CurrentDomain.UnhandledException += (sender, args) =>
{
RollbarLocator.RollbarInstance.Error(args.ExceptionObject as System.Exception);
};

TaskScheduler.UnobservedTaskException += (sender, args) =>
{
RollbarLocator.RollbarInstance.Error(args.Exception);
};
}
}
}
2 changes: 1 addition & 1 deletion Obfuscar.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<projectUrl>https://www.obfuscar.com</projectUrl>
<id>Obfuscar</id>
<title>Obfuscar</title>
<iconUrl>http://lextudio.com/images/obfuscar32.png</iconUrl>
<iconUrl>https://github.com/obfuscar/obfuscar/raw/master/Potion-icon.png</iconUrl>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<description>Obfuscar is a basic obfuscator for .NET assemblies. It uses massive overloading to rename metadata in .NET assemblies (including the names of methods, properties, events, fields, types and namespaces) to a minimal set, distinguishable in most cases only by signature.</description>
<summary>Open source obfuscar for .NET and Mono.</summary>
Expand Down
32 changes: 29 additions & 3 deletions Obfuscar.sln
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26430.12
# Visual Studio Version 16
VisualStudioVersion = 16.0.28407.52
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{65D27ECD-E8FC-47CB-8CB0-819627673662}"
ProjectSection(SolutionItems) = preProject
.nuget\NuGet.exe = .nuget\NuGet.exe
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Obfuscar", "Obfuscar\Obfuscar.csproj", "{F28CDDFF-5A7A-413E-809E-15FFB8766E86}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Obfuscar", "Obfuscar\Obfuscar.csproj", "{F28CDDFF-5A7A-413E-809E-15FFB8766E86}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Obfuscar.Console", "Console\Obfuscar.Console.csproj", "{275B3EED-7E70-4460-950F-96EDCA099BD4}"
EndProject
Expand All @@ -29,6 +29,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
test.bat = test.bat
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GlobalTools", "GlobalTools\GlobalTools.csproj", "{BD9CF93A-2CDF-44DF-A0E8-1C7142E0C645}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -141,6 +143,30 @@ Global
{25EE08C8-0C9D-49E3-86FE-A331E9D4F12A}.winphone_Debug|Any CPU.Build.0 = Debug|Any CPU
{25EE08C8-0C9D-49E3-86FE-A331E9D4F12A}.winphone_Release|Any CPU.ActiveCfg = Release|Any CPU
{25EE08C8-0C9D-49E3-86FE-A331E9D4F12A}.winphone_Release|Any CPU.Build.0 = Release|Any CPU
{BD9CF93A-2CDF-44DF-A0E8-1C7142E0C645}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BD9CF93A-2CDF-44DF-A0E8-1C7142E0C645}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BD9CF93A-2CDF-44DF-A0E8-1C7142E0C645}.net_2_0_Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BD9CF93A-2CDF-44DF-A0E8-1C7142E0C645}.net_2_0_Debug|Any CPU.Build.0 = Debug|Any CPU
{BD9CF93A-2CDF-44DF-A0E8-1C7142E0C645}.net_2_0_Release|Any CPU.ActiveCfg = Release|Any CPU
{BD9CF93A-2CDF-44DF-A0E8-1C7142E0C645}.net_2_0_Release|Any CPU.Build.0 = Release|Any CPU
{BD9CF93A-2CDF-44DF-A0E8-1C7142E0C645}.net_3_5_Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BD9CF93A-2CDF-44DF-A0E8-1C7142E0C645}.net_3_5_Debug|Any CPU.Build.0 = Debug|Any CPU
{BD9CF93A-2CDF-44DF-A0E8-1C7142E0C645}.net_3_5_Release|Any CPU.ActiveCfg = Release|Any CPU
{BD9CF93A-2CDF-44DF-A0E8-1C7142E0C645}.net_3_5_Release|Any CPU.Build.0 = Release|Any CPU
{BD9CF93A-2CDF-44DF-A0E8-1C7142E0C645}.net_4_0_Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BD9CF93A-2CDF-44DF-A0E8-1C7142E0C645}.net_4_0_Debug|Any CPU.Build.0 = Debug|Any CPU
{BD9CF93A-2CDF-44DF-A0E8-1C7142E0C645}.net_4_0_Release|Any CPU.ActiveCfg = Release|Any CPU
{BD9CF93A-2CDF-44DF-A0E8-1C7142E0C645}.net_4_0_Release|Any CPU.Build.0 = Release|Any CPU
{BD9CF93A-2CDF-44DF-A0E8-1C7142E0C645}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BD9CF93A-2CDF-44DF-A0E8-1C7142E0C645}.Release|Any CPU.Build.0 = Release|Any CPU
{BD9CF93A-2CDF-44DF-A0E8-1C7142E0C645}.silverlight_Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BD9CF93A-2CDF-44DF-A0E8-1C7142E0C645}.silverlight_Debug|Any CPU.Build.0 = Debug|Any CPU
{BD9CF93A-2CDF-44DF-A0E8-1C7142E0C645}.silverlight_Release|Any CPU.ActiveCfg = Release|Any CPU
{BD9CF93A-2CDF-44DF-A0E8-1C7142E0C645}.silverlight_Release|Any CPU.Build.0 = Release|Any CPU
{BD9CF93A-2CDF-44DF-A0E8-1C7142E0C645}.winphone_Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BD9CF93A-2CDF-44DF-A0E8-1C7142E0C645}.winphone_Debug|Any CPU.Build.0 = Debug|Any CPU
{BD9CF93A-2CDF-44DF-A0E8-1C7142E0C645}.winphone_Release|Any CPU.ActiveCfg = Release|Any CPU
{BD9CF93A-2CDF-44DF-A0E8-1C7142E0C645}.winphone_Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down

0 comments on commit 792e017

Please sign in to comment.