Skip to content

Commit

Permalink
Merge pull request orlikoski#66 from Lansatac/feature/dotNet45Upgrade
Browse files Browse the repository at this point in the history
Upgrading project to .NET 4.5, Fixes orlikoski#65
  • Loading branch information
Lansatac authored Nov 30, 2017
2 parents 90ee1bf + 9d87601 commit e911440
Show file tree
Hide file tree
Showing 17 changed files with 77 additions and 164 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ packages/
*.opendb
CyLRTests/obj/
CyLRTests/bin/
*.user
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
language: csharp
solution: CyLR.sln
env:
- PLATFORM=4.0
- PLATFORM=AnyCPU
script:
- xbuild /p:Configuration=Release /p:Platform="Framework $PLATFORM" CyLR.sln
- xbuild /p:Configuration=Release /p:Platform="$PLATFORM" CyLR.sln
- mono ./packages/NUnit.ConsoleRunner.3.7.0/tools/nunit3-console.exe CyLRTests/bin/Release/CyLRTests.dll
- zip -j ./CyLR/bin/merged/CyLR.zip ./CyLR/bin/merged/CyLR.exe
deploy:
Expand Down
25 changes: 14 additions & 11 deletions CyLR.sln
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26430.14
VisualStudioVersion = 15.0.26730.16
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CyLR", "CyLR\CyLR.csproj", "{87AD38A9-7D56-45E5-B131-64534FAE0435}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CyLRTests", "CyLRTests\CyLRTests.csproj", "{3FB4FD7A-8295-4990-8919-870FA5F438F3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Framework 4.0 = Debug|Framework 4.0
Release|Framework 4.0 = Release|Framework 4.0
Debug|AnyCPU = Debug|AnyCPU
Release|AnyCPU = Release|AnyCPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{87AD38A9-7D56-45E5-B131-64534FAE0435}.Debug|Framework 4.0.ActiveCfg = Debug|Framework 4.0
{87AD38A9-7D56-45E5-B131-64534FAE0435}.Debug|Framework 4.0.Build.0 = Debug|Framework 4.0
{87AD38A9-7D56-45E5-B131-64534FAE0435}.Release|Framework 4.0.ActiveCfg = Release|Framework 4.0
{87AD38A9-7D56-45E5-B131-64534FAE0435}.Release|Framework 4.0.Build.0 = Release|Framework 4.0
{3FB4FD7A-8295-4990-8919-870FA5F438F3}.Debug|Framework 4.0.ActiveCfg = Debug|Any CPU
{3FB4FD7A-8295-4990-8919-870FA5F438F3}.Debug|Framework 4.0.Build.0 = Debug|Any CPU
{3FB4FD7A-8295-4990-8919-870FA5F438F3}.Release|Framework 4.0.ActiveCfg = Release|Any CPU
{3FB4FD7A-8295-4990-8919-870FA5F438F3}.Release|Framework 4.0.Build.0 = Release|Any CPU
{87AD38A9-7D56-45E5-B131-64534FAE0435}.Debug|AnyCPU.ActiveCfg = Debug|Any CPU
{87AD38A9-7D56-45E5-B131-64534FAE0435}.Debug|AnyCPU.Build.0 = Debug|Any CPU
{87AD38A9-7D56-45E5-B131-64534FAE0435}.Release|AnyCPU.ActiveCfg = Release|Any CPU
{87AD38A9-7D56-45E5-B131-64534FAE0435}.Release|AnyCPU.Build.0 = Release|Any CPU
{3FB4FD7A-8295-4990-8919-870FA5F438F3}.Debug|AnyCPU.ActiveCfg = Debug|Any CPU
{3FB4FD7A-8295-4990-8919-870FA5F438F3}.Debug|AnyCPU.Build.0 = Debug|Any CPU
{3FB4FD7A-8295-4990-8919-870FA5F438F3}.Release|AnyCPU.ActiveCfg = Release|Any CPU
{3FB4FD7A-8295-4990-8919-870FA5F438F3}.Release|AnyCPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {365EAD9E-1614-4F2F-814E-12B3CD829C97}
EndGlobalSection
EndGlobal
2 changes: 1 addition & 1 deletion CyLR/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
</configuration>
51 changes: 20 additions & 31 deletions CyLR/CyLR.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\ILRepack.2.0.13\build\ILRepack.props" Condition="Exists('..\packages\ILRepack.2.0.13\build\ILRepack.props')" />
<Import Project="..\packages\ILRepack.2.0.14\build\ILRepack.props" Condition="Exists('..\packages\ILRepack.2.0.14\build\ILRepack.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
Expand All @@ -14,6 +14,9 @@
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<IsWebBootstrapper>false</IsWebBootstrapper>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<TargetFrameworkProfile />
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
Expand All @@ -26,42 +29,37 @@
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'Framework 4.0' ">
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|Framework 4.0' ">
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\4.0\Debug\</OutputPath>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|Framework 4.0' ">
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\4.0\Release\</OutputPath>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<UseVSHostingProcess>false</UseVSHostingProcess>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>Martin-Berube-Character-Knight.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<DefineConstants Condition=" '$(TargetFrameworkVersion)' == 'v4.0' ">DOT_NET_4_0</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Debug\</OutputPath>
Expand All @@ -84,8 +82,9 @@
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="DeviceIOControlLib, Version=0.1.3.0, Culture=neutral, PublicKeyToken=194e86a1dcd77098, processorArchitecture=MSIL">
<Reference Include="DeviceIOControlLib">
<HintPath>..\packages\DeviceIOControlLib.0.1.3\lib\net40\DeviceIOControlLib.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="DiscUtils, Version=0.11.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Discutils.0.11.0.2\lib\net40\DiscUtils.dll</HintPath>
Expand All @@ -95,15 +94,16 @@
<HintPath>..\packages\Discutils.0.11.0.2\lib\net40\DiscUtils.Common.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
<Reference Include="ICSharpCode.SharpZipLib">
<HintPath>..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="RawDiskLib, Version=0.1.4.0, Culture=neutral, PublicKeyToken=1e91a7ce501218a4, processorArchitecture=MSIL">
<Reference Include="RawDiskLib">
<HintPath>..\packages\RawDiskLib.0.1.4\lib\net40\RawDiskLib.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Renci.SshNet, Version=2016.0.0.0, Culture=neutral, PublicKeyToken=1cee9f8bde3db106, processorArchitecture=MSIL">
<HintPath>..\packages\SSH.NET.2016.0.0\lib\net40\Renci.SshNet.dll</HintPath>
<Reference Include="Renci.SshNet">
<HintPath>..\packages\SSH.NET.2016.1.0\lib\net40\Renci.SshNet.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
Expand All @@ -114,23 +114,12 @@
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<Choose>
<When Condition=" '$(Platform)' == 'Framework 4.0' ">
<ItemGroup>
<Reference Include="ICSharpCode.SharpZipLib">
<HintPath>..\Library\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
</ItemGroup>
</When>
</Choose>
<ItemGroup>
<Compile Include="src\archive\File.cs" />
<Compile Include="src\archive\NativeArchive.cs" />
<Compile Include="src\archive\SharpZipArchive.cs" />
<Compile Include="src\CollectionPaths.cs" />
<Compile Include="src\archive\Archive.cs" />
<Compile Include="src\Arguments.cs" />
<Compile Include="src\ConsoleEX.cs" />
<Compile Include="src\Platform.cs" />
<Compile Include="src\read\IFileSystem.cs" />
<Compile Include="src\read\NativeFileSystem.cs" />
Expand Down Expand Up @@ -163,15 +152,15 @@
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup Condition=" '$(OS)' != 'Unix' ">
<PostBuildEvent>"$(SolutionDir)packages\ILRepack.2.0.13\tools\ILRepack.exe" /wildcards /out:"$(ProjectDir)bin\merged\$(TargetFileName)" "$(TargetPath)" "$(TargetDir)*.dll"</PostBuildEvent>
<PostBuildEvent>"$(SolutionDir)packages\ILRepack.2.0.14\tools\ILRepack.exe" /wildcards /out:"$(ProjectDir)bin\merged\$(TargetFileName)" "$(TargetPath)" "$(TargetDir)*.dll"</PostBuildEvent>
</PropertyGroup>
<PropertyGroup Condition=" '$(OS)' == 'Unix' ">
<PostBuildEvent>mono $(SolutionDir)packages/ILRepack.2.0.13/tools/ILRepack.exe /wildcards /out:$(ProjectDir)bin/merged/$(TargetFileName) $(TargetPath) $(TargetDir)*.dll</PostBuildEvent>
<PostBuildEvent>mono $(SolutionDir)packages/ILRepack.2.0.14/tools/ILRepack.exe /wildcards /out:$(ProjectDir)bin/merged/$(TargetFileName) $(TargetPath) $(TargetDir)*.dll</PostBuildEvent>
</PropertyGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\ILRepack.2.0.13\build\ILRepack.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\ILRepack.2.0.13\build\ILRepack.props'))" />
<Error Condition="!Exists('..\packages\ILRepack.2.0.14\build\ILRepack.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\ILRepack.2.0.14\build\ILRepack.props'))" />
</Target>
</Project>
4 changes: 2 additions & 2 deletions CyLR/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
// 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.3.5.0")]
[assembly: AssemblyFileVersion("1.3.5.0")]
[assembly: AssemblyVersion("1.4.0")]
[assembly: AssemblyFileVersion("1.4.0")]

[assembly: InternalsVisibleTo("CyLRTests")]
10 changes: 5 additions & 5 deletions CyLR/packages.config
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="DeviceIOControlLib" version="0.1.3" targetFramework="net40" />
<package id="DeviceIOControlLib" version="0.1.3" targetFramework="net452" />
<package id="Discutils" version="0.11.0.2" targetFramework="net452" />
<package id="ILRepack" version="2.0.13" targetFramework="net40" />
<package id="RawDiskLib" version="0.1.4" targetFramework="net40" />
<package id="SharpZipLib" version="0.86.0" targetFramework="net40" />
<package id="SSH.NET" version="2016.0.0" targetFramework="net452" />
<package id="ILRepack" version="2.0.14" targetFramework="net452" />
<package id="RawDiskLib" version="0.1.4" targetFramework="net452" />
<package id="SharpZipLib" version="0.86.0" targetFramework="net452" />
<package id="SSH.NET" version="2016.1.0" targetFramework="net452" />
</packages>
7 changes: 7 additions & 0 deletions CyLR/src/CollectionPaths.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,13 @@ public static List<string> GetPaths(Arguments arguments, List<string> additional
paths.AddRange(arguments.CollectionFiles);
}

if (paths.Count == 1)
{
if (paths[0] == "")
{
return defaultPaths;
}
}
return paths.Any() ? paths : defaultPaths;
}
}
Expand Down
32 changes: 0 additions & 32 deletions CyLR/src/ConsoleEX.cs

