17 Commits

Author SHA1 Message Date
Matt Nadareski
efe4bad4c8 Add editorconfig, fix issues 2026-01-25 17:17:50 -05:00
Matt Nadareski
3e88270d14 Bump version 2025-11-19 08:31:07 -05:00
Matt Nadareski
905b622c27 Add license file to repo 2025-11-19 08:26:09 -05:00
Matt Nadareski
d1e3c82e23 Add support for .NET 10 2025-11-19 08:25:20 -05:00
Matt Nadareski
45e3ad8e48 Update packages 2025-10-12 22:44:37 -04:00
Matt Nadareski
0197d4f794 Sync with other projects 2024-12-19 11:08:55 -05:00
Matt Nadareski
577052a5b2 Bump version 2024-11-15 23:42:33 -05:00
Matt Nadareski
0d79e88377 Add .NET 9 to target frameworks 2024-11-15 23:41:33 -05:00
Matt Nadareski
2508b71cc8 Update Nuget package link 2024-04-26 21:09:16 -04:00
Matt Nadareski
bc85c4a73b Bump version, copyright date 2024-04-26 21:08:20 -04:00
Matt Nadareski
1a4fa8db4e Add workflows 2024-04-26 21:04:58 -04:00
Matt Nadareski
3bfabc26a4 Make Linux publish script executable 2024-04-26 21:01:32 -04:00
Matt Nadareski
911649a91a Add publish scripts 2024-04-26 21:01:20 -04:00
Matt Nadareski
ee8eb7cb57 Fix build 2024-04-26 20:54:48 -04:00
Matt Nadareski
8d17292db6 Update SabreTools.IO 2024-04-26 20:52:35 -04:00
Matt Nadareski
1871d1f02a Bump version 2024-03-05 10:24:27 -05:00
Matt Nadareski
596b1028ab Update SabreTools.IO 2024-03-05 10:24:15 -05:00
19 changed files with 948 additions and 124 deletions

167
.editorconfig Normal file
View File

@@ -0,0 +1,167 @@
# top-most EditorConfig file
root = true
# C# files
[*.cs]
# Indentation and spacing
charset = utf-8
indent_size = 4
indent_style = space
tab_width = 4
trim_trailing_whitespace = true
# New line preferences
end_of_line = lf
insert_final_newline = true
max_line_length = unset
# using directive preferences
csharp_using_directive_placement = outside_namespace
dotnet_diagnostic.IDE0005.severity = error
# Code-block preferences
csharp_style_namespace_declarations = block_scoped
csharp_style_prefer_method_group_conversion = true
csharp_style_prefer_top_level_statements = false
# Expression-level preferences
csharp_prefer_simple_default_expression = true
csharp_style_inlined_variable_declaration = true
csharp_style_unused_value_assignment_preference = discard_variable
csharp_style_unused_value_expression_statement_preference = discard_variable
dotnet_diagnostic.IDE0001.severity = warning
dotnet_diagnostic.IDE0002.severity = warning
dotnet_diagnostic.IDE0004.severity = warning
dotnet_diagnostic.IDE0010.severity = error
dotnet_diagnostic.IDE0051.severity = warning
dotnet_diagnostic.IDE0052.severity = warning
dotnet_diagnostic.IDE0072.severity = warning
dotnet_diagnostic.IDE0080.severity = warning
dotnet_diagnostic.IDE0100.severity = error
dotnet_diagnostic.IDE0110.severity = error
dotnet_diagnostic.IDE0120.severity = warning
dotnet_diagnostic.IDE0121.severity = warning
dotnet_diagnostic.IDE0240.severity = error
dotnet_diagnostic.IDE0241.severity = error
dotnet_style_coalesce_expression = true
dotnet_style_namespace_match_folder = false
dotnet_style_null_propagation = true
dotnet_style_prefer_auto_properties = true
dotnet_style_prefer_collection_expression = when_types_loosely_match
dotnet_style_prefer_is_null_check_over_reference_equality_method = true
dotnet_style_prefer_compound_assignment = true
csharp_style_prefer_simple_property_accessors = true
dotnet_style_prefer_simplified_interpolation = true
dotnet_style_prefer_simplified_boolean_expressions = true
csharp_style_prefer_unbound_generic_type_in_nameof = true
# Field preferences
dotnet_diagnostic.IDE0044.severity = warning
dotnet_style_readonly_field = true
# Language keyword vs. framework types preferences
dotnet_diagnostic.IDE0049.severity = error
dotnet_style_predefined_type_for_locals_parameters_members = true
dotnet_style_predefined_type_for_member_access = true
# Modifier preferences
csharp_prefer_static_local_function = true
csharp_style_prefer_readonly_struct = true
dotnet_diagnostic.IDE0036.severity = warning
dotnet_diagnostic.IDE0040.severity = error
dotnet_diagnostic.IDE0380.severity = error
dotnet_style_require_accessibility_modifiers = always
# New-line preferences
dotnet_diagnostic.IDE2000.severity = warning
dotnet_diagnostic.IDE2002.severity = warning
dotnet_diagnostic.IDE2003.severity = warning
dotnet_diagnostic.IDE2004.severity = warning
dotnet_diagnostic.IDE2005.severity = warning
dotnet_diagnostic.IDE2006.severity = warning
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = false
csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = false
csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = false
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false
dotnet_style_allow_multiple_blank_lines_experimental = false
dotnet_style_allow_statement_immediately_after_block_experimental = false
# Null-checking preferences
csharp_style_conditional_delegate_call = true
# Parameter preferences
dotnet_code_quality_unused_parameters = all
dotnet_diagnostic.IDE0280.severity = error
# Parentheses preferences
dotnet_diagnostic.IDE0047.severity = warning
dotnet_diagnostic.IDE0048.severity = warning
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity
dotnet_style_parentheses_in_other_operators = always_for_clarity
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity
# Pattern-matching preferences
dotnet_diagnostic.IDE0019.severity = warning
dotnet_diagnostic.IDE0020.severity = warning
dotnet_diagnostic.IDE0038.severity = warning
dotnet_diagnostic.IDE0066.severity = none
dotnet_diagnostic.IDE0083.severity = warning
dotnet_diagnostic.IDE0260.severity = warning
csharp_style_pattern_matching_over_as_with_null_check = true
csharp_style_pattern_matching_over_is_with_cast_check = true
csharp_style_prefer_not_pattern = true
csharp_style_prefer_pattern_matching = true
# this. and Me. preferences
dotnet_style_qualification_for_event = false
dotnet_style_qualification_for_field = false
dotnet_style_qualification_for_method = false
dotnet_style_qualification_for_property = false
# var preferences
csharp_style_var_for_built_in_types = false
csharp_style_var_when_type_is_apparent = true
# .NET formatting options
dotnet_separate_import_directive_groups = false
dotnet_sort_system_directives_first = true
# C# formatting options
csharp_indent_block_contents = true
csharp_indent_braces = false
csharp_indent_case_contents = true
csharp_indent_case_contents_when_block = false
csharp_indent_labels = one_less_than_current
csharp_indent_switch_labels = true
csharp_new_line_before_catch = true
csharp_new_line_before_else = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_open_brace = all
csharp_new_line_between_query_expression_clauses = true
csharp_preserve_single_line_blocks = true
csharp_preserve_single_line_statements = true
csharp_space_after_cast = false
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_after_comma = true
csharp_space_after_dot = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_after_semicolon_in_for_statement = true
csharp_space_around_binary_operators = before_and_after
csharp_space_around_declaration_statements = false
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_before_comma = false
csharp_space_before_dot = false
csharp_space_before_open_square_brackets = false
csharp_space_before_semicolon_in_for_statement = false
csharp_space_between_empty_square_brackets = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_space_between_square_brackets = false

