Skip to content

Commit

Permalink
Support extract PBP TOC to CUE
Browse files Browse the repository at this point in the history
Refactoring/code cleanup
Unit tests added for IndexPosition math
  • Loading branch information
RupertAvery committed Jan 18, 2020
1 parent 758d826 commit e0274c2
Show file tree
Hide file tree
Showing 22 changed files with 1,138 additions and 385 deletions.
6 changes: 6 additions & 0 deletions PSXPackager.sln
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DiscUtils.Iso9660", "DiscUt
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DiscUtils.Streams", "DiscUtils.Streams\DiscUtils.Streams.csproj", "{C76270B7-9FF7-400C-9A0C-D6A910C2B21D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTestProject", "UnitTestProject\UnitTestProject.csproj", "{477347DA-4397-413B-B3AB-F13200D31543}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -39,6 +41,10 @@ Global
{C76270B7-9FF7-400C-9A0C-D6A910C2B21D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C76270B7-9FF7-400C-9A0C-D6A910C2B21D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C76270B7-9FF7-400C-9A0C-D6A910C2B21D}.Release|Any CPU.Build.0 = Release|Any CPU
{477347DA-4397-413B-B3AB-F13200D31543}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{477347DA-4397-413B-B3AB-F13200D31543}.Debug|Any CPU.Build.0 = Debug|Any CPU
{477347DA-4397-413B-B3AB-F13200D31543}.Release|Any CPU.ActiveCfg = Release|Any CPU
{477347DA-4397-413B-B3AB-F13200D31543}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
13 changes: 13 additions & 0 deletions PSXPackager/ApplicationInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace PSXPackager
{
public static class ApplicationInfo
{
public static string AppPath { get; private set; }
static ApplicationInfo()
{
string path = System.Reflection.Assembly.GetExecutingAssembly().CodeBase.Replace("file:\\\\\\", "").Replace("file:///", "");
AppPath = System.IO.Path.GetDirectoryName(path);
}

}
}
37 changes: 37 additions & 0 deletions PSXPackager/FileExtensionHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using System.IO;

namespace PSXPackager
{
public static class FileExtensionHelper
{
public static bool IsCue(string filename)
{
return Path.GetExtension(filename).ToLower() == ".cue";
}

public static bool IsPbp(string filename)
{
return Path.GetExtension(filename).ToLower() == ".pbp";
}

public static bool IsArchive(string filename)
{
return Path.GetExtension(filename).ToLower() == ".7z" ||
Path.GetExtension(filename).ToLower() == ".rar" ||
Path.GetExtension(filename).ToLower() == ".zip";
}

public static bool IsBin(string filename)
{
return Path.GetExtension(filename).ToLower() == ".bin";
}

public static bool IsImageFile(string filename)
{
return Path.GetExtension(filename).ToLower() == ".bin" ||
Path.GetExtension(filename).ToLower() == ".img" ||
Path.GetExtension(filename).ToLower() == ".iso";
}

}
}
11 changes: 11 additions & 0 deletions PSXPackager/MergedBin.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using Popstation;
using System.Collections.Generic;

namespace PSXPackager
{
public class MergedBin
{
public string Path { get; set; }
public List<CueFile> CueFiles { get; set; }
}
}
27 changes: 27 additions & 0 deletions PSXPackager/Options.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using CommandLine;

namespace PSXPackager
{
public class Options
{
[Option('v', "verbose", Required = false, HelpText = "Set output to verbose messages.")]
public bool Verbose { get; set; }

[Option('l', "level", Required = false, HelpText = "Set compression level 0-9, default 5", Default = 5)]
public int CompressionLevel { get; set; }

[Option('o', "output", Required = false
, HelpText = "The output path where the converted file will be written")]
public string OutputPath { get; set; }

[Option('i', "input", Group = "input", HelpText = "The input file to convert")]
public string InputPath { get; set; }

[Option('b', "batch", Group = "input", HelpText = "The path to batch process a set of files")]
public string Batch { get; set; }

[Option('e', "ext", Required = false, HelpText = "The extension of the files to process in the batch folder, e.g. .7z")]
public string BatchExtension { get; set; }

}
}
Loading

0 comments on commit e0274c2

Please sign in to comment.