Code cleanup

This commit is contained in:
Gustave Monce
2019-12-22 12:25:48 +01:00
parent 0e6f905809
commit a2a1c2302b
149 changed files with 3980 additions and 4088 deletions
+1 -1
View File
@@ -27,7 +27,7 @@ namespace DiscUtils
public Block()
{
}
public long Position { get; set; }
public byte[] Data { get; set; }
-2
View File
@@ -22,9 +22,7 @@
namespace DiscUtils
{
using System;
using System.Collections.Generic;
using System.Text;
internal class BlockCache<T>
where T : Block, new()
@@ -22,10 +22,10 @@
namespace DiscUtils.BootConfig
{
using DiscUtils.Registry;
using System;
using System.Collections.Generic;
using System.Globalization;
using DiscUtils.Registry;
internal class DiscUtilsRegistryStorage : BaseStorage
{
-1
View File
@@ -23,7 +23,6 @@
namespace DiscUtils.BootConfig
{
using System;
using System.Globalization;
/// <summary>
/// The value of an element.
-4
View File
@@ -22,10 +22,6 @@
namespace DiscUtils.BootConfig
{
using System;
using System.Collections.Generic;
using System.Text;
/// <summary>
/// Indicates the type of objects that can inherit from an object.
/// </summary>
+1 -1
View File
@@ -22,9 +22,9 @@
namespace DiscUtils.BootConfig
{
using DiscUtils.Registry;
using System;
using System.Collections.Generic;
using DiscUtils.Registry;
/// <summary>
/// Represents a Boot Configuration Database store (i.e. a BCD file).
-2
View File
@@ -22,9 +22,7 @@
namespace DiscUtils
{
using System;
using System.Collections.Generic;
using System.Text;
internal class BuilderSparseStreamExtent : BuilderExtent
{
+3 -4
View File
@@ -24,7 +24,6 @@ namespace DiscUtils
{
using System;
using System.Collections.Generic;
using System.Text;
/// <summary>
/// Enumeration of possible cluster roles.
@@ -36,12 +35,12 @@ namespace DiscUtils
/// <summary>
/// Unknown, or unspecified role.
/// </summary>
None = 0x00,
None = 0x00,
/// <summary>
/// Cluster is free.
/// </summary>
Free = 0x01,
Free = 0x01,
/// <summary>
/// Cluster is in use by a normal file.
@@ -69,7 +68,7 @@ namespace DiscUtils
/// <summary>
/// Cluster is marked bad.
/// </summary>
Bad = 0x20,
Bad = 0x20,
}
/// <summary>
-1
View File
@@ -24,7 +24,6 @@ namespace DiscUtils.Fat
{
using System;
using System.IO;
using System.Text;
internal class DirectoryEntry
{
-1
View File
@@ -22,7 +22,6 @@
namespace DiscUtils.Fat
{
using System;
using System.IO;
internal class FileAllocationTable
+1 -1
View File
@@ -22,8 +22,8 @@
namespace DiscUtils.Fat
{
using System.IO;
using DiscUtils.Vfs;
using System.IO;
[VfsFileSystemFactory]
internal class FileSystemFactory : VfsFileSystemFactory
+1 -1
View File
@@ -22,9 +22,9 @@
namespace DiscUtils.LogicalDiskManager
{
using DiscUtils.Partitions;
using System;
using System.IO;
using DiscUtils.Partitions;
internal class DynamicDisk : IDiagnosticTraceable
{
@@ -22,11 +22,11 @@
namespace DiscUtils.LogicalDiskManager
{
using DiscUtils.Partitions;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using DiscUtils.Partitions;
internal class DynamicDiskGroup : IDiagnosticTraceable
{
@@ -22,9 +22,9 @@
namespace DiscUtils.LogicalDiskManager
{
using DiscUtils.Partitions;
using System.Collections.Generic;
using System.IO;
using DiscUtils.Partitions;
/// <summary>
/// A class that understands Windows LDM structures, mapping physical volumes to logical volumes.
-2
View File
@@ -22,8 +22,6 @@
namespace DiscUtils.LogicalDiskManager
{
using System;
internal class TocBlock
{
public string Signature; // TOCBLOCK
-1
View File
@@ -22,7 +22,6 @@
namespace DiscUtils
{
using System;
using System.Collections.Generic;
using System.IO;
+13 -13
View File
@@ -27,25 +27,25 @@ namespace DiscUtils.Ntfs
internal enum AttributeCollationRule : int
{
Binary = 0x00000000,
Filename = 0x00000001,
UnicodeString = 0x00000002,
UnsignedLong = 0x00000010,
Sid = 0x00000011,
SecurityHash = 0x00000012,
Binary = 0x00000000,
Filename = 0x00000001,
UnicodeString = 0x00000002,
UnsignedLong = 0x00000010,
Sid = 0x00000011,
SecurityHash = 0x00000012,
MultipleUnsignedLongs = 0x00000013
}
[Flags]
internal enum AttributeTypeFlags : int
{
None = 0x00,
Indexed = 0x02,
Multiple = 0x04,
NotZero = 0x08,
IndexedUnique = 0x10,
NamedUnique = 0x20,
MustBeResident = 0x40,
None = 0x00,
Indexed = 0x02,
Multiple = 0x04,
NotZero = 0x08,
IndexedUnique = 0x10,
NamedUnique = 0x20,
MustBeResident = 0x40,
CanBeNonResident = 0x80
}
+1 -1
View File
@@ -22,10 +22,10 @@
namespace DiscUtils.Ntfs
{
using DiscUtils.Compression;
using System;
using System.Collections.Generic;
using System.IO;
using DiscUtils.Compression;
internal sealed class CompressedClusterStream : ClusterStream
{
-1
View File
@@ -23,7 +23,6 @@
namespace DiscUtils.Ntfs
{
using System;
using System.Collections.Generic;
internal class CookedDataRun
{
-1
View File
@@ -23,7 +23,6 @@
namespace DiscUtils.Ntfs
{
using System.Globalization;
using System.IO;
internal class DataRun
{
+1 -1
View File
@@ -809,7 +809,7 @@ namespace DiscUtils.Ntfs
return SplitAttribute(record, (NonResidentAttributeRecord)record.FirstAttribute, false);
}
private bool SplitAttribute(FileRecord record, NonResidentAttributeRecord targetAttr, bool atStart)
{
if (targetAttr.DataRuns.Count <= 1)
-1
View File
@@ -24,7 +24,6 @@ namespace DiscUtils.Ntfs
{
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
[Flags]
+1 -1
View File
@@ -22,8 +22,8 @@
namespace DiscUtils.Ntfs
{
using System.IO;
using DiscUtils.Vfs;
using System.IO;
[VfsFileSystemFactory]
internal class FileSystemFactory : VfsFileSystemFactory
-1
View File
@@ -22,7 +22,6 @@
namespace DiscUtils.Ntfs
{
using System;
using System.IO;
internal abstract class FixupRecordBase
+1 -1
View File
@@ -474,7 +474,7 @@ namespace DiscUtils.Ntfs
{
writer.WriteLine(prefix + " " + EntryAsString(entry, _file.BestName, _name));
}
if ((entry.Flags & IndexEntryFlags.Node) != 0)
{
NodeAsString(writer, prefix + " ", GetSubBlock(entry).Node, ":i" + entry.ChildrenVirtualCluster);
-1
View File
@@ -23,7 +23,6 @@
namespace DiscUtils.Ntfs
{
using System;
using System.Collections.Generic;
using System.IO;
internal class IndexBlock : FixupRecordBase
+1 -1
View File
@@ -404,7 +404,7 @@ namespace DiscUtils.Ntfs
}
return null;
}
}
private IndexEntry PopulateEnd()
{
@@ -1,9 +1,5 @@
namespace DiscUtils.Ntfs.Internals
{
using System;
using System.Collections.Generic;
using System.Text;
public sealed class MasterFileTableAttribute
{
}
@@ -22,10 +22,6 @@
namespace DiscUtils.Ntfs.Internals
{
using System.Collections;
using System.Collections.Generic;
using System.IO;
public sealed class MasterFileTableRecord
{
private FileRecord _fileRecord;
@@ -22,8 +22,6 @@
namespace DiscUtils.Ntfs.Internals
{
using System;
/// <summary>
/// The known NTFS namespaces.
/// </summary>
+1 -1
View File
@@ -30,8 +30,8 @@
namespace DiscUtils.Ntfs
{
using System;
using DiscUtils.Compression;
using System;
/// <summary>
/// Implementation of the LZNT1 algorithm used for compressing NTFS files.
-1
View File
@@ -25,7 +25,6 @@ namespace DiscUtils.Ntfs
using System;
using System.Collections.Generic;
using System.IO;
using DiscUtils.Compression;
internal class NonResidentDataBuffer : DiscUtils.Buffer, IMappedBuffer
{
-1
View File
@@ -22,7 +22,6 @@
namespace DiscUtils.Ntfs
{
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
+6 -6
View File
@@ -1097,7 +1097,7 @@ namespace DiscUtils.Ntfs
}
}
UpdateStandardInformation(dirEntry, file, delegate(StandardInformation si) { si.FileAttributes = FileNameRecord.SetAttributes(newValue, si.FileAttributes); });
UpdateStandardInformation(dirEntry, file, delegate (StandardInformation si) { si.FileAttributes = FileNameRecord.SetAttributes(newValue, si.FileAttributes); });
}
}
@@ -1131,7 +1131,7 @@ namespace DiscUtils.Ntfs
{
using (new NtfsTransaction())
{
UpdateStandardInformation(path, delegate(StandardInformation si) { si.CreationTime = newTime; });
UpdateStandardInformation(path, delegate (StandardInformation si) { si.CreationTime = newTime; });
}
}
@@ -1165,7 +1165,7 @@ namespace DiscUtils.Ntfs
{
using (new NtfsTransaction())
{
UpdateStandardInformation(path, delegate(StandardInformation si) { si.LastAccessTime = newTime; });
UpdateStandardInformation(path, delegate (StandardInformation si) { si.LastAccessTime = newTime; });
}
}
@@ -1199,7 +1199,7 @@ namespace DiscUtils.Ntfs
{
using (new NtfsTransaction())
{
UpdateStandardInformation(path, delegate(StandardInformation si) { si.ModificationTime = newTime; });
UpdateStandardInformation(path, delegate (StandardInformation si) { si.ModificationTime = newTime; });
}
}
@@ -1763,7 +1763,7 @@ namespace DiscUtils.Ntfs
{
UpdateStandardInformation(
path,
delegate(StandardInformation si)
delegate (StandardInformation si)
{
si.CreationTime = info.CreationTime;
si.LastAccessTime = info.LastAccessTime;
@@ -1813,7 +1813,7 @@ namespace DiscUtils.Ntfs
DirectoryEntry dirEntry = GetDirectoryEntry(path);
if (dirEntry == null)
{
throw new FileNotFoundException("File not found", path);
throw new FileNotFoundException("File not found", path);
}
File file = GetFile(dirEntry.Reference);
+2 -2
View File
@@ -137,8 +137,8 @@ namespace DiscUtils.Ntfs
SetSecurityAttribute(volumeFile, "O:" + localAdminString + "G:BAD:(A;;0x12019f;;;SY)(A;;0x12019f;;;BA)");
volumeFile.UpdateRecordInMft();
_context.GetFileByIndex = delegate(long index) { return new File(_context, _context.Mft.GetRecord(index, false)); };
_context.AllocateFile = delegate(FileRecordFlags frf) { return new File(_context, _context.Mft.AllocateRecord(frf, false)); };
_context.GetFileByIndex = delegate (long index) { return new File(_context, _context.Mft.GetRecord(index, false)); };
_context.AllocateFile = delegate (FileRecordFlags frf) { return new File(_context, _context.Mft.AllocateRecord(frf, false)); };
File attrDefFile = CreateSystemFile(MasterFileTable.AttrDefIndex);
_context.AttributeDefinitions.WriteTo(attrDefFile);
+1 -2
View File
@@ -22,7 +22,6 @@
namespace DiscUtils.Ntfs
{
using System;
using System.Collections.Generic;
using System.IO;
@@ -70,7 +69,7 @@ namespace DiscUtils.Ntfs
value.ReadFrom(buffer, 0);
return value;
}
/// <summary>
/// Sets the content of a stream.
/// </summary>
-2
View File
@@ -23,8 +23,6 @@
namespace DiscUtils.Ntfs
{
using System;
using System.Collections.Generic;
using System.Text;
internal sealed class NtfsTransaction : IDisposable
{
+1 -1
View File
@@ -22,11 +22,11 @@
namespace DiscUtils.Ntfs
{
using DiscUtils;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using DiscUtils;
/// <summary>
/// Low-level non-resident attribute operations.
-2
View File
@@ -22,10 +22,8 @@
namespace DiscUtils.Ntfs
{
using System;
using System.IO;
using System.Security.AccessControl;
using System.Security.Principal;
internal sealed class SecurityDescriptor : IByteArraySerializable, IDiagnosticTraceable
{
-4
View File
@@ -22,10 +22,6 @@
namespace DiscUtils.Ntfs
{
using System;
using System.Collections.Generic;
using System.Text;
/// <summary>
/// Controls whether short file names are created automatically.
/// </summary>
+3 -3
View File
@@ -93,9 +93,9 @@ namespace DiscUtils.Ntfs
{
using (Stream s = Open(FileAccess.Read))
{
byte[] buffer = Utilities.ReadFully(s, (int)Length);
_structure.ReadFrom(buffer, 0);
_hasContent = s.Length != 0;
byte[] buffer = Utilities.ReadFully(s, (int)Length);
_structure.ReadFrom(buffer, 0);
_hasContent = s.Length != 0;
}
_initialized = true;
-1
View File
@@ -22,7 +22,6 @@
namespace DiscUtils.Ntfs
{
using System;
using System.IO;
internal sealed class VolumeInformation : IByteArraySerializable, IDiagnosticTraceable
-1
View File
@@ -22,7 +22,6 @@
namespace DiscUtils.Ntfs
{
using System;
using System.IO;
using System.Text;
-1
View File
@@ -23,7 +23,6 @@
namespace DiscUtils
{
using System;
using System.Collections;
using System.Collections.Generic;
/// <summary>
-4
View File
@@ -22,10 +22,6 @@
namespace DiscUtils
{
using System;
using System.Collections.Generic;
using System.Text;
/// <summary>
/// Enumeration used to indicate transfer of disposable objects.
/// </summary>
@@ -23,7 +23,6 @@
namespace DiscUtils.Partitions
{
using System;
using System.IO;
/// <summary>
/// Provides access to partition records in a BIOS (MBR) partition table.
@@ -24,7 +24,6 @@ namespace DiscUtils.Partitions
{
using System;
using System.Collections.Generic;
using System.IO;
/// <summary>
/// Builds a stream with the contents of a BIOS partitioned disk.
@@ -23,7 +23,6 @@
namespace DiscUtils.Partitions
{
using System;
using System.IO;
/// <summary>
/// Provides access to partition records in a GUID partition table.
-1
View File
@@ -24,7 +24,6 @@ namespace DiscUtils.Partitions
{
using System;
using System.Globalization;
using System.IO;
/// <summary>
/// Base class representing a disk partition.
+1 -1
View File
@@ -22,9 +22,9 @@
namespace DiscUtils
{
using DiscUtils.Partitions;
using System;
using System.Globalization;
using DiscUtils.Partitions;
/// <summary>
/// Enumeration of possible types of physical volume.
-1
View File
@@ -24,7 +24,6 @@ namespace DiscUtils
{
using System;
using System.Collections.Generic;
using System.Text;
/// <summary>
/// Represents a range of values.
-1
View File
@@ -23,7 +23,6 @@
namespace DiscUtils.Raw
{
using System;
using System.Collections.Generic;
using System.IO;
[VirtualDiskFactory("RAW", ".img,.ima,.vfd,.flp,.bif")]
+1 -1
View File
@@ -22,9 +22,9 @@
namespace DiscUtils.Raw
{
using DiscUtils.Partitions;
using System;
using System.IO;
using DiscUtils.Partitions;
/// <summary>
/// Represents a single raw disk image file.
-1
View File
@@ -22,7 +22,6 @@
namespace DiscUtils.Registry
{
using System;
using System.IO;
internal sealed class BinHeader : IByteArraySerializable
-1
View File
@@ -22,7 +22,6 @@
namespace DiscUtils
{
using System.Collections.Generic;
using System.IO;
/// <summary>
-2
View File
@@ -22,8 +22,6 @@
namespace DiscUtils
{
using System;
internal abstract class Tuple
{
public abstract object this[int i]
-2
View File
@@ -22,8 +22,6 @@
namespace DiscUtils
{
using System;
/// <summary>
/// Standard Unix-style file type.
/// </summary>
+1 -1
View File
@@ -29,7 +29,7 @@ namespace DiscUtils
using System.Text.RegularExpressions;
internal delegate TResult Func<T, TResult>(T arg);
internal static class Utilities
{
/// <summary>
@@ -23,8 +23,6 @@
namespace DiscUtils.Vfs
{
using System;
using System.Collections.Generic;
using System.Text;
/// <summary>
/// Attribute identifying file system factory classes.
+1 -1
View File
@@ -22,11 +22,11 @@
namespace DiscUtils
{
using DiscUtils.Partitions;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using DiscUtils.Partitions;
/// <summary>
/// Base class representing virtual hard disks.
+1 -1
View File
@@ -22,11 +22,11 @@
namespace DiscUtils
{
using DiscUtils.Partitions;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using DiscUtils.Partitions;
/// <summary>
/// VolumeManager interprets partitions and other on-disk structures (possibly combining multiple disks).