diff --git a/DICUI.Library/Utilities/Parameters.cs b/DICUI.Library/Utilities/Parameters.cs
index ba07c3c9..2f25fd1a 100644
--- a/DICUI.Library/Utilities/Parameters.cs
+++ b/DICUI.Library/Utilities/Parameters.cs
@@ -8,26 +8,48 @@ using DICUI.Data;
namespace DICUI.Utilities
{
///
- /// Represents a generic set of DIC parameters
+ /// Represents a generic set of DiscImageCreator parameters
///
public class Parameters
{
- // DIC Command
- public DICCommand Command;
+ ///
+ /// Base DiscImageCreator command to run
+ ///
+ public DICCommand Command { get; set; }
- // Drive Information
- public string DriveLetter;
- public int? DriveSpeed;
+ ///
+ /// Drive letter or path to pass to DiscImageCreator
+ ///
+ public string DriveLetter { get; set; }
- // Path Information
- public string Filename;
- public string OptiarcFilename;
+ ///
+ /// Drive speed to set, if applicable
+ ///
+ public int? DriveSpeed { get; set; }
- // Sector Information
- public int? StartLBAValue;
- public int? EndLBAValue;
+ ///
+ /// Destination filename for DiscImageCreator output
+ ///
+ public string Filename { get; set; }
- // DIC Flags
+ ///
+ /// Optiarc drive output filename for merging
+ ///
+ public string OptiarcFilename { get; set; }
+
+ ///
+ /// Start LBA value for dumping specific sectors
+ ///
+ public int? StartLBAValue { get; set; }
+
+ ///
+ /// End LBA value for dumping specific sectors
+ ///
+ public int? EndLBAValue { get; set; }
+
+ ///
+ /// Set of flags to pass to DiscImageCreator
+ ///
private Dictionary _flags = new Dictionary();
public bool this[DICFlag key]
{
@@ -42,27 +64,57 @@ namespace DICUI.Utilities
_flags[key] = value;
}
}
- public IEnumerable Keys => _flags.Keys;
+ internal IEnumerable Keys => _flags.Keys;
- // DIC Flag Values
- public int? AddOffsetValue;
- public string BEOpcodeValue; // raw (default), pack
- public int?[] C2OpcodeValue = new int?[4]; // Reread Value;
- //public int? C2OpcodeValue2; // 0 reread issue sector (default), 1 reread all
- //public int? C2OpcodeValue3; // First LBA to reread (default 0)
- //public int? C2OpcodeValue4; // Last LBA to reread (default EOS)
- public int? ForceUnitAccessValue; // Delete per specified (default 1)
- public int? ScanFileProtectValue; // Timeout value (default 60)
- public int?[] SkipSectorValue = new int?[2]; // Skip between sectors
- public int? SubchannelReadLevelValue; // 0 no next sub, 1 next sub (default), 2 next and next next
- public int? VideoNowValue; // Insert n empty bytes in the head of 1st track
+ #region DIC Flag Values
///
- /// Generic empty constructor for adding things individually
+ /// Manual offset for Audio CD
///
- public Parameters()
- {
- }
+ public int? AddOffsetValue { get; set; }
+
+ ///
+ /// 0xbe opcode value for dumping
+ /// Possible values: raw (default), pack
+ ///
+ public string BEOpcodeValue { get; set; }
+
+ ///
+ /// C2 reread options for dumping
+ /// [0] - Reread value
+ /// [1] - 0 reread issue sector (default), 1 reread all
+ /// [2] - First LBA to reread (default 0)
+ /// [3] - Last LBA to reread (default EOS)
+ ///
+ public int?[] C2OpcodeValue { get; set; } = new int?[4];
+
+ ///
+ /// Set the force unit access flag value (default 1)
+ ///
+ public int? ForceUnitAccessValue { get; set; }
+
+ ///
+ /// Set scan file timeout value (default 60)
+ ///
+ public int? ScanFileProtectValue { get; set; }
+
+ ///
+ /// Beginning and ending sectors to skip for physical protection
+ ///
+ public int?[] SkipSectorValue { get; set; } = new int?[2];
+
+ ///
+ /// Set the subchanel read level
+ /// Possible values: 0 no next sub, 1 next sub (default), 2 next and next next
+ ///
+ public int? SubchannelReadLevelValue { get; set; }
+
+ ///
+ /// Set number of empty bytes to insert at the head of first track for VideoNow
+ ///
+ public int? VideoNowValue { get; set; }
+
+ #endregion
///
/// Populate a Parameters object from a param string
@@ -117,7 +169,6 @@ namespace DICUI.Utilities
///
/// Determine the base flags to use for checking a commandline
///
- /// Parameters as a string to check
/// Output nullable MediaType containing the found MediaType, if possible
/// Output nullable KnownSystem containing the found KnownSystem, if possible
/// Output string containing the found drive letter
@@ -154,7 +205,7 @@ namespace DICUI.Utilities
system = KnownSystem.NintendoGameCube;
}
- // PlaySTation
+ // PlayStation
else if (this[DICFlag.NoFixSubQLibCrypt]
|| this[DICFlag.ScanAntiMod])
{
@@ -610,9 +661,7 @@ namespace DICUI.Utilities
{
// The string has to be valid by itself first
if (String.IsNullOrWhiteSpace(parameters))
- {
return false;
- }
// Now split the string into parts for easier validation
// https://stackoverflow.com/questions/14655023/split-a-string-that-has-white-spaces-unless-they-are-enclosed-within-quotes
@@ -1414,9 +1463,7 @@ namespace DICUI.Utilities
// First check to see if the combination of system and MediaType is valid
var validTypes = Validators.GetValidMediaTypes(system);
if (!validTypes.Contains(type))
- {
return;
- }
// Set the C2 reread count
switch (rereadCount)
diff --git a/DICUI.Library/Utilities/Result.cs b/DICUI.Library/Utilities/Result.cs
index d50deb49..a6d314ae 100644
--- a/DICUI.Library/Utilities/Result.cs
+++ b/DICUI.Library/Utilities/Result.cs
@@ -5,7 +5,14 @@
///
public class Result
{
- private bool success;
+ ///
+ /// Internal representation of success
+ ///
+ private readonly bool success;
+
+ ///
+ /// Optional message for the result
+ ///
public string Message { get; private set; }
private Result(bool success, string message)
@@ -14,14 +21,46 @@
this.Message = message;
}
+ ///
+ /// Create a default success result with no message
+ ///
public static Result Success() => new Result(true, "");
+
+ ///
+ /// Create a success result with a custom message
+ ///
+ /// String to add as a message
public static Result Success(string message) => new Result(true, message);
+
+ ///
+ /// Create a success result with a custom message with format parameters
+ ///
+ /// String to add as a message
+ /// Formatting parameters for the string
public static Result Success(string message, params object[] args) => new Result(true, string.Format(message, args));
+ ///
+ /// Create a default failure result with no message
+ ///
+ ///
public static Result Failure() => new Result(false, "");
+
+ ///
+ /// Create a failure result with a custom message
+ ///
+ /// String to add as a message
public static Result Failure(string message) => new Result(false, message);
+
+ ///
+ /// Create a failure result with a custom message with format parameters
+ ///
+ /// String to add as a message
+ /// Formatting parameters for the string
public static Result Failure(string message, params object[] args) => new Result(false, string.Format(message, args));
+ ///
+ /// Results can be compared to boolean values based on the success value
+ ///
public static implicit operator bool(Result result) => result.success;
}
}
diff --git a/DICUI.Library/Utilities/Validators.cs b/DICUI.Library/Utilities/Validators.cs
index ff8122b4..bb23360e 100644
--- a/DICUI.Library/Utilities/Validators.cs
+++ b/DICUI.Library/Utilities/Validators.cs
@@ -830,11 +830,11 @@ namespace DICUI.Utilities
// Specifically unknown type
case MediaType.NONE:
- return Result.Failure("Please select a valid disc type");
+ return Result.Failure("Please select a valid media type");
// Undumpable but recognized types
default:
- return Result.Failure("{0} discs are not supported for dumping", type.LongName());
+ return Result.Failure("{0} media are not supported for dumping", type.LongName());
}
}
@@ -859,7 +859,7 @@ namespace DICUI.Utilities
}
catch
{
- return "Disc could not be scanned!";
+ return "Path could not be scanned!";
}
}
}