mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[ArchiveTools] Rename variables
This commit is contained in:
@@ -238,23 +238,23 @@ namespace SabreTools.Helper
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Attempt to copy a file between archives
|
/// Attempt to copy a file between archives
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="inputarc">Source archive name</param>
|
/// <param name="inputArchive">Source archive name</param>
|
||||||
/// <param name="outputarc">Destination archive name</param>
|
/// <param name="outputArchive">Destination archive name</param>
|
||||||
/// <param name="inentryname">Input entry name</param>
|
/// <param name="sourceEntryName">Input entry name</param>
|
||||||
/// <param name="outentryname">Output entry name</param>
|
/// <param name="destEntryName">Output entry name</param>
|
||||||
/// <param name="logger">Logger object for file and console output</param>
|
/// <param name="logger">Logger object for file and console output</param>
|
||||||
/// <returns>True if the copy was a success, false otherwise</returns>
|
/// <returns>True if the copy was a success, false otherwise</returns>
|
||||||
public static bool CopyFileBetweenArchives(string inputarc, string outputarc,
|
public static bool CopyFileBetweenArchives(string inputArchive, string outputArchive,
|
||||||
string inentryname, string outentryname, Logger logger)
|
string sourceEntryName, string destEntryName, Logger logger)
|
||||||
{
|
{
|
||||||
bool success = false;
|
bool success = false;
|
||||||
|
|
||||||
// First get the archive types
|
// First get the archive types
|
||||||
ArchiveType? iat = GetCurrentArchiveType(inputarc, logger);
|
ArchiveType? iat = GetCurrentArchiveType(inputArchive, logger);
|
||||||
ArchiveType? oat = (File.Exists(outputarc) ? GetCurrentArchiveType(outputarc, logger) : ArchiveType.Zip);
|
ArchiveType? oat = (File.Exists(outputArchive) ? GetCurrentArchiveType(outputArchive, logger) : ArchiveType.Zip);
|
||||||
|
|
||||||
// If we got back null (or the output is not a Zipfile), then it's not an archive, so we we return
|
// If we got back null (or the output is not a Zipfile), then it's not an archive, so we we return
|
||||||
if (iat == null || (oat == null || oat != ArchiveType.Zip) || inputarc == outputarc)
|
if (iat == null || (oat == null || oat != ArchiveType.Zip) || inputArchive == outputArchive)
|
||||||
{
|
{
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
@@ -263,27 +263,27 @@ namespace SabreTools.Helper
|
|||||||
ZipArchive outarchive = null;
|
ZipArchive outarchive = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
reader = ReaderFactory.Open(File.OpenRead(inputarc));
|
reader = ReaderFactory.Open(File.OpenRead(inputArchive));
|
||||||
|
|
||||||
if (iat == ArchiveType.Zip || iat == ArchiveType.SevenZip || iat == ArchiveType.Rar)
|
if (iat == ArchiveType.Zip || iat == ArchiveType.SevenZip || iat == ArchiveType.Rar)
|
||||||
{
|
{
|
||||||
while (reader.MoveToNextEntry())
|
while (reader.MoveToNextEntry())
|
||||||
{
|
{
|
||||||
logger.Log("Current entry name: '" + reader.Entry.Key + "'");
|
logger.Log("Current entry name: '" + reader.Entry.Key + "'");
|
||||||
if (reader.Entry != null && reader.Entry.Key.Contains(inentryname))
|
if (reader.Entry != null && reader.Entry.Key.Contains(sourceEntryName))
|
||||||
{
|
{
|
||||||
if (!File.Exists(outputarc))
|
if (!File.Exists(outputArchive))
|
||||||
{
|
{
|
||||||
outarchive = ZipFile.Open(outputarc, ZipArchiveMode.Create);
|
outarchive = ZipFile.Open(outputArchive, ZipArchiveMode.Create);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
outarchive = ZipFile.Open(outputarc, ZipArchiveMode.Update);
|
outarchive = ZipFile.Open(outputArchive, ZipArchiveMode.Update);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (outarchive.Mode == ZipArchiveMode.Create || outarchive.GetEntry(outentryname) == null)
|
if (outarchive.Mode == ZipArchiveMode.Create || outarchive.GetEntry(destEntryName) == null)
|
||||||
{
|
{
|
||||||
ZipArchiveEntry iae = outarchive.CreateEntry(outentryname, CompressionLevel.Optimal) as ZipArchiveEntry;
|
ZipArchiveEntry iae = outarchive.CreateEntry(destEntryName, CompressionLevel.Optimal) as ZipArchiveEntry;
|
||||||
|
|
||||||
using (Stream iaestream = iae.Open())
|
using (Stream iaestream = iae.Open())
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user