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
+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;