Merge pull request #3068 from kc284/ionic

Removed dependency on IonicZip.
This commit is contained in:
Konstantina Chremmou 2022-12-14 01:00:23 +00:00 committed by GitHub
commit 92e66a2eed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 106 additions and 457 deletions

View File

@ -43,7 +43,6 @@ and also some libraries which we do not store in the source tree:
* Newtonsoft.Json.dll
* DiscUtils.dll
* ICSharpCode.SharpZipLib.dll
* Ionic.Zip.dll
* log4net.dll
You can find the source code of these libraries (along with some patches) in

View File

@ -69,7 +69,6 @@
<File Id="NewtonsoftJsonDLL" Source="$(env.RepoRoot)\XenAdmin\bin\Release\Newtonsoft.Json.CH.dll" />
<File Id="log4netDLL" Source="$(env.RepoRoot)\XenAdmin\bin\Release\log4net.dll" />
<File Id="SharpZipLibDLL" Source="$(env.RepoRoot)\XenAdmin\bin\Release\ICSharpCode.SharpZipLib.dll" />
<File Id="IonicZipDLL" Source="$(env.RepoRoot)\XenAdmin\bin\Release\Ionic.Zip.dll" />
<File Id="MSTSCLibDLL" Source="$(env.RepoRoot)\XenAdmin\bin\Release\MSTSCLib.dll" />
<File Id="XenCenterLibDLL" Source="$(env.RepoRoot)\XenAdmin\bin\Release\CoreUtilsLib.dll" />
<File Id="XenModelDLL" Source="$(env.RepoRoot)\XenAdmin\bin\Release\XenModel.dll" />

View File

@ -43,7 +43,6 @@
<File Id="HealthCheck_CookComputing.XmlRpcV2.dll" Name="CookComputing.XmlRpcV2.dll" Source="$(env.RepoRoot)\XenServerHealthCheck\bin\Release\CookComputing.XmlRpcV2.dll" />
<File Id="HealthCheck_NewtonsoftJsonDLL" Source="$(env.RepoRoot)\XenServerHealthCheck\bin\Release\Newtonsoft.Json.CH.dll" />
<File Id="HealthCheck_ICSharpCode.SharpZipLib.dll" Name="ICSharpCode.SharpZipLib.dll" Source="$(env.RepoRoot)\XenServerHealthCheck\bin\Release\ICSharpCode.SharpZipLib.dll" />
<File Id="HealthCheck_Ionic.Zip.dll" Name="Ionic.Zip.dll" Source="$(env.RepoRoot)\XenServerHealthCheck\bin\Release\Ionic.Zip.dll" />
<File Id="HealthCheck_log4net.dll" Name="log4net.dll" Source="$(env.RepoRoot)\XenServerHealthCheck\bin\Release\log4net.dll" />
<File Id="HealthCheck_CoreUtilsLib.dll" Name="CoreUtilsLib.dll" Source="$(env.RepoRoot)\XenServerHealthCheck\bin\Release\CoreUtilsLib.dll" />
<File Id="HealthCheck_XenModel.dll" Name="XenModel.dll" Source="$(env.RepoRoot)\XenServerHealthCheck\bin\Release\XenModel.dll" />

View File

