mirror of
https://github.com/atom0s/Steamless.git
synced 2024-12-19 23:07:41 +01:00
More code cleanup. (Adjusted some properties and other data to newer C# standards.)
This commit is contained in:
parent
e54c95bea3
commit
9765d3e5b3
6 changed files with 32 additions and 48 deletions
|
@ -44,8 +44,8 @@ namespace Steamless.API.Model
|
|||
/// </summary>
|
||||
public bool VerboseOutput
|
||||
{
|
||||
get { return this.Get<bool>("VerboseOutput"); }
|
||||
set { this.Set("VerboseOutput", value); }
|
||||
get => this.Get<bool>("VerboseOutput");
|
||||
set => this.Set("VerboseOutput", value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -53,8 +53,8 @@ namespace Steamless.API.Model
|
|||
/// </summary>
|
||||
public bool KeepBindSection
|
||||
{
|
||||
get { return this.Get<bool>("KeepBindSection"); }
|
||||
set { this.Set("KeepBindSection", value); }
|
||||
get => this.Get<bool>("KeepBindSection");
|
||||
set => this.Set("KeepBindSection", value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -62,8 +62,8 @@ namespace Steamless.API.Model
|
|||
/// </summary>
|
||||
public bool DumpPayloadToDisk
|
||||
{
|
||||
get { return this.Get<bool>("DumpPayloadToDisk"); }
|
||||
set { this.Set("DumpPayloadToDisk", value); }
|
||||
get => this.Get<bool>("DumpPayloadToDisk");
|
||||
set => this.Set("DumpPayloadToDisk", value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -71,8 +71,8 @@ namespace Steamless.API.Model
|
|||
/// </summary>
|
||||
public bool DumpSteamDrmpToDisk
|
||||
{
|
||||
get { return this.Get<bool>("DumpSteamDrmpToDisk"); }
|
||||
set { this.Set("DumpSteamDrmpToDisk", value); }
|
||||
get => this.Get<bool>("DumpSteamDrmpToDisk");
|
||||
set => this.Set("DumpSteamDrmpToDisk", value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -80,8 +80,8 @@ namespace Steamless.API.Model
|
|||
/// </summary>
|
||||
public bool UseExperimentalFeatures
|
||||
{
|
||||
get { return this.Get<bool>("UseExperimentalFeatures"); }
|
||||
set { this.Set("UseExperimentalFeatures", value); }
|
||||
get => this.Get<bool>("UseExperimentalFeatures");
|
||||
set => this.Set("UseExperimentalFeatures", value);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -70,8 +70,8 @@ namespace Steamless.API.Model
|
|||
/// </summary>
|
||||
private EventHandlerList Events
|
||||
{
|
||||
get { return this.Get<EventHandlerList>("Events"); }
|
||||
set { this.Set("Events", value); }
|
||||
get => this.Get<EventHandlerList>("Events");
|
||||
set => this.Set("Events", value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -79,8 +79,8 @@ namespace Steamless.API.Model
|
|||
/// </summary>
|
||||
public event EventHandler<NavigatedEventArgs> NavigatedFrom
|
||||
{
|
||||
add { this.Events.AddHandler("NavigatedFromEvent", value); }
|
||||
remove { this.Events.RemoveHandler("NavigatedFromEvent", value); }
|
||||
add => this.Events.AddHandler("NavigatedFromEvent", value);
|
||||
remove => this.Events.RemoveHandler("NavigatedFromEvent", value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -88,8 +88,8 @@ namespace Steamless.API.Model
|
|||
/// </summary>
|
||||
public event EventHandler<NavigatedEventArgs> NavigatedTo
|
||||
{
|
||||
add { this.Events.AddHandler("NavigatedToEvent", value); }
|
||||
remove { this.Events.RemoveHandler("NavigatedToEvent", value); }
|
||||
add => this.Events.AddHandler("NavigatedToEvent", value);
|
||||
remove => this.Events.RemoveHandler("NavigatedToEvent", value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -187,20 +187,16 @@ namespace Steamless.Unpacker.Variant20.x86
|
|||
if (BitConverter.ToUInt32(this.File.FileData, (int)fileOffset - 4) != 0xC0DEC0DE)
|
||||
return false;
|
||||
|
||||
uint structOffset;
|
||||
uint structSize;
|
||||
uint structXorKey;
|
||||
|
||||
// Disassemble the file to locate the needed DRM information..
|
||||
if (!this.DisassembleFile(out structOffset, out structSize, out structXorKey))
|
||||
if (!this.DisassembleFile(out var structOffset, out var structSize, out var structXorKey))
|
||||
return false;
|
||||
|
||||
// Obtain the DRM header data..
|
||||
var headerData = new byte[structSize];
|
||||
Array.Copy(this.File.FileData, this.File.GetFileOffsetFromRva((uint)structOffset), headerData, 0, structSize);
|
||||
Array.Copy(this.File.FileData, this.File.GetFileOffsetFromRva(structOffset), headerData, 0, structSize);
|
||||
|
||||
// Xor decode the header data..
|
||||
this.XorKey = SteamStubHelpers.SteamXor(ref headerData, (uint)headerData.Length, (uint)structXorKey);
|
||||
this.XorKey = SteamStubHelpers.SteamXor(ref headerData, (uint)headerData.Length, structXorKey);
|
||||
|
||||
// Determine how to handle the header based on the size..
|
||||
if ((structSize / 4) == 0xD0)
|
||||
|
@ -557,14 +553,14 @@ namespace Steamless.Unpacker.Variant20.x86
|
|||
if (inst.Mnemonic == ud_mnemonic_code.UD_Imov && inst.Operands[0].Type == ud_type.UD_OP_MEM && inst.Operands[1].Type == ud_type.UD_OP_IMM)
|
||||
{
|
||||
if (structOffset == 0)
|
||||
structOffset = (uint)(inst.Operands[1].LvalUDWord - this.File.NtHeaders.OptionalHeader.ImageBase);
|
||||
structOffset = inst.Operands[1].LvalUDWord - this.File.NtHeaders.OptionalHeader.ImageBase;
|
||||
else
|
||||
structXorKey = (uint)inst.Operands[1].LvalUDWord;
|
||||
structXorKey = inst.Operands[1].LvalUDWord;
|
||||
}
|
||||
|
||||
// Looks for: mov reg, immediate
|
||||
if (inst.Mnemonic == ud_mnemonic_code.UD_Imov && inst.Operands[0].Type == ud_type.UD_OP_REG && inst.Operands[1].Type == ud_type.UD_OP_IMM)
|
||||
structSize = (uint)inst.Operands[1].LvalUDWord * 4;
|
||||
structSize = inst.Operands[1].LvalUDWord * 4;
|
||||
}
|
||||
|
||||
offset = size = xorKey = 0;
|
||||
|
@ -643,7 +639,7 @@ namespace Steamless.Unpacker.Variant20.x86
|
|||
var skipMov = false;
|
||||
|
||||
// Disassemble the incoming block of data to look for the needed offsets dynamically..
|
||||
disasm = new Disassembler(data, ArchitectureMode.x86_32, 0);
|
||||
disasm = new Disassembler(data, ArchitectureMode.x86_32);
|
||||
foreach (var inst in disasm.Disassemble().Where(inst => !inst.Error))
|
||||
{
|
||||
if (count >= 8)
|
||||
|
|
|
@ -51,8 +51,7 @@ namespace Steamless.Classes
|
|||
|
||||
private static void OnGridViewColumnWidthFromItemsPropertyChanged(DependencyObject dpo, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var lv = dpo as ListView;
|
||||
if (lv != null)
|
||||
if (dpo is ListView lv)
|
||||
{
|
||||
if ((bool)e.NewValue)
|
||||
lv.Loaded += OnListViewLoaded;
|
||||
|
|
|
@ -53,8 +53,8 @@ namespace Steamless.Model.Tasks
|
|||
/// </summary>
|
||||
public bool Completed
|
||||
{
|
||||
get { return this.Get<bool>("Completed"); }
|
||||
set { this.Set("Completed", value); }
|
||||
get => this.Get<bool>("Completed");
|
||||
set => this.Set("Completed", value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -62,8 +62,8 @@ namespace Steamless.Model.Tasks
|
|||
/// </summary>
|
||||
public double Progress
|
||||
{
|
||||
get { return this.Get<double>("Progress"); }
|
||||
set { this.Set("Progress", value); }
|
||||
get => this.Get<double>("Progress");
|
||||
set => this.Set("Progress", value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -71,8 +71,8 @@ namespace Steamless.Model.Tasks
|
|||
/// </summary>
|
||||
public double ProgressTotal
|
||||
{
|
||||
get { return this.Get<double>("ProgressTotal"); }
|
||||
set { this.Set("ProgressTotal", value); }
|
||||
get => this.Get<double>("ProgressTotal");
|
||||
set => this.Set("ProgressTotal", value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -80,8 +80,8 @@ namespace Steamless.Model.Tasks
|
|||
/// </summary>
|
||||
public string Text
|
||||
{
|
||||
get { return this.Get<string>("Text"); }
|
||||
set { this.Set("Text", value); }
|
||||
get => this.Get<string>("Text");
|
||||
set => this.Set("Text", value);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -122,17 +122,6 @@ namespace Steamless.ViewModel
|
|||
this.m_TaskThread.Start();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the applications current status.
|
||||
/// </summary>
|
||||
/// <param name="state"></param>
|
||||
/// <param name="msg"></param>
|
||||
public void SetApplicationStatus(ApplicationState state, string msg)
|
||||
{
|
||||
this.State = state;
|
||||
this.CurrentTask = new StatusTask(msg);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Thread callback to process application tasks.
|
||||
/// </summary>
|
||||
|
|
Loading…
Reference in a new issue