8 Commits

Author SHA1 Message Date
Matt Nadareski
b3f3f12b3e Use "main" instead of "master" 2024-02-27 19:06:26 -05:00
Matt Nadareski
b41700ff92 Update copyright date 2024-02-27 17:18:02 -05:00
Matt Nadareski
e8a357546b Add nuget package and PR workflows 2024-02-27 17:17:50 -05:00
Matt Nadareski
68f0201c11 Add SafeDisc encrypted file entry model 2023-11-30 19:11:52 -05:00
Matt Nadareski
25b6493249 Bump version 2023-11-21 11:15:24 -05:00
Matt Nadareski
a551363c0b Support .NET Framework 2.0 2023-11-20 23:44:05 -05:00
Matt Nadareski
2fd92aea8f Support .NET Framework 3.5 2023-11-20 21:10:43 -05:00
Matt Nadareski
a61b3d0ed9 Add IS Archive V3 models 2023-11-15 14:30:25 -05:00
11 changed files with 238 additions and 7 deletions

43
.github/workflows/build_nupkg.yml vendored Normal file
View File

@@ -0,0 +1,43 @@
name: Nuget Pack
on:
push:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Pack
run: dotnet pack
- name: Upload build
uses: actions/upload-artifact@v4
with:
name: 'Nuget Package'
path: 'bin/Release/*.nupkg'
- name: Upload to rolling
uses: ncipollo/release-action@v1.14.0
with:
allowUpdates: True
artifacts: 'bin/Release/*.nupkg'
body: 'Last built commit: ${{ github.sha }}'
name: 'Rolling Release'
prerelease: True
replacesArtifacts: True
tag: "rolling"
updateOnlyUnreleased: True

17
.github/workflows/check_pr.yml vendored Normal file
View File

