mirror of
https://github.com/Caraxi/mare.client.git
synced 2025-12-12 20:57:22 +01:00
requested changes
This commit is contained in:
parent
9023aa8006
commit
57a4e65383
2 changed files with 29 additions and 27 deletions
|
|
@ -178,31 +178,30 @@ public sealed class CharacterAnalyzer : MediatorSubscriberBase, IDisposable
|
|||
}
|
||||
public long OriginalSize { get; private set; } = OriginalSize;
|
||||
public long CompressedSize { get; private set; } = CompressedSize;
|
||||
|
||||
private string? _format;
|
||||
|
||||
public string? Format
|
||||
public Lazy<string> Format = new(() =>
|
||||
{
|
||||
get
|
||||
switch (FileType)
|
||||
{
|
||||
if (_format != null) return _format;
|
||||
|
||||
switch (FileType)
|
||||
{
|
||||
case "tex":
|
||||
case "tex":
|
||||
{
|
||||
using var stream = new FileStream(FilePaths[0], FileMode.Open, FileAccess.Read, FileShare.Read);
|
||||
using var reader = new BinaryReader(stream);
|
||||
reader.BaseStream.Position = 4;
|
||||
var format = (TexFile.TextureFormat) reader.ReadInt32();
|
||||
_format = format.ToString();
|
||||
return _format;
|
||||
try
|
||||
{
|
||||
using var stream = new FileStream(FilePaths[0], FileMode.Open, FileAccess.Read, FileShare.Read);
|
||||
using var reader = new BinaryReader(stream);
|
||||
reader.BaseStream.Position = 4;
|
||||
var format = (TexFile.TextureFormat)reader.ReadInt32();
|
||||
return format.ToString();
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
}
|
||||
default:
|
||||
_format = string.Empty;
|
||||
return _format;
|
||||
}
|
||||
default:
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue