From 0d59561bee4cf7db10d53a8aa58952ae65e856b5 Mon Sep 17 00:00:00 2001 From: Wither OrNot Date: Thu, 13 Feb 2025 09:49:35 -0500 Subject: Initial commit Co-authored-by: neko <109633131+nekoppai@users.noreply.github.com> Co-authored-by: Lyssa <75037904+thecatontheceiling@users.noreply.github.com> Co-authored-by: abbodi1406 <33669284+abbodi1406@users.noreply.github.com> --- LibTSforge/PhysicalStore/IPhysicalStore.cs | 92 ++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 LibTSforge/PhysicalStore/IPhysicalStore.cs (limited to 'LibTSforge/PhysicalStore/IPhysicalStore.cs') diff --git a/LibTSforge/PhysicalStore/IPhysicalStore.cs b/LibTSforge/PhysicalStore/IPhysicalStore.cs new file mode 100644 index 0000000..e451281 --- /dev/null +++ b/LibTSforge/PhysicalStore/IPhysicalStore.cs @@ -0,0 +1,92 @@ +namespace LibTSforge.PhysicalStore +{ + using System; + using System.Collections.Generic; + + public class PSBlock + { + public BlockType Type; + public uint Flags; + public uint Unknown = 0; + public byte[] Key; + public string KeyAsStr + { + get + { + return Utils.DecodeString(Key); + } + set + { + Key = Utils.EncodeString(value); + } + } + public byte[] Value; + public string ValueAsStr + { + get + { + return Utils.DecodeString(Value); + } + set + { + Value = Utils.EncodeString(value); + } + } + public uint ValueAsInt + { + get + { + return BitConverter.ToUInt32(Value, 0); + } + set + { + Value = BitConverter.GetBytes(value); + } + } + public byte[] Data; + public string DataAsStr + { + get + { + return Utils.DecodeString(Data); + } + set + { + Data = Utils.EncodeString(value); + } + } + public uint DataAsInt + { + get + { + return BitConverter.ToUInt32(Data, 0); + } + set + { + Data = BitConverter.GetBytes(value); + } + } + } + + public interface IPhysicalStore : IDisposable + { + PSBlock GetBlock(string key, string value); + PSBlock GetBlock(string key, uint value); + void AddBlock(PSBlock block); + void AddBlocks(IEnumerable blocks); + void SetBlock(string key, string value, byte[] data); + void SetBlock(string key, string value, string data); + void SetBlock(string key, string value, uint data); + void SetBlock(string key, uint value, byte[] data); + void SetBlock(string key, uint value, string data); + void SetBlock(string key, uint value, uint data); + void DeleteBlock(string key, string value); + void DeleteBlock(string key, uint value); + byte[] Serialize(); + void Deserialize(byte[] data); + byte[] ReadRaw(); + void WriteRaw(byte[] data); + IEnumerable FindBlocks(string valueSearch); + IEnumerable FindBlocks(uint valueSearch); + } +} -- cgit v1.2.3