@@ -0,0 +1,17 @@
name: Build PR
on: [pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Build
run: dotnet build

View File

@@ -0,0 +1,21 @@
namespace SabreTools.Models.InstallShieldArchiveV3
{
/// <see href="https://github.com/wfr/unshieldv3/blob/master/ISArchiveV3.cpp"/>
public class Archive
{
/// <summary>
/// Archive header information
/// </summary>
public Header? Header { get; set; }
/// <summary>
/// Directories found in the archive
/// </summary>
public Directory[]? Directories { get; set; }
/// <summary>
/// Files found in the archive
/// </summary>
public File[]? Files { get; set; }
}
}

View File

@@ -0,0 +1,10 @@
namespace SabreTools.Models.InstallShieldArchiveV3
{
/// <see href="https://github.com/wfr/unshieldv3/blob/master/ISArchiveV3.cpp"/>
public class Directory
{
public string? Name { get; set; }
public ushort FileCount { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
namespace SabreTools.Models.InstallShieldArchiveV3
{
public enum Attributes : byte
{
READONLY = 0x01,
HIDDEN = 0x02,
SYSTEM = 0x04,
UNCOMPRESSED = 0x10,
ARCHIVE = 0x20,
}
}

View File

@@ -0,0 +1,32 @@
namespace SabreTools.Models.InstallShieldArchiveV3
{
/// <see href="https://github.com/wfr/unshieldv3/blob/master/ISArchiveV3.h"/>
public class File
{
public byte VolumeEnd { get; set; }
public ushort Index { get; set; }
public uint UncompressedSize { get; set; }
public uint CompressedSize { get; set; }
public uint Offset { get; set; }
public uint DateTime { get; set; }
public uint Reserved0 { get; set; }
public ushort ChunkSize { get; set; }
public Attributes Attrib { get; set; }
public byte IsSplit { get; set; }
public byte Reserved1 { get; set; }
public byte VolumeStart { get; set; }
public string? Name { get; set; }
}
}

View File

@@ -0,0 +1,50 @@
namespace SabreTools.Models.InstallShieldArchiveV3
{
/// <see href="https://github.com/wfr/unshieldv3/blob/master/ISArchiveV3.h"/>
public class Header
{
public uint Signature1 { get; set; }
public uint Signature2 { get; set; }
public ushort Reserved0 { get; set; }
public ushort IsMultivolume { get; set; }
public ushort FileCount { get; set; }
public uint DateTime { get; set; }
public uint CompressedSize { get; set; }
public uint UncompressedSize { get; set; }
public uint Reserved1 { get; set; }
/// <remarks>
/// Set in first vol only, zero in subsequent vols
/// </remarks>
public byte VolumeTotal { get; set; }
/// <remarks>
/// [1...n]
/// </remarks>
public byte VolumeNumber { get; set; }
public byte Reserved2 { get; set; }
public uint SplitBeginAddress { get; set; }
public uint SplitEndAddress { get; set; }
public uint TocAddress { get; set; }
public uint Reserved3 { get; set; }
public ushort DirCount { get; set; }
public uint Reserved4 { get; set; }
public uint Reserved5 { get; set; }
}
}

View File

@@ -126,11 +126,11 @@ namespace SabreTools.Models.Metadata
string? asString = Read<string>(key);
if (asString != null)
return new string[] { asString };
return [asString];
asString = this[key]!.ToString();
if (asString != null)
return new string[] { asString };
return [asString];
return null;
}
@@ -140,7 +140,7 @@ namespace SabreTools.Models.Metadata
/// </summary>
private bool ValidateKey(string key)
{
if (string.IsNullOrWhiteSpace(key))
if (string.IsNullOrEmpty(key))
return false;
else if (!ContainsKey(key))
return false;

View File

@@ -2,17 +2,17 @@
<PropertyGroup>
<!-- Assembly Properties -->
<TargetFrameworks>net40;net452;net462;net472;net48;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>net20;net35;net40;net452;net462;net472;net48;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0</TargetFrameworks>
<RuntimeIdentifiers>win-x86;win-x64;win-arm64;linux-x64;linux-arm64;osx-x64;osx-arm64</RuntimeIdentifiers>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Version>1.2.0</Version>
<Version>1.3.0</Version>
<!-- Package Properties -->
<Authors>Matt Nadareski</Authors>
<Description>Common models used by other SabreTools projects</Description>
<Copyright>Copyright (c) Matt Nadareski 2022-2023</Copyright>
<Copyright>Copyright (c) Matt Nadareski 2022-2024</Copyright>
<PackageProjectUrl>https://github.com/SabreTools/</PackageProjectUrl>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RepositoryUrl>https://github.com/SabreTools/SabreTools.Models</RepositoryUrl>
@@ -22,10 +22,13 @@
</PropertyGroup>
<ItemGroup>
<None Include="README.md" Pack="true" PackagePath=""/>
<None Include="README.md" Pack="true" PackagePath="" />
</ItemGroup>
<!-- Support for old .NET versions -->
<ItemGroup Condition="$(TargetFramework.StartsWith(`net2`)) OR $(TargetFramework.StartsWith(`net3`))">
<PackageReference Include="MinValueTupleBridge" Version="0.2.0" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith(`net4`))">
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
</ItemGroup>

13
SafeDisc/Constants.cs Normal file
View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace SabreTools.Models.SafeDisc
{
public static class Constants
{
public const uint EncryptedFileEntrySignature1 = 0xA8726B03;
public const uint EncryptedFileEntrySignature2 = 0xEF01996C;
}
}

View File

@@ -0,0 +1,31 @@
namespace SabreTools.Models.SafeDisc
{
/// <see href="http://blog.w4kfu.com/tag/safedisc"/>
public class EncryptedFileEntry
{
/// <summary>
/// 0xA8726B03
/// </summary>
public uint Signature1 { get; set; }
/// <summary>
/// 0xEF01996C
/// </summary>
public uint Signature2 { get; set; }
public uint FileNumber { get; set; }
public uint Offset1 { get; set; }
public uint Offset2 { get; set; }
public uint Unknown1 { get; set; }
public uint Unknown2 { get; set; }
/// <remarks>
/// 0x0D bytes
/// </remarks>
public byte[]? Name { get; set; }
}
}