Rename CopyToStream to GetEntryStream

This commit is contained in:
Matt Nadareski
2024-07-15 21:37:38 -04:00
parent e29610de4b
commit 8af80b79af
13 changed files with 20 additions and 20 deletions

View File

@@ -746,7 +746,7 @@ namespace SabreTools.DatTools
if (archive != null)
{
ItemType itemType = datItem.GetStringFieldValue(Models.Metadata.DatItem.TypeKey).AsEnumValue<ItemType>();
(stream, _) = archive.CopyToStream(datItem.GetName() ?? itemType.AsStringValue() ?? string.Empty);
(stream, _) = archive.GetEntryStream(datItem.GetName() ?? itemType.AsStringValue() ?? string.Empty);
}
}
// Otherwise, just open the filestream

View File

@@ -130,7 +130,7 @@ namespace SabreTools.FileTypes.Archives
public override string? CopyToFile(string entryName, string outDir)
{
// Try to extract a stream using the given information
(Stream? ms, string? realEntry) = CopyToStream(entryName);
(Stream? ms, string? realEntry) = GetEntryStream(entryName);
// If the stream and the entry name are both non-null, we write to file
if (ms != null && realEntry != null)
@@ -170,7 +170,7 @@ namespace SabreTools.FileTypes.Archives
}
/// <inheritdoc/>
public override (Stream?, string?) CopyToStream(string entryName)
public override (Stream?, string?) GetEntryStream(string entryName)
{
var ms = new MemoryStream();
string? realEntry;

View File

@@ -49,7 +49,7 @@ namespace SabreTools.FileTypes.Archives
}
/// <inheritdoc/>
public override (Stream?, string?) CopyToStream(string entryName)
public override (Stream?, string?) GetEntryStream(string entryName)
{
throw new NotImplementedException();
}

View File

@@ -49,7 +49,7 @@ namespace SabreTools.FileTypes.Archives
}
/// <inheritdoc/>
public override (Stream?, string?) CopyToStream(string entryName)
public override (Stream?, string?) GetEntryStream(string entryName)
{
throw new NotImplementedException();
}

View File

@@ -96,7 +96,7 @@ namespace SabreTools.FileTypes.Archives
public override string? CopyToFile(string entryName, string outDir)
{
// Try to extract a stream using the given information
(Stream? ms, string? realEntry) = CopyToStream(entryName);
(Stream? ms, string? realEntry) = GetEntryStream(entryName);
// If the stream and the entry name are both non-null, we write to file
if (ms != null && realEntry != null)
@@ -134,7 +134,7 @@ namespace SabreTools.FileTypes.Archives
}
/// <inheritdoc/>
public override (Stream?, string?) CopyToStream(string entryName)
public override (Stream?, string?) GetEntryStream(string entryName)
{
#if NET462_OR_GREATER || NETCOREAPP
var ms = new MemoryStream();

View File

@@ -183,7 +183,7 @@ namespace SabreTools.FileTypes.Archives
public override string? CopyToFile(string entryName, string outDir)
{
// Try to extract a stream using the given information
(Stream? ms, string? realEntry) = CopyToStream(entryName);
(Stream? ms, string? realEntry) = GetEntryStream(entryName);
// If the stream and the entry name are both non-null, we write to file
if (ms != null && realEntry != null)
@@ -221,7 +221,7 @@ namespace SabreTools.FileTypes.Archives
}
/// <inheritdoc/>
public override (Stream?, string?) CopyToStream(string entryName)
public override (Stream?, string?) GetEntryStream(string entryName)
{
var ms = new MemoryStream();
string? realEntry = null;

View File

@@ -97,7 +97,7 @@ namespace SabreTools.FileTypes.Archives
public override string? CopyToFile(string entryName, string outDir)
{
// Try to extract a stream using the given information
(Stream? ms, string? realEntry) = CopyToStream(entryName);
(Stream? ms, string? realEntry) = GetEntryStream(entryName);
// If the stream and the entry name are both non-null, we write to file
if (ms != null && realEntry != null)
@@ -135,7 +135,7 @@ namespace SabreTools.FileTypes.Archives
}
/// <inheritdoc/>
public override (Stream?, string?) CopyToStream(string entryName)
public override (Stream?, string?) GetEntryStream(string entryName)
{
#if NET462_OR_GREATER || NETCOREAPP
var ms = new MemoryStream();

View File

@@ -114,7 +114,7 @@ namespace SabreTools.FileTypes.Archives
public override string? CopyToFile(string entryName, string outDir)
{
// Try to extract a stream using the given information
(Stream? ms, string? realEntry) = CopyToStream(entryName);
(Stream? ms, string? realEntry) = GetEntryStream(entryName);
// If the stream and the entry name are both non-null, we write to file
if (ms != null && realEntry != null)
@@ -152,7 +152,7 @@ namespace SabreTools.FileTypes.Archives
}
/// <inheritdoc/>
public override (Stream?, string?) CopyToStream(string entryName)
public override (Stream?, string?) GetEntryStream(string entryName)
{
#if NET462_OR_GREATER || NETCOREAPP
var ms = new MemoryStream();

View File

@@ -49,7 +49,7 @@ namespace SabreTools.FileTypes.Archives
}
/// <inheritdoc/>
public override (Stream?, string?) CopyToStream(string entryName)
public override (Stream?, string?) GetEntryStream(string entryName)
{
throw new NotImplementedException();
}

View File

@@ -158,7 +158,7 @@ namespace SabreTools.FileTypes.Archives
public override string? CopyToFile(string entryName, string outDir)
{
// Try to extract a stream using the given information
(Stream? ms, string? realEntry) = CopyToStream(entryName);
(Stream? ms, string? realEntry) = GetEntryStream(entryName);
// If the stream and the entry name are both non-null, we write to file
if (ms != null && realEntry != null)
@@ -196,7 +196,7 @@ namespace SabreTools.FileTypes.Archives
}
/// <inheritdoc/>
public override (Stream?, string?) CopyToStream(string entryName)
public override (Stream?, string?) GetEntryStream(string entryName)
{
var ms = new MemoryStream();
string? realEntry = null;

View File

@@ -49,7 +49,7 @@ namespace SabreTools.FileTypes.Archives
}
/// <inheritdoc/>
public override (Stream?, string?) CopyToStream(string entryName)
public override (Stream?, string?) GetEntryStream(string entryName)
{
throw new NotImplementedException();
}

View File

@@ -121,7 +121,7 @@ namespace SabreTools.FileTypes
public override abstract string? CopyToFile(string entryName, string outDir);
/// <inheritdoc/>
public override abstract (Stream?, string?) CopyToStream(string entryName);
public override abstract (Stream?, string?) GetEntryStream(string entryName);
#endregion

View File

@@ -209,8 +209,8 @@ namespace SabreTools.FileTypes
/// Attempt to extract a stream from an archive
/// </summary>
/// <param name="entryName">Name of the entry to be extracted</param>
/// <returns>MemoryStream representing the entry, null on error</returns>
public virtual (Stream?, string?) CopyToStream(string entryName)
/// <returns>Stream representing the entry, null on error</returns>
public virtual (Stream?, string?) GetEntryStream(string entryName)
{
var ms = new MemoryStream();
string? realentry = null;