Minor fixups
This commit is contained in:
@ -14,7 +14,7 @@ namespace LibTSforge.TokenStore
|
||||
public class TokenMeta
|
||||
{
|
||||
public string Name;
|
||||
public Dictionary<string, string> Data = new Dictionary<string, string>();
|
||||
public readonly Dictionary<string, string> Data = new Dictionary<string, string>();
|
||||
|
||||
public byte[] Serialize()
|
||||
{
|
||||
@ -37,7 +37,7 @@ namespace LibTSforge.TokenStore
|
||||
return writer.GetBytes();
|
||||
}
|
||||
|
||||
public void Deserialize(byte[] data)
|
||||
private void Deserialize(byte[] data)
|
||||
{
|
||||
BinaryReader reader = new BinaryReader(new MemoryStream(data));
|
||||
reader.ReadInt32();
|
||||
|
@ -4,7 +4,7 @@ namespace LibTSforge.TokenStore
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using LibTSforge.Crypto;
|
||||
using Crypto;
|
||||
|
||||
public class TokenStoreModern : ITokenStore
|
||||
{
|
||||
@ -18,7 +18,7 @@ namespace LibTSforge.TokenStore
|
||||
private static readonly byte[] CONTS_FOOTER = Enumerable.Repeat((byte)0xAA, 0x20).ToArray();
|
||||
|
||||
private List<TokenEntry> Entries = new List<TokenEntry>();
|
||||
public FileStream TokensFile;
|
||||
private readonly FileStream TokensFile;
|
||||
|
||||
public void Deserialize()
|
||||
{
|
||||
@ -40,7 +40,7 @@ namespace LibTSforge.TokenStore
|
||||
uint contentOffset = reader.ReadUInt32();
|
||||
uint contentLength = reader.ReadUInt32();
|
||||
uint allocLength = reader.ReadUInt32();
|
||||
byte[] contentData = new byte[] { };
|
||||
byte[] contentData = { };
|
||||
|
||||
if (populated)
|
||||
{
|
||||
@ -140,11 +140,10 @@ namespace LibTSforge.TokenStore
|
||||
writer.WritePadding(BLOCK_PAD_SIZE);
|
||||
|
||||
writer.BaseStream.Seek(curBlockOffset, SeekOrigin.Begin);
|
||||
byte[] blockHash;
|
||||
byte[] blockData = new byte[BLOCK_SIZE - 0x20];
|
||||
byte[] blockHash = CryptoUtils.SHA256Hash(blockData);
|
||||
|
||||
tokens.Read(blockData, 0, BLOCK_SIZE - 0x20);
|
||||
blockHash = CryptoUtils.SHA256Hash(blockData);
|
||||
|
||||
writer.BaseStream.Seek(curBlockOffset + BLOCK_SIZE - 0x20, SeekOrigin.Begin);
|
||||
writer.Write(blockHash);
|
||||
@ -275,11 +274,6 @@ namespace LibTSforge.TokenStore
|
||||
Deserialize();
|
||||
}
|
||||
|
||||
public TokenStoreModern()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Serialize();
|
||||
|
Reference in New Issue
Block a user