2019-07-07 21:02:20 +02:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.IO.Compression;
|
|
|
|
|
using System.Threading.Tasks;
|
2019-07-16 23:35:21 +02:00
|
|
|
|
using Toolbox.Library.IO;
|
2019-07-07 21:02:20 +02:00
|
|
|
|
|
2019-07-16 23:35:21 +02:00
|
|
|
|
namespace Toolbox.Library
|
2019-07-07 21:02:20 +02:00
|
|
|
|
{
|
2019-07-31 23:08:00 +02:00
|
|
|
|
public class Yaz0 : ICompressionFormat
|
2019-07-07 21:02:20 +02:00
|
|
|
|
{
|
2019-07-31 23:08:00 +02:00
|
|
|
|
public string[] Description { get; set; } = new string[] { "Yaz0" };
|
2019-07-07 21:02:20 +02:00
|
|
|
|
public string[] Extension { get; set; } = new string[] { "*.yaz0", "*.szs",};
|
|
|
|
|
|
2019-09-16 01:13:01 +02:00
|
|
|
|
public override string ToString() { return "Yaz0"; }
|
|
|
|
|
|
|
|
|
|
public bool Identify(Stream stream, string fileName)
|
2019-07-07 21:02:20 +02:00
|
|
|
|
{
|
|
|
|
|
using (var reader = new FileReader(stream, true))
|
|
|
|
|
{
|
|
|
|
|
return reader.CheckSignature(4, "Yaz0");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool CanCompress { get; } = true;
|
|
|
|
|
|
|
|
|
|
public Stream Decompress(Stream stream)
|
|
|
|
|
{
|
|
|
|
|
return new MemoryStream(EveryFileExplorer.YAZ0.Decompress(stream.ToArray()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Stream Compress(Stream stream)
|
|
|
|
|
{
|
|
|
|
|
return new MemoryStream(EveryFileExplorer.YAZ0.Compress(stream.ToArray()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|