This commit is contained in:
Crsky
2023-08-25 09:03:13 +08:00
119 changed files with 11077 additions and 617 deletions

View File

@@ -34,6 +34,7 @@ using System.Windows.Media;
namespace GameRes
{
[Export(typeof(ImageFormat))]
[ExportMetadata("Priority", 100)] // makes PNG first format in list
public class PngFormat : ImageFormat
{
public override string Tag { get { return "PNG"; } }

View File

@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion ("1.5.44.324")]
[assembly: AssemblyFileVersion ("1.5.44.324")]
[assembly: AssemblyVersion ("1.5.44.321")]
[assembly: AssemblyFileVersion ("1.5.44.321")]

View File

@@ -30,12 +30,51 @@ namespace GameRes
{
public override string Type { get { return "script"; } }
public abstract bool IsScript (IBinaryStream file);
public abstract Stream ConvertFrom (IBinaryStream file);
public abstract Stream ConvertBack (IBinaryStream file);
public abstract ScriptData Read (string name, Stream file);
public abstract void Write (Stream file, ScriptData script);
public static ScriptFormat FindFormat (IBinaryStream file)
{
foreach (var impl in FormatCatalog.Instance.FindFormats<ScriptFormat> (file.Name, file.Signature))
{
try
{
file.Position = 0;
if (impl.IsScript (file))
return impl;
}
catch (System.OperationCanceledException)
{
throw;
}
catch { }
}
return null;
}
}
public abstract class GenericScriptFormat : ScriptFormat
{
public override bool IsScript (IBinaryStream file)
{
return false;
}
public override Stream ConvertFrom (IBinaryStream file)
{
return file.AsStream;
}
public override Stream ConvertBack (IBinaryStream file)
{
return file.AsStream;
}
public override ScriptData Read (string name, Stream file)
{
throw new System.NotImplementedException();