mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-09-22 14:55:11 +00:00
Extraction tool can pretend everything works
This commit is contained in:
@@ -101,12 +101,7 @@ namespace ExtractionTool
|
||||
{
|
||||
// 7-zip
|
||||
case SevenZip sz:
|
||||
#if NET20 || NET35 || NET40 || NET452
|
||||
Console.WriteLine("Extraction is not supported for this framework!");
|
||||
Console.WriteLine();
|
||||
#else
|
||||
sz.Extract(outputDirectory, includeDebug);
|
||||
#endif
|
||||
break;
|
||||
|
||||
// BFPK archive
|
||||
@@ -126,12 +121,7 @@ namespace ExtractionTool
|
||||
|
||||
// CFB
|
||||
case CFB cfb:
|
||||
#if NET20 || NET35
|
||||
Console.WriteLine("Extraction is not supported for this framework!");
|
||||
Console.WriteLine();
|
||||
#else
|
||||
cfb.Extract(outputDirectory, includeDebug);
|
||||
#endif
|
||||
break;
|
||||
|
||||
// GCF
|
||||
@@ -176,15 +166,9 @@ namespace ExtractionTool
|
||||
MicrosoftCabinet.ExtractSet(file, outputDirectory, includeDebug);
|
||||
break;
|
||||
|
||||
// MoPaQ (MPQ) archive -- Reimplement
|
||||
// MoPaQ (MPQ) archive
|
||||
case MoPaQ mpq:
|
||||
#if NET20 || NET35 || !(WINX86 || WINX64)
|
||||
Console.WriteLine("Extraction is not supported for this framework!");
|
||||
Console.WriteLine();
|
||||
#else
|
||||
Console.WriteLine("Extraction needs to be reimplemented for this framework!");
|
||||
Console.WriteLine();
|
||||
#endif
|
||||
mpq.Extract(outputDirectory, includeDebug);
|
||||
break;
|
||||
|
||||
// New Executable
|
||||
@@ -204,12 +188,7 @@ namespace ExtractionTool
|
||||
|
||||
// PKZIP
|
||||
case PKZIP pkzip:
|
||||
#if NET20 || NET35 || NET40 || NET452
|
||||
Console.WriteLine("Extraction is not supported for this framework!");
|
||||
Console.WriteLine();
|
||||
#else
|
||||
pkzip.Extract(outputDirectory, includeDebug);
|
||||
#endif
|
||||
break;
|
||||
|
||||
// Portable Executable
|
||||
@@ -224,12 +203,7 @@ namespace ExtractionTool
|
||||
|
||||
// RAR
|
||||
case RAR rar:
|
||||
#if NET20 || NET35 || NET40 || NET452
|
||||
Console.WriteLine("Extraction is not supported for this framework!");
|
||||
Console.WriteLine();
|
||||
#else
|
||||
rar.Extract(outputDirectory, includeDebug);
|
||||
#endif
|
||||
break;
|
||||
|
||||
// SGA
|
||||
@@ -259,12 +233,7 @@ namespace ExtractionTool
|
||||
|
||||
// xz
|
||||
case XZ xz:
|
||||
#if NET20 || NET35 || NET40 || NET452
|
||||
Console.WriteLine("Extraction is not supported for this framework!");
|
||||
Console.WriteLine();
|
||||
#else
|
||||
xz.Extract(outputDirectory, includeDebug);
|
||||
#endif
|
||||
break;
|
||||
|
||||
// XZP
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
using System.IO;
|
||||
using System;
|
||||
using System.IO;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Wrappers
|
||||
{
|
||||
public partial class MoPaQ : WrapperBase<Models.MoPaQ.Archive>
|
||||
public partial class MoPaQ : WrapperBase<Models.MoPaQ.Archive>, IExtractable
|
||||
{
|
||||
#region Descriptive Properties
|
||||
|
||||
@@ -78,5 +80,24 @@ namespace SabreTools.Serialization.Wrappers
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Extraction
|
||||
|
||||
/// <inheritdoc/>
|
||||
/// TODO: Reimplement extraction based on StormLibSharp
|
||||
public bool Extract(string outputDirectory, bool includeDebug)
|
||||
{
|
||||
#if NET20 || NET35 || !(WINX86 || WINX64)
|
||||
Console.WriteLine("Extraction is not supported for this framework!");
|
||||
Console.WriteLine();
|
||||
return false;
|
||||
#else
|
||||
Console.WriteLine("Extraction needs to be reimplemented for this framework!");
|
||||
Console.WriteLine();
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,6 +203,8 @@ namespace SabreTools.Serialization.Wrappers
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
Console.WriteLine("Extraction is not supported for this framework!");
|
||||
Console.WriteLine();
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -133,6 +133,8 @@ namespace SabreTools.Serialization.Wrappers
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
Console.WriteLine("Extraction is not supported for this framework!");
|
||||
Console.WriteLine();
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -135,6 +135,8 @@ namespace SabreTools.Serialization.Wrappers
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
Console.WriteLine("Extraction is not supported for this framework!");
|
||||
Console.WriteLine();
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
#if NET462_OR_GREATER || NETCOREAPP
|
||||
@@ -87,17 +88,19 @@ namespace SabreTools.Serialization.Wrappers
|
||||
/// <inheritdoc/>
|
||||
public bool Extract(string outputDirectory, bool includeDebug)
|
||||
{
|
||||
#if NET462_OR_GREATER || NETCOREAPP
|
||||
if (_dataSource == null || !_dataSource.CanRead)
|
||||
return false;
|
||||
|
||||
#if NET462_OR_GREATER || NETCOREAPP
|
||||
try
|
||||
{
|
||||
// Try opening the stream
|
||||
using var xzFile = new XZStream(_dataSource);
|
||||
|
||||
// Ensure directory separators are consistent
|
||||
string filename = System.Guid.NewGuid().ToString();
|
||||
string filename = Filename != null
|
||||
? Path.GetFileNameWithoutExtension(Filename)
|
||||
: Guid.NewGuid().ToString();
|
||||
if (Path.DirectorySeparatorChar == '\\')
|
||||
filename = filename.Replace('/', '\\');
|
||||
else if (Path.DirectorySeparatorChar == '/')
|
||||
@@ -116,12 +119,14 @@ namespace SabreTools.Serialization.Wrappers
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (includeDebug) System.Console.Error.WriteLine(ex);
|
||||
if (includeDebug) Console.Error.WriteLine(ex);
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
Console.WriteLine("Extraction is not supported for this framework!");
|
||||
Console.WriteLine();
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user