Skip to content

Commit

Permalink
Update to BurnOutSharp 1.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mnadareski committed Nov 4, 2020
1 parent a50b99d commit 70d30d3
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 17 deletions.
1 change: 1 addition & 0 deletions CHANGELIST.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
- Add option to allow users to select dumping program
- ~~Updated to DIC version 20201101~~
- Add support for `/ps` DIC flag
- Updated to BurnOutSharp 1.5.0

### 1.17.1 (2020-09-14)
- Shuffled some shared, internal UI variables
Expand Down
6 changes: 4 additions & 2 deletions DICUI.Avalonia/DICUI.Avalonia.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@
<ItemGroup>
<PackageReference Include="Avalonia" Version="0.9.12" />
<PackageReference Include="Avalonia.Desktop" Version="0.9.12" />
<PackageReference Include="BurnOutSharp" PrivateAssets="analyzers;build" ExcludeAssets="contentFiles" Version="1.4.1" GeneratePathProperty="true" />
<PackageReference Include="BurnOutSharp" PrivateAssets="build; analyzers" ExcludeAssets="contentFiles" Version="1.5.0" GeneratePathProperty="true">
<IncludeAssets>runtime; compile; build; native; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.7.0" />
</ItemGroup>

<ItemGroup>
<Content Include="$(PkgBurnOutSharp)\content\**" PackagePath="contentFiles\any\any;content" CopyToOutputDirectory="Always" PackageCopyToOutput="true"/>
<Content Include="$(PkgBurnOutSharp)\content\**" PackagePath="contentFiles\any\any;content" CopyToOutputDirectory="Always" PackageCopyToOutput="true" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 4 additions & 2 deletions DICUI.Check/DICUI.Check.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="BurnOutSharp" PrivateAssets="analyzers;build" ExcludeAssets="contentFiles" Version="1.4.1" GeneratePathProperty="true" />
<PackageReference Include="BurnOutSharp" PrivateAssets="build; analyzers" ExcludeAssets="contentFiles" Version="1.5.0" GeneratePathProperty="true">
<IncludeAssets>runtime; compile; build; native; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<Content Include="$(PkgBurnOutSharp)\content\**" PackagePath="contentFiles\any\any;content" CopyToOutputDirectory="Always" PackageCopyToOutput="true"/>
<Content Include="$(PkgBurnOutSharp)\content\**" PackagePath="contentFiles\any\any;content" CopyToOutputDirectory="Always" PackageCopyToOutput="true" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 4 additions & 2 deletions DICUI.Library/DICUI.Library.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,15 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="BurnOutSharp" PrivateAssets="analyzers;build" ExcludeAssets="contentFiles" Version="1.4.1" GeneratePathProperty="true" />
<PackageReference Include="BurnOutSharp" PrivateAssets="build; analyzers" ExcludeAssets="contentFiles" Version="1.5.0" GeneratePathProperty="true">
<IncludeAssets>runtime; compile; build; native; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="System.Management" Version="4.7.0" />
</ItemGroup>

<ItemGroup>
<Content Include="$(PkgBurnOutSharp)\content\**" PackagePath="contentFiles\any\any;content" CopyToOutputDirectory="Always" PackageCopyToOutput="true"/>
<Content Include="$(PkgBurnOutSharp)\content\**" PackagePath="contentFiles\any\any;content" CopyToOutputDirectory="Always" PackageCopyToOutput="true" />
</ItemGroup>

<ItemGroup>
Expand Down
69 changes: 68 additions & 1 deletion DICUI.Library/Utilities/Tools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,74 @@

namespace DICUI.Utilities
{
public class Tools
public static class Tools
{
#region Byte Arrays

/// <summary>
/// Search for a byte array in another array
/// </summary>
public static bool Contains(this byte[] stack, byte[] needle, out int position, int start = 0, int end = -1)
{
// Initialize the found position to -1
position = -1;

// If either array is null or empty, we can't do anything
if (stack == null || stack.Length == 0 || needle == null || needle.Length == 0)
return false;

// If the needle array is larger than the stack array, it can't be contained within
if (needle.Length > stack.Length)
return false;

// If start or end are not set properly, set them to defaults
if (start < 0)
start = 0;
if (end < 0)
end = stack.Length - needle.Length;

for (int i = start; i < end; i++)
{
if (stack.EqualAt(needle, i))
{
position = i;
return true;
}
}

return false;
}

/// <summary>
/// See if a byte array starts with another
/// </summary>
public static bool StartsWith(this byte[] stack, byte[] needle)
{
return stack.Contains(needle, out int _, start: 0, end: 1);
}

/// <summary>
/// Get if a stack at a certain index is equal to a needle
/// </summary>
private static bool EqualAt(this byte[] stack, byte[] needle, int index)
{
// If we're too close to the end of the stack, return false
if (needle.Length >= stack.Length - index)
return false;

for (int i = 0; i < needle.Length; i++)
{
if (stack[i + index] != needle[i])
return false;
}

return true;
}

#endregion

#region Versioning

/// <summary>
/// Check for a new DICUI version
/// </summary>
Expand Down Expand Up @@ -44,5 +110,6 @@ private static string GetCurrentVersion()
return $"{assemblyVersion.Major}.{assemblyVersion.Minor}" + (assemblyVersion.Build != 0 ? $".{assemblyVersion.Build}" : string.Empty);
}

#endregion
}
}
20 changes: 11 additions & 9 deletions DICUI.Library/Utilities/Validators.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1044,30 +1044,32 @@ public static Result GetSupportStatus(KnownSystem? system, MediaType? type)
/// <returns>Copy protection detected in the envirionment, if any</returns>
public static async Task<string> RunProtectionScanOnPath(string path, IProgress<FileProtection> progress = null)
{
#if NET_FRAMEWORK
try
{
var found = await Task.Run(() =>
{
return ProtectionFind.Scan(path, includePosition: false, progress: progress);
var scanner = new Scanner(progress)
{
IncludePosition = false, // Debug flag to include protection position in file
ScanAllFiles = false, // Forces all files to be scanned as executables
ScanArchives = true, // Allows archives to have internals extracted and scanned
ScanPackers = false, // Allows executable packers to be detected
};
return scanner.GetProtections(path);
});

if (found == null || found.Count == 0)
return "None found";

// Strip out "CD Check" instances due to false positives
// Join the output protections for writing
return string.Join("\n", found
.Where(kvp => !kvp.Value.Equals("CD Check", StringComparison.OrdinalIgnoreCase))
.Select(kvp => kvp.Key + ": " + kvp.Value.Replace("CD Check,", string.Empty).Replace("CD Check", string.Empty).Trim())
.ToArray());
.Where(kvp => kvp.Value != null && kvp.Value.Any())
.Select(kvp => $"{kvp.Key}: {string.Join(", ", kvp.Value)}"));
}
catch (Exception ex)
{
return $"Path could not be scanned! {ex}";
}
#else
return "Copy protection scanning is not available on .NET Core builds";
#endif
}
}
}
4 changes: 3 additions & 1 deletion DICUI/DICUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BurnOutSharp" PrivateAssets="analyzers;build" ExcludeAssets="contentFiles" Version="1.4.1" GeneratePathProperty="true" />
<PackageReference Include="BurnOutSharp" PrivateAssets="build; analyzers" ExcludeAssets="contentFiles" Version="1.5.0" GeneratePathProperty="true">
<IncludeAssets>runtime; compile; build; native; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.7.0" />
</ItemGroup>

Expand Down

0 comments on commit 70d30d3

Please sign in to comment.