Skip to content

Commit

Permalink
0.0.6 beta5 (#29)
Browse files Browse the repository at this point in the history
* beta4

* value based array class

* incremental update

* beta4 fix edge cases

* correction this is beta3

* delete empty projs

* remove unneeded using statements

* beta4 initial

* more work towards beta 4, removed duplicate tests

* allow unsafe and linear trie

* Beta4, added a new trie impl that is as fast as the ArrayTrie but uses about 1/4 of the memory

* fix type

* beta5
  • Loading branch information
clarkis117 authored Nov 24, 2018
1 parent aa397aa commit 36ed8f2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/Mime-Detective/Analyzers/LinearTrie.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public unsafe FileType Search(in ReadResult readResult)
i++;

//collect the record
if (i > highestMatchingCount && (object)node.Record != null)
if (i > highestMatchingCount && !(node.Record is null))
{
match = node.Record;
highestMatchingCount = i;
Expand Down
10 changes: 7 additions & 3 deletions src/Mime-Detective/Extensions/FileInfo/FileInfoExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,12 @@ public static bool IsType(this FileInfo file, FileType type)
}

/// <summary>
/// Checks if the file is executable
/// Checks if the file is executable file .exe
/// </summary>
/// <param name="fileInfo"></param>
/// <returns></returns>
/// <returns>
/// <c>true</c> if the specified file is type; otherwise, <c>false</c>.
/// </returns>
public static bool IsExe(this FileInfo fileInfo) => fileInfo.IsType(MimeTypes.DLL_EXE);

/// <summary>
Expand All @@ -107,7 +109,9 @@ public static bool IsType(this FileInfo file, FileType type)
/// But it could be MSWord or MSExcel, or Powerpoint...
/// </summary>
/// <param name="fileInfo"></param>
/// <returns></returns>
/// <returns>
/// <c>true</c> if the specified file is type; otherwise, <c>false</c>.
/// </returns>
public static bool IsMsi(this FileInfo fileInfo)
{
// MSI has a generic DOCFILE header. Also it matches PPT files
Expand Down
23 changes: 5 additions & 18 deletions src/Mime-Detective/Mime-Detective.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Description>Mime-Detective can find the MIME Types of files</Description>
<Description>Detect MIME type from files.</Description>
<AssemblyTitle>Mime-Detective</AssemblyTitle>
<Authors>Joshua Clark</Authors>
<TargetFrameworks>netstandard1.3;net45</TargetFrameworks>
<TargetFrameworks>netstandard1.3;net45;netstandard2.0</TargetFrameworks>
<AssemblyName>Mime-Detective</AssemblyName>
<PackageId>Mime-Detective</PackageId>
<PackageTags>mime, mime detective, file types</PackageTags>
Expand All @@ -13,14 +13,10 @@
<PackageLicenseUrl>https://github.com/clarkis117/Mime-Detective/blob/master/LICENSE</PackageLicenseUrl>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/clarkis117/Mime-Detective.git</RepositoryUrl>
<PackageTargetFallback Condition="'$(TargetFramework)' == 'netstandard1.3'">
$(PackageTargetFallback);portable-net45+win8
</PackageTargetFallback>
<AssemblyVersion>0.0.6.0</AssemblyVersion>
<FileVersion>0.0.6.0</FileVersion>
<PackageReleaseNotes>See beta4 PR</PackageReleaseNotes>
<Version>0.0.6.0-beta4</Version>
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
<PackageReleaseNotes>See beta5 PR</PackageReleaseNotes>
<Version>0.0.6.0-beta5</Version>
<!--Needed to allow usage of fixed sized buffers-->
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
Expand All @@ -32,16 +28,7 @@
<Reference Include="System.IO.Compression" />
<Reference Include="System.Core" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard1.3'">
<PackageReference Include="System.Collections" Version="4.3.0" />
<PackageReference Include="System.IO" Version="4.3.0" />
<PackageReference Include="System.Linq" Version="4.3.0" />
<PackageReference Include="System.IO.FileSystem" Version="4.3.0" />
<PackageReference Include="System.IO.Compression" Version="4.3.0" />
<PackageReference Include="System.Runtime.InteropServices" Version="4.3.0" />
</ItemGroup>


<ItemGroup>
<PackageReference Include="System.Buffers" Version="4.*" />
</ItemGroup>
Expand Down

0 comments on commit 36ed8f2

Please sign in to comment.