45
.github/workflows/build_and_test.yml vendored Normal file
View File

@@ -0,0 +1,45 @@
name: Build and Test
on:
push:
branches: ["main"]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
8.0.x
9.0.x
10.0.x
- name: Run publish script
run: ./publish-nix.sh -d
- name: Update rolling tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -f rolling
git push origin :refs/tags/rolling || true
git push origin rolling --force
- name: Upload to rolling
uses: ncipollo/release-action@v1.20.0
with:
allowUpdates: True
artifacts: "*.nupkg,*.snupkg,*.zip"
body: "Last built commit: ${{ github.sha }}"
name: "Rolling Release"
prerelease: True
replacesArtifacts: True
tag: "rolling"
updateOnlyUnreleased: True

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

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

296
.gitignore vendored
View File

@@ -1,15 +1,7 @@
*.swp
*.*~
project.lock.json
.DS_Store
*.pyc
nupkg/
# Visual Studio Code
.vscode
# Rider
.idea
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.suo
@@ -17,6 +9,9 @@ nupkg/
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
@@ -24,15 +19,280 @@ nupkg/
[Rr]eleases/
x64/
x86/
build/
bld/
[Bb]in/
[Oo]bj/
[Oo]ut/
msbuild.log
msbuild.err
msbuild.wrn
[Ll]og/
# Visual Studio 2015
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
**/Properties/launchSettings.json
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Typescript v1 declaration files
typings/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
*.sln.iml
# CodeRush
.cr/
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs

15
.vscode/tasks.json vendored Normal file
View File

@@ -0,0 +1,15 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/psxt001z.sln",
],
"problemMatcher": "$msCompile"
},
]
}

7
LICENSE Normal file
View File

