mirror of
https://github.com/par274/sharpemu.git
synced 2026-08-03 16:39:51 +08:00
initial commit
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
// Copyright (C) 2026 SharpEmu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
namespace SharpEmu.Core;
|
||||
|
||||
public sealed class PhysicalFileSystem : IFileSystem
|
||||
{
|
||||
public bool Exists(string path)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(path))
|
||||
return false;
|
||||
|
||||
return File.Exists(path);
|
||||
}
|
||||
|
||||
public bool TryReadAllBytes(string path, out byte[] data)
|
||||
{
|
||||
data = Array.Empty<byte>();
|
||||
|
||||
if (string.IsNullOrWhiteSpace(path))
|
||||
return false;
|
||||
|
||||
if (!File.Exists(path))
|
||||
return false;
|
||||
|
||||
try
|
||||
{
|
||||
data = File.ReadAllBytes(path);
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
data = Array.Empty<byte>();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user