mirror of
https://github.com/RomanBelkov/DiskImager.git
synced 2026-05-15 14:15:51 -06:00
Update to latest XZ.NET version
This commit is contained in:
parent
1550289283
commit
f7ce586514
14 changed files with 45 additions and 808 deletions
|
|
@ -28,12 +28,6 @@
|
|||
}
|
||||
"Entry"
|
||||
{
|
||||
"MsmKey" = "8:_4C9E153BB206498EB3F99948F60DD2E3"
|
||||
"OwnerKey" = "8:_UNDEFINED"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
}
|
||||
"Entry"
|
||||
{
|
||||
"MsmKey" = "8:_7A90225E7B5B42BF83B88E936E1116F1"
|
||||
"OwnerKey" = "8:_UNDEFINED"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
|
|
@ -58,6 +52,12 @@
|
|||
}
|
||||
"Entry"
|
||||
{
|
||||
"MsmKey" = "8:_B5FC2750082B4FB18131860FB1717AF0"
|
||||
"OwnerKey" = "8:_UNDEFINED"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
}
|
||||
"Entry"
|
||||
{
|
||||
"MsmKey" = "8:_BD562995EA454F2DBD8AACDE632CAD6B"
|
||||
"OwnerKey" = "8:_UNDEFINED"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
|
|
@ -83,13 +83,13 @@
|
|||
"Entry"
|
||||
{
|
||||
"MsmKey" = "8:_UNDEFINED"
|
||||
"OwnerKey" = "8:_2A202A8E898BF0213E650B636A646B65"
|
||||
"OwnerKey" = "8:_8798A45953E30B8F6063024DF55EE398"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
}
|
||||
"Entry"
|
||||
{
|
||||
"MsmKey" = "8:_UNDEFINED"
|
||||
"OwnerKey" = "8:_8798A45953E30B8F6063024DF55EE398"
|
||||
"OwnerKey" = "8:_2A202A8E898BF0213E650B636A646B65"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
}
|
||||
}
|
||||
|
|
@ -199,11 +199,6 @@
|
|||
"AssemblyAsmDisplayName" = "8:XZ.NET, Version=1.0.0.0, Culture=neutral, processorArchitecture=x86"
|
||||
"ScatterAssemblies"
|
||||
{
|
||||
"_2A202A8E898BF0213E650B636A646B65"
|
||||
{
|
||||
"Name" = "8:XZ.NET.dll"
|
||||
"Attributes" = "3:512"
|
||||
}
|
||||
}
|
||||
"SourcePath" = "8:XZ.NET.dll"
|
||||
"TargetName" = "8:"
|
||||
|
|
@ -243,26 +238,6 @@
|
|||
"IsDependency" = "11:FALSE"
|
||||
"IsolateTo" = "8:"
|
||||
}
|
||||
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_4C9E153BB206498EB3F99948F60DD2E3"
|
||||
{
|
||||
"SourcePath" = "8:..\\XZ.NET\\liblzma.dll"
|
||||
"TargetName" = "8:liblzma.dll"
|
||||
"Tag" = "8:"
|
||||
"Folder" = "8:_072AE4B10D3C471AA2B16D68E3691837"
|
||||
"Condition" = "8:"
|
||||
"Transitive" = "11:FALSE"
|
||||
"Vital" = "11:TRUE"
|
||||
"ReadOnly" = "11:FALSE"
|
||||
"Hidden" = "11:FALSE"
|
||||
"System" = "11:FALSE"
|
||||
"Permanent" = "11:FALSE"
|
||||
"SharedLegacy" = "11:FALSE"
|
||||
"PackageAs" = "3:1"
|
||||
"Register" = "3:1"
|
||||
"Exclude" = "11:FALSE"
|
||||
"IsDependency" = "11:FALSE"
|
||||
"IsolateTo" = "8:"
|
||||
}
|
||||
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_7A90225E7B5B42BF83B88E936E1116F1"
|
||||
{
|
||||
"SourcePath" = "8:..\\doc\\CHANGELOG.txt"
|
||||
|
|
@ -290,11 +265,6 @@
|
|||
"AssemblyAsmDisplayName" = "8:ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, processorArchitecture=MSIL"
|
||||
"ScatterAssemblies"
|
||||
{
|
||||
"_8798A45953E30B8F6063024DF55EE398"
|
||||
{
|
||||
"Name" = "8:ICSharpCode.SharpZipLib.dll"
|
||||
"Attributes" = "3:512"
|
||||
}
|
||||
}
|
||||
"SourcePath" = "8:ICSharpCode.SharpZipLib.dll"
|
||||
"TargetName" = "8:"
|
||||
|
|
@ -334,6 +304,26 @@
|
|||
"IsDependency" = "11:FALSE"
|
||||
"IsolateTo" = "8:"
|
||||
}
|
||||
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_B5FC2750082B4FB18131860FB1717AF0"
|
||||
{
|
||||
"SourcePath" = "8:..\\DiskImager\\liblzma.dll"
|
||||
"TargetName" = "8:liblzma.dll"
|
||||
"Tag" = "8:"
|
||||
"Folder" = "8:_072AE4B10D3C471AA2B16D68E3691837"
|
||||
"Condition" = "8:"
|
||||
"Transitive" = "11:FALSE"
|
||||
"Vital" = "11:TRUE"
|
||||
"ReadOnly" = "11:FALSE"
|
||||
"Hidden" = "11:FALSE"
|
||||
"System" = "11:FALSE"
|
||||
"Permanent" = "11:FALSE"
|
||||
"SharedLegacy" = "11:FALSE"
|
||||
"PackageAs" = "3:1"
|
||||
"Register" = "3:1"
|
||||
"Exclude" = "11:FALSE"
|
||||
"IsDependency" = "11:FALSE"
|
||||
"IsolateTo" = "8:"
|
||||
}
|
||||
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_BD562995EA454F2DBD8AACDE632CAD6B"
|
||||
{
|
||||
"SourcePath" = "8:..\\doc\\UserGuide.pdf"
|
||||
|
|
|
|||
|
|
@ -1,12 +1,9 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2013
|
||||
VisualStudioVersion = 12.0.31101.0
|
||||
VisualStudioVersion = 12.0.40629.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiskImager", "DiskImager\DiskImager.csproj", "{4A73C63C-2BF2-4F85-AA55-A5CA581A33B4}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{2A389B68-70DC-4853-81AE-56484F32E94D} = {2A389B68-70DC-4853-81AE-56484F32E94D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{0FB24EA0-02E1-48C7-852F-CF51898CCF93}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
|
|
@ -18,8 +15,6 @@ Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "DiskImager.Installer", "Dis
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpZLib", "ICSharpCode.SharpZipLib\ICSharpCode.SharpZLib.csproj", "{0E7413FF-EB9E-4714-ACF2-BE3A6A7B2FFD}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XZ.NET", "XZ.NET\XZ.NET.csproj", "{2A389B68-70DC-4853-81AE-56484F32E94D}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
|
@ -60,16 +55,6 @@ Global
|
|||
{0E7413FF-EB9E-4714-ACF2-BE3A6A7B2FFD}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{0E7413FF-EB9E-4714-ACF2-BE3A6A7B2FFD}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{0E7413FF-EB9E-4714-ACF2-BE3A6A7B2FFD}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{2A389B68-70DC-4853-81AE-56484F32E94D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2A389B68-70DC-4853-81AE-56484F32E94D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2A389B68-70DC-4853-81AE-56484F32E94D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{2A389B68-70DC-4853-81AE-56484F32E94D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{2A389B68-70DC-4853-81AE-56484F32E94D}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{2A389B68-70DC-4853-81AE-56484F32E94D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2A389B68-70DC-4853-81AE-56484F32E94D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{2A389B68-70DC-4853-81AE-56484F32E94D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{2A389B68-70DC-4853-81AE-56484F32E94D}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{2A389B68-70DC-4853-81AE-56484F32E94D}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
@ -77,7 +62,4 @@ Global
|
|||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
VisualSVNWorkingCopyRoot = .
|
||||
EndGlobalSection
|
||||
GlobalSection(Performance) = preSolution
|
||||
HasPerformanceSessions = true
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
|
|||
|
|
@ -78,6 +78,10 @@
|
|||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="XZ.NET, Version=1.2.0.0, Culture=neutral, processorArchitecture=x86">
|
||||
<HintPath>..\packages\XZ.NET.1.2.1\lib\XZ.NET.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Detection\DriveDetector.cs">
|
||||
|
|
@ -119,6 +123,7 @@
|
|||
</Compile>
|
||||
<EmbeddedResource Include="Properties\Resources.ru.resx" />
|
||||
<None Include="app.manifest" />
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
|
|
@ -131,6 +136,9 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="DD-All.ico" />
|
||||
<Content Include="liblzma.dll">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include=".NETFramework,Version=v4.0,Profile=Client">
|
||||
|
|
@ -159,10 +167,6 @@
|
|||
<Project>{0E7413FF-EB9E-4714-ACF2-BE3A6A7B2FFD}</Project>
|
||||
<Name>ICSharpCode.SharpZLib</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\XZ.NET\XZ.NET.csproj">
|
||||
<Project>{2a389b68-70dc-4853-81ae-56484f32e94d}</Project>
|
||||
<Name>XZ.NET</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
4
DiskImager/packages.config
Normal file
4
DiskImager/packages.config
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="XZ.NET" version="1.2.1" targetFramework="net40-Client" />
|
||||
</packages>
|
||||
|
|
@ -1,160 +0,0 @@
|
|||
/**
|
||||
* XZ.NET - a .NET wrapper for liblzma.dll
|
||||
*
|
||||
* Copyright 2015 by Roman Belkov <romanbelkov@gmail.com>
|
||||
* Copyright 2015 by Melentyev Kirill <melentyev.k@gmail.com>
|
||||
*
|
||||
* Licensed under GNU General Public License 3.0 or later.
|
||||
* Some rights reserved. See LICENSE, AUTHORS, LICENSE-Notices.
|
||||
*
|
||||
* @license GPL-3.0+ <http://www.gnu.org/licenses/gpl-3.0.en.html>
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace XZ.NET
|
||||
{
|
||||
internal enum LzmaReturn : uint
|
||||
{
|
||||
LzmaOK = 0,
|
||||
LzmaStreamEnd = 1,
|
||||
LzmaNoCheck = 2,
|
||||
LzmaUnsupportedCheck = 3,
|
||||
LzmaGetCheck = 4,
|
||||
LzmaMemError = 5,
|
||||
LzmaMemlimitError = 6,
|
||||
LzmaFormatError = 7,
|
||||
LzmaOptionsError = 8,
|
||||
LzmaDataError = 9,
|
||||
LzmaBufError = 10,
|
||||
LzmaProgError = 11
|
||||
}
|
||||
|
||||
internal enum LzmaAction
|
||||
{
|
||||
LzmaRun = 0,
|
||||
LzmaSyncFlush = 1,
|
||||
LzmaFullFlush = 2,
|
||||
LzmaFinish = 3,
|
||||
LzmaFullBarrier = 4
|
||||
}
|
||||
|
||||
internal enum LzmaCheck
|
||||
{
|
||||
LzmaCheckNone = 0,
|
||||
LzmaCheckCrc32 = 1,
|
||||
LzmaCheckCrc64 = 4,
|
||||
LzmaCheckSha256 = 10
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct LzmaStreamFlags
|
||||
{
|
||||
private readonly UInt32 version;
|
||||
|
||||
public UInt64 backwardSize;
|
||||
|
||||
public LzmaCheck check;
|
||||
|
||||
private readonly int reserved_enum1;
|
||||
private readonly int reserved_enum2;
|
||||
private readonly int reserved_enum3;
|
||||
private readonly int reserved_enum4;
|
||||
private readonly char reserved_bool1;
|
||||
private readonly char reserved_bool2;
|
||||
private readonly char reserved_bool3;
|
||||
private readonly char reserved_bool4;
|
||||
private readonly char reserved_bool5;
|
||||
private readonly char reserved_bool6;
|
||||
private readonly char reserved_bool7;
|
||||
private readonly char reserved_bool8;
|
||||
private readonly UInt32 reserved_int1;
|
||||
private readonly UInt32 reserved_int2;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct LzmaMT
|
||||
{
|
||||
public UInt32 flags;
|
||||
public UInt32 threads;
|
||||
public UInt64 block_size;
|
||||
public UInt32 timeout;
|
||||
public UInt32 preset;
|
||||
public IntPtr filters;
|
||||
//public LzmaFilter filters;
|
||||
public LzmaCheck check;
|
||||
|
||||
private readonly int reserved_enum1;
|
||||
private readonly int reserved_enum2;
|
||||
private readonly int reserved_enum3;
|
||||
private readonly int reserved_int1;
|
||||
private readonly int reserved_int2;
|
||||
private readonly int reserved_int3;
|
||||
private readonly int reserved_int4;
|
||||
private readonly UInt64 reserved_int5;
|
||||
private readonly UInt64 reserved_int6;
|
||||
private readonly UInt64 reserved_int7;
|
||||
private readonly UInt64 reserved_int8;
|
||||
private readonly IntPtr reserved_ptr1;
|
||||
private readonly IntPtr reserved_ptr2;
|
||||
private readonly IntPtr reserved_ptr3;
|
||||
private readonly IntPtr reserved_ptr4;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct LzmaStream
|
||||
{
|
||||
public IntPtr next_in;
|
||||
public UInt32 avail_in;
|
||||
public UInt64 total_in;
|
||||
|
||||
public IntPtr next_out;
|
||||
public UInt32 avail_out;
|
||||
public UInt64 total_out;
|
||||
|
||||
public IntPtr allocator;
|
||||
|
||||
private readonly IntPtr internalState;
|
||||
|
||||
private readonly IntPtr reserved_ptr1;
|
||||
private readonly IntPtr reserved_ptr2;
|
||||
private readonly IntPtr reserved_ptr3;
|
||||
private readonly IntPtr reserved_ptr4;
|
||||
private readonly UInt64 reserved_int1;
|
||||
private readonly UInt64 reserved_int2;
|
||||
private readonly UInt32 reserved_int3;
|
||||
private readonly UInt32 reserved_int4;
|
||||
private readonly UInt32 reserved_enum1;
|
||||
private readonly UInt32 reserved_enum2;
|
||||
}
|
||||
|
||||
public static class Native
|
||||
{
|
||||
[DllImport("liblzma.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern LzmaReturn lzma_stream_decoder(ref LzmaStream stream, UInt64 memLimit, UInt32 flags);
|
||||
|
||||
[DllImport("liblzma.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern LzmaReturn lzma_code(ref LzmaStream stream, LzmaAction action);
|
||||
|
||||
[DllImport("liblzma.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern LzmaReturn lzma_stream_footer_decode(ref LzmaStreamFlags options, byte[] inp);
|
||||
|
||||
[DllImport("liblzma.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern UInt64 lzma_index_uncompressed_size(IntPtr i);
|
||||
|
||||
[DllImport("liblzma.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern UInt32 lzma_index_buffer_decode(ref IntPtr i, ref UInt64 memLimit, IntPtr allocator, byte[] indexBuffer,
|
||||
ref UInt32 inPosition, UInt64 inSize);
|
||||
|
||||
[DllImport("liblzma.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern void lzma_index_end(IntPtr i, IntPtr allocator);
|
||||
|
||||
[DllImport("liblzma.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern void lzma_end(ref LzmaStream stream);
|
||||
|
||||
[DllImport("liblzma.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern LzmaReturn lzma_stream_encoder_mt(ref LzmaStream stream, ref LzmaMT mt);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 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("XZ.NET")]
|
||||
[assembly: AssemblyDescription(".NET wrapper for liblzma.dll")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("XZ.NET")]
|
||||
[assembly: AssemblyCopyright("Copyright © Roman Belkov & Kirill Melentyev 2015")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("12343423-cc1d-47ef-a2b6-16043a43150f")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// 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")]
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
<?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')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{2A389B68-70DC-4853-81AE-56484F32E94D}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>XZ.NET</RootNamespace>
|
||||
<AssemblyName>XZ.NET</AssemblyName>
|
||||
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</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>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</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>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="NativeMethods.cs" />
|
||||
<Compile Include="XZInputStream.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="XZOutputStream.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="liblzma.dll">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</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>
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2013
|
||||
VisualStudioVersion = 12.0.31101.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XZ.NET", "XZ.NET.csproj", "{2A389B68-70DC-4853-81AE-56484F32E94D}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Examples", "..\Examples\Examples.csproj", "{EBEC5795-82AB-455E-806B-64099BA50A0A}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{2A389B68-70DC-4853-81AE-56484F32E94D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2A389B68-70DC-4853-81AE-56484F32E94D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2A389B68-70DC-4853-81AE-56484F32E94D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2A389B68-70DC-4853-81AE-56484F32E94D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{EBEC5795-82AB-455E-806B-64099BA50A0A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{EBEC5795-82AB-455E-806B-64099BA50A0A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{EBEC5795-82AB-455E-806B-64099BA50A0A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{EBEC5795-82AB-455E-806B-64099BA50A0A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
@ -1,256 +0,0 @@
|
|||
/**
|
||||
* XZ.NET - a .NET wrapper for liblzma.dll
|
||||
*
|
||||
* Copyright 2015 by Roman Belkov <romanbelkov@gmail.com>
|
||||
* Copyright 2015 by Melentyev Kirill <melentyev.k@gmail.com>
|
||||
*
|
||||
* Licensed under GNU General Public License 3.0 or later.
|
||||
* Some rights reserved. See LICENSE, AUTHORS, LICENSE-Notices.
|
||||
*
|
||||
* @license GPL-3.0+ <http://www.gnu.org/licenses/gpl-3.0.en.html>
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace XZ.NET
|
||||
{
|
||||
public class XZInputStream : Stream
|
||||
{
|
||||
private readonly List<byte> _mInternalBuffer = new List<byte>();
|
||||
private LzmaStream _lzmaStream;
|
||||
private readonly Stream _mInnerStream;
|
||||
private readonly IntPtr _inbuf;
|
||||
private readonly IntPtr _outbuf;
|
||||
private long _length;
|
||||
|
||||
// You can tweak BufSize value to get optimal results
|
||||
// of speed and chunk size
|
||||
private const int BufSize = 512;
|
||||
private const int LzmaConcatenatedFlag = 0x08;
|
||||
|
||||
public XZInputStream(Stream s)
|
||||
{
|
||||
_mInnerStream = s;
|
||||
|
||||
var ret = Native.lzma_stream_decoder(ref _lzmaStream, UInt64.MaxValue, LzmaConcatenatedFlag);
|
||||
|
||||
_inbuf = Marshal.AllocHGlobal(BufSize);
|
||||
_outbuf = Marshal.AllocHGlobal(BufSize);
|
||||
|
||||
_lzmaStream.avail_in = 0;
|
||||
_lzmaStream.next_out = _outbuf;
|
||||
_lzmaStream.avail_out = BufSize;
|
||||
|
||||
if (ret == LzmaReturn.LzmaOK)
|
||||
return;
|
||||
|
||||
switch (ret)
|
||||
{
|
||||
case LzmaReturn.LzmaMemError:
|
||||
throw new Exception("Memory allocation failed");
|
||||
|
||||
case LzmaReturn.LzmaOptionsError:
|
||||
throw new Exception("Unsupported decompressor flags");
|
||||
|
||||
default:
|
||||
throw new Exception("Unknown error, possibly a bug");
|
||||
}
|
||||
}
|
||||
|
||||
#region Overrides
|
||||
public override void Flush()
|
||||
{
|
||||
throw new NotSupportedException("XZ Stream does not support flush");
|
||||
}
|
||||
|
||||
public override long Seek(long offset, SeekOrigin origin)
|
||||
{
|
||||
throw new NotSupportedException("XZ Stream does not support seek");
|
||||
}
|
||||
|
||||
public override void SetLength(long value)
|
||||
{
|
||||
throw new NotSupportedException("XZ Stream does not support setting length");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads bytes from stream
|
||||
/// </summary>
|
||||
/// <returns>byte read or -1 on end of stream</returns>
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
var action = LzmaAction.LzmaRun;
|
||||
|
||||
var readBuf = new byte[BufSize];
|
||||
var outManagedBuf = new byte[BufSize];
|
||||
|
||||
while (_mInternalBuffer.Count < count)
|
||||
{
|
||||
if (_lzmaStream.avail_in == 0)
|
||||
{
|
||||
_lzmaStream.avail_in = (uint)_mInnerStream.Read(readBuf, 0, readBuf.Length);
|
||||
Marshal.Copy(readBuf, 0, _inbuf, (int)_lzmaStream.avail_in);
|
||||
_lzmaStream.next_in = _inbuf;
|
||||
|
||||
if (_lzmaStream.avail_in == 0)
|
||||
action = LzmaAction.LzmaFinish;
|
||||
}
|
||||
|
||||
var ret = Native.lzma_code(ref _lzmaStream, action);
|
||||
|
||||
if (_lzmaStream.avail_out == 0 || ret == LzmaReturn.LzmaStreamEnd)
|
||||
{
|
||||
var writeSize = BufSize - (int)_lzmaStream.avail_out;
|
||||
Marshal.Copy(_outbuf, outManagedBuf, 0, writeSize);
|
||||
|
||||
_mInternalBuffer.AddRange(outManagedBuf);
|
||||
var tail = outManagedBuf.Length - writeSize;
|
||||
_mInternalBuffer.RemoveRange(_mInternalBuffer.Count - tail, tail);
|
||||
|
||||
_lzmaStream.next_out = _outbuf;
|
||||
_lzmaStream.avail_out = BufSize;
|
||||
}
|
||||
|
||||
if (ret != LzmaReturn.LzmaOK)
|
||||
{
|
||||
if (ret == LzmaReturn.LzmaStreamEnd)
|
||||
break;
|
||||
|
||||
Native.lzma_end(ref _lzmaStream);
|
||||
|
||||
switch (ret)
|
||||
{
|
||||
case LzmaReturn.LzmaMemError:
|
||||
throw new Exception("Memory allocation failed");
|
||||
|
||||
case LzmaReturn.LzmaFormatError:
|
||||
throw new Exception("The input is not in the .xz format");
|
||||
|
||||
case LzmaReturn.LzmaOptionsError:
|
||||
throw new Exception("Unsupported compression options");
|
||||
|
||||
case LzmaReturn.LzmaDataError:
|
||||
throw new Exception("Compressed file is corrupt");
|
||||
|
||||
case LzmaReturn.LzmaBufError:
|
||||
throw new Exception("Compressed file is truncated or otherwise corrupt");
|
||||
|
||||
default:
|
||||
throw new Exception("Uknown error.Possibly a bug");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_mInternalBuffer.Count >= count)
|
||||
{
|
||||
_mInternalBuffer.CopyTo(0, buffer, offset, count);
|
||||
_mInternalBuffer.RemoveRange(0, count);
|
||||
return count;
|
||||
}
|
||||
else
|
||||
{
|
||||
var intBufLength = _mInternalBuffer.Count;
|
||||
_mInternalBuffer.CopyTo(0, buffer, offset, intBufLength);
|
||||
_mInternalBuffer.Clear();
|
||||
return intBufLength;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Write(byte[] buffer, int offset, int count)
|
||||
{
|
||||
throw new NotSupportedException("XZ Input stream does not support writing");
|
||||
}
|
||||
|
||||
public override bool CanRead
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override bool CanSeek
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public override bool CanWrite
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gives a size of uncompressed data in bytes
|
||||
/// </summary>
|
||||
/// <returns>Size of uncompressed data or 0 if error occured</returns>
|
||||
public override long Length
|
||||
{
|
||||
get
|
||||
{
|
||||
const int streamFooterSize = 12;
|
||||
|
||||
if (_length == 0)
|
||||
{
|
||||
var lzmaStreamFlags = new LzmaStreamFlags();
|
||||
var streamFooter = new byte[streamFooterSize];
|
||||
|
||||
_mInnerStream.Seek(-streamFooterSize, SeekOrigin.End);
|
||||
_mInnerStream.Read(streamFooter, 0, streamFooterSize);
|
||||
|
||||
Native.lzma_stream_footer_decode(ref lzmaStreamFlags, streamFooter);
|
||||
var indexPointer = new byte[lzmaStreamFlags.backwardSize];
|
||||
|
||||
_mInnerStream.Seek(-(Int64)streamFooterSize - (Int64)lzmaStreamFlags.backwardSize, SeekOrigin.End);
|
||||
_mInnerStream.Read(indexPointer, 0, (int)lzmaStreamFlags.backwardSize);
|
||||
_mInnerStream.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
var index = IntPtr.Zero;
|
||||
var memLimit = UInt64.MaxValue;
|
||||
UInt32 inPos = 0;
|
||||
|
||||
Native.lzma_index_buffer_decode(ref index, ref memLimit, IntPtr.Zero, indexPointer, ref inPos,
|
||||
lzmaStreamFlags.backwardSize);
|
||||
|
||||
if (inPos != lzmaStreamFlags.backwardSize)
|
||||
{
|
||||
Native.lzma_index_end(index, IntPtr.Zero);
|
||||
throw new Exception("Index decoding failed!");
|
||||
}
|
||||
|
||||
var uSize = Native.lzma_index_uncompressed_size(index);
|
||||
|
||||
Native.lzma_index_end(index, IntPtr.Zero);
|
||||
_length = (Int64)uSize;
|
||||
return _length;
|
||||
}
|
||||
else
|
||||
{
|
||||
return _length;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override long Position
|
||||
{
|
||||
get { throw new NotSupportedException("XZ Stream does not support getting position"); }
|
||||
set { throw new NotSupportedException("XZ Stream does not support setting position"); }
|
||||
}
|
||||
|
||||
public override void Close()
|
||||
{
|
||||
Dispose(true);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
Native.lzma_end(ref _lzmaStream);
|
||||
|
||||
Marshal.FreeHGlobal(_inbuf);
|
||||
Marshal.FreeHGlobal(_outbuf);
|
||||
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -1,208 +0,0 @@
|
|||
/**
|
||||
* XZ.NET - a .NET wrapper for liblzma.dll
|
||||
*
|
||||
* Copyright 2015 by Roman Belkov <romanbelkov@gmail.com>
|
||||
* Copyright 2015 by Melentyev Kirill <melentyev.k@gmail.com>
|
||||
*
|
||||
* Licensed under GNU General Public License 3.0 or later.
|
||||
* Some rights reserved. See LICENSE, AUTHORS, LICENSE-Notices.
|
||||
*
|
||||
* @license GPL-3.0+ <http://www.gnu.org/licenses/gpl-3.0.en.html>
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace XZ.NET
|
||||
{
|
||||
public class XZOutputStream : Stream
|
||||
{
|
||||
private LzmaStream _lzmaStream;
|
||||
private readonly Stream _mInnerStream;
|
||||
private readonly IntPtr _inbuf;
|
||||
private readonly IntPtr _outbuf;
|
||||
|
||||
private const int MaxThreads = 8;
|
||||
|
||||
// This is a default compression preset & since
|
||||
// the output does not benefit a lot from changing
|
||||
// this value it is hard coded
|
||||
private const int Preset = 6;
|
||||
|
||||
// You can tweak BufSize value to get optimal results
|
||||
// of speed and chunk size
|
||||
private const int BufSize = 1 * 1024 * 1024;
|
||||
|
||||
public XZOutputStream(Stream s)
|
||||
{
|
||||
_mInnerStream = s;
|
||||
|
||||
var mt = new LzmaMT()
|
||||
{
|
||||
flags = 0,
|
||||
block_size = 0,
|
||||
timeout = 0,
|
||||
preset = Preset,
|
||||
filters = IntPtr.Zero,
|
||||
check = LzmaCheck.LzmaCheckCrc64,
|
||||
threads = (uint)Environment.ProcessorCount
|
||||
};
|
||||
|
||||
if (mt.threads > MaxThreads)
|
||||
mt.threads = MaxThreads;
|
||||
|
||||
var ret = Native.lzma_stream_encoder_mt(ref _lzmaStream, ref mt);
|
||||
//var ret = Native.lzma_easy_encoder(ref _lzmaStream, Preset, LzmaCheck.LzmaCheckCrc64);
|
||||
|
||||
_inbuf = Marshal.AllocHGlobal(BufSize);
|
||||
_outbuf = Marshal.AllocHGlobal(BufSize);
|
||||
|
||||
_lzmaStream.avail_in = 0;
|
||||
_lzmaStream.next_out = _outbuf;
|
||||
_lzmaStream.avail_out = BufSize;
|
||||
|
||||
if (ret == LzmaReturn.LzmaOK)
|
||||
return;
|
||||
|
||||
switch (ret)
|
||||
{
|
||||
case LzmaReturn.LzmaMemError:
|
||||
throw new Exception("Memory allocation failed");
|
||||
|
||||
case LzmaReturn.LzmaOptionsError:
|
||||
throw new Exception("Specified preset is not supported");
|
||||
|
||||
case LzmaReturn.LzmaUnsupportedCheck:
|
||||
throw new Exception("Specified integrity check is not supported");
|
||||
|
||||
default:
|
||||
throw new Exception("Unknown error, possibly a bug");
|
||||
}
|
||||
}
|
||||
|
||||
public override void Flush()
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public override long Seek(long offset, SeekOrigin origin)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public override void SetLength(long value)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public override void Write(byte[] buffer, int offset, int count)
|
||||
{
|
||||
var outManagedBuf = new byte[BufSize];
|
||||
|
||||
if (_lzmaStream.avail_in == 0)
|
||||
{
|
||||
_lzmaStream.avail_in = (uint)count;
|
||||
Marshal.Copy(buffer, 0, _inbuf, (int)_lzmaStream.avail_in);
|
||||
_lzmaStream.next_in = _inbuf;
|
||||
}
|
||||
|
||||
var ret = LzmaReturn.LzmaOK;
|
||||
|
||||
while (_lzmaStream.avail_in > 0)
|
||||
{
|
||||
ret = Native.lzma_code(ref _lzmaStream, LzmaAction.LzmaRun);
|
||||
|
||||
if (_lzmaStream.avail_out == 0 || ret == LzmaReturn.LzmaStreamEnd)
|
||||
{
|
||||
var writeSize = BufSize - (int)_lzmaStream.avail_out;
|
||||
Marshal.Copy(_outbuf, outManagedBuf, 0, writeSize);
|
||||
|
||||
_mInnerStream.Write(outManagedBuf, 0, writeSize);
|
||||
|
||||
_lzmaStream.next_out = _outbuf;
|
||||
_lzmaStream.avail_out = BufSize;
|
||||
}
|
||||
}
|
||||
|
||||
if (ret != LzmaReturn.LzmaOK)
|
||||
{
|
||||
if (ret == LzmaReturn.LzmaStreamEnd)
|
||||
return;
|
||||
|
||||
Native.lzma_end(ref _lzmaStream);
|
||||
|
||||
switch (ret)
|
||||
{
|
||||
case LzmaReturn.LzmaMemError:
|
||||
throw new Exception("Memory allocation failed");
|
||||
|
||||
case LzmaReturn.LzmaDataError:
|
||||
throw new Exception("File size limits exceeded");
|
||||
|
||||
default:
|
||||
throw new Exception("Unknown error, possibly a bug");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool CanRead
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public override bool CanSeek
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public override bool CanWrite
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override long Length
|
||||
{
|
||||
get { throw new NotSupportedException(); }
|
||||
}
|
||||
|
||||
public override long Position
|
||||
{
|
||||
get { throw new NotSupportedException(); }
|
||||
set { throw new NotSupportedException(); }
|
||||
}
|
||||
|
||||
public override void Close()
|
||||
{
|
||||
Dispose(true);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
_lzmaStream.avail_in = 0; //check if needed
|
||||
|
||||
var ret = Native.lzma_code(ref _lzmaStream, LzmaAction.LzmaFinish);
|
||||
var outManagedBuf = new byte[BufSize];
|
||||
|
||||
if (_lzmaStream.avail_out == 0 || ret == LzmaReturn.LzmaStreamEnd)
|
||||
{
|
||||
var writeSize = BufSize - (int)_lzmaStream.avail_out;
|
||||
Marshal.Copy(_outbuf, outManagedBuf, 0, writeSize);
|
||||
|
||||
_mInnerStream.Write(outManagedBuf, 0, writeSize);
|
||||
}
|
||||
|
||||
Native.lzma_end(ref _lzmaStream);
|
||||
|
||||
Marshal.FreeHGlobal(_inbuf);
|
||||
Marshal.FreeHGlobal(_outbuf);
|
||||
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
packages/XZ.NET.1.2.1/XZ.NET.1.2.1.nupkg
vendored
Normal file
BIN
packages/XZ.NET.1.2.1/XZ.NET.1.2.1.nupkg
vendored
Normal file
Binary file not shown.
BIN
packages/XZ.NET.1.2.1/lib/XZ.NET.dll
vendored
Normal file
BIN
packages/XZ.NET.1.2.1/lib/XZ.NET.dll
vendored
Normal file
Binary file not shown.
4
packages/repositories.config
Normal file
4
packages/repositories.config
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<repositories>
|
||||
<repository path="..\DiskImager\packages.config" />
|
||||
</repositories>
|
||||
Loading…
Add table
Add a link
Reference in a new issue