@@ -0,0 +1,7 @@
Copyright (c) 2018-2025 Matt Nadareski
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -1,5 +1,13 @@
# psxt001z
[![Build and Test](https://github.com/SabreTools/psxt001z/actions/workflows/build_and_test.yml/badge.svg)](https://github.com/SabreTools/psxt001z/actions/workflows/build_and_test.yml)
This library is a mostly-complete port of the [tool of the same name](https://github.com/Dremora/psxt001z) by [Dremora](https://github.com/Dremora/). This currently compiles as a library and does not feature any of the direct disc reading that the original tool did. There are aspirations to changes this in the future.
Find the link to the Nuget package [here](https://www.nuget.org/packages/psxt001z).
Find the link to the Nuget package [here](https://www.nuget.org/packages/psxt001z.Library/).
## Releases
For the most recent stable build, download the latest release here: [Releases Page](https://github.com/SabreTools/psxt001z/releases)
For the latest WIP build here: [Rolling Release](https://github.com/SabreTools/psxt001z/releases/tag/rolling)

View File

@@ -19,12 +19,6 @@ namespace psxt001z
/// </summary>
public static byte IntegerToBinary(byte i) => (byte)(i / 10 * 16 + i % 10);
/// <summary>
/// Get a santized hex string from an input byte array
/// </summary>
public static string GetHexString(byte[] bytes) =>
BitConverter.ToString(bytes).Replace("-", string.Empty);
/// <summary>
/// Get a santized hex string from an input byte array
/// </summary>

View File

@@ -1,6 +1,7 @@
using System;
using System.IO;
using System.Text;
using SabreTools.IO.Extensions;
namespace psxt001z
{
@@ -22,37 +23,33 @@ namespace psxt001z
string filename = string.Empty;
while (filename != "SYSTEM.CNF")
{
byte[] buf = new byte[10];
_file.Read(buf, 0, 10);
byte[] buf = _file.ReadBytes(10);
filename = Encoding.ASCII.GetString(buf);
_file.Seek(-9, SeekOrigin.Current);
}
byte[] buffer = new byte[20];
_file.Seek(-32, SeekOrigin.Current);
_file.Read(buffer, 0, 4);
uint lba = BitConverter.ToUInt32(buffer, 0);
uint lba = _file.ReadUInt32();
_file.Seek((2352 * lba) + 29, SeekOrigin.Begin);
_file.Read(buffer, 0, 6);
byte[] buffer = _file.ReadBytes(6);
string iniLine = Encoding.ASCII.GetString(buffer);
while (iniLine != "cdrom:")
{
_file.Seek(-5, SeekOrigin.Current);
_file.Read(buffer, 0, 6);
buffer = _file.ReadBytes(6);
iniLine = Encoding.ASCII.GetString(buffer);
}
_file.Read(buffer, 0, 1);
buffer = _file.ReadBytes(1);
if (buffer[0] != '\\')
_file.Seek(-1, SeekOrigin.Current);
int i = -1;
do
{
_file.Read(buffer, ++i, 1);
_ = _file.Read(buffer, ++i, 1);
} while (buffer[i] != ';');
for (long a = 0; a < i; a++)
@@ -65,20 +62,19 @@ namespace psxt001z
public string GetDate()
{
byte[] buffer = new byte[12], datenofrmt = new byte[3];
_file.Seek(51744, SeekOrigin.Begin);
byte[] buffer = new byte[12];
do
{
_file.Read(buffer, 0, 11);
_ = _file.Read(buffer, 0, 11);
buffer[11] = 0;
_file.Seek(-10, SeekOrigin.Current);
} while (Encoding.ASCII.GetString(_executableName) != Encoding.ASCII.GetString(buffer));
_file.Seek(-16, SeekOrigin.Current);
_file.Read(datenofrmt, 0, 3);
byte[] datenofrmt = _file.ReadBytes(3);
if (datenofrmt[0] < 50)
{
byte[] year = Encoding.ASCII.GetBytes($"{2000 + datenofrmt[0]}");
@@ -140,7 +136,7 @@ namespace psxt001z
{
_file.Seek(0x9368, SeekOrigin.Begin);
byte[] sizebuf = new byte[4];
_file.Read(sizebuf, 0, 4);
_ = _file.Read(sizebuf, 0, 4);
return BitConverter.ToInt32(sizebuf, 0);
}
}

View File

@@ -1,7 +1,7 @@
using System;
using System.IO;
using System.Text;
using SabreTools.IO;
using SabreTools.IO.Extensions;
namespace psxt001z
{
@@ -63,7 +63,7 @@ namespace psxt001z
file.Seek(51744, SeekOrigin.Begin);
while (Encoding.ASCII.GetString(buffer) != "SYSTEM.CNF")
{
file.Read(buffer, 0, 10);
_ = file.Read(buffer, 0, 10);
buffer[10] = 0;
file.Seek(-9, SeekOrigin.Current);
}
@@ -71,22 +71,22 @@ namespace psxt001z
file.Seek(-32, SeekOrigin.Current);
uint lba = file.ReadUInt32();
file.Seek((2352 * lba) + 29, SeekOrigin.Begin);
file.Read(buffer, 0, 6);
_ = file.Read(buffer, 0, 6);
buffer[6] = 0;
while (Encoding.ASCII.GetString(buffer) != "cdrom:")
{
file.Seek(-5, SeekOrigin.Current);
file.Read(buffer, 0, 6);
_ = file.Read(buffer, 0, 6);
}
file.Read(buffer, 0, 1);
_ = file.Read(buffer, 0, 1);
if (buffer[0] != '\\')
file.Seek(-1, SeekOrigin.Current);
int i = -1;
do
{
file.Read(buffer, ++i, 1);
_ = file.Read(buffer, ++i, 1);
} while (buffer[i] != ';');
for (int a = 0; a < i; a++)

View File

@@ -1,7 +1,7 @@
using System;
using System.IO;
using System.Linq;
using SabreTools.IO;
using SabreTools.IO.Extensions;
namespace psxt001z
{
@@ -44,7 +44,7 @@ namespace psxt001z
#region Type
image.Read(buffer, 0, 12);
_ = image.Read(buffer, 0, 12);
int sectorsize;
if (buffer.Take(12).SequenceEqual(syncheader.Take(12)))
@@ -130,7 +130,7 @@ namespace psxt001z
var crc = new CRC32();
for (int i = 0; i < 16; i++)
{
image.Read(buffer, 0, 2352);
_ = image.Read(buffer, 0, 2352);
crc.Calculate(buffer, 0, 2352);
}
@@ -155,7 +155,7 @@ namespace psxt001z
#region Postgap
image.Seek((sectors - 150) * sectorsize + 16, SeekOrigin.Begin);
image.Read(buffer, 0, 2336);
_ = image.Read(buffer, 0, 2336);
string postgap = "Postgap type: Form ";
if ((buffer[2] >> 5 & 0x01) != 0)
@@ -203,7 +203,7 @@ namespace psxt001z
{
bool bad = false;
image.Seek(sector * sectorsize, SeekOrigin.Begin);
image.Read(buffer, 0, sectorsize);
_ = image.Read(buffer, 0, sectorsize);
string sectorInfo = string.Empty;

View File

@@ -115,7 +115,7 @@ namespace psxt001z
// sbi
Stream? sbi = null;
if (args.Length > 1 && args[1] != null)
if (args.Length > 1 && args[1] is not null)
{
sbi = File.OpenWrite(args[1]);
sbi.Write(Encoding.ASCII.GetBytes("SBI\0"), 0, 4);
@@ -184,7 +184,7 @@ namespace psxt001z
Console.WriteLine("");
psectors++;
if (sbi != null)
if (sbi is not null)
{
sbi.Write(sub, 7, 3);
sbi.Write([0x01], 0, 1);

View File

@@ -48,7 +48,7 @@ namespace psxt001z
}
else
{
sector_file.Read(sector, 0, sectors);
_ = sector_file.Read(sector, 0, sectors);
}
int offset = MemSearch(sector, sync, sectors, 12);

View File

@@ -184,7 +184,7 @@ namespace psxt001z
private bool Calculate()
{
var calc = new CRC32();
if (_smallFile && _fileContents != null)
if (_smallFile && _fileContents is not null)
{
if (_isRiff)
calc.Calculate(_riff, 0, 44);

View File

@@ -1,32 +1,37 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<!-- Assembly Properties -->
<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>0.21-beta3</Version>
<PropertyGroup>
<!-- Assembly Properties -->
<TargetFrameworks>net20;net35;net40;net452;net462;net472;net48;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0;net9.0;net10.0;netstandard2.0;netstandard2.1</TargetFrameworks>
<CheckEolTargetFramework>false</CheckEolTargetFramework>
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
<IncludeSymbols>true</IncludeSymbols>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Version>0.21-rc3</Version>
<!-- Package Properties -->
<Authors>Kirill Korolyov, Matt Nadareski</Authors>
<Description>C# port of psxt001z as a library</Description>
<Copyright>Copyright (c)2013 Dremora, Copyright (c)2018-2023 Matt Nadareski</Copyright>
<PackageProjectUrl>https://github.com/SabreTools/</PackageProjectUrl>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RepositoryUrl>https://github.com/SabreTools/psxt001z</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>libcrypt psx ps1 psone</PackageTags>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
</PropertyGroup>
<!-- Package Properties -->
<Authors>Kirill Korolyov, Matt Nadareski</Authors>
<Description>C# port of psxt001z as a library</Description>
<Copyright>Copyright (c)2013 Dremora, Copyright (c)2018-2025 Matt Nadareski</Copyright>
<PackageProjectUrl>https://github.com/SabreTools/</PackageProjectUrl>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RepositoryUrl>https://github.com/SabreTools/psxt001z</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>libcrypt psx ps1 psone</PackageTags>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
</PropertyGroup>
<ItemGroup>
<None Include="../README.md" Pack="true" PackagePath="" />
</ItemGroup>
<ItemGroup>
<None Include="../README.md" Pack="true" PackagePath="" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="SabreTools.IO" Version="1.3.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Net30.LinqBridge" Version="1.6.0" Condition="$(TargetFramework.StartsWith(`net2`))" />
<PackageReference Include="SabreTools.IO" Version="[1.9.0]" />
</ItemGroup>
</Project>
</Project>

View File

@@ -2,6 +2,7 @@
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using SabreTools.IO.Extensions;
using static psxt001z.LibCrypt;
namespace psxt001z
@@ -26,15 +27,15 @@ namespace psxt001z
break;
case "--libcrypt" or "-l":
DetectLibCrypt(args.Skip(2).ToArray());
DetectLibCrypt([.. args.Skip(2)]);
break;
case "--libcryptdrv":
DetectLibCryptDrive(args.Skip(2).ToArray());
DetectLibCryptDrive([.. args.Skip(2)]);
break;
case "--libcryptdrvfast":
DetectLibCryptDriveFast(args.Skip(2).ToArray());
DetectLibCryptDriveFast([.. args.Skip(2)]);
break;
case "--xorlibcrypt":
@@ -159,7 +160,7 @@ namespace psxt001z
var crc = new CRC32();
for (uint i = 0; i < 16; i++)
{
image.Read(buffer, 0, 2352);
_ = image.Read(buffer, 0, 2352);
crc.Calculate(buffer, 0, 2352);
}
@@ -264,7 +265,7 @@ namespace psxt001z
while (f1.Position < f1.Length && f2.Position < f2.Length)
{
byte[] buffer = new byte[1];
f2.Read(buffer, 0, 1);
_ = f2.Read(buffer, 0, 1);
f1.Write(buffer, 0, 1);
i++;
}
@@ -377,13 +378,13 @@ namespace psxt001z
image.Seek(sector * 2352 + 18, SeekOrigin.Begin);
byte[] z = new byte[1];
image.Read(z, 0, 1);
_ = image.Read(z, 0, 1);
if ((z[0] >> 5 & 0x1) != 0)
{
image.Seek(-3, SeekOrigin.Current);
byte[] buffer = new byte[2332];
image.Read(buffer, 0, 2332);
_ = image.Read(buffer, 0, 2332);
image.Seek(0, SeekOrigin.Current);
buffer = BitConverter.GetBytes(CalculateEDC(buffer, 0, 2332, edc_lut));
@@ -505,8 +506,8 @@ namespace psxt001z
sha1.TransformFinalBlock(Message_Digest, 0, Message_Digest.Length);
Console.WriteLine($"\rCRC-32: {crc.Hash:8x} \n");
Console.WriteLine($"MD5: {GetHexString(md5.Hash!)}");
Console.WriteLine($"SHA-1: {GetHexString(sha1.Hash!)}");
Console.WriteLine($"MD5: {md5.Hash.ToHexString()}");
Console.WriteLine($"SHA-1: {sha1.Hash.ToHexString()}");
Console.WriteLine();
return 1;
}
@@ -634,13 +635,13 @@ namespace psxt001z
for (long i = 0; i < subsize; i++)
{
byte[] r1 = new byte[1];
f1.Read(r1, 0, 1);
_ = f1.Read(r1, 0, 1);
byte[] r2 = new byte[1];
f2.Read(r2, 0, 1);
_ = f2.Read(r2, 0, 1);
byte[] r3 = new byte[1];
f3.Read(r3, 0, 1);
_ = f3.Read(r3, 0, 1);
if (r1 == r2)
{
@@ -691,19 +692,19 @@ namespace psxt001z
str.Seek(2, SeekOrigin.Current);
byte[] ctrlbyte = new byte[1];
str.Read(ctrlbyte, 0, 1);
_ = str.Read(ctrlbyte, 0, 1);
byte[] buffer = new byte[2336];
if ((ctrlbyte[0] >> 5 & 0x1) != 0)
{
str.Seek(-3, SeekOrigin.Current);
str.Read(buffer, 0, 2336);
_ = str.Read(buffer, 0, 2336);
audio.Write(buffer, 0, 2336);
}
else
{
str.Seek(5, SeekOrigin.Current);
str.Read(buffer, 0, 2048);
_ = str.Read(buffer, 0, 2048);
video.Write(buffer, 0, 2048);
str.Seek(280, SeekOrigin.Current);
}
@@ -738,7 +739,7 @@ namespace psxt001z
Stream bs = File.OpenWrite(directory + "\\000001.bs");
str.Seek(32, SeekOrigin.Current);
str.Read(buffer, 0, 2016);
_ = str.Read(buffer, 0, 2016);
Console.WriteLine(directory);
bs.Write(buffer, 0, 2016);
@@ -750,7 +751,7 @@ namespace psxt001z
str.Seek(1, SeekOrigin.Current);
byte[] byt = new byte[1];
str.Read(byt, 0, 1);
_ = str.Read(byt, 0, 1);
if (byt[0] == 0)
{
@@ -760,7 +761,7 @@ namespace psxt001z
}
str.Seek(30, SeekOrigin.Current);
str.Read(buffer, 0, 2016);
_ = str.Read(buffer, 0, 2016);
bs.Write(buffer, 0, 2016);
}
@@ -877,7 +878,7 @@ namespace psxt001z
image.Seek(sector * 2352 + 18, SeekOrigin.Begin);
byte[] z = new byte[1];
image.Read(z, 0, 1);
_ = image.Read(z, 0, 1);
if ((z[0] >> 5 & 0x1) != 0)
{
image.Seek(2329, SeekOrigin.Current);

View File

@@ -1,27 +1,46 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<!-- Assembly Properties -->
<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>
<OutputType>Exe</OutputType>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<CheckEolTargetFramework>false</CheckEolTargetFramework>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Version>0.21-beta3</Version>
<PropertyGroup>
<!-- Assembly Properties -->
<TargetFrameworks>net20;net35;net40;net452;net462;net472;net48;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0;net9.0;net10.0</TargetFrameworks>
<OutputType>Exe</OutputType>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<CheckEolTargetFramework>false</CheckEolTargetFramework>
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Version>0.21-rc3</Version>
<!-- Package Properties -->
<Authors>Kirill Korolyov, Matt Nadareski</Authors>
<Description>C# port of psxt001z</Description>
<Copyright>Copyright (c)2013 Dremora, Copyright (c)2018-2023 Matt Nadareski</Copyright>
<RepositoryUrl>https://github.com/SabreTools/psxt001z</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
</PropertyGroup>
<!-- Package Properties -->
<Authors>Kirill Korolyov, Matt Nadareski</Authors>
<Description>C# port of psxt001z</Description>
<Copyright>Copyright (c)2013 Dremora, Copyright (c)2018-2024 Matt Nadareski</Copyright>
<RepositoryUrl>https://github.com/SabreTools/psxt001z</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\psxt001z.Library\psxt001z.Library.csproj" />
</ItemGroup>
<!-- Support All Frameworks -->
<PropertyGroup Condition="$(TargetFramework.StartsWith(`net2`)) OR $(TargetFramework.StartsWith(`net3`)) OR $(TargetFramework.StartsWith(`net4`))">
<RuntimeIdentifiers>win-x86;win-x64</RuntimeIdentifiers>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.StartsWith(`netcoreapp`)) OR $(TargetFramework.StartsWith(`net5`))">
<RuntimeIdentifiers>win-x86;win-x64;win-arm64;linux-x64;linux-arm64;osx-x64</RuntimeIdentifiers>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.StartsWith(`net6`)) OR $(TargetFramework.StartsWith(`net7`)) OR $(TargetFramework.StartsWith(`net8`)) OR $(TargetFramework.StartsWith(`net9`)) OR $(TargetFramework.StartsWith(`net10`))">
<RuntimeIdentifiers>win-x86;win-x64;win-arm64;linux-x64;linux-arm64;osx-x64;osx-arm64</RuntimeIdentifiers>
</PropertyGroup>
<PropertyGroup Condition="$(RuntimeIdentifier.StartsWith(`osx-arm`))">
<TargetFrameworks>net6.0;net7.0;net8.0;net9.0;net10.0</TargetFrameworks>
</PropertyGroup>
</Project>
<ItemGroup>
<ProjectReference Include="..\psxt001z.Library\psxt001z.Library.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Net30.LinqBridge" Version="1.6.0" Condition="$(TargetFramework.StartsWith(`net2`))" />
<PackageReference Include="SabreTools.IO" Version="[1.9.0]" />
</ItemGroup>
</Project>

151
publish-nix.sh Executable file
View File

@@ -0,0 +1,151 @@
#!/bin/bash
# This batch file assumes the following:
# - .NET 10.0 (or newer) SDK is installed and in PATH
# - zip is installed and in PATH
# - Git is installed and in PATH
#
# If any of these are not satisfied, the operation may fail
# in an unpredictable way and result in an incomplete output.
# Optional parameters
USE_ALL=false
INCLUDE_DEBUG=false
NO_BUILD=false
NO_ARCHIVE=false
while getopts "udba" OPTION; do
case $OPTION in
u)
USE_ALL=true
;;
d)
INCLUDE_DEBUG=true
;;
b)
NO_BUILD=true
;;
a)
NO_ARCHIVE=true
;;
*)
echo "Invalid option provided"
exit 1
;;
esac
done
# Set the current directory as a variable
BUILD_FOLDER=$PWD
# Set the current commit hash
COMMIT=$(git log --pretty=%H -1)
# Output the selected options
echo "Selected Options:"
echo " Use all frameworks (-u) $USE_ALL"
echo " Include debug builds (-d) $INCLUDE_DEBUG"
echo " No build (-b) $NO_BUILD"
echo " No archive (-a) $NO_ARCHIVE"
echo " "
# Create the build matrix arrays
FRAMEWORKS=("net10.0")
RUNTIMES=("win-x86" "win-x64" "win-arm64" "linux-x64" "linux-arm64" "osx-x64" "osx-arm64")
# Use expanded lists, if requested
if [ $USE_ALL = true ]; then
FRAMEWORKS=("net20" "net35" "net40" "net452" "net462" "net472" "net48" "netcoreapp3.1" "net5.0" "net6.0" "net7.0" "net8.0" "net9.0" "net10.0")
fi
# Create the filter arrays
SINGLE_FILE_CAPABLE=("net5.0" "net6.0" "net7.0" "net8.0" "net9.0" "net10.0")
VALID_APPLE_FRAMEWORKS=("net6.0" "net7.0" "net8.0" "net9.0" "net10.0")
VALID_CROSS_PLATFORM_FRAMEWORKS=("netcoreapp3.1" "net5.0" "net6.0" "net7.0" "net8.0" "net9.0" "net10.0")
VALID_CROSS_PLATFORM_RUNTIMES=("win-arm64" "linux-x64" "linux-arm64" "osx-x64" "osx-arm64")
# Only build if requested
if [ $NO_BUILD = false ]; then
# Restore Nuget packages for all builds
echo "Restoring Nuget packages"
dotnet restore
# Create Nuget Package
dotnet pack psxt001z.Library/psxt001z.Library.csproj --output $BUILD_FOLDER
# Build psxt001z
for FRAMEWORK in "${FRAMEWORKS[@]}"; do
for RUNTIME in "${RUNTIMES[@]}"; do
# Output the current build
echo "===== Build psxt001z - $FRAMEWORK, $RUNTIME ====="
# If we have an invalid combination of framework and runtime
if [[ ! $(echo ${VALID_CROSS_PLATFORM_FRAMEWORKS[@]} | fgrep -w $FRAMEWORK) ]]; then
if [[ $(echo ${VALID_CROSS_PLATFORM_RUNTIMES[@]} | fgrep -w $RUNTIME) ]]; then
echo "Skipped due to invalid combination"
continue
fi
fi
# If we have Apple silicon but an unsupported framework
if [[ ! $(echo ${VALID_APPLE_FRAMEWORKS[@]} | fgrep -w $FRAMEWORK) ]]; then
if [ $RUNTIME = "osx-arm64" ]; then
echo "Skipped due to no Apple Silicon support"
continue
fi
fi
# Only .NET 5 and above can publish to a single file
if [[ $(echo ${SINGLE_FILE_CAPABLE[@]} | fgrep -w $FRAMEWORK) ]]; then
# Only include Debug if set
if [ $INCLUDE_DEBUG = true ]; then
dotnet publish psxt001z/psxt001z.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true
fi
dotnet publish psxt001z/psxt001z.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true -p:DebugType=None -p:DebugSymbols=false
else
# Only include Debug if set
if [ $INCLUDE_DEBUG = true ]; then
dotnet publish psxt001z/psxt001z.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT
fi
dotnet publish psxt001z/psxt001z.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:DebugType=None -p:DebugSymbols=false
fi
done
done
fi
# Only create archives if requested
if [ $NO_ARCHIVE = false ]; then
# Create psxt001z archives
for FRAMEWORK in "${FRAMEWORKS[@]}"; do
for RUNTIME in "${RUNTIMES[@]}"; do
# Output the current build
echo "===== Archive psxt001z - $FRAMEWORK, $RUNTIME ====="
# If we have an invalid combination of framework and runtime
if [[ ! $(echo ${VALID_CROSS_PLATFORM_FRAMEWORKS[@]} | fgrep -w $FRAMEWORK) ]]; then
if [[ $(echo ${VALID_CROSS_PLATFORM_RUNTIMES[@]} | fgrep -w $RUNTIME) ]]; then
echo "Skipped due to invalid combination"
continue
fi
fi
# If we have Apple silicon but an unsupported framework
if [[ ! $(echo ${VALID_APPLE_FRAMEWORKS[@]} | fgrep -w $FRAMEWORK) ]]; then
if [ $RUNTIME = "osx-arm64" ]; then
echo "Skipped due to no Apple Silicon support"
continue
fi
fi
# Only include Debug if set
if [ $INCLUDE_DEBUG = true ]; then
cd $BUILD_FOLDER/psxt001z/bin/Debug/${FRAMEWORK}/${RUNTIME}/publish/
zip -r $BUILD_FOLDER/psxt001z_${FRAMEWORK}_${RUNTIME}_debug.zip .
fi
cd $BUILD_FOLDER/psxt001z/bin/Release/${FRAMEWORK}/${RUNTIME}/publish/
zip -r $BUILD_FOLDER/psxt001z_${FRAMEWORK}_${RUNTIME}_release.zip .
done
done
# Reset the directory
cd $BUILD_FOLDER
fi

136
publish-win.ps1 Normal file
View File

@@ -0,0 +1,136 @@
# This batch file assumes the following:
# - .NET 10.0 (or newer) SDK is installed and in PATH
# - 7-zip commandline (7z.exe) is installed and in PATH
# - Git for Windows is installed and in PATH
#
# If any of these are not satisfied, the operation may fail
# in an unpredictable way and result in an incomplete output.
# Optional parameters
param(
[Parameter(Mandatory = $false)]
[Alias("UseAll")]
[switch]$USE_ALL,
[Parameter(Mandatory = $false)]
[Alias("IncludeDebug")]
[switch]$INCLUDE_DEBUG,
[Parameter(Mandatory = $false)]
[Alias("NoBuild")]
[switch]$NO_BUILD,
[Parameter(Mandatory = $false)]
[Alias("NoArchive")]
[switch]$NO_ARCHIVE
)
# Set the current directory as a variable
$BUILD_FOLDER = $PSScriptRoot
# Set the current commit hash
$COMMIT = git log --pretty=format:"%H" -1
# Output the selected options
Write-Host "Selected Options:"
Write-Host " Use all frameworks (-UseAll) $USE_ALL"
Write-Host " Include debug builds (-IncludeDebug) $INCLUDE_DEBUG"
Write-Host " No build (-NoBuild) $NO_BUILD"
Write-Host " No archive (-NoArchive) $NO_ARCHIVE"
Write-Host " "
# Create the build matrix arrays
$FRAMEWORKS = @('net10.0')
$RUNTIMES = @('win-x86', 'win-x64', 'win-arm64', 'linux-x64', 'linux-arm64', 'osx-x64', 'osx-arm64')
# Use expanded lists, if requested
if ($USE_ALL.IsPresent) {
$FRAMEWORKS = @('net20', 'net35', 'net40', 'net452', 'net462', 'net472', 'net48', 'netcoreapp3.1', 'net5.0', 'net6.0', 'net7.0', 'net8.0', 'net9.0', 'net10.0')
}
# Create the filter arrays
$SINGLE_FILE_CAPABLE = @('net5.0', 'net6.0', 'net7.0', 'net8.0', 'net9.0', 'net10.0')
$VALID_APPLE_FRAMEWORKS = @('net6.0', 'net7.0', 'net8.0', 'net9.0', 'net10.0')
$VALID_CROSS_PLATFORM_FRAMEWORKS = @('netcoreapp3.1', 'net5.0', 'net6.0', 'net7.0', 'net8.0', 'net9.0', 'net10.0')
$VALID_CROSS_PLATFORM_RUNTIMES = @('win-arm64', 'linux-x64', 'linux-arm64', 'osx-x64', 'osx-arm64')
# Only build if requested
if (!$NO_BUILD.IsPresent) {
# Restore Nuget packages for all builds
Write-Host "Restoring Nuget packages"
dotnet restore
# Create Nuget Package
dotnet pack psxt001z.Library\psxt001z.Library.csproj --output $BUILD_FOLDER
# Build psxt001z
foreach ($FRAMEWORK in $FRAMEWORKS) {
foreach ($RUNTIME in $RUNTIMES) {
# Output the current build
Write-Host "===== Build psxt001z - $FRAMEWORK, $RUNTIME ====="
# If we have an invalid combination of framework and runtime
if ($VALID_CROSS_PLATFORM_FRAMEWORKS -notcontains $FRAMEWORK -and $VALID_CROSS_PLATFORM_RUNTIMES -contains $RUNTIME) {
Write-Host "Skipped due to invalid combination"
continue
}
# If we have Apple silicon but an unsupported framework
if ($VALID_APPLE_FRAMEWORKS -notcontains $FRAMEWORK -and $RUNTIME -eq 'osx-arm64') {
Write-Host "Skipped due to no Apple Silicon support"
continue
}
# Only .NET 5 and above can publish to a single file
if ($SINGLE_FILE_CAPABLE -contains $FRAMEWORK) {
# Only include Debug if set
if ($INCLUDE_DEBUG.IsPresent) {
dotnet publish psxt001z\psxt001z.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true
}
dotnet publish psxt001z\psxt001z.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true -p:DebugType=None -p:DebugSymbols=false
}
else {
# Only include Debug if set
if ($INCLUDE_DEBUG.IsPresent) {
dotnet publish psxt001z\psxt001z.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT
}
dotnet publish psxt001z\psxt001z.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:DebugType=None -p:DebugSymbols=false
}
}
}
}
# Only create archives if requested
if (!$NO_ARCHIVE.IsPresent) {
# Create psxt001z archives
foreach ($FRAMEWORK in $FRAMEWORKS) {
foreach ($RUNTIME in $RUNTIMES) {
# Output the current build
Write-Host "===== Archive Program - $FRAMEWORK, $RUNTIME ====="
# If we have an invalid combination of framework and runtime
if ($VALID_CROSS_PLATFORM_FRAMEWORKS -notcontains $FRAMEWORK -and $VALID_CROSS_PLATFORM_RUNTIMES -contains $RUNTIME) {
Write-Host "Skipped due to invalid combination"
continue
}
# If we have Apple silicon but an unsupported framework
if ($VALID_APPLE_FRAMEWORKS -notcontains $FRAMEWORK -and $RUNTIME -eq 'osx-arm64') {
Write-Host "Skipped due to no Apple Silicon support"
continue
}
# Only include Debug if set
if ($INCLUDE_DEBUG.IsPresent) {
Set-Location -Path $BUILD_FOLDER\psxt001z\bin\Debug\${FRAMEWORK}\${RUNTIME}\publish\
7z a -tzip $BUILD_FOLDER\psxt001z_${FRAMEWORK}_${RUNTIME}_debug.zip *
}
Set-Location -Path $BUILD_FOLDER\psxt001z\bin\Release\${FRAMEWORK}\${RUNTIME}\publish\
7z a -tzip $BUILD_FOLDER\psxt001z_${FRAMEWORK}_${RUNTIME}_release.zip *
}
}
# Reset the directory
Set-Location -Path $PSScriptRoot
}