1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
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);
}
}
|