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
+2 -2
View File
@@ -33,11 +33,11 @@ namespace SevenZip.CommandLineParser
MaxLen = maxLen; MaxLen = maxLen;
PostCharSet = postCharSet; PostCharSet = postCharSet;
} }
public SwitchForm(string idString, SwitchType type, bool multi, int minLen): public SwitchForm(string idString, SwitchType type, bool multi, int minLen) :
this(idString, type, multi, minLen, 0, "") this(idString, type, multi, minLen, 0, "")
{ {
} }
public SwitchForm(string idString, SwitchType type, bool multi): public SwitchForm(string idString, SwitchType type, bool multi) :
this(idString, type, multi, 0) this(idString, type, multi, 0)
{ {
} }
+3 -3
View File
@@ -199,9 +199,9 @@ namespace SevenZip.Compression.LZ
UInt32 count = _cutValue; UInt32 count = _cutValue;
while(true) while (true)
{ {
if(curMatch <= matchMinPos || count-- == 0) if (curMatch <= matchMinPos || count-- == 0)
{ {
_son[ptr0] = _son[ptr1] = kEmptyHashValue; _son[ptr0] = _son[ptr1] = kEmptyHashValue;
break; break;
@@ -215,7 +215,7 @@ namespace SevenZip.Compression.LZ
UInt32 len = Math.Min(len0, len1); UInt32 len = Math.Min(len0, len1);
if (_bufferBase[pby1 + len] == _bufferBase[cur + len]) if (_bufferBase[pby1 + len] == _bufferBase[cur + len])
{ {
while(++len != lenLimit) while (++len != lenLimit)
if (_bufferBase[pby1 + len] != _bufferBase[cur + len]) if (_bufferBase[pby1 + len] != _bufferBase[cur + len])
break; break;
if (maxLen < len) if (maxLen < len)
+1 -1
View File
@@ -115,7 +115,7 @@ namespace SevenZip.Compression.LZ
UInt32 pby = _bufferOffset + _pos + (UInt32)index; UInt32 pby = _bufferOffset + _pos + (UInt32)index;
UInt32 i; UInt32 i;
for (i = 0; i < limit && _bufferBase[pby + i] == _bufferBase[pby + i - distance]; i++); for (i = 0; i < limit && _bufferBase[pby + i] == _bufferBase[pby + i - distance]; i++) ;
return i; return i;
} }
+3 -3
View File
@@ -624,7 +624,7 @@ namespace SevenZip.Compression.LZMA
UInt32 lenEnd = ((lenMain >= repLens[repMaxIndex]) ? lenMain : repLens[repMaxIndex]); UInt32 lenEnd = ((lenMain >= repLens[repMaxIndex]) ? lenMain : repLens[repMaxIndex]);
if(lenEnd < 2) if (lenEnd < 2)
{ {
backRes = _optimum[1].BackPrev; backRes = _optimum[1].BackPrev;
return 1; return 1;
@@ -898,7 +898,7 @@ namespace SevenZip.Compression.LZMA
optimum.Prev1IsChar = false; optimum.Prev1IsChar = false;
} }
} }
while(--lenTest >= 2); while (--lenTest >= 2);
lenTest = lenTestTemp; lenTest = lenTestTemp;
if (repIndex == 0) if (repIndex == 0)
@@ -929,7 +929,7 @@ namespace SevenZip.Compression.LZMA
// for(; lenTest2 >= 2; lenTest2--) // for(; lenTest2 >= 2; lenTest2--)
{ {
UInt32 offset = lenTest + 1 + lenTest2; UInt32 offset = lenTest + 1 + lenTest2;
while(lenEnd < cur + offset) while (lenEnd < cur + offset)
_optimum[++lenEnd].Price = kIfinityPrice; _optimum[++lenEnd].Price = kIfinityPrice;
UInt32 curAndLenPrice = nextRepMatchPrice + GetRepPrice(0, lenTest2, state2, posStateNext); UInt32 curAndLenPrice = nextRepMatchPrice + GetRepPrice(0, lenTest2, state2, posStateNext);
Optimal optimum = _optimum[cur + offset]; Optimal optimum = _optimum[cur + offset];
@@ -22,7 +22,7 @@ namespace SevenZip.Compression.RangeCoder
public void Encode(Encoder rangeEncoder, UInt32 symbol) public void Encode(Encoder rangeEncoder, UInt32 symbol)
{ {
UInt32 m = 1; UInt32 m = 1;
for (int bitIndex = NumBitLevels; bitIndex > 0; ) for (int bitIndex = NumBitLevels; bitIndex > 0;)
{ {
bitIndex--; bitIndex--;
UInt32 bit = (symbol >> bitIndex) & 1; UInt32 bit = (symbol >> bitIndex) & 1;
@@ -47,7 +47,7 @@ namespace SevenZip.Compression.RangeCoder
{ {
UInt32 price = 0; UInt32 price = 0;
UInt32 m = 1; UInt32 m = 1;
for (int bitIndex = NumBitLevels; bitIndex > 0; ) for (int bitIndex = NumBitLevels; bitIndex > 0;)
{ {
bitIndex--; bitIndex--;
UInt32 bit = (symbol >> bitIndex) & 1; UInt32 bit = (symbol >> bitIndex) & 1;
+2 -2
View File
@@ -9,7 +9,7 @@ namespace SevenZip
/// </summary> /// </summary>
class DataErrorException : ApplicationException class DataErrorException : ApplicationException
{ {
public DataErrorException(): base("Data Error") { } public DataErrorException() : base("Data Error") { }
} }
/// <summary> /// <summary>
@@ -17,7 +17,7 @@ namespace SevenZip
/// </summary> /// </summary>
class InvalidParamException : ApplicationException class InvalidParamException : ApplicationException
{ {
public InvalidParamException(): base("Invalid Parameter") { } public InvalidParamException() : base("Invalid Parameter") { }
} }
public interface ICodeProgress public interface ICodeProgress
+2 -2
View File
@@ -19,10 +19,10 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
using System; using System;
using System.Linq;
using System.Windows;
using System.IO; using System.IO;
using System.Linq;
using System.Threading; using System.Threading;
using System.Windows;
namespace WPinternals namespace WPinternals
{ {
-2
View File
@@ -22,9 +22,7 @@
namespace DiscUtils namespace DiscUtils
{ {
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
internal class BlockCache<T> internal class BlockCache<T>
where T : Block, new() where T : Block, new()
@@ -22,10 +22,10 @@
namespace DiscUtils.BootConfig namespace DiscUtils.BootConfig
{ {
using DiscUtils.Registry;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using DiscUtils.Registry;
internal class DiscUtilsRegistryStorage : BaseStorage internal class DiscUtilsRegistryStorage : BaseStorage
{ {
-1
View File
@@ -23,7 +23,6 @@
namespace DiscUtils.BootConfig namespace DiscUtils.BootConfig
{ {
using System; using System;
using System.Globalization;
/// <summary> /// <summary>
/// The value of an element. /// The value of an element.
-4
View File
@@ -22,10 +22,6 @@
namespace DiscUtils.BootConfig namespace DiscUtils.BootConfig
{ {
using System;
using System.Collections.Generic;
using System.Text;
/// <summary> /// <summary>
/// Indicates the type of objects that can inherit from an object. /// Indicates the type of objects that can inherit from an object.
/// </summary> /// </summary>
+1 -1
View File
@@ -22,9 +22,9 @@
namespace DiscUtils.BootConfig namespace DiscUtils.BootConfig
{ {
using DiscUtils.Registry;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using DiscUtils.Registry;
/// <summary> /// <summary>
/// Represents a Boot Configuration Database store (i.e. a BCD file). /// Represents a Boot Configuration Database store (i.e. a BCD file).
-2
View File
@@ -22,9 +22,7 @@
namespace DiscUtils namespace DiscUtils
{ {
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
internal class BuilderSparseStreamExtent : BuilderExtent internal class BuilderSparseStreamExtent : BuilderExtent
{ {
-1
View File
@@ -24,7 +24,6 @@ namespace DiscUtils
{ {
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
/// <summary> /// <summary>
/// Enumeration of possible cluster roles. /// Enumeration of possible cluster roles.
-1
View File
@@ -24,7 +24,6 @@ namespace DiscUtils.Fat
{ {
using System; using System;
using System.IO; using System.IO;
using System.Text;
internal class DirectoryEntry internal class DirectoryEntry
{ {
-1
View File
@@ -22,7 +22,6 @@
namespace DiscUtils.Fat namespace DiscUtils.Fat
{ {
using System;
using System.IO; using System.IO;
internal class FileAllocationTable internal class FileAllocationTable
+1 -1
View File
@@ -22,8 +22,8 @@
namespace DiscUtils.Fat namespace DiscUtils.Fat
{ {
using System.IO;
using DiscUtils.Vfs; using DiscUtils.Vfs;
using System.IO;
[VfsFileSystemFactory] [VfsFileSystemFactory]
internal class FileSystemFactory : VfsFileSystemFactory internal class FileSystemFactory : VfsFileSystemFactory
+1 -1
View File
@@ -22,9 +22,9 @@
namespace DiscUtils.LogicalDiskManager namespace DiscUtils.LogicalDiskManager
{ {
using DiscUtils.Partitions;
using System; using System;
using System.IO; using System.IO;
using DiscUtils.Partitions;
internal class DynamicDisk : IDiagnosticTraceable internal class DynamicDisk : IDiagnosticTraceable
{ {
@@ -22,11 +22,11 @@
namespace DiscUtils.LogicalDiskManager namespace DiscUtils.LogicalDiskManager
{ {
using DiscUtils.Partitions;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using DiscUtils.Partitions;
internal class DynamicDiskGroup : IDiagnosticTraceable internal class DynamicDiskGroup : IDiagnosticTraceable
{ {
@@ -22,9 +22,9 @@
namespace DiscUtils.LogicalDiskManager namespace DiscUtils.LogicalDiskManager
{ {
using DiscUtils.Partitions;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using DiscUtils.Partitions;
/// <summary> /// <summary>
/// A class that understands Windows LDM structures, mapping physical volumes to logical volumes. /// A class that understands Windows LDM structures, mapping physical volumes to logical volumes.
-2
View File
@@ -22,8 +22,6 @@
namespace DiscUtils.LogicalDiskManager namespace DiscUtils.LogicalDiskManager
{ {
using System;
internal class TocBlock internal class TocBlock
{ {
public string Signature; // TOCBLOCK public string Signature; // TOCBLOCK
-1
View File
@@ -22,7 +22,6 @@
namespace DiscUtils namespace DiscUtils
{ {
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
+1 -1
View File
@@ -22,10 +22,10 @@
namespace DiscUtils.Ntfs namespace DiscUtils.Ntfs
{ {
using DiscUtils.Compression;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using DiscUtils.Compression;
internal sealed class CompressedClusterStream : ClusterStream internal sealed class CompressedClusterStream : ClusterStream
{ {
-1
View File
@@ -23,7 +23,6 @@
namespace DiscUtils.Ntfs namespace DiscUtils.Ntfs
{ {
using System; using System;
using System.Collections.Generic;
internal class CookedDataRun internal class CookedDataRun
{ {
-1
View File
@@ -23,7 +23,6 @@
namespace DiscUtils.Ntfs namespace DiscUtils.Ntfs
{ {
using System.Globalization; using System.Globalization;
using System.IO;
internal class DataRun internal class DataRun
{ {
-1
View File
@@ -24,7 +24,6 @@ namespace DiscUtils.Ntfs
{ {
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO; using System.IO;
[Flags] [Flags]
+1 -1
View File
@@ -22,8 +22,8 @@
namespace DiscUtils.Ntfs namespace DiscUtils.Ntfs
{ {
using System.IO;
using DiscUtils.Vfs; using DiscUtils.Vfs;
using System.IO;
[VfsFileSystemFactory] [VfsFileSystemFactory]
internal class FileSystemFactory : VfsFileSystemFactory internal class FileSystemFactory : VfsFileSystemFactory
-1
View File
@@ -22,7 +22,6 @@
namespace DiscUtils.Ntfs namespace DiscUtils.Ntfs
{ {
using System;
using System.IO; using System.IO;
internal abstract class FixupRecordBase internal abstract class FixupRecordBase
-1
View File
@@ -23,7 +23,6 @@
namespace DiscUtils.Ntfs namespace DiscUtils.Ntfs
{ {
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
internal class IndexBlock : FixupRecordBase internal class IndexBlock : FixupRecordBase
@@ -1,9 +1,5 @@
namespace DiscUtils.Ntfs.Internals namespace DiscUtils.Ntfs.Internals
{ {
using System;
using System.Collections.Generic;
using System.Text;
public sealed class MasterFileTableAttribute public sealed class MasterFileTableAttribute
{ {
} }
@@ -22,10 +22,6 @@
namespace DiscUtils.Ntfs.Internals namespace DiscUtils.Ntfs.Internals
{ {
using System.Collections;
using System.Collections.Generic;
using System.IO;
public sealed class MasterFileTableRecord public sealed class MasterFileTableRecord
{ {
private FileRecord _fileRecord; private FileRecord _fileRecord;
@@ -22,8 +22,6 @@
namespace DiscUtils.Ntfs.Internals namespace DiscUtils.Ntfs.Internals
{ {
using System;
/// <summary> /// <summary>
/// The known NTFS namespaces. /// The known NTFS namespaces.
/// </summary> /// </summary>
+1 -1
View File
@@ -30,8 +30,8 @@
namespace DiscUtils.Ntfs namespace DiscUtils.Ntfs
{ {
using System;
using DiscUtils.Compression; using DiscUtils.Compression;
using System;
/// <summary> /// <summary>
/// Implementation of the LZNT1 algorithm used for compressing NTFS files. /// Implementation of the LZNT1 algorithm used for compressing NTFS files.
-1
View File
@@ -25,7 +25,6 @@ namespace DiscUtils.Ntfs
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using DiscUtils.Compression;
internal class NonResidentDataBuffer : DiscUtils.Buffer, IMappedBuffer internal class NonResidentDataBuffer : DiscUtils.Buffer, IMappedBuffer
{ {
-1
View File
@@ -22,7 +22,6 @@
namespace DiscUtils.Ntfs namespace DiscUtils.Ntfs
{ {
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
+5 -5
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()) 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()) 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()) 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( UpdateStandardInformation(
path, path,
delegate(StandardInformation si) delegate (StandardInformation si)
{ {
si.CreationTime = info.CreationTime; si.CreationTime = info.CreationTime;
si.LastAccessTime = info.LastAccessTime; si.LastAccessTime = info.LastAccessTime;
+2 -2
View File
@@ -137,8 +137,8 @@ namespace DiscUtils.Ntfs
SetSecurityAttribute(volumeFile, "O:" + localAdminString + "G:BAD:(A;;0x12019f;;;SY)(A;;0x12019f;;;BA)"); SetSecurityAttribute(volumeFile, "O:" + localAdminString + "G:BAD:(A;;0x12019f;;;SY)(A;;0x12019f;;;BA)");
volumeFile.UpdateRecordInMft(); volumeFile.UpdateRecordInMft();
_context.GetFileByIndex = delegate(long index) { return new File(_context, _context.Mft.GetRecord(index, 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)); }; _context.AllocateFile = delegate (FileRecordFlags frf) { return new File(_context, _context.Mft.AllocateRecord(frf, false)); };
File attrDefFile = CreateSystemFile(MasterFileTable.AttrDefIndex); File attrDefFile = CreateSystemFile(MasterFileTable.AttrDefIndex);
_context.AttributeDefinitions.WriteTo(attrDefFile); _context.AttributeDefinitions.WriteTo(attrDefFile);
-1
View File
@@ -22,7 +22,6 @@
namespace DiscUtils.Ntfs namespace DiscUtils.Ntfs
{ {
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
-2
View File
@@ -23,8 +23,6 @@
namespace DiscUtils.Ntfs namespace DiscUtils.Ntfs
{ {
using System; using System;
using System.Collections.Generic;
using System.Text;
internal sealed class NtfsTransaction : IDisposable internal sealed class NtfsTransaction : IDisposable
{ {
+1 -1
View File
@@ -22,11 +22,11 @@
namespace DiscUtils.Ntfs namespace DiscUtils.Ntfs
{ {
using DiscUtils;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using DiscUtils;
/// <summary> /// <summary>
/// Low-level non-resident attribute operations. /// Low-level non-resident attribute operations.
-2
View File
@@ -22,10 +22,8 @@
namespace DiscUtils.Ntfs namespace DiscUtils.Ntfs
{ {
using System;
using System.IO; using System.IO;
using System.Security.AccessControl; using System.Security.AccessControl;
using System.Security.Principal;
internal sealed class SecurityDescriptor : IByteArraySerializable, IDiagnosticTraceable internal sealed class SecurityDescriptor : IByteArraySerializable, IDiagnosticTraceable
{ {
-4
View File
@@ -22,10 +22,6 @@
namespace DiscUtils.Ntfs namespace DiscUtils.Ntfs
{ {
using System;
using System.Collections.Generic;
using System.Text;
/// <summary> /// <summary>
/// Controls whether short file names are created automatically. /// Controls whether short file names are created automatically.
/// </summary> /// </summary>
-1
View File
@@ -22,7 +22,6 @@
namespace DiscUtils.Ntfs namespace DiscUtils.Ntfs
{ {
using System;
using System.IO; using System.IO;
internal sealed class VolumeInformation : IByteArraySerializable, IDiagnosticTraceable internal sealed class VolumeInformation : IByteArraySerializable, IDiagnosticTraceable
-1
View File
@@ -22,7 +22,6 @@
namespace DiscUtils.Ntfs namespace DiscUtils.Ntfs
{ {
using System;
using System.IO; using System.IO;
using System.Text; using System.Text;
-1
View File
@@ -23,7 +23,6 @@
namespace DiscUtils namespace DiscUtils
{ {
using System; using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
/// <summary> /// <summary>
-4
View File
@@ -22,10 +22,6 @@
namespace DiscUtils namespace DiscUtils
{ {
using System;
using System.Collections.Generic;
using System.Text;
/// <summary> /// <summary>
/// Enumeration used to indicate transfer of disposable objects. /// Enumeration used to indicate transfer of disposable objects.
/// </summary> /// </summary>
@@ -23,7 +23,6 @@
namespace DiscUtils.Partitions namespace DiscUtils.Partitions
{ {
using System; using System;
using System.IO;
/// <summary> /// <summary>
/// Provides access to partition records in a BIOS (MBR) partition table. /// Provides access to partition records in a BIOS (MBR) partition table.
@@ -24,7 +24,6 @@ namespace DiscUtils.Partitions
{ {
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
/// <summary> /// <summary>
/// Builds a stream with the contents of a BIOS partitioned disk. /// Builds a stream with the contents of a BIOS partitioned disk.
@@ -23,7 +23,6 @@
namespace DiscUtils.Partitions namespace DiscUtils.Partitions
{ {
using System; using System;
using System.IO;
/// <summary> /// <summary>
/// Provides access to partition records in a GUID partition table. /// Provides access to partition records in a GUID partition table.
-1
View File
@@ -24,7 +24,6 @@ namespace DiscUtils.Partitions
{ {
using System; using System;
using System.Globalization; using System.Globalization;
using System.IO;
/// <summary> /// <summary>
/// Base class representing a disk partition. /// Base class representing a disk partition.
+1 -1
View File
@@ -22,9 +22,9 @@
namespace DiscUtils namespace DiscUtils
{ {
using DiscUtils.Partitions;
using System; using System;
using System.Globalization; using System.Globalization;
using DiscUtils.Partitions;
/// <summary> /// <summary>
/// Enumeration of possible types of physical volume. /// Enumeration of possible types of physical volume.
-1
View File
@@ -24,7 +24,6 @@ namespace DiscUtils
{ {
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
/// <summary> /// <summary>
/// Represents a range of values. /// Represents a range of values.
-1
View File
@@ -23,7 +23,6 @@
namespace DiscUtils.Raw namespace DiscUtils.Raw
{ {
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
[VirtualDiskFactory("RAW", ".img,.ima,.vfd,.flp,.bif")] [VirtualDiskFactory("RAW", ".img,.ima,.vfd,.flp,.bif")]
+1 -1
View File
@@ -22,9 +22,9 @@
namespace DiscUtils.Raw namespace DiscUtils.Raw
{ {
using DiscUtils.Partitions;
using System; using System;
using System.IO; using System.IO;
using DiscUtils.Partitions;
/// <summary> /// <summary>
/// Represents a single raw disk image file. /// Represents a single raw disk image file.
-1
View File
@@ -22,7 +22,6 @@
namespace DiscUtils.Registry namespace DiscUtils.Registry
{ {
using System;
using System.IO; using System.IO;
internal sealed class BinHeader : IByteArraySerializable internal sealed class BinHeader : IByteArraySerializable
-1
View File
@@ -22,7 +22,6 @@
namespace DiscUtils namespace DiscUtils
{ {
using System.Collections.Generic;
using System.IO; using System.IO;
/// <summary> /// <summary>
-2
View File
@@ -22,8 +22,6 @@
namespace DiscUtils namespace DiscUtils
{ {
using System;
internal abstract class Tuple internal abstract class Tuple
{ {
public abstract object this[int i] public abstract object this[int i]
-2
View File
@@ -22,8 +22,6 @@
namespace DiscUtils namespace DiscUtils
{ {
using System;
/// <summary> /// <summary>
/// Standard Unix-style file type. /// Standard Unix-style file type.
/// </summary> /// </summary>
@@ -23,8 +23,6 @@
namespace DiscUtils.Vfs namespace DiscUtils.Vfs
{ {
using System; using System;
using System.Collections.Generic;
using System.Text;
/// <summary> /// <summary>
/// Attribute identifying file system factory classes. /// Attribute identifying file system factory classes.
+1 -1
View File
@@ -22,11 +22,11 @@
namespace DiscUtils namespace DiscUtils
{ {
using DiscUtils.Partitions;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using DiscUtils.Partitions;
/// <summary> /// <summary>
/// Base class representing virtual hard disks. /// Base class representing virtual hard disks.
+1 -1
View File
@@ -22,11 +22,11 @@
namespace DiscUtils namespace DiscUtils
{ {
using DiscUtils.Partitions;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using DiscUtils.Partitions;
/// <summary> /// <summary>
/// VolumeManager interprets partitions and other on-disk structures (possibly combining multiple disks). /// VolumeManager interprets partitions and other on-disk structures (possibly combining multiple disks).
+1 -1
View File
@@ -27,7 +27,7 @@ using System.Windows.Media;
namespace WPinternals namespace WPinternals
{ {
public class PathChangedEventArgs: EventArgs public class PathChangedEventArgs : EventArgs
{ {
public PathChangedEventArgs(string NewPath) public PathChangedEventArgs(string NewPath)
: base() : base()
+20 -21
View File
@@ -22,25 +22,24 @@
// Where possible the original authors are referenced. // Where possible the original authors are referenced.
using System; using System;
using System.IO; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.IO;
using System.IO.Compression;
using System.Linq; using System.Linq;
using System.Reflection;
using System.Text; using System.Text;
using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Data; using System.Windows.Data;
using System.Windows.Documents; using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media.Animation; using System.Windows.Media.Animation;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using System.Threading;
using System.Windows.Input;
using System.Windows.Threading; using System.Windows.Threading;
using System.IO.Compression;
using System.Collections;
using System.Reflection;
using System.Net;
namespace WPinternals namespace WPinternals
{ {
@@ -1061,7 +1060,7 @@ namespace WPinternals
{ {
} }
public DelegateCommand(Action executeMethod, Func<bool> canExecuteMethod): base(o => executeMethod(), f => canExecuteMethod()) public DelegateCommand(Action executeMethod, Func<bool> canExecuteMethod) : base(o => executeMethod(), f => canExecuteMethod())
{ {
} }
@@ -1076,7 +1075,7 @@ namespace WPinternals
} }
} }
internal class FlowDocumentScrollViewerNoMouseWheel: FlowDocumentScrollViewer internal class FlowDocumentScrollViewerNoMouseWheel : FlowDocumentScrollViewer
{ {
protected override void OnMouseWheel(MouseWheelEventArgs e) protected override void OnMouseWheel(MouseWheelEventArgs e)
{ {
@@ -1167,7 +1166,7 @@ namespace WPinternals
} }
} }
internal class WPinternalsException: Exception internal class WPinternalsException : Exception
{ {
// Message and SubMessaage are always printable // Message and SubMessaage are always printable
internal string SubMessage = null; internal string SubMessage = null;
@@ -1494,7 +1493,7 @@ namespace WPinternals
} }
} }
public override void SetLength(long value) { throw new NotSupportedException(); } public override void SetLength(long value) { throw new NotSupportedException(); }
public override void Write(byte[] buffer, int offset, int count) {throw new NotSupportedException(); } public override void Write(byte[] buffer, int offset, int count) { throw new NotSupportedException(); }
public override void Flush() { UnderlyingStream.Flush(); } public override void Flush() { UnderlyingStream.Flush(); }
public override void Close() { UnderlyingStream.Close(); } public override void Close() { UnderlyingStream.Close(); }
protected override void Dispose(bool disposing) protected override void Dispose(bool disposing)
@@ -1507,7 +1506,7 @@ namespace WPinternals
} }
// For writing a compressed stream // For writing a compressed stream
internal class CompressedStream: Stream internal class CompressedStream : Stream
{ {
private UInt32 HeaderSize; private UInt32 HeaderSize;
private UInt64 WritePosition; private UInt64 WritePosition;
@@ -1558,7 +1557,7 @@ namespace WPinternals
} }
} }
internal class SeekableStream: Stream internal class SeekableStream : Stream
{ {
private Stream UnderlyingStream; private Stream UnderlyingStream;
private Int64 ReadPosition = 0; private Int64 ReadPosition = 0;
@@ -1929,7 +1928,7 @@ namespace WPinternals
/// </summary> /// </summary>
public static class GridViewColumnResize public static class GridViewColumnResize
{ {
#region DependencyProperties #region DependencyProperties
public static readonly DependencyProperty WidthProperty = public static readonly DependencyProperty WidthProperty =
DependencyProperty.RegisterAttached("Width", typeof(string), typeof(GridViewColumnResize), DependencyProperty.RegisterAttached("Width", typeof(string), typeof(GridViewColumnResize),
@@ -1948,7 +1947,7 @@ namespace WPinternals
DependencyProperty.RegisterAttached("ListViewResizeBehaviorProperty", DependencyProperty.RegisterAttached("ListViewResizeBehaviorProperty",
typeof(ListViewResizeBehavior), typeof(GridViewColumnResize), null); typeof(ListViewResizeBehavior), typeof(GridViewColumnResize), null);
#endregion #endregion
public static string GetWidth(DependencyObject obj) public static string GetWidth(DependencyObject obj)
{ {
@@ -1970,7 +1969,7 @@ namespace WPinternals
obj.SetValue(EnabledProperty, value); obj.SetValue(EnabledProperty, value);
} }
#region CallBack #region CallBack
private static void OnSetWidthCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e) private static void OnSetWidthCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
{ {
@@ -2025,9 +2024,9 @@ namespace WPinternals
return behavior; return behavior;
} }
#endregion #endregion
#region Nested type: GridViewColumnResizeBehavior #region Nested type: GridViewColumnResizeBehavior
// This class was written by: Rolf Wessels // This class was written by: Rolf Wessels
// https://github.com/rolfwessels/lazycowprojects/tree/master/Wpf // https://github.com/rolfwessels/lazycowprojects/tree/master/Wpf
@@ -2103,9 +2102,9 @@ namespace WPinternals
} }
} }
#endregion #endregion
#region Nested type: ListViewResizeBehavior #region Nested type: ListViewResizeBehavior
// This class was written by: Rolf Wessels // This class was written by: Rolf Wessels
// https://github.com/rolfwessels/lazycowprojects/tree/master/Wpf // https://github.com/rolfwessels/lazycowprojects/tree/master/Wpf
@@ -2211,7 +2210,7 @@ namespace WPinternals
} }
} }
#endregion #endregion
} }
internal static class ExtensionMethods internal static class ExtensionMethods
+1 -1
View File
@@ -365,7 +365,7 @@ namespace WPinternals
uint crc = (uint)(((uint)0) ^ (-1)); uint crc = (uint)(((uint)0) ^ (-1));
for (var i = Offset; i < (Offset + Length); i++) for (var i = Offset; i < (Offset + Length); i++)
{ {
crc = (crc >> 8) ^ CRC32Table[ (crc ^ Input[i]) & 0xFF ]; crc = (crc >> 8) ^ CRC32Table[(crc ^ Input[i]) & 0xFF];
} }
crc = (uint)(crc ^ (-1)); crc = (uint)(crc ^ (-1));
+8 -8
View File
@@ -20,15 +20,15 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Json;
using System.Net; using System.Net;
using System.Net.Http; using System.Net.Http;
using System.Net.Http.Headers; using System.Net.Http.Headers;
using System.IO; using System.Runtime.Serialization;
using System.Runtime.Serialization.Json;
using System.Text;
using System.Threading.Tasks;
using System.Xml; using System.Xml;
using System.Xml.Serialization; using System.Xml.Serialization;
@@ -363,7 +363,7 @@ namespace WPinternals
} }
} }
#pragma warning disable 0649 #pragma warning disable 0649
[DataContract] [DataContract]
internal class FileUrlResult internal class FileUrlResult
{ {
@@ -379,7 +379,7 @@ namespace WPinternals
[DataMember] [DataMember]
internal List<SoftwareFileChecksum> checksum; internal List<SoftwareFileChecksum> checksum;
} }
#pragma warning restore 0649 #pragma warning restore 0649
[DataContract] [DataContract]
public class DiscoveryQueryParameters public class DiscoveryQueryParameters
@@ -454,7 +454,7 @@ namespace WPinternals
[DataMember] [DataMember]
public List<string> response; public List<string> response;
public DiscoveryParameters(): this(DiscoveryCondition.Default) public DiscoveryParameters() : this(DiscoveryCondition.Default)
{ {
} }
+2 -2
View File
@@ -26,7 +26,7 @@ using System.Runtime.InteropServices;
namespace WPinternals namespace WPinternals
{ {
internal class MassStorage: NokiaPhoneModel internal class MassStorage : NokiaPhoneModel
{ {
internal string Drive = null; internal string Drive = null;
internal string PhysicalDrive = null; internal string PhysicalDrive = null;
@@ -37,7 +37,7 @@ namespace WPinternals
private QualcommSerial Serial; private QualcommSerial Serial;
internal MassStorage(string DevicePath): base(DevicePath) internal MassStorage(string DevicePath) : base(DevicePath)
{ {
try try
{ {
+3 -3
View File
@@ -18,10 +18,10 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
using System;
using System.Runtime.InteropServices;
using System.Runtime.ConstrainedExecution;
using Microsoft.Win32.SafeHandles; using Microsoft.Win32.SafeHandles;
using System;
using System.Runtime.ConstrainedExecution;
using System.Runtime.InteropServices;
using System.Security; using System.Security;
namespace WPinternals namespace WPinternals
+1 -1
View File
@@ -1112,7 +1112,7 @@ namespace WPinternals
ExecuteRawMethod(Request); ExecuteRawMethod(Request);
} }
internal enum SecureBootKeyType: byte internal enum SecureBootKeyType : byte
{ {
Retail = 0, Retail = 0,
Engineering = 1 Engineering = 1
+1 -1
View File
@@ -27,7 +27,7 @@ using System.Linq;
namespace WPinternals namespace WPinternals
{ {
internal class NokiaPhoneModel: IDisposable internal class NokiaPhoneModel : IDisposable
{ {
protected bool Disposed = false; protected bool Disposed = false;
private USBDevice Device = null; private USBDevice Device = null;
+2 -2
View File
@@ -21,15 +21,15 @@
using System; using System;
using System.Collections.Specialized; using System.Collections.Specialized;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.ConstrainedExecution; using System.Runtime.ConstrainedExecution;
using System.Runtime.InteropServices;
using System.Threading; using System.Threading;
namespace WPinternals namespace WPinternals
{ {
using Luid = NativeMethods.LUID; using Luid = NativeMethods.LUID;
using Win32Exception = System.ComponentModel.Win32Exception;
using PrivilegeNotHeldException = System.Security.AccessControl.PrivilegeNotHeldException; using PrivilegeNotHeldException = System.Security.AccessControl.PrivilegeNotHeldException;
using Win32Exception = System.ComponentModel.Win32Exception;
internal delegate void PrivilegedCallback(object state); internal delegate void PrivilegedCallback(object state);
+1 -1
View File
@@ -47,7 +47,7 @@ namespace WPinternals
internal uint CertificatesOffset; internal uint CertificatesOffset;
internal byte[] RootKeyHash = null; internal byte[] RootKeyHash = null;
internal QualcommPartition(string Path): this(File.ReadAllBytes(Path)) { } internal QualcommPartition(string Path) : this(File.ReadAllBytes(Path)) { }
internal QualcommPartition(byte[] Binary, uint Offset = 0) internal QualcommPartition(byte[] Binary, uint Offset = 0)
{ {
+1 -1
View File
@@ -23,7 +23,7 @@ using System.Threading.Tasks;
namespace WPinternals namespace WPinternals
{ {
internal enum SaharaMode: uint internal enum SaharaMode : uint
{ {
ImageTransferPending = 0x00, ImageTransferPending = 0x00,
ImagetransferComplete = 0x01, ImagetransferComplete = 0x01,
+2 -2
View File
@@ -24,7 +24,7 @@ using System.IO.Ports;
namespace WPinternals namespace WPinternals
{ {
internal class QualcommSerial: IDisposable internal class QualcommSerial : IDisposable
{ {
private bool Disposed = false; private bool Disposed = false;
private SerialPort Port = null; private SerialPort Port = null;
@@ -132,7 +132,7 @@ namespace WPinternals
for (int i = 0; i < ResponsePattern.Length; i++) for (int i = 0; i < ResponsePattern.Length; i++)
if (DecodedResponse[i] != ResponsePattern[i]) if (DecodedResponse[i] != ResponsePattern[i])
{ {
byte[] LogResponse = new byte[DecodedResponse.Length < 0x10 ? DecodedResponse.Length: 0x10]; byte[] LogResponse = new byte[DecodedResponse.Length < 0x10 ? DecodedResponse.Length : 0x10];
LogFile.Log("Qualcomm serial response: " + Converter.ConvertHexToString(LogResponse, ""), LogType.FileOnly); LogFile.Log("Qualcomm serial response: " + Converter.ConvertHexToString(LogResponse, ""), LogType.FileOnly);
LogFile.Log("Expected: " + Converter.ConvertHexToString(ResponsePattern, ""), LogType.FileOnly); LogFile.Log("Expected: " + Converter.ConvertHexToString(ResponsePattern, ""), LogType.FileOnly);
throw new BadMessageException(); throw new BadMessageException();
+2 -2
View File
@@ -22,9 +22,9 @@ using System;
namespace WPinternals namespace WPinternals
{ {
internal class SBL1: QualcommPartition internal class SBL1 : QualcommPartition
{ {
internal SBL1(byte[] Binary): base(Binary, 0x2800) { } internal SBL1(byte[] Binary) : base(Binary, 0x2800) { }
internal byte[] GenerateExtraSector(byte[] PartitionHeader) internal byte[] GenerateExtraSector(byte[] PartitionHeader)
{ {
-2
View File
@@ -1,6 +1,4 @@
using System.Reflection; using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Windows; using System.Windows;
+1 -1
View File
@@ -20,7 +20,7 @@
namespace WPinternals namespace WPinternals
{ {
internal class AboutViewModel: ContextViewModel internal class AboutViewModel : ContextViewModel
{ {
internal AboutViewModel() : base() { } internal AboutViewModel() : base() { }
+1 -1
View File
@@ -23,7 +23,7 @@ using System.Threading;
namespace WPinternals namespace WPinternals
{ {
internal class BackupTargetSelectionViewModel: ContextViewModel internal class BackupTargetSelectionViewModel : ContextViewModel
{ {
private PhoneNotifierViewModel PhoneNotifier; private PhoneNotifierViewModel PhoneNotifier;
private Action<string, string, string> BackupCallback; private Action<string, string, string> BackupCallback;
+1 -1
View File
@@ -26,7 +26,7 @@ using System.Threading;
namespace WPinternals namespace WPinternals
{ {
internal class BackupViewModel: ContextViewModel internal class BackupViewModel : ContextViewModel
{ {
private PhoneNotifierViewModel PhoneNotifier; private PhoneNotifierViewModel PhoneNotifier;
private Action Callback; private Action Callback;
+2 -2
View File
@@ -73,11 +73,11 @@ namespace WPinternals
UIContext = SynchronizationContext.Current; UIContext = SynchronizationContext.Current;
} }
internal ContextViewModel(MainViewModel Main): this() internal ContextViewModel(MainViewModel Main) : this()
{ {
} }
internal ContextViewModel(MainViewModel Main, ContextViewModel SubContext): this(Main) internal ContextViewModel(MainViewModel Main, ContextViewModel SubContext) : this(Main)
{ {
SubContextViewModel = SubContext; SubContextViewModel = SubContext;
} }
+2 -2
View File
@@ -32,7 +32,7 @@ using System.Windows.Data;
namespace WPinternals namespace WPinternals
{ {
internal class DownloadsViewModel: ContextViewModel internal class DownloadsViewModel : ContextViewModel
{ {
private PhoneNotifierViewModel Notifier; private PhoneNotifierViewModel Notifier;
private Timer SpeedTimer; private Timer SpeedTimer;
@@ -496,7 +496,7 @@ namespace WPinternals
Failed Failed
}; };
internal class DownloadEntry: INotifyPropertyChanged internal class DownloadEntry : INotifyPropertyChanged
{ {
private SynchronizationContext UIContext; private SynchronizationContext UIContext;
public event PropertyChangedEventHandler PropertyChanged = delegate { }; public event PropertyChangedEventHandler PropertyChanged = delegate { };
@@ -23,7 +23,7 @@ using System.Threading;
namespace WPinternals namespace WPinternals
{ {
internal class DumpRomTargetSelectionViewModel: ContextViewModel internal class DumpRomTargetSelectionViewModel : ContextViewModel
{ {
private Action<string, string, bool, string, bool, string, bool> DumpCallback; private Action<string, string, bool, string, bool, string, bool> DumpCallback;
internal Action SwitchToUnlockBoot; internal Action SwitchToUnlockBoot;
+1 -1
View File
@@ -24,7 +24,7 @@ using System.Threading;
namespace WPinternals namespace WPinternals
{ {
internal class DumpRomViewModel: ContextViewModel internal class DumpRomViewModel : ContextViewModel
{ {
private Action SwitchToUnlockBoot; private Action SwitchToUnlockBoot;
private Action SwitchToUnlockRoot; private Action SwitchToUnlockRoot;
+1 -1
View File
@@ -22,7 +22,7 @@ using System;
namespace WPinternals namespace WPinternals
{ {
internal class GettingStartedViewModel: ContextViewModel internal class GettingStartedViewModel : ContextViewModel
{ {
internal Action ShowDisclaimer; internal Action ShowDisclaimer;
internal Action SwitchToUnlockBoot; internal Action SwitchToUnlockBoot;
@@ -23,7 +23,7 @@ using System.Threading;
namespace WPinternals namespace WPinternals
{ {
internal class LumiaFlashRomSourceSelectionViewModel: ContextViewModel internal class LumiaFlashRomSourceSelectionViewModel : ContextViewModel
{ {
private PhoneNotifierViewModel PhoneNotifier; private PhoneNotifierViewModel PhoneNotifier;
private Action<string, string, string> FlashPartitionsCallback; private Action<string, string, string> FlashPartitionsCallback;
+1 -1
View File
@@ -28,7 +28,7 @@ using System.Threading.Tasks;
namespace WPinternals namespace WPinternals
{ {
internal class LumiaFlashRomViewModel: ContextViewModel internal class LumiaFlashRomViewModel : ContextViewModel
{ {
private PhoneNotifierViewModel PhoneNotifier; private PhoneNotifierViewModel PhoneNotifier;
internal Action SwitchToUnlockBoot; internal Action SwitchToUnlockBoot;
+1 -1
View File
@@ -22,7 +22,7 @@ using System;
namespace WPinternals namespace WPinternals
{ {
internal class LumiaInfoViewModel: ContextViewModel internal class LumiaInfoViewModel : ContextViewModel
{ {
internal PhoneInterfaces? CurrentInterface; internal PhoneInterfaces? CurrentInterface;
internal IDisposable CurrentModel; internal IDisposable CurrentModel;
+2 -1
View File
@@ -111,7 +111,8 @@ namespace WPinternals
catch (Exception Ex) catch (Exception Ex)
{ {
IsSwitchingInterface = false; IsSwitchingInterface = false;
ActivateSubContext(new MessageViewModel(Ex.Message, () => { ActivateSubContext(new MessageViewModel(Ex.Message, () =>
{
Callback(); Callback();
Refresh(); Refresh();
})); }));
@@ -23,19 +23,19 @@ using System.Threading;
namespace WPinternals namespace WPinternals
{ {
internal class LumiaUnlockRootTargetSelectionViewModel: LumiaRootAccessTargetSelectionViewModel internal class LumiaUnlockRootTargetSelectionViewModel : LumiaRootAccessTargetSelectionViewModel
{ {
public LumiaUnlockRootTargetSelectionViewModel(PhoneNotifierViewModel PhoneNotifier, Action SwitchToUnlockBoot, Action SwitchToDumpRom, Action SwitchToFlashRom, Action UnlockPhoneCallback, Action<string, string> UnlockImageCallback) public LumiaUnlockRootTargetSelectionViewModel(PhoneNotifierViewModel PhoneNotifier, Action SwitchToUnlockBoot, Action SwitchToDumpRom, Action SwitchToFlashRom, Action UnlockPhoneCallback, Action<string, string> UnlockImageCallback)
: base(PhoneNotifier, SwitchToUnlockBoot, SwitchToDumpRom, SwitchToFlashRom, UnlockPhoneCallback, UnlockImageCallback) { } : base(PhoneNotifier, SwitchToUnlockBoot, SwitchToDumpRom, SwitchToFlashRom, UnlockPhoneCallback, UnlockImageCallback) { }
} }
internal class LumiaUndoRootTargetSelectionViewModel: LumiaRootAccessTargetSelectionViewModel internal class LumiaUndoRootTargetSelectionViewModel : LumiaRootAccessTargetSelectionViewModel
{ {
public LumiaUndoRootTargetSelectionViewModel(PhoneNotifierViewModel PhoneNotifier, Action SwitchToUnlockBoot, Action SwitchToDumpRom, Action SwitchToFlashRom, Action UnlockPhoneCallback, Action<string, string> UnlockImageCallback) public LumiaUndoRootTargetSelectionViewModel(PhoneNotifierViewModel PhoneNotifier, Action SwitchToUnlockBoot, Action SwitchToDumpRom, Action SwitchToFlashRom, Action UnlockPhoneCallback, Action<string, string> UnlockImageCallback)
: base(PhoneNotifier, SwitchToUnlockBoot, SwitchToDumpRom, SwitchToFlashRom, UnlockPhoneCallback, UnlockImageCallback) { } : base(PhoneNotifier, SwitchToUnlockBoot, SwitchToDumpRom, SwitchToFlashRom, UnlockPhoneCallback, UnlockImageCallback) { }
} }
internal class LumiaRootAccessTargetSelectionViewModel: ContextViewModel internal class LumiaRootAccessTargetSelectionViewModel : ContextViewModel
{ {
private PhoneNotifierViewModel PhoneNotifier; private PhoneNotifierViewModel PhoneNotifier;
internal Action SwitchToUnlockBoot; internal Action SwitchToUnlockBoot;
+3 -2
View File
@@ -24,7 +24,7 @@ using System.Threading;
namespace WPinternals namespace WPinternals
{ {
internal class LumiaUnlockRootViewModel: ContextViewModel internal class LumiaUnlockRootViewModel : ContextViewModel
{ {
private PhoneNotifierViewModel PhoneNotifier; private PhoneNotifierViewModel PhoneNotifier;
private Action SwitchToUnlockBoot; private Action SwitchToUnlockBoot;
@@ -82,7 +82,8 @@ namespace WPinternals
} }
catch (Exception Ex) catch (Exception Ex)
{ {
ActivateSubContext(new MessageViewModel(Ex.Message, () => { ActivateSubContext(new MessageViewModel(Ex.Message, () =>
{
Callback(); Callback();
ActivateSubContext(null); ActivateSubContext(null);
})); }));
+1 -1
View File
@@ -22,7 +22,7 @@ using System;
namespace WPinternals namespace WPinternals
{ {
internal class MessageViewModel: ContextViewModel internal class MessageViewModel : ContextViewModel
{ {
internal MessageViewModel(string Message, Action OkAction = null, Action CancelAction = null) internal MessageViewModel(string Message, Action OkAction = null, Action CancelAction = null)
: base() : base()
+1 -3
View File
@@ -18,11 +18,9 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
using System.Threading;
namespace WPinternals namespace WPinternals
{ {
internal class NokiaMassStorageViewModel: ContextViewModel internal class NokiaMassStorageViewModel : ContextViewModel
{ {
private MassStorage CurrentModel; private MassStorage CurrentModel;
-4
View File
@@ -19,11 +19,7 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks;
namespace WPinternals namespace WPinternals
{ {
@@ -19,7 +19,6 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
using System; using System;
using System.Collections.Generic;
namespace WPinternals namespace WPinternals
{ {
+1 -1
View File
@@ -22,7 +22,7 @@ using System;
namespace WPinternals namespace WPinternals
{ {
internal class NokiaModeNormalViewModel: ContextViewModel internal class NokiaModeNormalViewModel : ContextViewModel
{ {
private NokiaPhoneModel CurrentModel; private NokiaPhoneModel CurrentModel;
private Action<PhoneInterfaces?> RequestModeSwitch; private Action<PhoneInterfaces?> RequestModeSwitch;
+1 -1
View File
@@ -20,7 +20,7 @@
namespace WPinternals namespace WPinternals
{ {
internal class NotImplementedViewModel: ContextViewModel internal class NotImplementedViewModel : ContextViewModel
{ {
internal string Message { get; set; } internal string Message { get; set; }
+4 -2
View File
@@ -256,7 +256,8 @@ namespace WPinternals
// It is not possible to invoke COM objects from a WndProc. // It is not possible to invoke COM objects from a WndProc.
// MassStorage uses ManagementObjectSearcher, which is a COM object. // MassStorage uses ManagementObjectSearcher, which is a COM object.
// Therefore we use a new thread. // Therefore we use a new thread.
ThreadPool.QueueUserWorkItem(s => { ThreadPool.QueueUserWorkItem(s =>
{
lock (ModelLock) lock (ModelLock)
{ {
if (!(CurrentModel is MassStorage)) if (!(CurrentModel is MassStorage))
@@ -392,7 +393,8 @@ namespace WPinternals
(e.DevicePath.IndexOf("VID_05C6&PID_9008", StringComparison.OrdinalIgnoreCase) >= 0) || (e.DevicePath.IndexOf("VID_05C6&PID_9008", StringComparison.OrdinalIgnoreCase) >= 0) ||
(e.DevicePath.IndexOf(@"disk&ven_qualcomm&prod_mmc_storage", StringComparison.OrdinalIgnoreCase) >= 0) || (e.DevicePath.IndexOf(@"disk&ven_qualcomm&prod_mmc_storage", StringComparison.OrdinalIgnoreCase) >= 0) ||
(e.DevicePath.IndexOf(@"DISK&VEN_MSFT&PROD_PHONE_MMC_STOR", StringComparison.OrdinalIgnoreCase) >= 0) (e.DevicePath.IndexOf(@"DISK&VEN_MSFT&PROD_PHONE_MMC_STOR", StringComparison.OrdinalIgnoreCase) >= 0)
) { )
{
if (CurrentInterface != null) if (CurrentInterface != null)
LastInterface = CurrentInterface; LastInterface = CurrentInterface;
CurrentInterface = null; CurrentInterface = null;
@@ -23,7 +23,7 @@ using System.Threading;
namespace WPinternals namespace WPinternals
{ {
internal class RestoreSourceSelectionViewModel: ContextViewModel internal class RestoreSourceSelectionViewModel : ContextViewModel
{ {
private PhoneNotifierViewModel PhoneNotifier; private PhoneNotifierViewModel PhoneNotifier;
private Action<string, string, string> RestoreCallback; private Action<string, string, string> RestoreCallback;
+1 -1
View File
@@ -24,7 +24,7 @@ using System.Threading;
namespace WPinternals namespace WPinternals
{ {
internal class RestoreViewModel: ContextViewModel internal class RestoreViewModel : ContextViewModel
{ {
private PhoneNotifierViewModel PhoneNotifier; private PhoneNotifierViewModel PhoneNotifier;
private Action Callback; private Action Callback;
+3 -2
View File
@@ -30,7 +30,7 @@ namespace WPinternals
internal delegate void ModeSwitchErrorHandler(string Message); internal delegate void ModeSwitchErrorHandler(string Message);
internal delegate void ModeSwitchSuccessHandler(IDisposable NewModel, PhoneInterfaces NewInterface); internal delegate void ModeSwitchSuccessHandler(IDisposable NewModel, PhoneInterfaces NewInterface);
internal class SwitchModeViewModel: ContextViewModel internal class SwitchModeViewModel : ContextViewModel
{ {
protected PhoneNotifierViewModel PhoneNotifier; protected PhoneNotifierViewModel PhoneNotifier;
protected IDisposable CurrentModel; protected IDisposable CurrentModel;
@@ -149,7 +149,8 @@ namespace WPinternals
} }
else else
{ {
UIContext.Post(s => { UIContext.Post(s =>
{
ModeSwitchProgress(Message, SubMessage); ModeSwitchProgress(Message, SubMessage);
SetWorkingStatus(Message, SubMessage); SetWorkingStatus(Message, SubMessage);
}, null); }, null);
+1 -2
View File
@@ -22,9 +22,8 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Xml.Serialization;
using System.Security.Cryptography; using System.Security.Cryptography;
using System.Windows; using System.Xml.Serialization;
namespace WPinternals namespace WPinternals
{ {

Some files were not shown because too many files have changed in this diff Show More