This file was deleted.

18 changes: 1 addition & 17 deletions CyLR/src/Platform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,12 @@ public static bool SupportsRawAccess()
{
return !IsUnixLike();
}

//http://stackoverflow.com/questions/3453220/how-to-detect-if-console-in-stdin-has-been-redirected :(

public static bool IsInputRedirected
{
get
{
#if DOT_NET_4_0
try
{
if (IsUnixLike())
{
return (0 == (Console.WindowHeight + Console.WindowWidth)); //This works in mono, but not .NET
}
return ConsoleEx.IsInputRedirected; //this works in .NET, but not mono
}
catch (Exception)
{
return true;
}
#else
return Console.IsInputRedirected;
#endif
}
}
}
Expand Down
6 changes: 1 addition & 5 deletions CyLR/src/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ private static int Main(string[] args)
if (Platform.IsInputRedirected)
{
string input = null;
while ((input = Console.ReadLine()) != null)
while ((input = Console.In.ReadLine()) != null)
{
input = Environment.ExpandEnvironmentVariables(input);
additionalPaths.Add(input);
Expand Down Expand Up @@ -118,11 +118,7 @@ private static int Main(string[] args)
/// <param name="paths">Map of driveLetter->path for all files to collect.</param>
private static void CreateArchive(Arguments arguments, Stream archiveStream, IEnumerable<string> paths)
{
#if DOT_NET_4_0
using (var archive = new SharpZipArchive(archiveStream, arguments.ZipPassword))
#else
using (var archive = new NativeArchive(archiveStream))
#endif
{
var system = arguments.ForceNative ? (IFileSystem) new NativeFileSystem() : new RawFileSystem();

Expand Down
36 changes: 0 additions & 36 deletions CyLR/src/archive/NativeArchive.cs

This file was deleted.

7 changes: 2 additions & 5 deletions CyLR/src/archive/SharpZipArchive.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#if DOT_NET_4_0
using System;
using System;
using System.IO;
using ICSharpCode.SharpZipLib.Core;
using ICSharpCode.SharpZipLib.Zip;

namespace CyLR.archive
Expand Down Expand Up @@ -43,5 +41,4 @@ protected override void Dispose(bool disposing)
}
}
}
}
#endif
}
Loading

0 comments on commit e911440

Please sign in to comment.