From ec94c6e913438ee5c8ba38baea3f40a42efe4fd7 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sat, 1 Jul 2017 03:26:31 +0100 Subject: [PATCH] Filename should not include compressed extension. --- DiscImageChef.Filters/BZip2.cs | 8 +++++++- DiscImageChef.Filters/GZip.cs | 8 +++++++- DiscImageChef.Filters/LZip.cs | 8 +++++++- DiscImageChef.Filters/XZ.cs | 8 +++++++- 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/DiscImageChef.Filters/BZip2.cs b/DiscImageChef.Filters/BZip2.cs index 1bdcade7e..2afc32a5d 100644 --- a/DiscImageChef.Filters/BZip2.cs +++ b/DiscImageChef.Filters/BZip2.cs @@ -221,7 +221,13 @@ namespace DiscImageChef.Filters public override string GetFilename() { - return basePath != null ? Path.GetFileName(basePath) : null; + if(basePath == null) + return null; + if(basePath.EndsWith(".bz2", StringComparison.InvariantCultureIgnoreCase)) + return basePath.Substring(0, basePath.Length - 4); + if(basePath.EndsWith(".bzip2", StringComparison.InvariantCultureIgnoreCase)) + return basePath.Substring(0, basePath.Length - 6); + return basePath; } public override string GetParentFolder() diff --git a/DiscImageChef.Filters/GZip.cs b/DiscImageChef.Filters/GZip.cs index bd778d30e..2c22e700a 100644 --- a/DiscImageChef.Filters/GZip.cs +++ b/DiscImageChef.Filters/GZip.cs @@ -225,7 +225,13 @@ namespace DiscImageChef.Filters public override string GetFilename() { - return basePath != null ? Path.GetFileName(basePath) : null; + if(basePath == null) + return null; + if(basePath.EndsWith(".gz", StringComparison.InvariantCultureIgnoreCase)) + return basePath.Substring(0, basePath.Length - 3); + if(basePath.EndsWith(".gzip", StringComparison.InvariantCultureIgnoreCase)) + return basePath.Substring(0, basePath.Length - 5); + return basePath; } public override string GetParentFolder() diff --git a/DiscImageChef.Filters/LZip.cs b/DiscImageChef.Filters/LZip.cs index c87a9948d..f0b58e564 100644 --- a/DiscImageChef.Filters/LZip.cs +++ b/DiscImageChef.Filters/LZip.cs @@ -193,7 +193,13 @@ namespace DiscImageChef.Filters public override string GetFilename() { - return basePath != null ? Path.GetFileName(basePath) : null; + if(basePath == null) + return null; + if(basePath.EndsWith(".lz", StringComparison.InvariantCultureIgnoreCase)) + return basePath.Substring(0, basePath.Length - 3); + if(basePath.EndsWith(".lzip", StringComparison.InvariantCultureIgnoreCase)) + return basePath.Substring(0, basePath.Length - 5); + return basePath; } public override string GetParentFolder() diff --git a/DiscImageChef.Filters/XZ.cs b/DiscImageChef.Filters/XZ.cs index 15ba8e67d..4889480fd 100644 --- a/DiscImageChef.Filters/XZ.cs +++ b/DiscImageChef.Filters/XZ.cs @@ -240,7 +240,13 @@ namespace DiscImageChef.Filters public override string GetFilename() { - return basePath != null ? Path.GetFileName(basePath) : null; + if(basePath == null) + return null; + if(basePath.EndsWith(".xz", StringComparison.InvariantCultureIgnoreCase)) + return basePath.Substring(0, basePath.Length - 3); + if(basePath.EndsWith(".xzip", StringComparison.InvariantCultureIgnoreCase)) + return basePath.Substring(0, basePath.Length - 5); + return basePath; } public override string GetParentFolder()