Agregar archivos de proyecto.
This commit is contained in:
21
Baget/Aplicacion.nuspec
Normal file
21
Baget/Aplicacion.nuspec
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<package >
|
||||||
|
<metadata>
|
||||||
|
<id>tsZIP</id>
|
||||||
|
<version>6.0.0.0</version>
|
||||||
|
<authors>Tecnosis</authors>
|
||||||
|
<owners>Tecnosis</owners>
|
||||||
|
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||||
|
<description>Librería Compresion con ZipForge de Tecnosis para .NET 4.8</description>
|
||||||
|
<language>es-ES</language>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency id="ZipForge" version="2.0.3" />
|
||||||
|
</dependencies>
|
||||||
|
</metadata>
|
||||||
|
|
||||||
|
<files>
|
||||||
|
<file src="..\bin\Debug\tsZip.dll" target="lib\net48" />
|
||||||
|
<file src="..\bin\Debug\tsZip.xml" target="lib\net48" />
|
||||||
|
</files>
|
||||||
|
</package>
|
||||||
13
My Project/Application.Designer.vb
generated
Normal file
13
My Project/Application.Designer.vb
generated
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
'------------------------------------------------------------------------------
|
||||||
|
' <auto-generated>
|
||||||
|
' Este código fue generado por una herramienta.
|
||||||
|
' Versión de runtime:4.0.30319.42000
|
||||||
|
'
|
||||||
|
' Los cambios en este archivo podrían causar un comportamiento incorrecto y se perderán si
|
||||||
|
' se vuelve a generar el código.
|
||||||
|
' </auto-generated>
|
||||||
|
'------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Option Strict On
|
||||||
|
Option Explicit On
|
||||||
|
|
||||||
10
My Project/Application.myapp
Normal file
10
My Project/Application.myapp
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||||
|
<MySubMain>false</MySubMain>
|
||||||
|
<SingleInstance>false</SingleInstance>
|
||||||
|
<ShutdownMode>0</ShutdownMode>
|
||||||
|
<EnableVisualStyles>true</EnableVisualStyles>
|
||||||
|
<AuthenticationMode>0</AuthenticationMode>
|
||||||
|
<ApplicationType>1</ApplicationType>
|
||||||
|
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
|
||||||
|
</MyApplicationData>
|
||||||
35
My Project/AssemblyInfo.vb
Normal file
35
My Project/AssemblyInfo.vb
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
Imports System
|
||||||
|
Imports System.Reflection
|
||||||
|
Imports System.Runtime.InteropServices
|
||||||
|
|
||||||
|
' La información general sobre un ensamblado se controla mediante el siguiente
|
||||||
|
' conjunto de atributos. Cambie estos atributos para modificar la información
|
||||||
|
' asociada con un ensamblado.
|
||||||
|
|
||||||
|
' Revisar los valores de los atributos del ensamblado
|
||||||
|
|
||||||
|
<Assembly: AssemblyTitle("tsZIP")>
|
||||||
|
<Assembly: AssemblyDescription("")>
|
||||||
|
<Assembly: AssemblyCompany("")>
|
||||||
|
<Assembly: AssemblyProduct("tsZIP")>
|
||||||
|
<Assembly: AssemblyCopyright("Copyright © 2016")>
|
||||||
|
<Assembly: AssemblyTrademark("")>
|
||||||
|
|
||||||
|
<Assembly: ComVisible(False)>
|
||||||
|
|
||||||
|
'El siguiente GUID sirve como identificador de typelib si este proyecto se expone a COM
|
||||||
|
<Assembly: Guid("67e42aca-f4b8-45a8-920a-74063c6e5408")>
|
||||||
|
|
||||||
|
' La información de versión de un ensamblado consta de los cuatro valores siguientes:
|
||||||
|
'
|
||||||
|
' Versión principal
|
||||||
|
' Versión secundaria
|
||||||
|
' Número de compilación
|
||||||
|
' Revisión
|
||||||
|
'
|
||||||
|
' Puede especificar todos los valores o usar los valores predeterminados de número de compilación y de revisión
|
||||||
|
' mediante el asterisco ('*'), como se muestra a continuación:
|
||||||
|
' <Assembly: AssemblyVersion("1.0.*")>
|
||||||
|
|
||||||
|
<Assembly: AssemblyVersion("6.0.0.0")>
|
||||||
|
<Assembly: AssemblyFileVersion("6.0.0.0")>
|
||||||
63
My Project/Resources.Designer.vb
generated
Normal file
63
My Project/Resources.Designer.vb
generated
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
'------------------------------------------------------------------------------
|
||||||
|
' <auto-generated>
|
||||||
|
' Este código fue generado por una herramienta.
|
||||||
|
' Versión de runtime:4.0.30319.42000
|
||||||
|
'
|
||||||
|
' Los cambios en este archivo podrían causar un comportamiento incorrecto y se perderán si
|
||||||
|
' se vuelve a generar el código.
|
||||||
|
' </auto-generated>
|
||||||
|
'------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Option Strict On
|
||||||
|
Option Explicit On
|
||||||
|
|
||||||
|
Imports System
|
||||||
|
|
||||||
|
Namespace My.Resources
|
||||||
|
|
||||||
|
'StronglyTypedResourceBuilder generó automáticamente esta clase
|
||||||
|
'a través de una herramienta como ResGen o Visual Studio.
|
||||||
|
'Para agregar o quitar un miembro, edite el archivo .ResX y, a continuación, vuelva a ejecutar ResGen
|
||||||
|
'con la opción /str o recompile su proyecto de VS.
|
||||||
|
'''<summary>
|
||||||
|
''' Clase de recurso fuertemente tipado, para buscar cadenas traducidas, etc.
|
||||||
|
'''</summary>
|
||||||
|
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0"), _
|
||||||
|
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||||
|
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||||
|
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
|
||||||
|
Friend Module Resources
|
||||||
|
|
||||||
|
Private resourceMan As Global.System.Resources.ResourceManager
|
||||||
|
|
||||||
|
Private resourceCulture As Global.System.Globalization.CultureInfo
|
||||||
|
|
||||||
|
'''<summary>
|
||||||
|
''' Devuelve la instancia de ResourceManager almacenada en caché utilizada por esta clase.
|
||||||
|
'''</summary>
|
||||||
|
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||||
|
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
|
||||||
|
Get
|
||||||
|
If Object.ReferenceEquals(resourceMan, Nothing) Then
|
||||||
|
Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("tsZIP.Resources", GetType(Resources).Assembly)
|
||||||
|
resourceMan = temp
|
||||||
|
End If
|
||||||
|
Return resourceMan
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
'''<summary>
|
||||||
|
''' Reemplaza la propiedad CurrentUICulture del subproceso actual para todas las
|
||||||
|
''' búsquedas de recursos mediante esta clase de recurso fuertemente tipado.
|
||||||
|
'''</summary>
|
||||||
|
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||||
|
Friend Property Culture() As Global.System.Globalization.CultureInfo
|
||||||
|
Get
|
||||||
|
Return resourceCulture
|
||||||
|
End Get
|
||||||
|
Set
|
||||||
|
resourceCulture = value
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
|
End Module
|
||||||
|
End Namespace
|
||||||
117
My Project/Resources.resx
Normal file
117
My Project/Resources.resx
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
||||||
73
My Project/Settings.Designer.vb
generated
Normal file
73
My Project/Settings.Designer.vb
generated
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
'------------------------------------------------------------------------------
|
||||||
|
' <auto-generated>
|
||||||
|
' Este código fue generado por una herramienta.
|
||||||
|
' Versión de runtime:4.0.30319.42000
|
||||||
|
'
|
||||||
|
' Los cambios en este archivo podrían causar un comportamiento incorrecto y se perderán si
|
||||||
|
' se vuelve a generar el código.
|
||||||
|
' </auto-generated>
|
||||||
|
'------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Option Strict On
|
||||||
|
Option Explicit On
|
||||||
|
|
||||||
|
|
||||||
|
Namespace My
|
||||||
|
|
||||||
|
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||||
|
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.13.0.0"), _
|
||||||
|
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||||
|
Partial Friend NotInheritable Class MySettings
|
||||||
|
Inherits Global.System.Configuration.ApplicationSettingsBase
|
||||||
|
|
||||||
|
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
|
||||||
|
|
||||||
|
#Region "Funcionalidad para autoguardar My.Settings"
|
||||||
|
#If _MyType = "WindowsForms" Then
|
||||||
|
Private Shared addedHandler As Boolean
|
||||||
|
|
||||||
|
Private Shared addedHandlerLockObject As New Object
|
||||||
|
|
||||||
|
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||||
|
Private Shared Sub AutoSaveSettings(sender As Global.System.Object, e As Global.System.EventArgs)
|
||||||
|
If My.Application.SaveMySettingsOnExit Then
|
||||||
|
My.Settings.Save()
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
|
#End If
|
||||||
|
#End Region
|
||||||
|
|
||||||
|
Public Shared ReadOnly Property [Default]() As MySettings
|
||||||
|
Get
|
||||||
|
|
||||||
|
#If _MyType = "WindowsForms" Then
|
||||||
|
If Not addedHandler Then
|
||||||
|
SyncLock addedHandlerLockObject
|
||||||
|
If Not addedHandler Then
|
||||||
|
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
|
||||||
|
addedHandler = True
|
||||||
|
End If
|
||||||
|
End SyncLock
|
||||||
|
End If
|
||||||
|
#End If
|
||||||
|
Return defaultInstance
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
End Class
|
||||||
|
End Namespace
|
||||||
|
|
||||||
|
Namespace My
|
||||||
|
|
||||||
|
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
|
||||||
|
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||||
|
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
|
||||||
|
Friend Module MySettingsProperty
|
||||||
|
|
||||||
|
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
|
||||||
|
Friend ReadOnly Property Settings() As Global.tsZIP.My.MySettings
|
||||||
|
Get
|
||||||
|
Return Global.tsZIP.My.MySettings.Default
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
End Module
|
||||||
|
End Namespace
|
||||||
7
My Project/Settings.settings
Normal file
7
My Project/Settings.settings
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
|
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true">
|
||||||
|
<Profiles>
|
||||||
|
<Profile Name="(Default)" />
|
||||||
|
</Profiles>
|
||||||
|
<Settings />
|
||||||
|
</SettingsFile>
|
||||||
35
tsZIP.sln
Normal file
35
tsZIP.sln
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 18
|
||||||
|
VisualStudioVersion = 18.6.11806.211 stable
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "tsZIP", "tsZIP.vbproj", "{342634F5-212E-4EEC-8AC5-E6ADA887ECA9}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{342634F5-212E-4EEC-8AC5-E6ADA887ECA9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{342634F5-212E-4EEC-8AC5-E6ADA887ECA9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{342634F5-212E-4EEC-8AC5-E6ADA887ECA9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{342634F5-212E-4EEC-8AC5-E6ADA887ECA9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {89D988B5-CA07-4153-8A7B-169B6F04A391}
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(TeamFoundationVersionControl) = preSolution
|
||||||
|
SccNumberOfProjects = 1
|
||||||
|
SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
|
||||||
|
SccTeamFoundationServer = http://ts-devopss:81/tecnosiscollection
|
||||||
|
SccProjectUniqueName0 = tsZIP.vbproj
|
||||||
|
SccProjectName0 = .
|
||||||
|
SccAuxPath0 = http://ts-devopss:81/tecnosiscollection
|
||||||
|
SccLocalPath0 = .
|
||||||
|
SccProvider0 = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
123
tsZIP.vbproj
Normal file
123
tsZIP.vbproj
Normal file
@@ -0,0 +1,123 @@
|
|||||||
|
<?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>{342634F5-212E-4EEC-8AC5-E6ADA887ECA9}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<RootNamespace>tsZIP</RootNamespace>
|
||||||
|
<AssemblyName>tsZIP</AssemblyName>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<MyType>Windows</MyType>
|
||||||
|
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||||
|
<SccProjectName>SAK</SccProjectName>
|
||||||
|
<SccLocalPath>SAK</SccLocalPath>
|
||||||
|
<SccAuxPath>SAK</SccAuxPath>
|
||||||
|
<SccProvider>SAK</SccProvider>
|
||||||
|
<TargetFrameworkProfile />
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<DefineDebug>true</DefineDebug>
|
||||||
|
<DefineTrace>true</DefineTrace>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DocumentationFile>tsZIP.xml</DocumentationFile>
|
||||||
|
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||||
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
|
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<DefineDebug>false</DefineDebug>
|
||||||
|
<DefineTrace>true</DefineTrace>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DocumentationFile>tsZIP.xml</DocumentationFile>
|
||||||
|
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||||
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<OptionExplicit>On</OptionExplicit>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<OptionCompare>Binary</OptionCompare>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<OptionStrict>Off</OptionStrict>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<OptionInfer>On</OptionInfer>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Windows.Forms" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="ZipForge, Version=2.0.3.0, Culture=neutral, PublicKeyToken=3a6e82ca8e39718a, processorArchitecture=MSIL">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\..\Controles\Binarios\ZipForge.NET\Framework 2.0\ZipForge.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Import Include="Microsoft.VisualBasic" />
|
||||||
|
<Import Include="System" />
|
||||||
|
<Import Include="System.Collections" />
|
||||||
|
<Import Include="System.Collections.Generic" />
|
||||||
|
<Import Include="System.Data" />
|
||||||
|
<Import Include="System.Diagnostics" />
|
||||||
|
<Import Include="System.Linq" />
|
||||||
|
<Import Include="System.Xml.Linq" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="My Project\AssemblyInfo.vb" />
|
||||||
|
<Compile Include="My Project\Application.Designer.vb">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>Application.myapp</DependentUpon>
|
||||||
|
<DesignTime>True</DesignTime>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="My Project\Resources.Designer.vb">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DesignTime>True</DesignTime>
|
||||||
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="My Project\Settings.Designer.vb">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>Settings.settings</DependentUpon>
|
||||||
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="zip.vb" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Include="My Project\Resources.resx">
|
||||||
|
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
|
||||||
|
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
|
||||||
|
<CustomToolNamespace>My.Resources</CustomToolNamespace>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</EmbeddedResource>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="Baget\Aplicacion.nuspec" />
|
||||||
|
<None Include="My Project\Application.myapp">
|
||||||
|
<Generator>MyApplicationCodeGenerator</Generator>
|
||||||
|
<LastGenOutput>Application.Designer.vb</LastGenOutput>
|
||||||
|
</None>
|
||||||
|
<None Include="My Project\Settings.settings">
|
||||||
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
|
<CustomToolNamespace>My</CustomToolNamespace>
|
||||||
|
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.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>
|
||||||
430
zip.vb
Normal file
430
zip.vb
Normal file
@@ -0,0 +1,430 @@
|
|||||||
|
Imports ComponentAce.Compression.ZipForge
|
||||||
|
Imports ComponentAce.Compression.Archiver
|
||||||
|
|
||||||
|
Imports System.Windows.Forms
|
||||||
|
Imports System.IO
|
||||||
|
|
||||||
|
Public Class zip
|
||||||
|
Private Shared WithEvents Zip As ZipForge
|
||||||
|
Private Shared pbProgreso As ProgressBar
|
||||||
|
|
||||||
|
|
||||||
|
Public Shared Sub ExtraeDeZip(ByVal FicheroZip As Byte(), ByVal FicheroAExtraer As String, ByVal FicheroDestino As String)
|
||||||
|
' ----------------------------------------------------------------------------------------------------
|
||||||
|
' Descripción Sub: Extrae de un archivo zip un único archivo en la ruta indicada.
|
||||||
|
' Fecha. Creacion: ?
|
||||||
|
' Creada por: manmog
|
||||||
|
' Ultima Modificacion: 14/05/2008
|
||||||
|
'
|
||||||
|
' Modificaciones:
|
||||||
|
' ===============
|
||||||
|
' 14/05/2008 DANMUN Adaptación de C1Zip a ZipForge.Net.
|
||||||
|
' 23/11/2011 manmog Adaptación de C1Zip a ZipForge.Net.
|
||||||
|
' ----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Dim sDirTmp As String = ObtieneDirectorioAleatorio()
|
||||||
|
Dim ms As New IO.MemoryStream(FicheroZip)
|
||||||
|
Dim zf As New ZipForge
|
||||||
|
zf.OpenArchive(ms, False)
|
||||||
|
zf.BaseDir = sDirTmp 'Voy a descomprimir en Temp y luego lo muevo al lugar que corresponda.
|
||||||
|
zf.ExtractFiles(FicheroAExtraer)
|
||||||
|
If System.IO.Directory.Exists(FicheroDestino) = True Then 'Si existe "FicheroDestino" como directorio tengo que extraer el fichero dentro de ese directorio.
|
||||||
|
FicheroDestino = FicheroDestino & "\" & System.IO.Path.GetFileName(FicheroAExtraer)
|
||||||
|
End If
|
||||||
|
If My.Computer.FileSystem.FileExists(FicheroDestino) = True Then 'Si ya existía un fichero con ese nombre, se borra. Es como si lo sobreescribiera.
|
||||||
|
My.Computer.FileSystem.DeleteFile(FicheroDestino)
|
||||||
|
End If
|
||||||
|
My.Computer.FileSystem.MoveFile(sDirTmp & "\" & System.IO.Path.GetFileName(FicheroAExtraer), FicheroDestino)
|
||||||
|
zf.CloseArchive()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Public Shared Function ExtraeDeZip(ByVal FicheroZip As Stream, ByVal FicheroAExtraer As String) As Byte()
|
||||||
|
' ----------------------------------------------------------------------------------------------------
|
||||||
|
' Descripción Sub: Extrae de un archivo zip un único archivo en la ruta indicada.
|
||||||
|
' Fecha. Creacion: ?
|
||||||
|
' Creada por: manmog
|
||||||
|
' Ultima Modificacion: 14/05/2008
|
||||||
|
'
|
||||||
|
' Modificaciones:
|
||||||
|
' ===============
|
||||||
|
' 14/05/2008 DANMUN Adaptación de C1Zip a ZipForge.Net.
|
||||||
|
' 23/11/2011 manmog Adaptación de C1Zip a ZipForge.Net.
|
||||||
|
' ----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Dim sDirTmp As String = ObtieneDirectorioAleatorio()
|
||||||
|
Dim zf As New ZipForge
|
||||||
|
|
||||||
|
' zf.Zip64Mode = ComponentAce.Compression.Archiver.Zip64Mode.Disabled
|
||||||
|
zf.OpenArchive(FicheroZip, False)
|
||||||
|
zf.BaseDir = sDirTmp 'Voy a descomprimir en Temp y luego lo muevo al lugar que corresponda.
|
||||||
|
Dim b As Byte() = Nothing
|
||||||
|
zf.ExtractFiles(FicheroAExtraer)
|
||||||
|
zf.ExtractToBuffer(FicheroAExtraer, b)
|
||||||
|
zf.CloseArchive()
|
||||||
|
Return b
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
Public Shared Function ExtraeDeZip(ByVal FicheroZip As Byte(), ByVal FicheroAExtraer As String) As Byte()
|
||||||
|
' ----------------------------------------------------------------------------------------------------
|
||||||
|
' Descripción Sub: Extrae de un archivo zip un único archivo en la ruta indicada.
|
||||||
|
' Fecha. Creacion: ?
|
||||||
|
' Creada por: manmog
|
||||||
|
' Ultima Modificacion: 14/05/2008
|
||||||
|
'
|
||||||
|
' Modificaciones:
|
||||||
|
' ===============
|
||||||
|
' 14/05/2008 DANMUN Adaptación de C1Zip a ZipForge.Net.
|
||||||
|
' 23/11/2011 manmog Adaptación de C1Zip a ZipForge.Net.
|
||||||
|
' ----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Dim sDirTmp As String = ObtieneDirectorioAleatorio()
|
||||||
|
Dim ms As New IO.MemoryStream(FicheroZip)
|
||||||
|
Dim zf As New ZipForge
|
||||||
|
zf.OpenArchive(ms, False)
|
||||||
|
zf.BaseDir = sDirTmp 'Voy a descomprimir en Temp y luego lo muevo al lugar que corresponda.
|
||||||
|
Dim b As Byte() = Nothing
|
||||||
|
zf.ExtractToBuffer(FicheroAExtraer, b)
|
||||||
|
zf.CloseArchive()
|
||||||
|
Return b
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Public Shared Sub ExtraeDeZip(ByVal FicheroZip As String, ByVal FicheroAExtraer As String, ByVal FicheroDestino As String)
|
||||||
|
' ----------------------------------------------------------------------------------------------------
|
||||||
|
' Descripción Sub: Extrae de un archivo zip un único archivo en la ruta indicada.
|
||||||
|
' Fecha. Creacion: ?
|
||||||
|
' Creada por: manmog
|
||||||
|
' Ultima Modificacion: 14/05/2008
|
||||||
|
'
|
||||||
|
' Modificaciones:
|
||||||
|
' ===============
|
||||||
|
' 14/05/2008 DANMUN Adaptación de C1Zip a ZipForge.Net.
|
||||||
|
' 23/11/2011 manmog Adaptación de C1Zip a ZipForge.Net.
|
||||||
|
' ----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Dim sDirTmp As String = ObtieneDirectorioAleatorio()
|
||||||
|
|
||||||
|
Dim zf As New ZipForge
|
||||||
|
zf.FileName = FicheroZip
|
||||||
|
zf.OpenArchive()
|
||||||
|
zf.BaseDir = sDirTmp 'Voy a descomprimir en Temp y luego lo muevo al lugar que corresponda.
|
||||||
|
zf.ExtractFiles(FicheroAExtraer)
|
||||||
|
If System.IO.Directory.Exists(FicheroDestino) = True Then 'Si existe "FicheroDestino" como directorio tengo que extraer el fichero dentro de ese directorio.
|
||||||
|
FicheroDestino = FicheroDestino & "\" & System.IO.Path.GetFileName(FicheroAExtraer)
|
||||||
|
End If
|
||||||
|
If My.Computer.FileSystem.FileExists(FicheroDestino) = True Then 'Si ya existía un fichero con ese nombre, se borra. Es como si lo sobreescribiera.
|
||||||
|
My.Computer.FileSystem.DeleteFile(FicheroDestino)
|
||||||
|
End If
|
||||||
|
My.Computer.FileSystem.MoveFile(sDirTmp & "\" & System.IO.Path.GetFileName(FicheroAExtraer), FicheroDestino)
|
||||||
|
zf.CloseArchive()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Public Shared Sub ExtraeDeZip(ByVal FicheroZip As String, ByVal FicheroAExtraer As String, ByVal FicheroDestino As String, ByVal Progreso As ProgressBar)
|
||||||
|
' ----------------------------------------------------------------------------------------------------
|
||||||
|
' Descripción Sub: Extrae de un archivo zip un único archivo en la ruta indicada.
|
||||||
|
' Fecha. Creacion: ?
|
||||||
|
' Creada por: manmog
|
||||||
|
' Ultima Modificacion: 14/05/2008
|
||||||
|
'
|
||||||
|
' Modificaciones:
|
||||||
|
' ===============
|
||||||
|
' 14/05/2008 DANMUN Adaptación de C1Zip a ZipForge.Net.
|
||||||
|
' 23/11/2011 manmog Adaptación de C1Zip a ZipForge.Net.
|
||||||
|
' ----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
pbProgreso = Progreso
|
||||||
|
|
||||||
|
Dim sDirTmp As String = ObtieneDirectorioAleatorio()
|
||||||
|
|
||||||
|
Zip = New ZipForge
|
||||||
|
Zip.FileName = FicheroZip
|
||||||
|
Zip.OpenArchive()
|
||||||
|
Zip.BaseDir = sDirTmp 'Voy a descomprimir en Temp y luego lo muevo al lugar que corresponda.
|
||||||
|
Zip.ExtractFiles(FicheroAExtraer)
|
||||||
|
If System.IO.Directory.Exists(FicheroDestino) = True Then 'Si existe "FicheroDestino" como directorio tengo que extraer el fichero dentro de ese directorio.
|
||||||
|
FicheroDestino = FicheroDestino & "\" & System.IO.Path.GetFileName(FicheroAExtraer)
|
||||||
|
End If
|
||||||
|
If My.Computer.FileSystem.FileExists(FicheroDestino) = True Then 'Si ya existía un fichero con ese nombre, se borra. Es como si lo sobreescribiera.
|
||||||
|
My.Computer.FileSystem.DeleteFile(FicheroDestino)
|
||||||
|
End If
|
||||||
|
My.Computer.FileSystem.MoveFile(sDirTmp & "\" & System.IO.Path.GetFileName(FicheroAExtraer), FicheroDestino)
|
||||||
|
Zip.CloseArchive()
|
||||||
|
Zip.Dispose()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
|
Public Shared Sub ExtraeDeZip(ByVal FicheroZip As String, ByVal FicheroAExtraer As String, ByVal FicheroDestino As String, Optional ByVal DelegadoProgreso As ZipForge.OnOverallProgressDelegate = Nothing)
|
||||||
|
' ----------------------------------------------------------------------------------------------------
|
||||||
|
' Descripción Sub: Extrae de un archivo zip un único archivo en la ruta indicada.
|
||||||
|
' Fecha. Creacion: ?
|
||||||
|
' Creada por: manmog
|
||||||
|
' Ultima Modificacion: 14/05/2008
|
||||||
|
'
|
||||||
|
' Modificaciones:
|
||||||
|
' ===============
|
||||||
|
' 14/05/2008 DANMUN Adaptación de C1Zip a ZipForge.Net.
|
||||||
|
' 23/11/2011 manmog Adaptación de C1Zip a ZipForge.Net.
|
||||||
|
' ----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
Dim sDirTmp As String = ObtieneDirectorioAleatorio()
|
||||||
|
|
||||||
|
Zip = New ZipForge
|
||||||
|
|
||||||
|
If Not DelegadoProgreso Is Nothing Then
|
||||||
|
AddHandler Zip.OnOverallProgress, DelegadoProgreso
|
||||||
|
End If
|
||||||
|
|
||||||
|
Zip.FileName = FicheroZip
|
||||||
|
Zip.OpenArchive()
|
||||||
|
Zip.BaseDir = sDirTmp 'Voy a descomprimir en Temp y luego lo muevo al lugar que corresponda.
|
||||||
|
Zip.ExtractFiles(FicheroAExtraer)
|
||||||
|
If System.IO.Directory.Exists(FicheroDestino) = True Then 'Si existe "FicheroDestino" como directorio tengo que extraer el fichero dentro de ese directorio.
|
||||||
|
FicheroDestino = FicheroDestino & "\" & System.IO.Path.GetFileName(FicheroAExtraer)
|
||||||
|
End If
|
||||||
|
If My.Computer.FileSystem.FileExists(FicheroDestino) = True Then 'Si ya existía un fichero con ese nombre, se borra. Es como si lo sobreescribiera.
|
||||||
|
My.Computer.FileSystem.DeleteFile(FicheroDestino)
|
||||||
|
End If
|
||||||
|
My.Computer.FileSystem.MoveFile(sDirTmp & "\" & System.IO.Path.GetFileName(FicheroAExtraer), FicheroDestino)
|
||||||
|
Zip.CloseArchive()
|
||||||
|
Zip.Dispose()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
|
Public Shared Sub AñadeAZip(ByVal FicheroZip As String, ByVal FicheroAAñadir As String, ByVal NombreFicheroDestino As String, ByVal Progreso As ProgressBar)
|
||||||
|
' ----------------------------------------------------------------------------------------------------
|
||||||
|
' Descripción Sub: Añade a un archivo zip un único archivo
|
||||||
|
' Fecha. Creacion: ?
|
||||||
|
' Creada por: manmog
|
||||||
|
' Ultima Modificacion: 14/05/2008
|
||||||
|
'
|
||||||
|
' Modificaciones:
|
||||||
|
' ===============
|
||||||
|
' 14/05/2008 DANMUN Adaptación de C1Zip a ZipForge.Net.
|
||||||
|
' ----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
pbProgreso = Progreso
|
||||||
|
|
||||||
|
Zip = New ZipForge
|
||||||
|
Zip.FileName = FicheroZip
|
||||||
|
If Not IO.File.Exists(FicheroZip) Then
|
||||||
|
Zip.OpenArchive(System.IO.FileMode.Create)
|
||||||
|
Else
|
||||||
|
Zip.OpenArchive()
|
||||||
|
End If
|
||||||
|
Zip.DeleteFiles(NombreFicheroDestino)
|
||||||
|
Dim ai As New ComponentAce.Compression.Archiver.ArchiveItem(FicheroAAñadir)
|
||||||
|
ai.FileName = NombreFicheroDestino
|
||||||
|
Zip.BaseDir = IO.Path.GetDirectoryName(FicheroAAñadir)
|
||||||
|
Zip.AddItem(ai)
|
||||||
|
Zip.CloseArchive()
|
||||||
|
Zip.Dispose()
|
||||||
|
End Sub
|
||||||
|
''' <summary>
|
||||||
|
''' Recibe varios byte array en un diccionario, los comprime en un archivo y lo devuelve.
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="archivos">Un diccionario cuya clave es el nombre del archivo y el valor un array de bytes.</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
''' <remarks></remarks>
|
||||||
|
Public Shared Function ComprimirArchivos(ByVal archivos As Dictionary(Of String, Byte())) As Byte()
|
||||||
|
' ----------------------------------------------------------------------------------------------------
|
||||||
|
' Creada por: danmun
|
||||||
|
' Fecha de creación: 31/01/2014
|
||||||
|
'
|
||||||
|
' ----------------------------------------------------------------------------------------------------
|
||||||
|
Dim rutaArchivo As String = IO.Path.GetTempFileName
|
||||||
|
|
||||||
|
Dim zip As New ZipForge()
|
||||||
|
zip.Zip64Mode = ComponentAce.Compression.Archiver.Zip64Mode.Disabled
|
||||||
|
zip.FileName = rutaArchivo
|
||||||
|
zip.OpenArchive(IO.FileMode.Create)
|
||||||
|
For Each archivo In archivos
|
||||||
|
zip.AddFromBuffer(archivo.Key, archivo.Value, archivo.Value.Length)
|
||||||
|
Next
|
||||||
|
zip.CloseArchive()
|
||||||
|
zip.Dispose()
|
||||||
|
|
||||||
|
Dim resultado As Byte() = IO.File.ReadAllBytes(rutaArchivo)
|
||||||
|
Try
|
||||||
|
IO.File.Delete(rutaArchivo)
|
||||||
|
Catch ex As Exception
|
||||||
|
' Por precaución lo pongo en un try y no hago nada en ese try,
|
||||||
|
' es decir, que si no se borra, ahí lo dejo, de momento.
|
||||||
|
' Cuando lo pruebe realizaré modificaciones.
|
||||||
|
End Try
|
||||||
|
Return resultado
|
||||||
|
End Function
|
||||||
|
''' <summary>
|
||||||
|
''' Recibe varios Stream en un diccionario, los comprime en un archivo y lo devuelve.
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="archivos">Un diccionario cuya clave es el nombre del archivo y el valor un array de bytes.</param>
|
||||||
|
''' <returns></returns>
|
||||||
|
''' <remarks></remarks>
|
||||||
|
Public Shared Function ComprimirArchivos(ByVal archivos As Dictionary(Of String, IO.Stream)) As Byte()
|
||||||
|
' ----------------------------------------------------------------------------------------------------
|
||||||
|
' Creada por: danmun
|
||||||
|
' Fecha de creación: 31/01/2014
|
||||||
|
'
|
||||||
|
' ----------------------------------------------------------------------------------------------------
|
||||||
|
Dim rutaArchivo As String = IO.Path.GetTempFileName
|
||||||
|
|
||||||
|
Dim zip As New ZipForge()
|
||||||
|
zip.Zip64Mode = ComponentAce.Compression.Archiver.Zip64Mode.Disabled
|
||||||
|
zip.FileName = rutaArchivo
|
||||||
|
zip.OpenArchive(IO.FileMode.Create)
|
||||||
|
For Each archivo In archivos
|
||||||
|
zip.AddFromStream(archivo.Key, archivo.Value, archivo.Value.Length)
|
||||||
|
Next
|
||||||
|
zip.CloseArchive()
|
||||||
|
zip.Dispose()
|
||||||
|
|
||||||
|
|
||||||
|
Dim resultado As Byte() = IO.File.ReadAllBytes(rutaArchivo)
|
||||||
|
Try
|
||||||
|
IO.File.Delete(rutaArchivo)
|
||||||
|
Catch ex As Exception
|
||||||
|
' Por precaución lo pongo en un try y no hago nada en ese try,
|
||||||
|
' es decir, que si no se borra, ahí lo dejo, de momento.
|
||||||
|
' Cuando lo pruebe realizaré modificaciones.
|
||||||
|
End Try
|
||||||
|
Return resultado
|
||||||
|
End Function
|
||||||
|
Public Shared Sub AñadeAZip(ByVal FicheroZip As String, ByVal FicheroAAñadir As String, ByVal NombreFicheroDestino As String, Optional ByVal DelegadoProgreso As ZipForge.OnOverallProgressDelegate = Nothing)
|
||||||
|
' ----------------------------------------------------------------------------------------------------
|
||||||
|
' Descripción Sub: Añade a un archivo zip un único archivo
|
||||||
|
' Fecha. Creacion: ?
|
||||||
|
' Creada por: manmog
|
||||||
|
' Ultima Modificacion: 14/05/2008
|
||||||
|
'
|
||||||
|
' Modificaciones:
|
||||||
|
' ===============
|
||||||
|
' 25/07/2014 MANMOG En caso de que no exista el fichero zip se crea
|
||||||
|
' 06/05/2012 MANMOG En caso de que no exista el fichero zip se lanza una excepción
|
||||||
|
' 06/05/2012 MANMOG Se añade más información en caso de excepción
|
||||||
|
' 14/05/2008 DANMUN Adaptación de C1Zip a ZipForge.Net.
|
||||||
|
' ----------------------------------------------------------------------------------------------------
|
||||||
|
Try
|
||||||
|
' If Not IO.File.Exists(FicheroZip) Then Throw New Exception("No existe el fichero " & FicheroZip)
|
||||||
|
Dim zf As New ZipForge
|
||||||
|
If Not DelegadoProgreso Is Nothing Then
|
||||||
|
AddHandler zf.OnOverallProgress, DelegadoProgreso
|
||||||
|
End If
|
||||||
|
|
||||||
|
zf.FileName = FicheroZip
|
||||||
|
|
||||||
|
If Not IO.File.Exists(FicheroZip) Then
|
||||||
|
zf.OpenArchive(System.IO.FileMode.Create)
|
||||||
|
Else
|
||||||
|
zf.OpenArchive()
|
||||||
|
End If
|
||||||
|
zf.DeleteFiles(NombreFicheroDestino)
|
||||||
|
Dim ai As New ComponentAce.Compression.Archiver.ArchiveItem(FicheroAAñadir)
|
||||||
|
ai.FileName = NombreFicheroDestino
|
||||||
|
zf.BaseDir = IO.Path.GetDirectoryName(FicheroAAñadir)
|
||||||
|
zf.AddItem(ai)
|
||||||
|
zf.CloseArchive()
|
||||||
|
zf.Dispose()
|
||||||
|
Catch ex As Exception
|
||||||
|
Throw New Exception("Error Añadiendo fichero a zip. FicheroZIP: " & FicheroZip & " Fichero a Añadir: " & FicheroAAñadir & " Fichero Destino: " & NombreFicheroDestino & vbCrLf & ex.Message, ex)
|
||||||
|
End Try
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Shared Sub Zip_OnOverallProgress(ByVal sender As Object, ByVal progress As Double, ByVal timeElapsed As System.TimeSpan, ByVal timeLeft As System.TimeSpan, ByVal operation As ProcessOperation, ByVal progressPhase As ProgressPhase, ByRef cancel As Boolean) Handles Zip.OnOverallProgress
|
||||||
|
' ----------------------------------------------------------------------------------------------------
|
||||||
|
' Descripción Sub: Actualiza la barra de progreso de descompresión de un archivo zip.
|
||||||
|
' Fecha. Creacion: ?
|
||||||
|
' Creada por: manmog
|
||||||
|
' Ultima Modificacion: 14/05/2008
|
||||||
|
'
|
||||||
|
' Modificaciones:
|
||||||
|
' ===============
|
||||||
|
' 14/05/2008 DANMUN Adaptación de C1Zip a ZipForge.Net. (COMPROBADO)
|
||||||
|
' ----------------------------------------------------------------------------------------------------
|
||||||
|
Try
|
||||||
|
If Not IsNothing(pbProgreso) Then
|
||||||
|
pbProgreso.Maximum = 100
|
||||||
|
pbProgreso.Value = progress
|
||||||
|
System.Windows.Forms.Application.DoEvents()
|
||||||
|
End If
|
||||||
|
Catch EX As Exception
|
||||||
|
End Try
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
|
Public Shared Sub ComprimeDirectorio(ByVal Directorio As String, ByVal FicheroZIP As String, ByVal ZIP64 As Boolean)
|
||||||
|
Dim zFichero As New ComponentAce.Compression.ZipForge.ZipForge
|
||||||
|
zFichero.FileName = FicheroZIP
|
||||||
|
|
||||||
|
If ZIP64 Then
|
||||||
|
zFichero.Zip64Mode = ComponentAce.Compression.Archiver.Zip64Mode.Always
|
||||||
|
Else
|
||||||
|
zFichero.Zip64Mode = ComponentAce.Compression.Archiver.Zip64Mode.Disabled
|
||||||
|
End If
|
||||||
|
zFichero.OpenArchive(IO.FileMode.Create)
|
||||||
|
zFichero.BaseDir = Directorio
|
||||||
|
Dim iNumeroArchivosTotal As Integer
|
||||||
|
Dim sFichero As String, sFicheros() As String = Nothing
|
||||||
|
ObtieneFicherosRecursivo(Directorio, sFicheros)
|
||||||
|
iNumeroArchivosTotal = sFicheros.Length
|
||||||
|
Dim i As Long = 0
|
||||||
|
For Each sFichero In sFicheros
|
||||||
|
i += 1
|
||||||
|
If sFichero <> FicheroZIP Then zFichero.AddFiles(sFichero)
|
||||||
|
Next
|
||||||
|
zFichero.CloseArchive()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Shared Sub ExtraeTodoDeZip(FicheroZIP As String, RutaDestino As String, Optional EliminaDirectorioDestino As Boolean = False)
|
||||||
|
Dim Zip As New ComponentAce.Compression.ZipForge.ZipForge
|
||||||
|
If EliminaDirectorioDestino Then
|
||||||
|
If IO.Directory.Exists(RutaDestino) Then IO.Directory.Delete(RutaDestino, True)
|
||||||
|
End If
|
||||||
|
If Not IO.Directory.Exists(RutaDestino) Then IO.Directory.CreateDirectory(RutaDestino)
|
||||||
|
Zip.FileName = FicheroZIP
|
||||||
|
Zip.OpenArchive()
|
||||||
|
Zip.BaseDir = RutaDestino
|
||||||
|
Zip.ExtractFiles("*")
|
||||||
|
Zip.CloseArchive()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
|
Shared Sub ExtraeTodoDeZip(FicheroZIP As IO.MemoryStream, RutaDestino As String, Optional EliminaDirectorioDestino As Boolean = False)
|
||||||
|
Dim Zip As New ComponentAce.Compression.ZipForge.ZipForge()
|
||||||
|
If EliminaDirectorioDestino Then
|
||||||
|
If IO.Directory.Exists(RutaDestino) Then IO.Directory.Delete(RutaDestino, True)
|
||||||
|
End If
|
||||||
|
If Not IO.Directory.Exists(RutaDestino) Then IO.Directory.CreateDirectory(RutaDestino)
|
||||||
|
Zip.OpenArchive(FicheroZIP, False)
|
||||||
|
|
||||||
|
Zip.BaseDir = RutaDestino
|
||||||
|
Zip.ExtractFiles("*")
|
||||||
|
Zip.CloseArchive()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Public Shared Function ObtieneDirectorioAleatorio() As String
|
||||||
|
Dim sDir As String = System.IO.Path.GetTempPath & System.IO.Path.GetRandomFileName
|
||||||
|
Do While IO.Directory.Exists(sDir)
|
||||||
|
sDir = System.IO.Path.GetTempPath & "\" & System.IO.Path.GetRandomFileName
|
||||||
|
Loop
|
||||||
|
IO.Directory.CreateDirectory(sDir)
|
||||||
|
Return sDir
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Shared Sub ObtieneFicherosRecursivo(ByVal Ruta As String, ByRef Ficheros() As String)
|
||||||
|
Dim sFicheros() As String = IO.Directory.GetFiles(Ruta)
|
||||||
|
Dim iNumeroFicheros As Integer
|
||||||
|
If Not IsNothing(Ficheros) Then iNumeroFicheros = Ficheros.Length
|
||||||
|
ReDim Preserve Ficheros(sFicheros.Length - 1 + iNumeroFicheros)
|
||||||
|
sFicheros.CopyTo(Ficheros, iNumeroFicheros)
|
||||||
|
Dim sDirectorio, sDirectorios() As String
|
||||||
|
sDirectorios = IO.Directory.GetDirectories(Ruta)
|
||||||
|
For Each sDirectorio In sDirectorios
|
||||||
|
ObtieneFicherosRecursivo(sDirectorio, Ficheros)
|
||||||
|
Next
|
||||||
|
End Sub
|
||||||
|
End Class
|
||||||
Reference in New Issue
Block a user