Skip to content

Commit

Permalink
Tweaked it again to keep the original property, we'll just return the…
Browse files Browse the repository at this point in the history
… first of each collection as the docs say zero or one.
  • Loading branch information
Lloyd Kinsella committed Jun 20, 2024
1 parent 0ec81f8 commit d7437e4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
12 changes: 8 additions & 4 deletions src/Workshell.PE.Resources/Version/VersionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,32 @@

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Workshell.PE.Resources.Version
{
public sealed class VersionInfo
{
private readonly IReadOnlyCollection<StringFileInfo> _strings;
private readonly IReadOnlyCollection<VarFileInfo> _variables;

internal VersionInfo(VersionResource resource, uint languageId, FixedFileInfo fixedInfo, IReadOnlyCollection<StringFileInfo> stringInfo, IReadOnlyCollection<VarFileInfo> varInfo)
{
Resource = resource;
Language = languageId;
Fixed = fixedInfo;
Strings = stringInfo;
Variables = varInfo;
_strings = stringInfo;
_variables = varInfo;
}

#region Properties

public VersionResource Resource { get; }
public ResourceLanguage Language { get; }
public FixedFileInfo Fixed { get; }
public IReadOnlyCollection<StringFileInfo> Strings { get; }
public IReadOnlyCollection<VarFileInfo> Variables { get; }
public StringFileInfo Strings => _strings.FirstOrDefault();
public VarFileInfo Variables => _variables.FirstOrDefault();

#endregion
}
Expand Down
3 changes: 2 additions & 1 deletion src/Workshell.PE.Resources/Version/VersionResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ await mem.ReadBytesAsync(count)
throw new Exception("Invalid file version information.");
}

await AlignWordBoundaryAsync(mem).ConfigureAwait(false);
await AlignWordBoundaryAsync(mem)
.ConfigureAwait(false);

var ffiData = await mem.ReadStructAsync<VS_FIXEDFILEINFO>()
.ConfigureAwait(false);
Expand Down

0 comments on commit d7437e4

Please sign in to comment.