@ -206,31 +206,6 @@ All schemas sourced from schemas.dmtf.org: Copyright © 2009 Distributed Managem
DMTF is a not-for-profit association of industry members dedicated to promoting enterprise and systems management and interoperability. Members and non-members may reproduce DMTF specifications and documents for uses consistent with this purpose, provided that correct attribution is given. As DMTF specifications may be revised from time to time, the particular version and release date should always be noted.
Implementation of certain elements of this standard or proposed standard may be subject to third-party patent rights, including provisional patent rights (herein "patent rights"). DMTF makes no representations to users of the standard as to the existence of such rights, and is not responsible to recognize, disclose, or identify any or all such third party patent right, owners or claimants, nor for any incomplete or inaccurate identification or disclosure of such rights, owners or claimants. DMTF shall have no liability to any party, in any manner or circumstance, under any legal theory whatsoever, for failure to recognize, disclose, or identify any such third-party patent rights, or for such party's reliance on the standard or incorporation thereof in its product, protocols or testing procedures. DMTF shall have no liability to any party implementing such standard, whether such implementation is foreseeable or not, nor to any patent owner or claimant, and shall have no liability or responsibility for costs or losses incurred if a standard is withdrawn or modified after publication, and shall be indemnified and held harmless by any party implementing the standard from any and all claims of infringement by a patent owner for such implementations.
Software Licenses that apply to DotNetZip
This software, the DotNetZip library and tools is provided for your use under several licenses. One license applies to DotNetZip, and several other licenses apply to work that DotNetZip derives from. To use the software, you must accept the licenses. If you do not accept the licenses, do not use the software.
The following license, the Microsoft Public License (Ms-PL), applies to the original intellectual property in DotNetZip:
1. Definitions
The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law.
A "contribution" is the original software, or any additions or changes to the software.
A "contributor" is any person that distributes its contribution under this license.
"Licensed patents" are a contributor's patent claims that read directly on its contribution.
2. Grant of Rights
(A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create.
(B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software.
3. Conditions and Limitations
(A) No Trademark License - This license does not grant you rights to use any contributors name, logo, or trademarks.
(B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically.
(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software.
(D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license.
(E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement.
The managed ZLIB code included in Ionic.Zlib.dll and Ionic.Zip.dll is derived from the jzlib, which is Copyright (c) 2000,2001,2002,2003 ymnk, JCraft, Inc., and is licensed under the following terms:
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT, INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The xxHash library used in this software has the following MIT license:
MIT License
@ -240,24 +215,6 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
The jzlib library, itself, is based on the C-language ZLIB library, v1.1.3. The following notice and license applies to zlib:
ZLIB is Copyright (C) 1995-2004 Jean-loup Gailly and Mark Adler
The ZLIB software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Jean-loup Gailly jloup@gzip.org
Mark Adler madler@alumni.caltech.edu
The managed BZIP2 code included in Ionic.BZip2.dll and Ionic.Zip.dll is modified code, based on the bzip2 code in the Apache commons compress library.
The original BZip2 was created by Julian Seward, and is licensed under the BSD license.
The following license applies to the Apache code:
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Blueprint CSS Framework License: Copyright (c) 2007 - 2010 blueprintcss.org
Permission is hereby granted, free of charge, to any person obtaining a copy of the Blueprint CSS Framework and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</value>

View File

@ -206,31 +206,6 @@ All schemas sourced from schemas.dmtf.org: Copyright © 2009 Distributed Managem
DMTF is a not-for-profit association of industry members dedicated to promoting enterprise and systems management and interoperability. Members and non-members may reproduce DMTF specifications and documents for uses consistent with this purpose, provided that correct attribution is given. As DMTF specifications may be revised from time to time, the particular version and release date should always be noted.
Implementation of certain elements of this standard or proposed standard may be subject to third-party patent rights, including provisional patent rights (herein "patent rights"). DMTF makes no representations to users of the standard as to the existence of such rights, and is not responsible to recognize, disclose, or identify any or all such third party patent right, owners or claimants, nor for any incomplete or inaccurate identification or disclosure of such rights, owners or claimants. DMTF shall have no liability to any party, in any manner or circumstance, under any legal theory whatsoever, for failure to recognize, disclose, or identify any such third-party patent rights, or for such party's reliance on the standard or incorporation thereof in its product, protocols or testing procedures. DMTF shall have no liability to any party implementing such standard, whether such implementation is foreseeable or not, nor to any patent owner or claimant, and shall have no liability or responsibility for costs or losses incurred if a standard is withdrawn or modified after publication, and shall be indemnified and held harmless by any party implementing the standard from any and all claims of infringement by a patent owner for such implementations.
Software Licenses that apply to DotNetZip
This software, the DotNetZip library and tools is provided for your use under several licenses. One license applies to DotNetZip, and several other licenses apply to work that DotNetZip derives from. To use the software, you must accept the licenses. If you do not accept the licenses, do not use the software.
The following license, the Microsoft Public License (Ms-PL), applies to the original intellectual property in DotNetZip:
1. Definitions
The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law.
A "contribution" is the original software, or any additions or changes to the software.
A "contributor" is any person that distributes its contribution under this license.
"Licensed patents" are a contributor's patent claims that read directly on its contribution.
2. Grant of Rights
(A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create.
(B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software.
3. Conditions and Limitations
(A) No Trademark License - This license does not grant you rights to use any contributors name, logo, or trademarks.
(B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically.
(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software.
(D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license.
(E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement.
The managed ZLIB code included in Ionic.Zlib.dll and Ionic.Zip.dll is derived from the jzlib, which is Copyright (c) 2000,2001,2002,2003 ymnk, JCraft, Inc., and is licensed under the following terms:
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT, INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The xxHash library used in this software has the following MIT license:
MIT License
@ -240,24 +215,6 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
The jzlib library, itself, is based on the C-language ZLIB library, v1.1.3. The following notice and license applies to zlib:
ZLIB is Copyright (C) 1995-2004 Jean-loup Gailly and Mark Adler
The ZLIB software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Jean-loup Gailly jloup@gzip.org
Mark Adler madler@alumni.caltech.edu
The managed BZIP2 code included in Ionic.BZip2.dll and Ionic.Zip.dll is modified code, based on the bzip2 code in the Apache commons compress library.
The original BZip2 was created by Julian Seward, and is licensed under the BSD license.
The following license applies to the Apache code:
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Blueprint CSS Framework License: Copyright (c) 2007 - 2010 blueprintcss.org
Permission is hereby granted, free of charge, to any person obtaining a copy of the Blueprint CSS Framework and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</value>

View File

@ -206,31 +206,6 @@ All schemas sourced from schemas.dmtf.org: Copyright © 2009 Distributed Managem
DMTF is a not-for-profit association of industry members dedicated to promoting enterprise and systems management and interoperability. Members and non-members may reproduce DMTF specifications and documents for uses consistent with this purpose, provided that correct attribution is given. As DMTF specifications may be revised from time to time, the particular version and release date should always be noted.
Implementation of certain elements of this standard or proposed standard may be subject to third-party patent rights, including provisional patent rights (herein "patent rights"). DMTF makes no representations to users of the standard as to the existence of such rights, and is not responsible to recognize, disclose, or identify any or all such third party patent right, owners or claimants, nor for any incomplete or inaccurate identification or disclosure of such rights, owners or claimants. DMTF shall have no liability to any party, in any manner or circumstance, under any legal theory whatsoever, for failure to recognize, disclose, or identify any such third-party patent rights, or for such party's reliance on the standard or incorporation thereof in its product, protocols or testing procedures. DMTF shall have no liability to any party implementing such standard, whether such implementation is foreseeable or not, nor to any patent owner or claimant, and shall have no liability or responsibility for costs or losses incurred if a standard is withdrawn or modified after publication, and shall be indemnified and held harmless by any party implementing the standard from any and all claims of infringement by a patent owner for such implementations.
Software Licenses that apply to DotNetZip
This software, the DotNetZip library and tools is provided for your use under several licenses. One license applies to DotNetZip, and several other licenses apply to work that DotNetZip derives from. To use the software, you must accept the licenses. If you do not accept the licenses, do not use the software.
The following license, the Microsoft Public License (Ms-PL), applies to the original intellectual property in DotNetZip:
1. Definitions
The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law.
A "contribution" is the original software, or any additions or changes to the software.
A "contributor" is any person that distributes its contribution under this license.
"Licensed patents" are a contributor's patent claims that read directly on its contribution.
2. Grant of Rights
(A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create.
(B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software.
3. Conditions and Limitations
(A) No Trademark License - This license does not grant you rights to use any contributors name, logo, or trademarks.
(B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically.
(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software.
(D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license.
(E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement.
The managed ZLIB code included in Ionic.Zlib.dll and Ionic.Zip.dll is derived from the jzlib, which is Copyright (c) 2000,2001,2002,2003 ymnk, JCraft, Inc., and is licensed under the following terms:
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT, INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The xxHash library used in this software has the following MIT license:
MIT License
@ -240,24 +215,6 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
The jzlib library, itself, is based on the C-language ZLIB library, v1.1.3. The following notice and license applies to zlib:
ZLIB is Copyright (C) 1995-2004 Jean-loup Gailly and Mark Adler
The ZLIB software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Jean-loup Gailly jloup@gzip.org
Mark Adler madler@alumni.caltech.edu
The managed BZIP2 code included in Ionic.BZip2.dll and Ionic.Zip.dll is modified code, based on the bzip2 code in the Apache commons compress library.
The original BZip2 was created by Julian Seward, and is licensed under the BSD license.
The following license applies to the Apache code:
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Blueprint CSS Framework License: Copyright (c) 2007 - 2010 blueprintcss.org
Permission is hereby granted, free of charge, to any person obtaining a copy of the Blueprint CSS Framework and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</value>

View File

@ -39,13 +39,12 @@ namespace XenAdminTests.ArchiveTests
[TestFixture, Category(TestCategories.Unit)]
public class ArchiveFactoryTests
{
[TestCase(ArchiveFactory.Type.Tar, ExpectedResult = typeof(SharpZipTarArchiveIterator))]
[TestCase(ArchiveFactory.Type.TarGz, ExpectedResult = typeof(SharpZipTarArchiveIterator))]
[TestCase(ArchiveFactory.Type.TarBz2, ExpectedResult = typeof(SharpZipTarArchiveIterator))]
[TestCase(ArchiveFactory.Type.Tar, ExpectedResult = typeof(TarArchiveIterator))]
[TestCase(ArchiveFactory.Type.TarGz, ExpectedResult = typeof(TarArchiveIterator))]
[Test]
public Type TestReaderGeneration(int archiveType)
{
string target = TestUtils.GetTestResource("emptyfile.bz2");
string target = TestUtils.GetTestResource("emptyfile.gz");
using (var ms = new MemoryStream(File.ReadAllBytes(target)))
using (var iterator = ArchiveFactory.Reader((ArchiveFactory.Type)archiveType, ms))
@ -53,8 +52,8 @@ namespace XenAdminTests.ArchiveTests
}
[TestCase(ArchiveFactory.Type.Tar, ExpectedResult = typeof(SharpZipTarArchiveWriter))]
[TestCase(ArchiveFactory.Type.Zip, ExpectedResult = typeof(DotNetZipZipWriter))]
[TestCase(ArchiveFactory.Type.Tar, ExpectedResult = typeof(TarArchiveWriter))]
[TestCase(ArchiveFactory.Type.Zip, ExpectedResult = typeof(ZipArchiveWriter))]
[Test]
public Type TestWriterGeneration(int archiveType)
{
@ -66,7 +65,6 @@ namespace XenAdminTests.ArchiveTests
}
[TestCase(ArchiveFactory.Type.TarGz)]
[TestCase(ArchiveFactory.Type.TarBz2)]
[Test]
public void TestWriterGenerationUnsupported(int archiveType)
{

View File

@ -38,8 +38,8 @@ using XenCenterLib.Archive;
namespace XenAdminTests.ArchiveTests
{
[TestFixture(typeof(SharpZipTarArchiveIterator), typeof(SharpZipTarArchiveWriter))]
[TestFixture(typeof(DotNetZipZipIterator), typeof(DotNetZipZipWriter))]
[TestFixture(typeof(TarArchiveIterator), typeof(TarArchiveWriter))]
[TestFixture(typeof(ZipArchiveIterator), typeof(ZipArchiveWriter))]
[Category(TestCategories.Unit)]
public class ThirdPartyArchiveWriterTest<TR, TW>
where TR : ArchiveIterator, new()

View File

@ -39,8 +39,7 @@ namespace XenAdminTests.CompressionTests
[TestFixture, Category(TestCategories.Unit)]
public class CompressionFactoryTests
{
[TestCase(CompressionFactory.Type.Gz, ExpectedResult = typeof(DotNetZipGZipOutputStream))]
[TestCase(CompressionFactory.Type.Bz2, ExpectedResult = typeof(DotNetZipBZip2OutputStream))]
[TestCase(CompressionFactory.Type.Gz, ExpectedResult = typeof(GZipOutputStream))]
[Test]
public Type TestWriterGeneration(int archiveType)
{
@ -51,38 +50,17 @@ namespace XenAdminTests.CompressionTests
}
}
[TestCase(CompressionFactory.Type.Gz, ExpectedResult = typeof(DotNetZipGZipInputStream))]
[TestCase(CompressionFactory.Type.Bz2, ExpectedResult = typeof(DotNetZipBZip2InputStream))]
[TestCase(CompressionFactory.Type.Gz, ExpectedResult = typeof(GZipInputStream))]
[Test]
public Type TestReaderGenerationWithFile(int archiveType)
{
string target = TestUtils.GetTestResource("emptyfile.bz2");
/*
* Note: Reading a bzip2 file in as a byte[] works for gzip as well as bzip2 stream
* as the implementation of bzip2 must be initialised with a string containing a
* header, EOF etc. whereas gzip doesn't mind so the following will work despite
* opening a gzip compression stream with a bzip2 data
*/
string target = TestUtils.GetTestResource("emptyfile.gz");
using (MemoryStream ms = new MemoryStream(File.ReadAllBytes(target)))
{
using (var providedStream = CompressionFactory.Reader((CompressionFactory.Type)archiveType, ms))
return providedStream.GetType();
}
}
[TestCase(CompressionFactory.Type.Bz2)]
[Description("Checks that a BZip2 stream without actual BZip2 data, header, data etc., will throw an exception")]
[Test]
public void TestReaderGenerationWithoutFile(int archiveType)
{
using (MemoryStream ms = new MemoryStream())
Assert.Throws(typeof(IOException), () =>
{
using (CompressionFactory.Reader((CompressionFactory.Type)archiveType, ms))
{
}
});
}
}
}

View File

@ -38,8 +38,7 @@ using XenCenterLib.Compression;
namespace XenAdminTests.CompressionTests
{
[Category(TestCategories.Unit)]
[TestFixture(typeof(DotNetZipGZipInputStream), typeof(DotNetZipGZipOutputStream))]
[TestFixture(typeof(DotNetZipBZip2InputStream), typeof(DotNetZipBZip2OutputStream))]
[TestFixture(typeof(GZipInputStream), typeof(GZipOutputStream))]
public class ThirdPartyCompressionTests<TI, TO>
where TI : CompressionStream, new()
where TO : CompressionStream, new()
@ -94,7 +93,7 @@ namespace XenAdminTests.CompressionTests
Directory.Delete(basePath, true);
}
private void DecompressAFile( string targetFileName, string compressedFileName)
private void DecompressAFile(string targetFileName, string compressedFileName)
{
using (FileStream ifs = File.OpenRead(compressedFileName))
{

Binary file not shown.

View File

@ -133,9 +133,6 @@
<Compile Include="XenOvf\FileDigestTests.cs" />
</ItemGroup>
<ItemGroup>
<None Include="TestResources\emptyfile.bz2">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="TestResources\PluginResources\PowerShellTest.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>

View File

@ -47,7 +47,6 @@ namespace XenCenterLib.Archive
{
Tar,
TarGz,
TarBz2,
Zip
}
@ -62,13 +61,11 @@ namespace XenCenterLib.Archive
public static ArchiveIterator Reader(Type archiveType, Stream packagedData)
{
if (archiveType == Type.Tar)
return new SharpZipTarArchiveIterator(packagedData);
return new TarArchiveIterator(packagedData);
if (archiveType == Type.TarGz)
return new SharpZipTarArchiveIterator(packagedData, CompressionFactory.Type.Gz);
if (archiveType == Type.TarBz2)
return new SharpZipTarArchiveIterator(packagedData, CompressionFactory.Type.Bz2);
return new TarArchiveIterator(packagedData, CompressionFactory.Type.Gz);
if (archiveType == Type.Zip)
return new DotNetZipZipIterator(packagedData);
return new ZipArchiveIterator(packagedData);
throw new NotSupportedException($"Type {archiveType} is not supported by ArchiveIterator");
}
@ -83,9 +80,9 @@ namespace XenCenterLib.Archive
public static ArchiveWriter Writer(Type archiveType, Stream targetPackage)
{
if (archiveType == Type.Tar)
return new SharpZipTarArchiveWriter(targetPackage);
return new TarArchiveWriter(targetPackage);
if (archiveType == Type.Zip)
return new DotNetZipZipWriter(targetPackage);
return new ZipArchiveWriter(targetPackage);
throw new NotSupportedException($"Type {archiveType} is not supported by ArchiveWriter");
}

View File

@ -37,23 +37,17 @@ using XenCenterLib.Compression;
namespace XenCenterLib.Archive
{
public class SharpZipTarArchiveIterator : ArchiveIterator
public class TarArchiveIterator : ArchiveIterator
{
private TarInputStream tarStream;
private CompressionStream compressionStream;
private TarEntry tarEntry;
private bool disposed;
public SharpZipTarArchiveIterator()
{
}
public SharpZipTarArchiveIterator(Stream compressedTarFile, CompressionFactory.Type compressionType)
public TarArchiveIterator(Stream compressedTarFile, CompressionFactory.Type compressionType)
{
if (compressionType == CompressionFactory.Type.Gz)
compressionStream = CompressionFactory.Reader(CompressionFactory.Type.Gz, compressedTarFile);
else if (compressionType == CompressionFactory.Type.Bz2)
compressionStream = CompressionFactory.Reader(CompressionFactory.Type.Bz2, compressedTarFile);
else
throw new NotSupportedException($"Type {compressionType} is not supported by ArchiveIterator");
@ -61,7 +55,7 @@ namespace XenCenterLib.Archive
disposed = false;
}
public SharpZipTarArchiveIterator(Stream tarFile)
public TarArchiveIterator(Stream tarFile)
{
tarStream = new TarInputStream(tarFile);
disposed = false;
@ -73,7 +67,7 @@ namespace XenCenterLib.Archive
disposed = false;
}
~SharpZipTarArchiveIterator()
~TarArchiveIterator()
{
Dispose();
}

View File

@ -37,7 +37,7 @@ using ICSharpCode.SharpZipLib.Tar;
namespace XenCenterLib.Archive
{
public class SharpZipTarArchiveWriter : ArchiveWriter
public class TarArchiveWriter : ArchiveWriter
{
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -45,11 +45,11 @@ namespace XenCenterLib.Archive
private const long bufferSize = 32 * 1024;
private bool disposed;
public SharpZipTarArchiveWriter()
public TarArchiveWriter()
{
}
public SharpZipTarArchiveWriter(Stream outputStream)
public TarArchiveWriter(Stream outputStream)
{
tar = new TarOutputStream(outputStream);
disposed = false;

View File

@ -32,83 +32,49 @@
using System;
using System.Collections.Generic;
using System.IO;
using Ionic.Zip;
using System.IO.Compression;
namespace XenCenterLib.Archive
{
public class DotNetZipZipIterator : ArchiveIterator
public class ZipArchiveIterator : ArchiveIterator
{
private ZipFile zipFile;
private IEnumerator<ZipEntry> enumerator;
private ZipEntry zipEntry;
private bool disposed;
private ZipArchive _zipArchive;
private IEnumerator<ZipArchiveEntry> _enumerator;
private ZipArchiveEntry _currentEntry;
private int _currentPosition = -1;
private bool _disposed;
/// <summary>
/// delegate params: long bytesTransferred, long totalBytesToTransfer
/// index of current file, total file count
/// </summary>
public event Action<long, long> CurrentFileExtractProgressChanged;
public event Action CurrentFileExtractCompleted;
public event Action<int, int> CurrentFileExtracted;
public DotNetZipZipIterator()
public ZipArchiveIterator(Stream inputStream)
{
}
public DotNetZipZipIterator(Stream inputStream)
{
Initialise(inputStream);
disposed = false;
}
void zipFile_ExtractProgress(object sender, ExtractProgressEventArgs e)
{
switch (e.EventType)
{
case ZipProgressEventType.Extracting_EntryBytesWritten:
{
var handler = CurrentFileExtractProgressChanged;
handler?.Invoke(e.BytesTransferred, e.TotalBytesToTransfer);
}
break;
case ZipProgressEventType.Extracting_AfterExtractEntry:
{
var handler = CurrentFileExtractCompleted;
handler?.Invoke();
}
break;
}
}
private void Initialise(Stream zipStream)
{
try
{
zipFile = ZipFile.Read(zipStream);
}
catch (ZipException e)
{
throw new ArgumentException("Cannot read input as a ZipFile", "zipStream", e);
}
enumerator = zipFile.GetEnumerator();
zipFile.ExtractProgress += zipFile_ExtractProgress;
_zipArchive = new ZipArchive(inputStream, ZipArchiveMode.Read);
_enumerator = _zipArchive.Entries.GetEnumerator();
}
public override void SetBaseStream(Stream inputStream)
{
Initialise(inputStream);
disposed = false;
_zipArchive = new ZipArchive(inputStream, ZipArchiveMode.Read);
_enumerator = _zipArchive.Entries.GetEnumerator();
_disposed = false;
_currentPosition = -1;
}
~DotNetZipZipIterator()
~ZipArchiveIterator()
{
Dispose();
}
public override bool HasNext()
{
if (enumerator != null && enumerator.MoveNext())
if (_enumerator != null && _enumerator.MoveNext())
{
zipEntry = enumerator.Current;
_currentPosition++;
_currentEntry = _enumerator.Current;
return true;
}
return false;
@ -116,34 +82,23 @@ namespace XenCenterLib.Archive
public override string CurrentFileName()
{
if (zipEntry == null)
return String.Empty;
return zipEntry.FileName;
return _currentEntry == null ? string.Empty : _currentEntry.FullName;
}
public override long CurrentFileSize()
{
if (zipEntry == null)
return 0;
return zipEntry.UncompressedSize;
return _currentEntry?.Length ?? 0;
}
public override DateTime CurrentFileModificationTime()
{
if (zipEntry == null)
return new DateTime();
return zipEntry.LastModified;
return _currentEntry == null ? new DateTime() : _currentEntry.LastWriteTime.DateTime;
}
public override bool IsDirectory()
{
if (zipEntry == null)
return false;
return zipEntry.IsDirectory;
var attr = (FileAttributes)(_currentEntry.ExternalAttributes & 0xff);
return attr.HasFlag(FileAttributes.Directory);
}
public override void ExtractCurrentFile(Stream extractedFileContents, Action cancellingDelegate)
@ -151,25 +106,21 @@ namespace XenCenterLib.Archive
if (IsDirectory())
return;
zipEntry.Extract(extractedFileContents);
using (var entryStream = _currentEntry.Open())
StreamUtilities.BufferedStreamCopy(entryStream, extractedFileContents);
CurrentFileExtracted?.Invoke(_currentPosition, _zipArchive.Entries.Count);
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if(disposing)
if (disposing && !_disposed)
{
if(!disposed)
{
if (zipFile != null)
{
zipFile.ExtractProgress -= zipFile_ExtractProgress;
zipFile.Dispose();
}
disposed = true;
}
_zipArchive.Dispose();
_disposed = true;
}
base.Dispose(disposing);
}
}
}

View File

@ -31,72 +31,58 @@
using System;
using System.IO;
using System.Text;
using Ionic.Zip;
using System.IO.Compression;
namespace XenCenterLib.Archive
{
class DotNetZipZipWriter : ArchiveWriter
internal class ZipArchiveWriter : ArchiveWriter
{
private ZipOutputStream zip;
private bool disposed;
private ZipArchive _zipArchive;
private bool _disposed;
public DotNetZipZipWriter(Stream outputStream)
{
zip = new ZipOutputStream( outputStream ) {EnableZip64 = Zip64Option.AsNecessary};
disposed = false;
}
public DotNetZipZipWriter()
public ZipArchiveWriter(Stream outputStream)
{
_zipArchive = new ZipArchive(outputStream, ZipArchiveMode.Create);
}
public override void SetBaseStream(Stream outputStream)
{
zip = new ZipOutputStream(outputStream);
disposed = false;
_zipArchive = new ZipArchive(outputStream, ZipArchiveMode.Create);
_disposed = false;
}
public override void AddDirectory(string directoryName, DateTime modificationTime)
{
StringBuilder sb = new StringBuilder(directoryName);
//Need to add a trailing front-slash to add a directory
if (!directoryName.EndsWith("/"))
sb.Append("/");
directoryName += "/";
ZipEntry entry = zip.PutNextEntry(sb.ToString());
entry.ModifiedTime = modificationTime;
var entry = _zipArchive.CreateEntry(directoryName);
entry.LastWriteTime = modificationTime;
}
public override void Add(Stream filetoAdd, string fileName, DateTime modificationTime, Action cancellingDelegate)
public override void Add(Stream fileToAdd, string fileName, DateTime modificationTime, Action cancellingDelegate)
{
ZipEntry entry = zip.PutNextEntry(fileName);
entry.ModifiedTime = modificationTime;
var entry = _zipArchive.CreateEntry(fileName);
entry.LastWriteTime = modificationTime;
//You have to do this because if using a memory stream the pointer will be at the end it
//it's just been read and this will cause nothing to be written out
filetoAdd.Position = 0;
fileToAdd.Position = 0;
StreamUtilities.BufferedStreamCopy( filetoAdd, zip );
zip.Flush();
using (var entryStream = entry.Open())
StreamUtilities.BufferedStreamCopy(fileToAdd, entryStream);
}
protected override void Dispose(bool disposing)
{
if( !disposed )
if (disposing && !_disposed)
{
if (disposing)
{
if( zip != null )
{
zip.Flush();
zip.Dispose();
}
disposed = true;
}
_zipArchive?.Dispose();
_disposed = true;
}
base.Dispose(disposing);
}
}

View File

@ -1,80 +0,0 @@
/* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above
* copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
using System.IO;
using Ionic.BZip2;
namespace XenCenterLib.Compression
{
/// <summary>
/// A class that can compress a bzip2 data stream type
/// </summary>
class DotNetZipBZip2OutputStream : CompressionStream
{
public DotNetZipBZip2OutputStream()
{
}
public DotNetZipBZip2OutputStream(Stream inputStream)
{
zipStream = new BZip2OutputStream(inputStream);
}
public override void SetBaseStream(Stream baseStream)
{
zipStream = new BZip2OutputStream(baseStream);
}
}
/// <summary>
/// A class that can decompress a bzip2 data stream type
/// </summary>
class DotNetZipBZip2InputStream : CompressionStream
{
public DotNetZipBZip2InputStream()
{
}
public DotNetZipBZip2InputStream(Stream outputStream)
{
zipStream = new BZip2InputStream(outputStream);
}
public override void SetBaseStream(Stream outputStream)
{
zipStream = new BZip2InputStream(outputStream);
}
}
}

View File

@ -44,8 +44,7 @@ namespace XenCenterLib.Compression
/// </summary>
public enum Type
{
Gz,
Bz2
Gz
}
public static string StringOf(this Type t)
@ -54,8 +53,6 @@ namespace XenCenterLib.Compression
{
case Type.Gz:
return "Gzip";
case Type.Bz2:
return "BZip2";
default:
throw new ArgumentOutOfRangeException(nameof(t), t, null);
}
@ -67,8 +64,6 @@ namespace XenCenterLib.Compression
{
case Type.Gz:
return ".gz";
case Type.Bz2:
return ".bz2";
default:
throw new ArgumentOutOfRangeException(nameof(t), t, null);
}
@ -84,10 +79,7 @@ namespace XenCenterLib.Compression
public static CompressionStream Reader(Type compressionType, Stream compressedDataSource)
{
if (compressionType == Type.Gz)
return new DotNetZipGZipInputStream(compressedDataSource);
if (compressionType == Type.Bz2)
return new DotNetZipBZip2InputStream(compressedDataSource);
return new GZipInputStream(compressedDataSource);
throw new NotSupportedException(String.Format("Type: {0} is not supported by CompressionStream Reader", compressionType));
}
@ -102,10 +94,7 @@ namespace XenCenterLib.Compression
public static CompressionStream Writer(Type compressionType, Stream compressedDataTarget)
{
if (compressionType == Type.Gz)
return new DotNetZipGZipOutputStream(compressedDataTarget);
if (compressionType == Type.Bz2)
return new DotNetZipBZip2OutputStream(compressedDataTarget);
return new GZipOutputStream(compressedDataTarget);
throw new NotSupportedException(String.Format("Type: {0} is not supported by CompressionStream Writer", compressionType));
}

View File

@ -29,22 +29,17 @@
* SUCH DAMAGE.
*/
using Ionic.Zlib;
using System.IO;
using System.IO.Compression;
namespace XenCenterLib.Compression
{
/// <summary>
/// A class that can compress a bzip2 data stream type
/// A class that can compress a gzip data stream type
/// </summary>
class DotNetZipGZipOutputStream : CompressionStream
class GZipOutputStream : CompressionStream
{
public DotNetZipGZipOutputStream()
{
}
public DotNetZipGZipOutputStream(Stream outputStream)
public GZipOutputStream(Stream outputStream)
{
zipStream = new GZipStream(outputStream, CompressionMode.Compress);
}
@ -56,16 +51,11 @@ namespace XenCenterLib.Compression
}
/// <summary>
/// A class that can decompress a bzip2 data stream type
/// A class that can decompress a gzip data stream type
/// </summary>
class DotNetZipGZipInputStream : CompressionStream
class GZipInputStream : CompressionStream
{
public DotNetZipGZipInputStream()
{
}
public DotNetZipGZipInputStream(Stream inputStream)
public GZipInputStream(Stream inputStream)
{
zipStream = new GZipStream(inputStream, CompressionMode.Decompress);
}

View File

@ -39,9 +39,6 @@
<Reference Include="ICSharpCode.SharpZipLib, Version=0.85.4.404, Culture=neutral, PublicKeyToken=d247b8b0ac7959e9, processorArchitecture=MSIL">
<HintPath>..\packages\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
<Reference Include="Ionic.Zip, Version=1.9.1.8, Culture=neutral, PublicKeyToken=d247b8b0ac7959e9, processorArchitecture=MSIL">
<HintPath>..\packages\Ionic.Zip.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=2.0.15.0, Culture=neutral, PublicKeyToken=d247b8b0ac7959e9, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.dll</HintPath>
</Reference>
@ -49,6 +46,7 @@
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.IO.Compression" />
<Reference Include="System.Management" />
<Reference Include="System.Security" />
<Reference Include="System.Xml" />
@ -62,7 +60,6 @@
<Compile Include="Archive\TarSanitization.cs" />
<Compile Include="Archive\ZipArchiveIterator.cs" />
<Compile Include="Archive\ZipArchiveWriter.cs" />
<Compile Include="Compression\BZip2Streams.cs" />
<Compile Include="Compression\CompressionFactory.cs" />
<Compile Include="Compression\CompressionStream.cs" />
<Compile Include="Compression\GZipStreams.cs" />

View File

@ -298,7 +298,7 @@ namespace XenAdmin.Actions.OvfActions
// the compressed file will be replaced by the uncompressed, hence we need
// to use it with its disk extension (vmdk, vhd, etc.)
if (ext.ToLower().EndsWith(".gz") || ext.ToLower().EndsWith(".bz2"))
if (ext.ToLower().EndsWith(".gz"))
{
sourcefile = Path.Combine(pathToOvf, "unc_" + Path.GetFileNameWithoutExtension(filename));
ext = Path.GetExtension(sourcefile);

View File

@ -186,17 +186,17 @@ namespace XenAdmin.Actions
private void ExtractFile()
{
ArchiveIterator iterator = null;
DotNetZipZipIterator zipIterator = null;
ZipArchiveIterator zipIterator = null;
try
{
using (Stream stream = new FileStream(outputFileName, FileMode.Open, FileAccess.Read))
{
iterator = ArchiveFactory.Reader(ArchiveFactory.Type.Zip, stream);
zipIterator = iterator as DotNetZipZipIterator;
zipIterator = iterator as ZipArchiveIterator;
if (zipIterator != null)
zipIterator.CurrentFileExtractProgressChanged += archiveIterator_CurrentFileExtractProgressChanged;
zipIterator.CurrentFileExtracted += archiveIterator_CurrentFileExtracted;
while (iterator.HasNext())
{
@ -232,7 +232,7 @@ namespace XenAdmin.Actions
finally
{
if (zipIterator != null)
zipIterator.CurrentFileExtractProgressChanged -= archiveIterator_CurrentFileExtractProgressChanged;
zipIterator.CurrentFileExtracted -= archiveIterator_CurrentFileExtracted;
if (iterator != null)
iterator.Dispose();
@ -302,10 +302,11 @@ namespace XenAdmin.Actions
MarkCompleted();
}
void archiveIterator_CurrentFileExtractProgressChanged(long bytesTransferred, long totalBytesToTransfer)
private void archiveIterator_CurrentFileExtracted(int fileIndex, int totalFileCount)
{
int pc = downloadUpdate ? 95 + (int)(5.0 * bytesTransferred / totalBytesToTransfer) : (int)(100.0 * bytesTransferred / totalBytesToTransfer);
PercentComplete = pc;
PercentComplete = downloadUpdate
? 95 + (int)(5.0 * fileIndex / totalFileCount)
: (int)(100.0 * fileIndex / totalFileCount);
}
void client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)

View File

@ -71,11 +71,9 @@ namespace XenOvf
if (file.compression.ToLower() == "gzip")
method = CompressionFactory.Type.Gz;
else if (file.compression.ToLower() == "bzip2")
method = CompressionFactory.Type.Bz2;
else
{
log.ErrorFormat("File {0} uses unsupported method {1}. Must be Gzip or BZip2. Skipping.",
log.ErrorFormat("File {0} uses unsupported method {1}. Must be Gzip. Skipping.",
file.href, file.compression);
continue;
}

View File

@ -3431,7 +3431,7 @@ namespace XenOvf
/// <summary>
/// Find the filename for the given RASD.
/// The RASD must Resource Type: 17, 19, 21 and be a hard disk image.
/// The file may be compressed (gzip/bzip2)
/// The file may be compressed (gzip)
/// </summary>
public static string FindRasdFileName(EnvelopeType ovfEnv, RASD_Type rasd, out CompressionFactory.Type? compression)
{
@ -3482,12 +3482,6 @@ namespace XenOvf
return filer.href;
}
if (filer.compression.ToLower().Equals("bzip2"))
{
compression = CompressionFactory.Type.Bz2;
return filer.href;
}
throw new NotSupportedException(string.Format(Messages.COMPRESS_INVALID_METHOD, filer.compression));
}
}

View File

@ -229,8 +229,6 @@ namespace XenOvf
if (string.Compare(extension, ".gz", true) == 0)
_tarType = ArchiveFactory.Type.TarGz;
else if (string.Compare(extension, ".bz2", true) == 0)
_tarType = ArchiveFactory.Type.TarBz2;
}
public override string DescriptorFileName

View File

@ -129,7 +129,7 @@
</xs:attribute>
<xs:attribute name="compression" type="xs:string" default="" use="optional">
<xs:annotation>
<xs:documentation>Compression type (gzip, bzip2, or none if empty or not
<xs:documentation>Compression type (gzip, or none if empty or not
specified)</xs:documentation>
</xs:annotation>
</xs:attribute>

View File

@ -25,11 +25,6 @@
"target": "xenadmin.git/packages/",
"flat": "true"
},
{
"pattern": "@REMOTE_DOTNET@/dotnet48/Ionic.Zip.dll",
"target": "xenadmin.git/packages/",
"flat": "true"
},
{
"pattern": "@REMOTE_DOTNET@/dotnet48/log4net.dll",
"target": "xenadmin.git/packages/",

View File

@ -108,7 +108,6 @@ if [ -f "${SIGN_BAT}" ] ; then
cd ${REPO}/XenAdmin/bin/Release && ${SIGN_BAT} log4net.dll "Log4Net"
cd ${REPO}/XenAdmin/bin/Release && ${SIGN_BAT} ICSharpCode.SharpZipLib.dll "SharpZipLib"
cd ${REPO}/XenAdmin/bin/Release && ${SIGN_BAT} DiscUtils.dll "DiscUtils"
cd ${REPO}/XenAdmin/bin/Release && ${SIGN_BAT} Ionic.Zip.dll "OSS"
cd ${REPO}/XenServerHealthCheck/bin/Release && ${SIGN_BAT} XenServerHealthCheck.exe "${BRANDING_BRAND_CONSOLE}"
else
@ -116,7 +115,7 @@ else
fi
#copy files (signed accordingly) in XenServerHealthService folder
cp ${REPO}/XenAdmin/bin/Release/{CommandLib.dll,CoreUtilsLib.dll,XenModel.dll,CookComputing.XmlRpcV2.dll,Newtonsoft.Json.CH.dll,log4net.dll,ICSharpCode.SharpZipLib.dll,Ionic.Zip.dll} \
cp ${REPO}/XenAdmin/bin/Release/{CommandLib.dll,CoreUtilsLib.dll,XenModel.dll,CookComputing.XmlRpcV2.dll,Newtonsoft.Json.CH.dll,log4net.dll,ICSharpCode.SharpZipLib.dll} \
${REPO}/XenServerHealthCheck/bin/Release
#prepare wix