Skip to content

Commit

Permalink
🐛 GetManifestResource
Browse files Browse the repository at this point in the history
  • Loading branch information
AigioL committed Jun 18, 2024
1 parent ce06331 commit fedc2cc
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
2 changes: 1 addition & 1 deletion SevenZip/LibraryManager.BinaryResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,6 @@
_ => [],
};
""")]
partial class LibraryManager
partial class SevenZipLibraryManager
{
}
2 changes: 1 addition & 1 deletion SevenZip/LibraryManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ public static bool ModifyCapable

private static unsafe bool ExtractionBenchmark(string archiveFileName, Stream outStream, ref LibraryFeature? features, LibraryFeature testedFeature)
{
var bytes = LibraryManager.GetManifestResource(archiveFileName, "arch");
var bytes = SevenZipLibraryManager.GetManifestResource(archiveFileName, "arch");

Check failure on line 292 in SevenZip/LibraryManager.cs

View workflow job for this annotation

GitHub Actions / build (Release)

'SevenZipLibraryManager' does not contain a definition for 'GetManifestResource'
var bytes_span = bytes.AsSpan();
bytes_span.Reverse();
fixed (byte* ptr = bytes)
Expand Down
21 changes: 16 additions & 5 deletions SevenZip/SevenZipSfx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ private static SfxModule GetModuleByName(string name)
/// <param name="xmlDefinitions_xsd">The resource name for xsd definitions</param>
private unsafe void LoadCommandsFromResource(string xmlDefinitions_xml, string xmlDefinitions_xsd)
{
var bytes_cfg = LibraryManager.GetManifestResource(xmlDefinitions_xml, "sfx");
var bytes_cfg = SevenZipLibraryManager.GetManifestResource(xmlDefinitions_xml, "sfx");

Check failure on line 182 in SevenZip/SevenZipSfx.cs

View workflow job for this annotation

GitHub Actions / build (Release)

'SevenZipLibraryManager' does not contain a definition for 'GetManifestResource'
var bytes_cfg_span = bytes_cfg.AsSpan();
bytes_cfg_span.Reverse();
fixed (byte* ptr_cfg = bytes_cfg)
Expand All @@ -194,7 +194,7 @@ private unsafe void LoadCommandsFromResource(string xmlDefinitions_xml, string x

using UnmanagedMemoryStream cfg = new(ptr_cfg, bytes_cfg.Length);

var bytes_schm = LibraryManager.GetManifestResource(xmlDefinitions_xsd, "sfx");
var bytes_schm = SevenZipLibraryManager.GetManifestResource(xmlDefinitions_xsd, "sfx");

Check failure on line 197 in SevenZip/SevenZipSfx.cs

View workflow job for this annotation

GitHub Actions / build (Release)

'SevenZipLibraryManager' does not contain a definition for 'GetManifestResource'
var bytes_schm_span = bytes_schm.AsSpan();
bytes_schm_span.Reverse();
fixed (byte* ptr_schm = bytes_schm)
Expand Down Expand Up @@ -435,7 +435,7 @@ public void MakeSfx(Stream archive, SfxSettings settings, string sfxFileName)
/// <param name="archive">The archive stream.</param>
/// <param name="settings">The sfx settings.</param>
/// <param name="sfxStream">The stream to write the self-extracting executable to.</param>
public void MakeSfx(Stream archive, SfxSettings settings, Stream sfxStream)
public unsafe void MakeSfx(Stream archive, SfxSettings settings, Stream sfxStream)
{
if (!sfxStream.CanWrite)
{
Expand All @@ -444,9 +444,20 @@ public void MakeSfx(Stream archive, SfxSettings settings, Stream sfxStream)

ValidateSettings(settings);

using (var sfx = Assembly.GetExecutingAssembly().GetManifestResourceStream(GetResourceString(SfxSupportedModuleNames[SfxModule][0])))
var bytes_sfx = SevenZipLibraryManager.GetManifestResource(SfxSupportedModuleNames[SfxModule][0], "sfx");

Check failure on line 447 in SevenZip/SevenZipSfx.cs

View workflow job for this annotation

GitHub Actions / build (Release)

'SevenZipLibraryManager' does not contain a definition for 'GetManifestResource'
var bytes_sfx_span = bytes_sfx.AsSpan();
bytes_sfx_span.Reverse();
fixed (byte* ptr_sfx = bytes_sfx)
{
WriteStream(sfx, sfxStream);
try
{
using UnmanagedMemoryStream sfx = new(ptr_sfx, bytes_sfx.Length);
WriteStream(sfx, sfxStream);
}
finally
{
bytes_sfx_span.Clear();
}
}

if (SfxModule == SfxModule.Custom || _sfxCommands[SfxModule] != null)
Expand Down

0 comments on commit fedc2cc

Please sign in to comment.