mirror of
https://github.com/crskycode/GARbro.git
synced 2024-11-23 21:55:34 +08:00
widget/options methods moved from ArchiveFormat to IResource.
any resource could have options and corresponding widget.
This commit is contained in:
parent
142f7e1cdf
commit
5bf2493044
@ -101,6 +101,44 @@ namespace GameRes
|
|||||||
Extensions = new string[] { Tag.ToLowerInvariant() };
|
Extensions = new string[] { Tag.ToLowerInvariant() };
|
||||||
Signatures = new uint[] { this.Signature };
|
Signatures = new uint[] { this.Signature };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual ResourceOptions GetDefaultOptions ()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual ResourceOptions GetOptions (object widget)
|
||||||
|
{
|
||||||
|
return GetDefaultOptions();
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual object GetCreationWidget ()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual object GetAccessWidget ()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected OptType GetOptions<OptType> (ResourceOptions res_options) where OptType : ResourceOptions
|
||||||
|
{
|
||||||
|
var options = res_options as OptType;
|
||||||
|
if (null == options)
|
||||||
|
options = this.GetDefaultOptions() as OptType;
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected OptType Query<OptType> (string notice) where OptType : ResourceOptions
|
||||||
|
{
|
||||||
|
var args = new ParametersRequestEventArgs { Notice = notice };
|
||||||
|
FormatCatalog.Instance.InvokeParametersRequest (this, args);
|
||||||
|
if (!args.InputResult)
|
||||||
|
throw new OperationCanceledException();
|
||||||
|
|
||||||
|
return GetOptions<OptType> (args.Options);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ResourceOptions
|
public class ResourceOptions
|
||||||
@ -197,44 +235,6 @@ namespace GameRes
|
|||||||
throw new NotImplementedException ("ArchiveFormat.Create is not implemented");
|
throw new NotImplementedException ("ArchiveFormat.Create is not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual ResourceOptions GetDefaultOptions ()
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual ResourceOptions GetOptions (object widget)
|
|
||||||
{
|
|
||||||
return GetDefaultOptions();
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual object GetCreationWidget ()
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual object GetAccessWidget ()
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected OptType GetOptions<OptType> (ResourceOptions res_options) where OptType : ResourceOptions
|
|
||||||
{
|
|
||||||
var options = res_options as OptType;
|
|
||||||
if (null == options)
|
|
||||||
options = this.GetDefaultOptions() as OptType;
|
|
||||||
return options;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected OptType Query<OptType> (string notice) where OptType : ResourceOptions
|
|
||||||
{
|
|
||||||
var args = new ParametersRequestEventArgs { Notice = notice };
|
|
||||||
FormatCatalog.Instance.InvokeParametersRequest (this, args);
|
|
||||||
if (!args.InputResult)
|
|
||||||
throw new OperationCanceledException();
|
|
||||||
|
|
||||||
return GetOptions<OptType> (args.Options);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected static bool IsSaneCount (int count)
|
protected static bool IsSaneCount (int count)
|
||||||
{
|
{
|
||||||
return count > 0 && count < 0x20000;
|
return count > 0 && count < 0x20000;
|
||||||
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion ("1.1.3.8")]
|
[assembly: AssemblyVersion ("1.1.4.8")]
|
||||||
[assembly: AssemblyFileVersion ("1.1.3.8")]
|
[assembly: AssemblyFileVersion ("1.1.4.8")]
|
||||||
|
Loading…
Reference in New Issue
Block a user