summaryrefslogtreecommitdiff
path: root/LibTSforge/PhysicalStore
diff options
context:
space:
mode:
Diffstat (limited to 'LibTSforge/PhysicalStore')
-rw-r--r--LibTSforge/PhysicalStore/PhysicalStoreModern.cs48
-rw-r--r--LibTSforge/PhysicalStore/PhysicalStoreVista.cs4
-rw-r--r--LibTSforge/PhysicalStore/PhysicalStoreWin7.cs4
-rw-r--r--LibTSforge/PhysicalStore/VariableBag.cs3
4 files changed, 31 insertions, 28 deletions
diff --git a/LibTSforge/PhysicalStore/PhysicalStoreModern.cs b/LibTSforge/PhysicalStore/PhysicalStoreModern.cs
index 9d8bb73..b76852a 100644
--- a/LibTSforge/PhysicalStore/PhysicalStoreModern.cs
+++ b/LibTSforge/PhysicalStore/PhysicalStoreModern.cs
@@ -3,7 +3,7 @@ namespace LibTSforge.PhysicalStore
using System;
using System.Collections.Generic;
using System.IO;
- using LibTSforge.Crypto;
+ using Crypto;
public class ModernBlock
{
@@ -93,7 +93,7 @@ namespace LibTSforge.PhysicalStore
public sealed class PhysicalStoreModern : IPhysicalStore
{
- private byte[] PreHeaderBytes = new byte[] { };
+ private byte[] PreHeaderBytes = { };
private readonly Dictionary<string, List<ModernBlock>> Data = new Dictionary<string, List<ModernBlock>>();
private readonly FileStream TSFile;
private readonly PSVersion Version;
@@ -281,40 +281,44 @@ namespace LibTSforge.PhysicalStore
public void DeleteBlock(string key, string value)
{
- if (Data.ContainsKey(key))
+ if (!Data.ContainsKey(key))
{
- List<ModernBlock> blocks = Data[key];
+ return;
+ }
- foreach (ModernBlock block in blocks)
+ List<ModernBlock> blocks = Data[key];
+
+ foreach (ModernBlock block in blocks)
+ {
+ if (block.ValueAsStr == value)
{
- if (block.ValueAsStr == value)
- {
- blocks.Remove(block);
- break;
- }
+ blocks.Remove(block);
+ break;
}
-
- Data[key] = blocks;
}
+
+ Data[key] = blocks;
}
public void DeleteBlock(string key, uint value)
{
- if (Data.ContainsKey(key))
+ if (!Data.ContainsKey(key))
{
- List<ModernBlock> blocks = Data[key];
+ return;
+ }
- foreach (ModernBlock block in blocks)
+ List<ModernBlock> blocks = Data[key];
+
+ foreach (ModernBlock block in blocks)
+ {
+ if (block.ValueAsInt == value)
{
- if (block.ValueAsInt == value)
- {
- blocks.Remove(block);
- break;
- }
+ blocks.Remove(block);
+ break;
}
-
- Data[key] = blocks;
}
+
+ Data[key] = blocks;
}
public PhysicalStoreModern(string tsPath, bool production, PSVersion version)
diff --git a/LibTSforge/PhysicalStore/PhysicalStoreVista.cs b/LibTSforge/PhysicalStore/PhysicalStoreVista.cs
index 809be77..5251914 100644
--- a/LibTSforge/PhysicalStore/PhysicalStoreVista.cs
+++ b/LibTSforge/PhysicalStore/PhysicalStoreVista.cs
@@ -3,7 +3,7 @@ namespace LibTSforge.PhysicalStore
using System;
using System.Collections.Generic;
using System.IO;
- using LibTSforge.Crypto;
+ using Crypto;
public class VistaBlock
{
@@ -88,7 +88,7 @@ namespace LibTSforge.PhysicalStore
public sealed class PhysicalStoreVista : IPhysicalStore
{
- private byte[] PreHeaderBytes = new byte[] { };
+ private byte[] PreHeaderBytes = { };
private readonly List<VistaBlock> Blocks = new List<VistaBlock>();
private readonly FileStream TSPrimary;
private readonly FileStream TSSecondary;
diff --git a/LibTSforge/PhysicalStore/PhysicalStoreWin7.cs b/LibTSforge/PhysicalStore/PhysicalStoreWin7.cs
index d03bf9a..006c8df 100644
--- a/LibTSforge/PhysicalStore/PhysicalStoreWin7.cs
+++ b/LibTSforge/PhysicalStore/PhysicalStoreWin7.cs
@@ -3,7 +3,7 @@ namespace LibTSforge.PhysicalStore
using System;
using System.Collections.Generic;
using System.IO;
- using LibTSforge.Crypto;
+ using Crypto;
public class Win7Block
{
@@ -105,7 +105,7 @@ namespace LibTSforge.PhysicalStore
public sealed class PhysicalStoreWin7 : IPhysicalStore
{
- private byte[] PreHeaderBytes = new byte[] { };
+ private byte[] PreHeaderBytes = { };
private readonly List<Win7Block> Blocks = new List<Win7Block>();
private readonly FileStream TSPrimary;
private readonly FileStream TSSecondary;
diff --git a/LibTSforge/PhysicalStore/VariableBag.cs b/LibTSforge/PhysicalStore/VariableBag.cs
index ebe413f..bca0e32 100644
--- a/LibTSforge/PhysicalStore/VariableBag.cs
+++ b/LibTSforge/PhysicalStore/VariableBag.cs
@@ -74,7 +74,6 @@ namespace LibTSforge.PhysicalStore
public override void Decode(BinaryReader reader)
{
uint type = reader.ReadUInt32();
- uint unk_zero = reader.ReadUInt32();
uint lenName = reader.ReadUInt32();
uint lenVal = reader.ReadUInt32();
uint crc = reader.ReadUInt32();
@@ -156,7 +155,7 @@ namespace LibTSforge.PhysicalStore
public List<CRCBlock> Blocks = new List<CRCBlock>();
private readonly PSVersion Version;
- public void Deserialize(byte[] data)
+ private void Deserialize(byte[] data)
{
int len = data.Length;