summaryrefslogtreecommitdiff
path: root/LibTSforge/PhysicalStore/IPhysicalStore.cs
diff options
context:
space:
mode:
authorWither OrNot2025-02-13 14:49:35 +0000
committerWither OrNot2025-02-13 14:49:37 +0000
commit0d59561bee4cf7db10d53a8aa58952ae65e856b5 (patch)
treeb2ddb66c883dd2ef75426de4c080f3121f0a8658 /LibTSforge/PhysicalStore/IPhysicalStore.cs
downloadTSforge-0d59561bee4cf7db10d53a8aa58952ae65e856b5.zip
Initial commit1.0.0
Co-authored-by: neko <[email protected]> Co-authored-by: Lyssa <[email protected]> Co-authored-by: abbodi1406 <[email protected]>
Diffstat (limited to 'LibTSforge/PhysicalStore/IPhysicalStore.cs')
-rw-r--r--LibTSforge/PhysicalStore/IPhysicalStore.cs92
1 files changed, 92 insertions, 0 deletions
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<PSBlock> 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<PSBlock> FindBlocks(string valueSearch);
+ IEnumerable<PSBlock> FindBlocks(uint valueSearch);
+ }
+}