mirror of
https://github.com/crskycode/GARbro.git
synced 2026-07-03 20:00:21 +08:00
refactoring.
(ArchiveFormat): added Query<ResourceOptions> protected method for convenient invocation of parameters requests. (FormatCatalog): changed misguiding method name 'LookupTag' to 'LookupExtension'.
This commit is contained in:
@@ -294,7 +294,7 @@ namespace GameRes.Formats
|
||||
|
||||
uint WriteImageEntry (PackedEntry entry, Stream input, Stream output)
|
||||
{
|
||||
var grp = FormatCatalog.Instance.LookupTag<GrpFormat> ("GRP").FirstOrDefault();
|
||||
var grp = FormatCatalog.Instance.LookupExtension<GrpFormat> ("GRP").FirstOrDefault();
|
||||
if (null == grp) // probably never happens
|
||||
throw new FileFormatException ("GRP image encoder not available");
|
||||
bool is_grp = grp.Signature == FormatCatalog.ReadSignature (input);
|
||||
|
||||
@@ -334,15 +334,7 @@ namespace GameRes.Formats
|
||||
|
||||
uint? QueryEncryptionInfo ()
|
||||
{
|
||||
var args = new ParametersRequestEventArgs
|
||||
{
|
||||
Notice = arcStrings.INTNotice,
|
||||
};
|
||||
FormatCatalog.Instance.InvokeParametersRequest (this, args);
|
||||
if (!args.InputResult)
|
||||
throw new OperationCanceledException();
|
||||
|
||||
var options = GetOptions<IntOptions> (args.Options);
|
||||
var options = Query<IntOptions> (arcStrings.INTNotice);
|
||||
return options.EncryptionInfo.GetKey();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -333,15 +333,7 @@ namespace GameRes.Formats
|
||||
|
||||
NpaTitleId QueryGameEncryption ()
|
||||
{
|
||||
var args = new ParametersRequestEventArgs
|
||||
{
|
||||
Notice = arcStrings.ArcEncryptedNotice,
|
||||
};
|
||||
FormatCatalog.Instance.InvokeParametersRequest (this, args);
|
||||
if (!args.InputResult)
|
||||
throw new OperationCanceledException();
|
||||
|
||||
var options = GetOptions<NpaOptions> (args.Options);
|
||||
var options = Query<NpaOptions> (arcStrings.ArcEncryptedNotice);
|
||||
return options.TitleId;
|
||||
}
|
||||
|
||||
|
||||
@@ -281,15 +281,8 @@ NextEntry:
|
||||
|
||||
ICrypt QueryCryptAlgorithm ()
|
||||
{
|
||||
var args = new ParametersRequestEventArgs
|
||||
{
|
||||
Notice = arcStrings.ArcEncryptedNotice,
|
||||
};
|
||||
FormatCatalog.Instance.InvokeParametersRequest (this, args);
|
||||
if (!args.InputResult)
|
||||
throw new OperationCanceledException();
|
||||
|
||||
return GetOptions<Xp3Options> (args.Options).Scheme;
|
||||
var options = Query<Xp3Options> (arcStrings.ArcEncryptedNotice);
|
||||
return options.Scheme;
|
||||
}
|
||||
|
||||
public static ICrypt GetScheme (string scheme)
|
||||
|
||||
@@ -104,14 +104,8 @@ namespace GameRes.Formats
|
||||
|
||||
uint QueryEncryptionKey ()
|
||||
{
|
||||
var args = new ParametersRequestEventArgs
|
||||
{
|
||||
Notice = arcStrings.YPFNotice,
|
||||
};
|
||||
FormatCatalog.Instance.InvokeParametersRequest (this, args);
|
||||
if (!args.InputResult)
|
||||
throw new OperationCanceledException();
|
||||
return GetOptions<YpfOptions> (args.Options).Key;
|
||||
var options = Query<YpfOptions> (arcStrings.YPFNotice);
|
||||
return options.Key;
|
||||
}
|
||||
|
||||
private class Parser
|
||||
|
||||
Reference in New Issue
Block a user