1
0
Fork 0
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:
atom0s 2019-03-30 01:34:22 -07:00
parent e54c95bea3
commit 9765d3e5b3
6 changed files with 32 additions and 48 deletions

View file

@ -44,8 +44,8 @@ namespace Steamless.API.Model
/// </summary> /// </summary>
public bool VerboseOutput public bool VerboseOutput
{ {
get { return this.Get<bool>("VerboseOutput"); } get => this.Get<bool>("VerboseOutput");
set { this.Set("VerboseOutput", value); } set => this.Set("VerboseOutput", value);
} }
/// <summary> /// <summary>
@ -53,8 +53,8 @@ namespace Steamless.API.Model
/// </summary> /// </summary>
public bool KeepBindSection public bool KeepBindSection
{ {
get { return this.Get<bool>("KeepBindSection"); } get => this.Get<bool>("KeepBindSection");
set { this.Set("KeepBindSection", value); } set => this.Set("KeepBindSection", value);
} }
/// <summary> /// <summary>
@ -62,8 +62,8 @@ namespace Steamless.API.Model
/// </summary> /// </summary>
public bool DumpPayloadToDisk public bool DumpPayloadToDisk
{ {
get { return this.Get<bool>("DumpPayloadToDisk"); } get => this.Get<bool>("DumpPayloadToDisk");
set { this.Set("DumpPayloadToDisk", value); } set => this.Set("DumpPayloadToDisk", value);
} }
/// <summary> /// <summary>
@ -71,8 +71,8 @@ namespace Steamless.API.Model
/// </summary> /// </summary>
public bool DumpSteamDrmpToDisk public bool DumpSteamDrmpToDisk
{ {
get { return this.Get<bool>("DumpSteamDrmpToDisk"); } get => this.Get<bool>("DumpSteamDrmpToDisk");
set { this.Set("DumpSteamDrmpToDisk", value); } set => this.Set("DumpSteamDrmpToDisk", value);
} }
/// <summary> /// <summary>
@ -80,8 +80,8 @@ namespace Steamless.API.Model
/// </summary> /// </summary>
public bool UseExperimentalFeatures public bool UseExperimentalFeatures
{ {
get { return this.Get<bool>("UseExperimentalFeatures"); } get => this.Get<bool>("UseExperimentalFeatures");
set { this.Set("UseExperimentalFeatures", value); } set => this.Set("UseExperimentalFeatures", value);
} }
} }
} }

View file

@ -70,8 +70,8 @@ namespace Steamless.API.Model
/// </summary> /// </summary>
private EventHandlerList Events private EventHandlerList Events
{ {
get { return this.Get<EventHandlerList>("Events"); } get => this.Get<EventHandlerList>("Events");
set { this.Set("Events", value); } set => this.Set("Events", value);
} }
/// <summary> /// <summary>
@ -79,8 +79,8 @@ namespace Steamless.API.Model
/// </summary> /// </summary>
public event EventHandler<NavigatedEventArgs> NavigatedFrom public event EventHandler<NavigatedEventArgs> NavigatedFrom
{ {
add { this.Events.AddHandler("NavigatedFromEvent", value); } add => this.Events.AddHandler("NavigatedFromEvent", value);
remove { this.Events.RemoveHandler("NavigatedFromEvent", value); } remove => this.Events.RemoveHandler("NavigatedFromEvent", value);
} }
/// <summary> /// <summary>
@ -88,8 +88,8 @@ namespace Steamless.API.Model
/// </summary> /// </summary>
public event EventHandler<NavigatedEventArgs> NavigatedTo public event EventHandler<NavigatedEventArgs> NavigatedTo
{ {
add { this.Events.AddHandler("NavigatedToEvent", value); } add => this.Events.AddHandler("NavigatedToEvent", value);
remove { this.Events.RemoveHandler("NavigatedToEvent", value); } remove => this.Events.RemoveHandler("NavigatedToEvent", value);
} }
/// <summary> /// <summary>

View file

@ -187,20 +187,16 @@ namespace Steamless.Unpacker.Variant20.x86
if (BitConverter.ToUInt32(this.File.FileData, (int)fileOffset - 4) != 0xC0DEC0DE) if (BitConverter.ToUInt32(this.File.FileData, (int)fileOffset - 4) != 0xC0DEC0DE)
return false; return false;
uint structOffset;
uint structSize;
uint structXorKey;
// Disassemble the file to locate the needed DRM information.. // 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; return false;
// Obtain the DRM header data.. // Obtain the DRM header data..
var headerData = new byte[structSize]; 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.. // 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.. // Determine how to handle the header based on the size..
if ((structSize / 4) == 0xD0) 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 (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) 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 else
structXorKey = (uint)inst.Operands[1].LvalUDWord; structXorKey = inst.Operands[1].LvalUDWord;
} }
// Looks for: mov reg, immediate // 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) 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; offset = size = xorKey = 0;
@ -643,7 +639,7 @@ namespace Steamless.Unpacker.Variant20.x86
var skipMov = false; var skipMov = false;
// Disassemble the incoming block of data to look for the needed offsets dynamically.. // 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)) foreach (var inst in disasm.Disassemble().Where(inst => !inst.Error))
{ {
if (count >= 8) if (count >= 8)

View file

@ -51,8 +51,7 @@ namespace Steamless.Classes
private static void OnGridViewColumnWidthFromItemsPropertyChanged(DependencyObject dpo, DependencyPropertyChangedEventArgs e) private static void OnGridViewColumnWidthFromItemsPropertyChanged(DependencyObject dpo, DependencyPropertyChangedEventArgs e)
{ {
var lv = dpo as ListView; if (dpo is ListView lv)
if (lv != null)
{ {
if ((bool)e.NewValue) if ((bool)e.NewValue)
lv.Loaded += OnListViewLoaded; lv.Loaded += OnListViewLoaded;

View file

@ -53,8 +53,8 @@ namespace Steamless.Model.Tasks
/// </summary> /// </summary>
public bool Completed public bool Completed
{ {
get { return this.Get<bool>("Completed"); } get => this.Get<bool>("Completed");
set { this.Set("Completed", value); } set => this.Set("Completed", value);
} }
/// <summary> /// <summary>
@ -62,8 +62,8 @@ namespace Steamless.Model.Tasks
/// </summary> /// </summary>
public double Progress public double Progress
{ {
get { return this.Get<double>("Progress"); } get => this.Get<double>("Progress");
set { this.Set("Progress", value); } set => this.Set("Progress", value);
} }
/// <summary> /// <summary>
@ -71,8 +71,8 @@ namespace Steamless.Model.Tasks
/// </summary> /// </summary>
public double ProgressTotal public double ProgressTotal
{ {
get { return this.Get<double>("ProgressTotal"); } get => this.Get<double>("ProgressTotal");
set { this.Set("ProgressTotal", value); } set => this.Set("ProgressTotal", value);
} }
/// <summary> /// <summary>
@ -80,8 +80,8 @@ namespace Steamless.Model.Tasks
/// </summary> /// </summary>
public string Text public string Text
{ {
get { return this.Get<string>("Text"); } get => this.Get<string>("Text");
set { this.Set("Text", value); } set => this.Set("Text", value);
} }
} }
} }

View file

@ -122,17 +122,6 @@ namespace Steamless.ViewModel
this.m_TaskThread.Start(); 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> /// <summary>
/// Thread callback to process application tasks. /// Thread callback to process application tasks.
/// </summary> /// </summary>