Skip to content

Commit

Permalink
Csproj conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
clarkis117 committed Mar 14, 2017
1 parent 2dff5db commit d371c8c
Show file tree
Hide file tree
Showing 10 changed files with 111 additions and 166 deletions.
25 changes: 16 additions & 9 deletions Mime-Detective.sln
Original file line number Diff line number Diff line change
@@ -1,40 +1,47 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
# Visual Studio 15
VisualStudioVersion = 15.0.26228.4
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{098944FB-C1C9-48BE-AA37-CD3C5C336A84}"
ProjectSection(SolutionItems) = preProject
.gitignore = .gitignore
appveyor.yml = appveyor.yml
Build.ps1 = Build.ps1
build.sh = build.sh
global.json = global.json
LICENSE = LICENSE
NuGet.config = NuGet.config
README.md = README.md
EndProjectSection
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Mime-Detective", "src\Mime-Detective\Mime-Detective.xproj", "{9E3066B2-B987-4E32-83D4-16A20E3BA219}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Mime-Detective.Tests", "test\Mime-Detective.Tests\Mime-Detective.Tests.csproj", "{CB3A9BEA-C247-4FEB-8670-98E3034FC214}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Mime-Detective.Tests", "test\Mime-Detective.Tests\Mime-Detective.Tests.xproj", "{CB3A9BEA-C247-4FEB-8670-98E3034FC214}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{17C4E0DE-B863-4A81-B755-62E663D041F1}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{A50202E7-0386-4EB3-B09C-00EFCAE360F7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Mime-Detective", "src\Mime-Detective\Mime-Detective.csproj", "{40608F32-BF6E-4DE4-85AE-EF71C69EF18D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{9E3066B2-B987-4E32-83D4-16A20E3BA219}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9E3066B2-B987-4E32-83D4-16A20E3BA219}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9E3066B2-B987-4E32-83D4-16A20E3BA219}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9E3066B2-B987-4E32-83D4-16A20E3BA219}.Release|Any CPU.Build.0 = Release|Any CPU
{CB3A9BEA-C247-4FEB-8670-98E3034FC214}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CB3A9BEA-C247-4FEB-8670-98E3034FC214}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CB3A9BEA-C247-4FEB-8670-98E3034FC214}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CB3A9BEA-C247-4FEB-8670-98E3034FC214}.Release|Any CPU.Build.0 = Release|Any CPU
{40608F32-BF6E-4DE4-85AE-EF71C69EF18D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{40608F32-BF6E-4DE4-85AE-EF71C69EF18D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{40608F32-BF6E-4DE4-85AE-EF71C69EF18D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{40608F32-BF6E-4DE4-85AE-EF71C69EF18D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{CB3A9BEA-C247-4FEB-8670-98E3034FC214} = {A50202E7-0386-4EB3-B09C-00EFCAE360F7}
{40608F32-BF6E-4DE4-85AE-EF71C69EF18D} = {17C4E0DE-B863-4A81-B755-62E663D041F1}
EndGlobalSection
EndGlobal
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ configuration: Release
install:
- mklink /J Data "test/Mime-Detective.Tests/Data"
- ps: mkdir -Force ".\build\" | Out-Null
- ps: Invoke-WebRequest "https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0-preview2/scripts/obtain/dotnet-install.ps1" -OutFile ".\build\installcli.ps1"
- ps: Invoke-WebRequest "https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0/scripts/obtain/dotnet-install.ps1" -OutFile ".\build\installcli.ps1"
- ps: $env:DOTNET_INSTALL_DIR = "$pwd\.dotnetcli"
- ps: '& .\build\installcli.ps1 -InstallDir "$env:DOTNET_INSTALL_DIR" -NoPath -Version 1.0.0-preview2-1-003177'
- ps: '& .\build\installcli.ps1 -InstallDir "$env:DOTNET_INSTALL_DIR" -NoPath -Version 1.0.0'
- ps: $env:Path = "$env:DOTNET_INSTALL_DIR;$env:Path"
build_script:
- ps: ./Build.ps1
Expand Down
8 changes: 4 additions & 4 deletions src/Mime-Detective/FileType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ namespace MimeDetective
public class FileType
{
public byte?[] Header { get; }

public ushort HeaderOffset { get; }

public string Extension { get; }

public string Mime { get; }

/// <summary>
Expand All @@ -24,11 +27,8 @@ public class FileType
/// <param name="mime">The description of MIME.</param>
public FileType(byte?[] header, string extension, string mime, ushort offset = 0)
{
//header cannot be null, file type normal operation requires the data
if (header == null)
throw new ArgumentNullException(nameof(header), "cannot be null, FileType needs file header data");
Header = header ?? throw new ArgumentNullException(nameof(header), $"cannot be null, {nameof(FileType)} needs file header data");

Header = header;
HeaderOffset = offset;
Extension = extension;
Mime = mime;
Expand Down
41 changes: 41 additions & 0 deletions src/Mime-Detective/Mime-Detective.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<Project ToolsVersion="15.0" Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Description>Mime-Detective is group of classes for speeding Asp.Net Core development</Description>
<AssemblyTitle>Mime-Detective</AssemblyTitle>
<VersionPrefix>0.0.2</VersionPrefix>
<Authors>Joshua Clark</Authors>
<TargetFrameworks>netstandard1.3;net45</TargetFrameworks>
<AssemblyName>Mime-Detective</AssemblyName>
<PackageId>Mime-Detective</PackageId>
<PackageTags>mvc;ef;generic;utilities</PackageTags>
<PackageProjectUrl>https://github.com/clarkis117/GenericMvcUtilities</PackageProjectUrl>
<PackageLicenseUrl>https://github.com/clarkis117/GenericMvcUtilities/blob/master/License.txt</PackageLicenseUrl>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/clarkis117/GenericMvcUtilities.git</RepositoryUrl>
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netstandard1.3' ">$(PackageTargetFallback);portable-net451+win8</PackageTargetFallback>
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
<GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<GenerateAssemblyCopyrightAttribute>false</GenerateAssemblyCopyrightAttribute>
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.IO" />
<Reference Include="System.IO.Compression" />
</ItemGroup>

<ItemGroup Condition=" ' $(TargetFramework)' == 'netstandard1.3' ">
<PackageReference Include="System.IO" />
<PackageReference Include="System.IO.Compression" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="System.Xml.XmlSerializer" Version="4.3.0" />
</ItemGroup>

</Project>
23 changes: 0 additions & 23 deletions src/Mime-Detective/Mime-Detective.xproj

This file was deleted.

8 changes: 4 additions & 4 deletions src/Mime-Detective/MimeTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -245,15 +245,15 @@ public static FileType GetFileType(FileInfo file)
/// <returns>FileType or null not identified</returns>
public static FileType GetFileType(Func<IReadOnlyList<byte>> fileHeaderReadFunc, Stream stream = null, byte[] data = null)
{
return getFileType(fileHeaderReadFunc(), stream, data);
return GetFileType(fileHeaderReadFunc(), stream, data);
}

public static async Task<FileType> GetFileTypeAsync(Func<Task<IReadOnlyList<byte>>> fileHeaderReadFunc, Stream stream = null, byte[] data = null)
{
return getFileType(await fileHeaderReadFunc(), stream, data);
return GetFileType(await fileHeaderReadFunc(), stream, data);
}

private static FileType getFileType(IReadOnlyList<byte> fileHeader, Stream stream = null, byte[] data = null)
private static FileType GetFileType(IReadOnlyList<byte> fileHeader, Stream stream = null, byte[] data = null)
{
if (stream == null && data == null)
throw new ArgumentNullException($"{nameof(stream)} : {nameof(data)}", "both file data arguments are null");
Expand All @@ -274,7 +274,7 @@ private static FileType getFileType(IReadOnlyList<byte> fileHeader, Stream strea
// there may be situations where the file name is not given
if (type.Equals(ZIP))
{
using (Stream fileData = stream != null ? stream : new MemoryStream(data))
using (Stream fileData = stream ?? new MemoryStream(data))
{
if (fileData.Position > 0)
fileData.Seek(0, SeekOrigin.Begin);
Expand Down
67 changes: 0 additions & 67 deletions src/Mime-Detective/project.json

This file was deleted.

44 changes: 44 additions & 0 deletions test/Mime-Detective.Tests/Mime-Detective.Tests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp1.1;net452;net462</TargetFrameworks>
<AssemblyName>Mime-Detective.Tests</AssemblyName>
<PackageId>Mime-Detective.Tests</PackageId>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp1.1' ">1.1.1</RuntimeFrameworkVersion>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
</PropertyGroup>

<ItemGroup>
<None Update="Data\**\*">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
<PackageReference Include="xunit" Version="2.2.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net452' ">
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net462' ">
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Mime-Detective\Mime-Detective.csproj" />
</ItemGroup>

<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>

</Project>
22 changes: 0 additions & 22 deletions test/Mime-Detective.Tests/Mime-Detective.Tests.xproj

This file was deleted.

35 changes: 0 additions & 35 deletions test/Mime-Detective.Tests/project.json

This file was deleted.

0 comments on commit d371c8c

Please sign in to comment.