diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..5ec48ef Binary files /dev/null and b/.DS_Store differ diff --git a/.github/.DS_Store b/.github/.DS_Store new file mode 100644 index 0000000..a80c80f Binary files /dev/null and b/.github/.DS_Store differ diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 7c7745e..7478bde 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,10 +1,10 @@ name: publish Borderless Gaming -on: [push, pull_request] -#on: -# push: -# tags: -# - "*.*.*" + +on: + push: + tags: + - "*.*.*" jobs: publish: @@ -25,7 +25,7 @@ jobs: - name: Install bebopc shell: pwsh - run: irm https://bebop.sh | iex + run: $version = '2.7.4'; $script = irm "https://bebop.sh"; & ([scriptblock]::Create($script)) -bebopcVersion $version - name: Build release shell: pwsh diff --git a/BorderlessGaming/.DS_Store b/BorderlessGaming/.DS_Store new file mode 100644 index 0000000..3cd2306 Binary files /dev/null and b/BorderlessGaming/.DS_Store differ diff --git a/BorderlessGaming/BorderlessGaming.csproj b/BorderlessGaming/BorderlessGaming.csproj index 7be54d4..4187ba1 100644 --- a/BorderlessGaming/BorderlessGaming.csproj +++ b/BorderlessGaming/BorderlessGaming.csproj @@ -10,9 +10,10 @@ true true true - 9.5.6 - 9.5.6 - 9.5.6 + 10.0.0 + 10.0.0 + 10.0.0 + true BorderlessGaming_new.ico diff --git a/BorderlessGaming/Logic/.DS_Store b/BorderlessGaming/Logic/.DS_Store new file mode 100644 index 0000000..9546eeb Binary files /dev/null and b/BorderlessGaming/Logic/.DS_Store differ diff --git a/BorderlessGaming/Logic/Extensions/ProcessExtensions.cs b/BorderlessGaming/Logic/Extensions/ProcessExtensions.cs index 49f521f..a7c7cc7 100644 --- a/BorderlessGaming/Logic/Extensions/ProcessExtensions.cs +++ b/BorderlessGaming/Logic/Extensions/ProcessExtensions.cs @@ -4,9 +4,29 @@ namespace BorderlessGaming.Logic.Extensions { internal static class ProcessExtensions { + +#nullable enable + public static Process? GetProcessById(int id) + { + try + { + return Process.GetProcessById(id); + } + catch + { + return null; + } + } +#nullable disable + private static string FindIndexedProcessName(int pid) { - var processName = Process.GetProcessById(pid).ProcessName; + using var process = GetProcessById(pid); + if (process is null) + { + return string.Empty; + } + var processName = process.ProcessName; var processesByName = Process.GetProcessesByName(processName); string processIndexdName = null; @@ -14,7 +34,7 @@ private static string FindIndexedProcessName(int pid) { processIndexdName = index == 0 ? processName : processName + "#" + index; var processId = new PerformanceCounter("Process", "ID Process", processIndexdName); - if ((int) processId.NextValue() == pid) + if ((int)processId.NextValue() == pid) { return processIndexdName; } @@ -22,11 +42,15 @@ private static string FindIndexedProcessName(int pid) return processIndexdName; } - + private static Process FindPidFromIndexedProcessName(string indexedProcessName) { + if (string.IsNullOrEmpty(indexedProcessName)) + { + return null; + } var parentId = new PerformanceCounter("Process", "Creating Process ID", indexedProcessName); - return Process.GetProcessById((int) parentId.NextValue()); + return Process.GetProcessById((int)parentId.NextValue()); } public static Process Parent(this Process process) diff --git a/BorderlessGaming/Logic/Models/Models.g.cs b/BorderlessGaming/Logic/Models/Models.g.cs index a9f21a4..c5546fa 100644 --- a/BorderlessGaming/Logic/Models/Models.g.cs +++ b/BorderlessGaming/Logic/Models/Models.g.cs @@ -1,71 +1,52 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// -// bebopc version: -// 2.7.4 -// -// -// bebopc source: -// https://github.com/RainwayApp/bebop -// -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -// -// This source code was auto-generated by bebopc, Version=2.7.4. -// namespace BorderlessGaming.Logic.Models { /// A static class which contains schema defined constants. - [global::System.CodeDom.Compiler.GeneratedCode("bebopc", "2.7.4")] + [global::System.CodeDom.Compiler.GeneratedCode("bebopc", "2.8.7")] public static class BopConstants { public const string DefaultCulture = "en-US"; } - [global::System.CodeDom.Compiler.GeneratedCode("bebopc", "2.7.4")] - [global::Bebop.Attributes.BebopRecord(global::Bebop.Runtime.BebopKind.Struct, true)] - public partial class RuntimeException : global::Bebop.Runtime.BaseBebopRecord, global::System.IEquatable { + [global::System.CodeDom.Compiler.GeneratedCode("bebopc", "2.8.7")] + [global::Bebop.Attributes.BebopRecord(global::Bebop.Runtime.BebopKind.Struct)] + public partial class ProcessRectangle : global::Bebop.Runtime.BaseBebopRecord, global::System.IEquatable { /// public sealed override int MaxByteCount => GetMaxByteCount(); /// public sealed override int ByteCount => GetByteCount(); [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] - public string Reason { get; init; } + public int X { get; set; } [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] - public string InnerReason { get; init; } + public int Y { get; set; } [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] - public string Type { get; init; } + public int Width { get; set; } [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] - public string StackTrace { get; init; } + public int Height { get; set; } /// /// - public RuntimeException() : base() { } + public ProcessRectangle() : base() { } /// /// - /// + /// /// - /// + /// /// - /// + /// /// - /// + /// /// - public RuntimeException([global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] string reason, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] string innerReason, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] string type, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] string stackTrace) => (Reason, InnerReason, Type, StackTrace) = (reason, innerReason, type, stackTrace); - public RuntimeException([global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] RuntimeException original) => (Reason, InnerReason, Type, StackTrace) = (original.Reason, original.InnerReason, original.Type, original.StackTrace); - public void Deconstruct([global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out string reason, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out string innerReason, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out string type, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out string stackTrace) => (reason, innerReason, type, stackTrace) = (Reason, InnerReason, Type, StackTrace); + public ProcessRectangle([global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] int x, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] int y, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] int width, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] int height) => (X, Y, Width, Height) = (x, y, width, height); + public ProcessRectangle([global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] ProcessRectangle original) => (X, Y, Width, Height) = (original.X, original.Y, original.Width, original.Height); + public void Deconstruct([global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out int x, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out int y, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out int width, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out int height) => (x, y, width, height) = (X, Y, Width, Height); /// Calculates the maximum number of bytes produced by encoding the current record. [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] private protected int GetMaxByteCount() { int byteCount = 0; - byteCount += sizeof(uint) + global::System.Text.Encoding.UTF8.GetMaxByteCount(Reason.Length); - byteCount += sizeof(uint) + global::System.Text.Encoding.UTF8.GetMaxByteCount(InnerReason.Length); - byteCount += sizeof(uint) + global::System.Text.Encoding.UTF8.GetMaxByteCount(Type.Length); - byteCount += sizeof(uint) + global::System.Text.Encoding.UTF8.GetMaxByteCount(StackTrace.Length); + byteCount += sizeof(int); + byteCount += sizeof(int); + byteCount += sizeof(int); + byteCount += sizeof(int); return byteCount; } @@ -74,10 +55,10 @@ private protected int GetMaxByteCount() { [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] private protected int GetByteCount() { int byteCount = 0; - byteCount += sizeof(uint) + global::System.Text.Encoding.UTF8.GetByteCount(Reason); - byteCount += sizeof(uint) + global::System.Text.Encoding.UTF8.GetByteCount(InnerReason); - byteCount += sizeof(uint) + global::System.Text.Encoding.UTF8.GetByteCount(Type); - byteCount += sizeof(uint) + global::System.Text.Encoding.UTF8.GetByteCount(StackTrace); + byteCount += sizeof(int); + byteCount += sizeof(int); + byteCount += sizeof(int); + byteCount += sizeof(int); return byteCount; } @@ -88,7 +69,7 @@ public sealed override byte[] Encode() { return writer.ToArray(); } [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] - public static byte[] Encode(global::BorderlessGaming.Logic.Models.RuntimeException record) { + public static byte[] Encode(global::BorderlessGaming.Logic.Models.ProcessRectangle record) { var writer = global::Bebop.Runtime.BebopWriter.Create(); __EncodeInto(record, ref writer); return writer.ToArray(); @@ -101,7 +82,7 @@ public sealed override byte[] Encode(int initialCapacity) { return writer.ToArray(); } [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] - public static byte[] Encode(global::BorderlessGaming.Logic.Models.RuntimeException record, int initialCapacity) { + public static byte[] Encode(global::BorderlessGaming.Logic.Models.ProcessRectangle record, int initialCapacity) { var writer = global::Bebop.Runtime.BebopWriter.Create(initialCapacity); __EncodeInto(record, ref writer); return writer.ToArray(); @@ -114,7 +95,7 @@ public static byte[] Encode(global::BorderlessGaming.Logic.Models.RuntimeExcepti return writer.ToImmutableArray(); } [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] - public static global::System.Collections.Immutable.ImmutableArray EncodeImmutably(global::BorderlessGaming.Logic.Models.RuntimeException record) { + public static global::System.Collections.Immutable.ImmutableArray EncodeImmutably(global::BorderlessGaming.Logic.Models.ProcessRectangle record) { var writer = global::Bebop.Runtime.BebopWriter.Create(); __EncodeInto(record, ref writer); return writer.ToImmutableArray(); @@ -127,7 +108,7 @@ public static byte[] Encode(global::BorderlessGaming.Logic.Models.RuntimeExcepti return writer.ToImmutableArray(); } [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] - public static global::System.Collections.Immutable.ImmutableArray EncodeImmutably(global::BorderlessGaming.Logic.Models.RuntimeException record, int initialCapacity) { + public static global::System.Collections.Immutable.ImmutableArray EncodeImmutably(global::BorderlessGaming.Logic.Models.ProcessRectangle record, int initialCapacity) { var writer = global::Bebop.Runtime.BebopWriter.Create(initialCapacity); __EncodeInto(record, ref writer); return writer.ToImmutableArray(); @@ -139,38 +120,38 @@ public sealed override int EncodeIntoBuffer(byte[] outBuffer) { return __EncodeInto(this, ref writer); } [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] - public static int EncodeIntoBuffer(global::BorderlessGaming.Logic.Models.RuntimeException record, byte[] outBuffer) { + public static int EncodeIntoBuffer(global::BorderlessGaming.Logic.Models.ProcessRectangle record, byte[] outBuffer) { var writer = global::Bebop.Runtime.BebopWriter.Create(outBuffer); return __EncodeInto(record, ref writer); } #region Static Decode Methods [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] - public static global::BorderlessGaming.Logic.Models.RuntimeException Decode(byte[] record) { + public static global::BorderlessGaming.Logic.Models.ProcessRectangle Decode(byte[] record) { var reader = global::Bebop.Runtime.BebopReader.From(record); return __DecodeFrom(ref reader); } [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] - public static global::BorderlessGaming.Logic.Models.RuntimeException Decode(global::System.ReadOnlySpan record) { + public static global::BorderlessGaming.Logic.Models.ProcessRectangle Decode(global::System.ReadOnlySpan record) { var reader = global::Bebop.Runtime.BebopReader.From(record); return __DecodeFrom(ref reader); } [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] - public static global::BorderlessGaming.Logic.Models.RuntimeException Decode(global::System.ReadOnlyMemory record) { + public static global::BorderlessGaming.Logic.Models.ProcessRectangle Decode(global::System.ReadOnlyMemory record) { var reader = global::Bebop.Runtime.BebopReader.From(record); return __DecodeFrom(ref reader); } [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] - public static global::BorderlessGaming.Logic.Models.RuntimeException Decode(global::System.ArraySegment record) { + public static global::BorderlessGaming.Logic.Models.ProcessRectangle Decode(global::System.ArraySegment record) { var reader = global::Bebop.Runtime.BebopReader.From(record); return __DecodeFrom(ref reader); } [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] - public static global::BorderlessGaming.Logic.Models.RuntimeException Decode(global::System.Collections.Immutable.ImmutableArray record) { + public static global::BorderlessGaming.Logic.Models.ProcessRectangle Decode(global::System.Collections.Immutable.ImmutableArray record) { var reader = global::Bebop.Runtime.BebopReader.From(record); return __DecodeFrom(ref reader); } @@ -181,12 +162,12 @@ public static int EncodeIntoBuffer(global::BorderlessGaming.Logic.Models.Runtime [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - internal static int __EncodeInto(global::BorderlessGaming.Logic.Models.RuntimeException record, ref global::Bebop.Runtime.BebopWriter writer) { + internal static int __EncodeInto(global::BorderlessGaming.Logic.Models.ProcessRectangle record, ref global::Bebop.Runtime.BebopWriter writer) { var before = writer.Length; - writer.WriteString(record.Reason); - writer.WriteString(record.InnerReason); - writer.WriteString(record.Type); - writer.WriteString(record.StackTrace); + writer.WriteInt32(record.X); + writer.WriteInt32(record.Y); + writer.WriteInt32(record.Width); + writer.WriteInt32(record.Height); var after = writer.Length; return after - before; } @@ -196,34 +177,34 @@ internal static int __EncodeInto(global::BorderlessGaming.Logic.Models.RuntimeEx [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - internal static global::BorderlessGaming.Logic.Models.RuntimeException __DecodeFrom(ref global::Bebop.Runtime.BebopReader reader) { + internal static global::BorderlessGaming.Logic.Models.ProcessRectangle __DecodeFrom(ref global::Bebop.Runtime.BebopReader reader) { - string field0; - field0 = reader.ReadString(); - string field1; - field1 = reader.ReadString(); - string field2; - field2 = reader.ReadString(); - string field3; - field3 = reader.ReadString(); - return new global::BorderlessGaming.Logic.Models.RuntimeException { - Reason = field0, - InnerReason = field1, - Type = field2, - StackTrace = field3, + int field0; + field0 = reader.ReadInt32(); + int field1; + field1 = reader.ReadInt32(); + int field2; + field2 = reader.ReadInt32(); + int field3; + field3 = reader.ReadInt32(); + return new global::BorderlessGaming.Logic.Models.ProcessRectangle { + X = field0, + Y = field1, + Width = field2, + Height = field3, }; } #endregion #region Equality - public bool Equals(global::BorderlessGaming.Logic.Models.RuntimeException other) { + public bool Equals(global::BorderlessGaming.Logic.Models.ProcessRectangle other) { if (ReferenceEquals(null, other)) { return false; } if (ReferenceEquals(this, other)) { return true; } - return Reason == other.Reason && InnerReason == other.InnerReason && Type == other.Type && StackTrace == other.StackTrace; + return X == other.X && Y == other.Y && Width == other.Width && Height == other.Height; } public override bool Equals(object obj) { @@ -233,7 +214,7 @@ public override bool Equals(object obj) { if (ReferenceEquals(this, obj)) { return true; } - if (obj is not global::BorderlessGaming.Logic.Models.RuntimeException baseType) { + if (obj is not global::BorderlessGaming.Logic.Models.ProcessRectangle baseType) { return false; } return Equals(baseType); @@ -241,153 +222,138 @@ public override bool Equals(object obj) { public override int GetHashCode() { int hash = 1; - hash ^= Reason.GetHashCode(); - hash ^= InnerReason.GetHashCode(); - hash ^= Type.GetHashCode(); - hash ^= StackTrace.GetHashCode(); + hash ^= X.GetHashCode(); + hash ^= Y.GetHashCode(); + hash ^= Width.GetHashCode(); + hash ^= Height.GetHashCode(); return hash; } - public static bool operator ==(global::BorderlessGaming.Logic.Models.RuntimeException left, global::BorderlessGaming.Logic.Models.RuntimeException right) => Equals(left, right); - public static bool operator !=(global::BorderlessGaming.Logic.Models.RuntimeException left, global::BorderlessGaming.Logic.Models.RuntimeException right) => !Equals(left, right); + public static bool operator ==(global::BorderlessGaming.Logic.Models.ProcessRectangle left, global::BorderlessGaming.Logic.Models.ProcessRectangle right) => Equals(left, right); + public static bool operator !=(global::BorderlessGaming.Logic.Models.ProcessRectangle left, global::BorderlessGaming.Logic.Models.ProcessRectangle right) => !Equals(left, right); #endregion } - [global::System.CodeDom.Compiler.GeneratedCode("bebopc", "2.7.4")] - [global::Bebop.Attributes.BebopRecord(global::Bebop.Runtime.BebopKind.Enum)] - public enum FavoriteSize : byte { - Invalid = 0, - FullScreen = 1, - SpecificSize = 2, - NoChange = 3 - } - - [global::System.CodeDom.Compiler.GeneratedCode("bebopc", "2.7.4")] - [global::Bebop.Attributes.BebopRecord(global::Bebop.Runtime.BebopKind.Enum)] - public enum FavoriteType : byte { - Invalid = 0, - Process = 1, - Title = 2, - Regex = 3 - } - - [global::System.CodeDom.Compiler.GeneratedCode("bebopc", "2.7.4")] - [global::Bebop.Attributes.BebopRecord(global::Bebop.Runtime.BebopKind.Struct)] - public partial class Favorite : global::Bebop.Runtime.BaseBebopRecord, global::System.IEquatable { + [global::System.CodeDom.Compiler.GeneratedCode("bebopc", "2.8.7")] + [global::Bebop.Attributes.BebopRecord(global::Bebop.Runtime.BebopKind.Message)] + public partial class AppSettings : global::Bebop.Runtime.BaseBebopRecord, global::System.IEquatable { + #nullable enable /// public sealed override int MaxByteCount => GetMaxByteCount(); /// public sealed override int ByteCount => GetByteCount(); - [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] - public global::BorderlessGaming.Logic.Models.FavoriteType Type { get; set; } - [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] - public global::BorderlessGaming.Logic.Models.FavoriteSize Size { get; set; } - [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] - public string SearchText { get; set; } - [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] - public global::BorderlessGaming.Logic.Models.ProcessRectangle Screen { get; set; } - [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] - public int OffsetLeft { get; set; } - [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] - public int OffsetTop { get; set; } - [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] - public int OffsetRight { get; set; } - [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] - public int OffsetBottom { get; set; } - [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] - public bool ShouldMaximize { get; set; } - [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] - public int PositionX { get; set; } - [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] - public int PositionY { get; set; } - [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] - public int PositionWidth { get; set; } - [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] - public int PositionHeight { get; set; } - [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] - public bool RemoveMenus { get; set; } - [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] - public bool TopMost { get; set; } - [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] - public bool HideWindowsTaskbar { get; set; } - [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] - public bool HideMouseCursor { get; set; } - [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] - public bool DelayBorderless { get; set; } - [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] - public bool MuteInBackground { get; set; } + [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] + public bool? SlowWindowDetection { get; set; } + [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] + public bool? ViewAllProcessDetails { get; set; } + [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] + public bool? RunOnStartup { get; set; } + [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] + public bool? UseGlobalHotkey { get; set; } + [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] + public bool? UseMouseLockHotKey { get; set; } + [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] + public bool? UseMouseHideHotKey { get; set; } + [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] + public bool? StartMinimized { get; set; } + [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] + public bool? HideBalloonTips { get; set; } + [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] + public bool? CloseToTray { get; set; } + [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] + public bool? CheckForUpdates { get; set; } + [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] + public bool? DisableSteamIntegration { get; set; } + [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] + public string? Culture { get; set; } /// /// - public Favorite() : base() { } + public AppSettings() : base() { } /// /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// + /// /// - /// + /// /// - /// + /// /// - /// + /// /// - /// + /// /// - /// + /// /// - /// + /// /// - /// + /// /// - /// + /// /// - /// + /// /// - /// + /// /// - /// + /// /// - public Favorite([global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] global::BorderlessGaming.Logic.Models.FavoriteType type, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] global::BorderlessGaming.Logic.Models.FavoriteSize size, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] string searchText, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] global::BorderlessGaming.Logic.Models.ProcessRectangle screen, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] int offsetLeft, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] int offsetTop, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] int offsetRight, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] int offsetBottom, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] bool shouldMaximize, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] int positionX, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] int positionY, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] int positionWidth, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] int positionHeight, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] bool removeMenus, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] bool topMost, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] bool hideWindowsTaskbar, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] bool hideMouseCursor, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] bool delayBorderless, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] bool muteInBackground) => (Type, Size, SearchText, Screen, OffsetLeft, OffsetTop, OffsetRight, OffsetBottom, ShouldMaximize, PositionX, PositionY, PositionWidth, PositionHeight, RemoveMenus, TopMost, HideWindowsTaskbar, HideMouseCursor, DelayBorderless, MuteInBackground) = (type, size, searchText, screen, offsetLeft, offsetTop, offsetRight, offsetBottom, shouldMaximize, positionX, positionY, positionWidth, positionHeight, removeMenus, topMost, hideWindowsTaskbar, hideMouseCursor, delayBorderless, muteInBackground); - public Favorite([global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] Favorite original) => (Type, Size, SearchText, Screen, OffsetLeft, OffsetTop, OffsetRight, OffsetBottom, ShouldMaximize, PositionX, PositionY, PositionWidth, PositionHeight, RemoveMenus, TopMost, HideWindowsTaskbar, HideMouseCursor, DelayBorderless, MuteInBackground) = (original.Type, original.Size, original.SearchText, original.Screen, original.OffsetLeft, original.OffsetTop, original.OffsetRight, original.OffsetBottom, original.ShouldMaximize, original.PositionX, original.PositionY, original.PositionWidth, original.PositionHeight, original.RemoveMenus, original.TopMost, original.HideWindowsTaskbar, original.HideMouseCursor, original.DelayBorderless, original.MuteInBackground); - public void Deconstruct([global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out global::BorderlessGaming.Logic.Models.FavoriteType type, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out global::BorderlessGaming.Logic.Models.FavoriteSize size, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out string searchText, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out global::BorderlessGaming.Logic.Models.ProcessRectangle screen, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out int offsetLeft, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out int offsetTop, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out int offsetRight, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out int offsetBottom, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out bool shouldMaximize, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out int positionX, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out int positionY, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out int positionWidth, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out int positionHeight, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out bool removeMenus, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out bool topMost, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out bool hideWindowsTaskbar, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out bool hideMouseCursor, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out bool delayBorderless, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out bool muteInBackground) => (type, size, searchText, screen, offsetLeft, offsetTop, offsetRight, offsetBottom, shouldMaximize, positionX, positionY, positionWidth, positionHeight, removeMenus, topMost, hideWindowsTaskbar, hideMouseCursor, delayBorderless, muteInBackground) = (Type, Size, SearchText, Screen, OffsetLeft, OffsetTop, OffsetRight, OffsetBottom, ShouldMaximize, PositionX, PositionY, PositionWidth, PositionHeight, RemoveMenus, TopMost, HideWindowsTaskbar, HideMouseCursor, DelayBorderless, MuteInBackground); + public AppSettings([global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] bool? slowWindowDetection, [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] bool? viewAllProcessDetails, [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] bool? runOnStartup, [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] bool? useGlobalHotkey, [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] bool? useMouseLockHotKey, [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] bool? useMouseHideHotKey, [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] bool? startMinimized, [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] bool? hideBalloonTips, [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] bool? closeToTray, [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] bool? checkForUpdates, [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] bool? disableSteamIntegration, [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] string? culture) => (SlowWindowDetection, ViewAllProcessDetails, RunOnStartup, UseGlobalHotkey, UseMouseLockHotKey, UseMouseHideHotKey, StartMinimized, HideBalloonTips, CloseToTray, CheckForUpdates, DisableSteamIntegration, Culture) = (slowWindowDetection, viewAllProcessDetails, runOnStartup, useGlobalHotkey, useMouseLockHotKey, useMouseHideHotKey, startMinimized, hideBalloonTips, closeToTray, checkForUpdates, disableSteamIntegration, culture); + public AppSettings([global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] AppSettings? original) => (SlowWindowDetection, ViewAllProcessDetails, RunOnStartup, UseGlobalHotkey, UseMouseLockHotKey, UseMouseHideHotKey, StartMinimized, HideBalloonTips, CloseToTray, CheckForUpdates, DisableSteamIntegration, Culture) = (original?.SlowWindowDetection, original?.ViewAllProcessDetails, original?.RunOnStartup, original?.UseGlobalHotkey, original?.UseMouseLockHotKey, original?.UseMouseHideHotKey, original?.StartMinimized, original?.HideBalloonTips, original?.CloseToTray, original?.CheckForUpdates, original?.DisableSteamIntegration, original?.Culture); + public void Deconstruct([global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] out bool? slowWindowDetection, [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] out bool? viewAllProcessDetails, [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] out bool? runOnStartup, [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] out bool? useGlobalHotkey, [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] out bool? useMouseLockHotKey, [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] out bool? useMouseHideHotKey, [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] out bool? startMinimized, [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] out bool? hideBalloonTips, [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] out bool? closeToTray, [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] out bool? checkForUpdates, [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] out bool? disableSteamIntegration, [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] out string? culture) => (slowWindowDetection, viewAllProcessDetails, runOnStartup, useGlobalHotkey, useMouseLockHotKey, useMouseHideHotKey, startMinimized, hideBalloonTips, closeToTray, checkForUpdates, disableSteamIntegration, culture) = (SlowWindowDetection, ViewAllProcessDetails, RunOnStartup, UseGlobalHotkey, UseMouseLockHotKey, UseMouseHideHotKey, StartMinimized, HideBalloonTips, CloseToTray, CheckForUpdates, DisableSteamIntegration, Culture); /// Calculates the maximum number of bytes produced by encoding the current record. [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] private protected int GetMaxByteCount() { int byteCount = 0; - byteCount += sizeof(byte); - byteCount += sizeof(byte); - byteCount += sizeof(uint) + global::System.Text.Encoding.UTF8.GetMaxByteCount(SearchText.Length); - byteCount += Screen.MaxByteCount; - byteCount += sizeof(int); - byteCount += sizeof(int); - byteCount += sizeof(int); - byteCount += sizeof(int); - byteCount += sizeof(bool); - byteCount += sizeof(int); - byteCount += sizeof(int); - byteCount += sizeof(int); - byteCount += sizeof(int); - byteCount += sizeof(bool); - byteCount += sizeof(bool); - byteCount += sizeof(bool); - byteCount += sizeof(bool); - byteCount += sizeof(bool); - byteCount += sizeof(bool); + byteCount += 5; + if (SlowWindowDetection is not null) { + byteCount += sizeof(byte); + byteCount += sizeof(bool); + } + if (ViewAllProcessDetails is not null) { + byteCount += sizeof(byte); + byteCount += sizeof(bool); + } + if (RunOnStartup is not null) { + byteCount += sizeof(byte); + byteCount += sizeof(bool); + } + if (UseGlobalHotkey is not null) { + byteCount += sizeof(byte); + byteCount += sizeof(bool); + } + if (UseMouseLockHotKey is not null) { + byteCount += sizeof(byte); + byteCount += sizeof(bool); + } + if (UseMouseHideHotKey is not null) { + byteCount += sizeof(byte); + byteCount += sizeof(bool); + } + if (StartMinimized is not null) { + byteCount += sizeof(byte); + byteCount += sizeof(bool); + } + if (HideBalloonTips is not null) { + byteCount += sizeof(byte); + byteCount += sizeof(bool); + } + if (CloseToTray is not null) { + byteCount += sizeof(byte); + byteCount += sizeof(bool); + } + if (CheckForUpdates is not null) { + byteCount += sizeof(byte); + byteCount += sizeof(bool); + } + if (DisableSteamIntegration is not null) { + byteCount += sizeof(byte); + byteCount += sizeof(bool); + } + if (Culture is not null) { + byteCount += sizeof(byte); + byteCount += sizeof(uint) + global::System.Text.Encoding.UTF8.GetMaxByteCount(Culture.Length); + } return byteCount; } @@ -396,28 +362,60 @@ private protected int GetMaxByteCount() { [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] private protected int GetByteCount() { int byteCount = 0; - byteCount += sizeof(byte); - byteCount += sizeof(byte); - byteCount += sizeof(uint) + global::System.Text.Encoding.UTF8.GetByteCount(SearchText); - byteCount += Screen.ByteCount; - byteCount += sizeof(int); - byteCount += sizeof(int); - byteCount += sizeof(int); - byteCount += sizeof(int); - byteCount += sizeof(bool); - byteCount += sizeof(int); - byteCount += sizeof(int); - byteCount += sizeof(int); - byteCount += sizeof(int); - byteCount += sizeof(bool); - byteCount += sizeof(bool); - byteCount += sizeof(bool); - byteCount += sizeof(bool); - byteCount += sizeof(bool); - byteCount += sizeof(bool); + byteCount += 5; + if (SlowWindowDetection is not null) { + byteCount += sizeof(byte); + byteCount += sizeof(bool); + } + if (ViewAllProcessDetails is not null) { + byteCount += sizeof(byte); + byteCount += sizeof(bool); + } + if (RunOnStartup is not null) { + byteCount += sizeof(byte); + byteCount += sizeof(bool); + } + if (UseGlobalHotkey is not null) { + byteCount += sizeof(byte); + byteCount += sizeof(bool); + } + if (UseMouseLockHotKey is not null) { + byteCount += sizeof(byte); + byteCount += sizeof(bool); + } + if (UseMouseHideHotKey is not null) { + byteCount += sizeof(byte); + byteCount += sizeof(bool); + } + if (StartMinimized is not null) { + byteCount += sizeof(byte); + byteCount += sizeof(bool); + } + if (HideBalloonTips is not null) { + byteCount += sizeof(byte); + byteCount += sizeof(bool); + } + if (CloseToTray is not null) { + byteCount += sizeof(byte); + byteCount += sizeof(bool); + } + if (CheckForUpdates is not null) { + byteCount += sizeof(byte); + byteCount += sizeof(bool); + } + if (DisableSteamIntegration is not null) { + byteCount += sizeof(byte); + byteCount += sizeof(bool); + } + if (Culture is not null) { + byteCount += sizeof(byte); + byteCount += sizeof(uint) + global::System.Text.Encoding.UTF8.GetByteCount(Culture); + } return byteCount; } + #nullable disable + [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] public sealed override byte[] Encode() { var writer = global::Bebop.Runtime.BebopWriter.Create(); @@ -425,7 +423,7 @@ public sealed override byte[] Encode() { return writer.ToArray(); } [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] - public static byte[] Encode(global::BorderlessGaming.Logic.Models.Favorite record) { + public static byte[] Encode(global::BorderlessGaming.Logic.Models.AppSettings record) { var writer = global::Bebop.Runtime.BebopWriter.Create(); __EncodeInto(record, ref writer); return writer.ToArray(); @@ -438,7 +436,7 @@ public sealed override byte[] Encode(int initialCapacity) { return writer.ToArray(); } [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] - public static byte[] Encode(global::BorderlessGaming.Logic.Models.Favorite record, int initialCapacity) { + public static byte[] Encode(global::BorderlessGaming.Logic.Models.AppSettings record, int initialCapacity) { var writer = global::Bebop.Runtime.BebopWriter.Create(initialCapacity); __EncodeInto(record, ref writer); return writer.ToArray(); @@ -451,7 +449,7 @@ public static byte[] Encode(global::BorderlessGaming.Logic.Models.Favorite recor return writer.ToImmutableArray(); } [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] - public static global::System.Collections.Immutable.ImmutableArray EncodeImmutably(global::BorderlessGaming.Logic.Models.Favorite record) { + public static global::System.Collections.Immutable.ImmutableArray EncodeImmutably(global::BorderlessGaming.Logic.Models.AppSettings record) { var writer = global::Bebop.Runtime.BebopWriter.Create(); __EncodeInto(record, ref writer); return writer.ToImmutableArray(); @@ -464,7 +462,7 @@ public static byte[] Encode(global::BorderlessGaming.Logic.Models.Favorite recor return writer.ToImmutableArray(); } [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] - public static global::System.Collections.Immutable.ImmutableArray EncodeImmutably(global::BorderlessGaming.Logic.Models.Favorite record, int initialCapacity) { + public static global::System.Collections.Immutable.ImmutableArray EncodeImmutably(global::BorderlessGaming.Logic.Models.AppSettings record, int initialCapacity) { var writer = global::Bebop.Runtime.BebopWriter.Create(initialCapacity); __EncodeInto(record, ref writer); return writer.ToImmutableArray(); @@ -476,38 +474,38 @@ public sealed override int EncodeIntoBuffer(byte[] outBuffer) { return __EncodeInto(this, ref writer); } [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] - public static int EncodeIntoBuffer(global::BorderlessGaming.Logic.Models.Favorite record, byte[] outBuffer) { + public static int EncodeIntoBuffer(global::BorderlessGaming.Logic.Models.AppSettings record, byte[] outBuffer) { var writer = global::Bebop.Runtime.BebopWriter.Create(outBuffer); return __EncodeInto(record, ref writer); } #region Static Decode Methods [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] - public static global::BorderlessGaming.Logic.Models.Favorite Decode(byte[] record) { + public static global::BorderlessGaming.Logic.Models.AppSettings Decode(byte[] record) { var reader = global::Bebop.Runtime.BebopReader.From(record); return __DecodeFrom(ref reader); } [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] - public static global::BorderlessGaming.Logic.Models.Favorite Decode(global::System.ReadOnlySpan record) { + public static global::BorderlessGaming.Logic.Models.AppSettings Decode(global::System.ReadOnlySpan record) { var reader = global::Bebop.Runtime.BebopReader.From(record); return __DecodeFrom(ref reader); } [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] - public static global::BorderlessGaming.Logic.Models.Favorite Decode(global::System.ReadOnlyMemory record) { + public static global::BorderlessGaming.Logic.Models.AppSettings Decode(global::System.ReadOnlyMemory record) { var reader = global::Bebop.Runtime.BebopReader.From(record); return __DecodeFrom(ref reader); } [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] - public static global::BorderlessGaming.Logic.Models.Favorite Decode(global::System.ArraySegment record) { + public static global::BorderlessGaming.Logic.Models.AppSettings Decode(global::System.ArraySegment record) { var reader = global::Bebop.Runtime.BebopReader.From(record); return __DecodeFrom(ref reader); } [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] - public static global::BorderlessGaming.Logic.Models.Favorite Decode(global::System.Collections.Immutable.ImmutableArray record) { + public static global::BorderlessGaming.Logic.Models.AppSettings Decode(global::System.Collections.Immutable.ImmutableArray record) { var reader = global::Bebop.Runtime.BebopReader.From(record); return __DecodeFrom(ref reader); } @@ -518,27 +516,73 @@ public static int EncodeIntoBuffer(global::BorderlessGaming.Logic.Models.Favorit [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - internal static int __EncodeInto(global::BorderlessGaming.Logic.Models.Favorite record, ref global::Bebop.Runtime.BebopWriter writer) { + internal static int __EncodeInto(global::BorderlessGaming.Logic.Models.AppSettings record, ref global::Bebop.Runtime.BebopWriter writer) { var before = writer.Length; - writer.WriteByte(System.Runtime.CompilerServices.Unsafe.As(ref System.Runtime.CompilerServices.Unsafe.AsRef(record.Type))); - writer.WriteByte(System.Runtime.CompilerServices.Unsafe.As(ref System.Runtime.CompilerServices.Unsafe.AsRef(record.Size))); - writer.WriteString(record.SearchText); - global::BorderlessGaming.Logic.Models.ProcessRectangle.__EncodeInto(record.Screen, ref writer); - writer.WriteInt32(record.OffsetLeft); - writer.WriteInt32(record.OffsetTop); - writer.WriteInt32(record.OffsetRight); - writer.WriteInt32(record.OffsetBottom); - writer.WriteByte(record.ShouldMaximize); - writer.WriteInt32(record.PositionX); - writer.WriteInt32(record.PositionY); - writer.WriteInt32(record.PositionWidth); - writer.WriteInt32(record.PositionHeight); - writer.WriteByte(record.RemoveMenus); - writer.WriteByte(record.TopMost); - writer.WriteByte(record.HideWindowsTaskbar); - writer.WriteByte(record.HideMouseCursor); - writer.WriteByte(record.DelayBorderless); - writer.WriteByte(record.MuteInBackground); + var pos = writer.ReserveRecordLength(); + var start = writer.Length; + + if (record.SlowWindowDetection is not null) { + writer.WriteByte(1); + writer.WriteByte(record.SlowWindowDetection.Value); + } + + if (record.ViewAllProcessDetails is not null) { + writer.WriteByte(2); + writer.WriteByte(record.ViewAllProcessDetails.Value); + } + + if (record.RunOnStartup is not null) { + writer.WriteByte(3); + writer.WriteByte(record.RunOnStartup.Value); + } + + if (record.UseGlobalHotkey is not null) { + writer.WriteByte(4); + writer.WriteByte(record.UseGlobalHotkey.Value); + } + + if (record.UseMouseLockHotKey is not null) { + writer.WriteByte(5); + writer.WriteByte(record.UseMouseLockHotKey.Value); + } + + if (record.UseMouseHideHotKey is not null) { + writer.WriteByte(6); + writer.WriteByte(record.UseMouseHideHotKey.Value); + } + + if (record.StartMinimized is not null) { + writer.WriteByte(7); + writer.WriteByte(record.StartMinimized.Value); + } + + if (record.HideBalloonTips is not null) { + writer.WriteByte(8); + writer.WriteByte(record.HideBalloonTips.Value); + } + + if (record.CloseToTray is not null) { + writer.WriteByte(9); + writer.WriteByte(record.CloseToTray.Value); + } + + if (record.CheckForUpdates is not null) { + writer.WriteByte(10); + writer.WriteByte(record.CheckForUpdates.Value); + } + + if (record.DisableSteamIntegration is not null) { + writer.WriteByte(11); + writer.WriteByte(record.DisableSteamIntegration.Value); + } + + if (record.Culture is not null) { + writer.WriteByte(12); + writer.WriteString(record.Culture); + } + writer.WriteByte(0); + var end = writer.Length; + writer.FillRecordLength(pos, unchecked((uint) unchecked(end - start))); var after = writer.Length; return after - before; } @@ -548,79 +592,68 @@ internal static int __EncodeInto(global::BorderlessGaming.Logic.Models.Favorite [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - internal static global::BorderlessGaming.Logic.Models.Favorite __DecodeFrom(ref global::Bebop.Runtime.BebopReader reader) { + internal static global::BorderlessGaming.Logic.Models.AppSettings __DecodeFrom(ref global::Bebop.Runtime.BebopReader reader) { - global::BorderlessGaming.Logic.Models.FavoriteType field0; - field0 = System.Runtime.CompilerServices.Unsafe.As(ref System.Runtime.CompilerServices.Unsafe.AsRef(reader.ReadByte())); - global::BorderlessGaming.Logic.Models.FavoriteSize field1; - field1 = System.Runtime.CompilerServices.Unsafe.As(ref System.Runtime.CompilerServices.Unsafe.AsRef(reader.ReadByte())); - string field2; - field2 = reader.ReadString(); - global::BorderlessGaming.Logic.Models.ProcessRectangle field3; - field3 = global::BorderlessGaming.Logic.Models.ProcessRectangle.__DecodeFrom(ref reader); - int field4; - field4 = reader.ReadInt32(); - int field5; - field5 = reader.ReadInt32(); - int field6; - field6 = reader.ReadInt32(); - int field7; - field7 = reader.ReadInt32(); - bool field8; - field8 = reader.ReadByte() != 0; - int field9; - field9 = reader.ReadInt32(); - int field10; - field10 = reader.ReadInt32(); - int field11; - field11 = reader.ReadInt32(); - int field12; - field12 = reader.ReadInt32(); - bool field13; - field13 = reader.ReadByte() != 0; - bool field14; - field14 = reader.ReadByte() != 0; - bool field15; - field15 = reader.ReadByte() != 0; - bool field16; - field16 = reader.ReadByte() != 0; - bool field17; - field17 = reader.ReadByte() != 0; - bool field18; - field18 = reader.ReadByte() != 0; - return new global::BorderlessGaming.Logic.Models.Favorite { - Type = field0, - Size = field1, - SearchText = field2, - Screen = field3, - OffsetLeft = field4, - OffsetTop = field5, - OffsetRight = field6, - OffsetBottom = field7, - ShouldMaximize = field8, - PositionX = field9, - PositionY = field10, - PositionWidth = field11, - PositionHeight = field12, - RemoveMenus = field13, - TopMost = field14, - HideWindowsTaskbar = field15, - HideMouseCursor = field16, - DelayBorderless = field17, - MuteInBackground = field18, - }; + var record = new global::BorderlessGaming.Logic.Models.AppSettings(); + var length = reader.ReadRecordLength(); + var end = unchecked((int) (reader.Position + length)); + while (true) { + switch (reader.ReadByte()) { + case 0: + return record; + case 1: + record.SlowWindowDetection = reader.ReadByte() != 0; + break; + case 2: + record.ViewAllProcessDetails = reader.ReadByte() != 0; + break; + case 3: + record.RunOnStartup = reader.ReadByte() != 0; + break; + case 4: + record.UseGlobalHotkey = reader.ReadByte() != 0; + break; + case 5: + record.UseMouseLockHotKey = reader.ReadByte() != 0; + break; + case 6: + record.UseMouseHideHotKey = reader.ReadByte() != 0; + break; + case 7: + record.StartMinimized = reader.ReadByte() != 0; + break; + case 8: + record.HideBalloonTips = reader.ReadByte() != 0; + break; + case 9: + record.CloseToTray = reader.ReadByte() != 0; + break; + case 10: + record.CheckForUpdates = reader.ReadByte() != 0; + break; + case 11: + record.DisableSteamIntegration = reader.ReadByte() != 0; + break; + case 12: + record.Culture = reader.ReadString(); + break; + default: + reader.Position = end; + return record; + } + } } #endregion #region Equality - public bool Equals(global::BorderlessGaming.Logic.Models.Favorite other) { + public bool Equals(global::BorderlessGaming.Logic.Models.AppSettings other) { if (ReferenceEquals(null, other)) { return false; } if (ReferenceEquals(this, other)) { return true; } - return Type == other.Type && Size == other.Size && SearchText == other.SearchText && Screen == other.Screen && OffsetLeft == other.OffsetLeft && OffsetTop == other.OffsetTop && OffsetRight == other.OffsetRight && OffsetBottom == other.OffsetBottom && ShouldMaximize == other.ShouldMaximize && PositionX == other.PositionX && PositionY == other.PositionY && PositionWidth == other.PositionWidth && PositionHeight == other.PositionHeight && RemoveMenus == other.RemoveMenus && TopMost == other.TopMost && HideWindowsTaskbar == other.HideWindowsTaskbar && HideMouseCursor == other.HideMouseCursor && DelayBorderless == other.DelayBorderless && MuteInBackground == other.MuteInBackground; + return SlowWindowDetection == other.SlowWindowDetection && ViewAllProcessDetails == other.ViewAllProcessDetails && RunOnStartup == other.RunOnStartup && UseGlobalHotkey == other.UseGlobalHotkey && UseMouseLockHotKey == other.UseMouseLockHotKey && UseMouseHideHotKey == other.UseMouseHideHotKey && StartMinimized == other.StartMinimized && HideBalloonTips == other.HideBalloonTips && CloseToTray == other.CloseToTray && CheckForUpdates == other.CheckForUpdates && DisableSteamIntegration == other.DisableSteamIntegration && Culture == other.Culture; } public override bool Equals(object obj) { @@ -630,7 +663,7 @@ public override bool Equals(object obj) { if (ReferenceEquals(this, obj)) { return true; } - if (obj is not global::BorderlessGaming.Logic.Models.Favorite baseType) { + if (obj is not global::BorderlessGaming.Logic.Models.AppSettings baseType) { return false; } return Equals(baseType); @@ -638,82 +671,68 @@ public override bool Equals(object obj) { public override int GetHashCode() { int hash = 1; - hash ^= Type.GetHashCode(); - hash ^= Size.GetHashCode(); - hash ^= SearchText.GetHashCode(); - hash ^= Screen.GetHashCode(); - hash ^= OffsetLeft.GetHashCode(); - hash ^= OffsetTop.GetHashCode(); - hash ^= OffsetRight.GetHashCode(); - hash ^= OffsetBottom.GetHashCode(); - hash ^= ShouldMaximize.GetHashCode(); - hash ^= PositionX.GetHashCode(); - hash ^= PositionY.GetHashCode(); - hash ^= PositionWidth.GetHashCode(); - hash ^= PositionHeight.GetHashCode(); - hash ^= RemoveMenus.GetHashCode(); - hash ^= TopMost.GetHashCode(); - hash ^= HideWindowsTaskbar.GetHashCode(); - hash ^= HideMouseCursor.GetHashCode(); - hash ^= DelayBorderless.GetHashCode(); - hash ^= MuteInBackground.GetHashCode(); + if (SlowWindowDetection is not null) hash ^= SlowWindowDetection.Value.GetHashCode(); + if (ViewAllProcessDetails is not null) hash ^= ViewAllProcessDetails.Value.GetHashCode(); + if (RunOnStartup is not null) hash ^= RunOnStartup.Value.GetHashCode(); + if (UseGlobalHotkey is not null) hash ^= UseGlobalHotkey.Value.GetHashCode(); + if (UseMouseLockHotKey is not null) hash ^= UseMouseLockHotKey.Value.GetHashCode(); + if (UseMouseHideHotKey is not null) hash ^= UseMouseHideHotKey.Value.GetHashCode(); + if (StartMinimized is not null) hash ^= StartMinimized.Value.GetHashCode(); + if (HideBalloonTips is not null) hash ^= HideBalloonTips.Value.GetHashCode(); + if (CloseToTray is not null) hash ^= CloseToTray.Value.GetHashCode(); + if (CheckForUpdates is not null) hash ^= CheckForUpdates.Value.GetHashCode(); + if (DisableSteamIntegration is not null) hash ^= DisableSteamIntegration.Value.GetHashCode(); + if (Culture is not null) hash ^= Culture.GetHashCode(); return hash; } - public static bool operator ==(global::BorderlessGaming.Logic.Models.Favorite left, global::BorderlessGaming.Logic.Models.Favorite right) => Equals(left, right); - public static bool operator !=(global::BorderlessGaming.Logic.Models.Favorite left, global::BorderlessGaming.Logic.Models.Favorite right) => !Equals(left, right); + public static bool operator ==(global::BorderlessGaming.Logic.Models.AppSettings left, global::BorderlessGaming.Logic.Models.AppSettings right) => Equals(left, right); + public static bool operator !=(global::BorderlessGaming.Logic.Models.AppSettings left, global::BorderlessGaming.Logic.Models.AppSettings right) => !Equals(left, right); #endregion } - [global::System.CodeDom.Compiler.GeneratedCode("bebopc", "2.7.4")] - [global::Bebop.Attributes.BebopRecord(global::Bebop.Runtime.BebopKind.Struct)] - public partial class UserPreferences : global::Bebop.Runtime.BaseBebopRecord, global::System.IEquatable { + [global::System.CodeDom.Compiler.GeneratedCode("bebopc", "2.8.7")] + [global::Bebop.Attributes.BebopRecord(global::Bebop.Runtime.BebopKind.Struct, true)] + public partial class RuntimeException : global::Bebop.Runtime.BaseBebopRecord, global::System.IEquatable { /// public sealed override int MaxByteCount => GetMaxByteCount(); /// public sealed override int ByteCount => GetByteCount(); [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] - public global::BorderlessGaming.Logic.Models.Favorite[] Favorites { get; set; } + public string Reason { get; init; } [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] - public string[] HiddenProcesses { get; set; } + public string InnerReason { get; init; } [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] - public global::BorderlessGaming.Logic.Models.AppSettings Settings { get; set; } + public string Type { get; init; } + [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] + public string StackTrace { get; init; } /// /// - public UserPreferences() : base() { } + public RuntimeException() : base() { } /// /// - /// + /// /// - /// + /// /// - /// + /// /// - public UserPreferences([global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] global::BorderlessGaming.Logic.Models.Favorite[] favorites, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] string[] hiddenProcesses, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] global::BorderlessGaming.Logic.Models.AppSettings settings) => (Favorites, HiddenProcesses, Settings) = (favorites, hiddenProcesses, settings); - public UserPreferences([global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] UserPreferences original) => (Favorites, HiddenProcesses, Settings) = (original.Favorites, original.HiddenProcesses, original.Settings); - public void Deconstruct([global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out global::BorderlessGaming.Logic.Models.Favorite[] favorites, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out string[] hiddenProcesses, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out global::BorderlessGaming.Logic.Models.AppSettings settings) => (favorites, hiddenProcesses, settings) = (Favorites, HiddenProcesses, Settings); + /// + /// + public RuntimeException([global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] string reason, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] string innerReason, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] string type, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] string stackTrace) => (Reason, InnerReason, Type, StackTrace) = (reason, innerReason, type, stackTrace); + public RuntimeException([global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] RuntimeException original) => (Reason, InnerReason, Type, StackTrace) = (original.Reason, original.InnerReason, original.Type, original.StackTrace); + public void Deconstruct([global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out string reason, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out string innerReason, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out string type, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out string stackTrace) => (reason, innerReason, type, stackTrace) = (Reason, InnerReason, Type, StackTrace); /// Calculates the maximum number of bytes produced by encoding the current record. [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] private protected int GetMaxByteCount() { int byteCount = 0; - { - var length0 = unchecked((uint)Favorites.Length); - byteCount += sizeof(uint); - for (var i0 = 0; i0 < length0; i0++) { - byteCount += Favorites[i0].MaxByteCount; - } - } - { - var length0 = unchecked((uint)HiddenProcesses.Length); - byteCount += sizeof(uint); - for (var i0 = 0; i0 < length0; i0++) { - byteCount += sizeof(uint) + global::System.Text.Encoding.UTF8.GetMaxByteCount(HiddenProcesses[i0].Length); - } - } - byteCount += Settings.MaxByteCount; + byteCount += sizeof(uint) + global::System.Text.Encoding.UTF8.GetMaxByteCount(Reason.Length); + byteCount += sizeof(uint) + global::System.Text.Encoding.UTF8.GetMaxByteCount(InnerReason.Length); + byteCount += sizeof(uint) + global::System.Text.Encoding.UTF8.GetMaxByteCount(Type.Length); + byteCount += sizeof(uint) + global::System.Text.Encoding.UTF8.GetMaxByteCount(StackTrace.Length); return byteCount; } @@ -722,21 +741,10 @@ private protected int GetMaxByteCount() { [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] private protected int GetByteCount() { int byteCount = 0; - { - var length0 = unchecked((uint)Favorites.Length); - byteCount += sizeof(uint); - for (var i0 = 0; i0 < length0; i0++) { - byteCount += Favorites[i0].ByteCount; - } - } - { - var length0 = unchecked((uint)HiddenProcesses.Length); - byteCount += sizeof(uint); - for (var i0 = 0; i0 < length0; i0++) { - byteCount += sizeof(uint) + global::System.Text.Encoding.UTF8.GetByteCount(HiddenProcesses[i0]); - } - } - byteCount += Settings.ByteCount; + byteCount += sizeof(uint) + global::System.Text.Encoding.UTF8.GetByteCount(Reason); + byteCount += sizeof(uint) + global::System.Text.Encoding.UTF8.GetByteCount(InnerReason); + byteCount += sizeof(uint) + global::System.Text.Encoding.UTF8.GetByteCount(Type); + byteCount += sizeof(uint) + global::System.Text.Encoding.UTF8.GetByteCount(StackTrace); return byteCount; } @@ -747,7 +755,7 @@ public sealed override byte[] Encode() { return writer.ToArray(); } [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] - public static byte[] Encode(global::BorderlessGaming.Logic.Models.UserPreferences record) { + public static byte[] Encode(global::BorderlessGaming.Logic.Models.RuntimeException record) { var writer = global::Bebop.Runtime.BebopWriter.Create(); __EncodeInto(record, ref writer); return writer.ToArray(); @@ -760,7 +768,7 @@ public sealed override byte[] Encode(int initialCapacity) { return writer.ToArray(); } [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] - public static byte[] Encode(global::BorderlessGaming.Logic.Models.UserPreferences record, int initialCapacity) { + public static byte[] Encode(global::BorderlessGaming.Logic.Models.RuntimeException record, int initialCapacity) { var writer = global::Bebop.Runtime.BebopWriter.Create(initialCapacity); __EncodeInto(record, ref writer); return writer.ToArray(); @@ -773,7 +781,7 @@ public static byte[] Encode(global::BorderlessGaming.Logic.Models.UserPreference return writer.ToImmutableArray(); } [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] - public static global::System.Collections.Immutable.ImmutableArray EncodeImmutably(global::BorderlessGaming.Logic.Models.UserPreferences record) { + public static global::System.Collections.Immutable.ImmutableArray EncodeImmutably(global::BorderlessGaming.Logic.Models.RuntimeException record) { var writer = global::Bebop.Runtime.BebopWriter.Create(); __EncodeInto(record, ref writer); return writer.ToImmutableArray(); @@ -786,7 +794,7 @@ public static byte[] Encode(global::BorderlessGaming.Logic.Models.UserPreference return writer.ToImmutableArray(); } [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] - public static global::System.Collections.Immutable.ImmutableArray EncodeImmutably(global::BorderlessGaming.Logic.Models.UserPreferences record, int initialCapacity) { + public static global::System.Collections.Immutable.ImmutableArray EncodeImmutably(global::BorderlessGaming.Logic.Models.RuntimeException record, int initialCapacity) { var writer = global::Bebop.Runtime.BebopWriter.Create(initialCapacity); __EncodeInto(record, ref writer); return writer.ToImmutableArray(); @@ -798,38 +806,38 @@ public sealed override int EncodeIntoBuffer(byte[] outBuffer) { return __EncodeInto(this, ref writer); } [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] - public static int EncodeIntoBuffer(global::BorderlessGaming.Logic.Models.UserPreferences record, byte[] outBuffer) { + public static int EncodeIntoBuffer(global::BorderlessGaming.Logic.Models.RuntimeException record, byte[] outBuffer) { var writer = global::Bebop.Runtime.BebopWriter.Create(outBuffer); return __EncodeInto(record, ref writer); } #region Static Decode Methods [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] - public static global::BorderlessGaming.Logic.Models.UserPreferences Decode(byte[] record) { + public static global::BorderlessGaming.Logic.Models.RuntimeException Decode(byte[] record) { var reader = global::Bebop.Runtime.BebopReader.From(record); return __DecodeFrom(ref reader); } [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] - public static global::BorderlessGaming.Logic.Models.UserPreferences Decode(global::System.ReadOnlySpan record) { + public static global::BorderlessGaming.Logic.Models.RuntimeException Decode(global::System.ReadOnlySpan record) { var reader = global::Bebop.Runtime.BebopReader.From(record); return __DecodeFrom(ref reader); } [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] - public static global::BorderlessGaming.Logic.Models.UserPreferences Decode(global::System.ReadOnlyMemory record) { + public static global::BorderlessGaming.Logic.Models.RuntimeException Decode(global::System.ReadOnlyMemory record) { var reader = global::Bebop.Runtime.BebopReader.From(record); return __DecodeFrom(ref reader); } [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] - public static global::BorderlessGaming.Logic.Models.UserPreferences Decode(global::System.ArraySegment record) { + public static global::BorderlessGaming.Logic.Models.RuntimeException Decode(global::System.ArraySegment record) { var reader = global::Bebop.Runtime.BebopReader.From(record); return __DecodeFrom(ref reader); } [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] - public static global::BorderlessGaming.Logic.Models.UserPreferences Decode(global::System.Collections.Immutable.ImmutableArray record) { + public static global::BorderlessGaming.Logic.Models.RuntimeException Decode(global::System.Collections.Immutable.ImmutableArray record) { var reader = global::Bebop.Runtime.BebopReader.From(record); return __DecodeFrom(ref reader); } @@ -840,23 +848,12 @@ public static int EncodeIntoBuffer(global::BorderlessGaming.Logic.Models.UserPre [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - internal static int __EncodeInto(global::BorderlessGaming.Logic.Models.UserPreferences record, ref global::Bebop.Runtime.BebopWriter writer) { + internal static int __EncodeInto(global::BorderlessGaming.Logic.Models.RuntimeException record, ref global::Bebop.Runtime.BebopWriter writer) { var before = writer.Length; - { - var length0 = unchecked((uint)record.Favorites.Length); - writer.WriteUInt32(length0); - for (var i0 = 0; i0 < length0; i0++) { - global::BorderlessGaming.Logic.Models.Favorite.__EncodeInto(record.Favorites[i0], ref writer); - } - } - { - var length0 = unchecked((uint)record.HiddenProcesses.Length); - writer.WriteUInt32(length0); - for (var i0 = 0; i0 < length0; i0++) { - writer.WriteString(record.HiddenProcesses[i0]); - } - } - global::BorderlessGaming.Logic.Models.AppSettings.__EncodeInto(record.Settings, ref writer); + writer.WriteString(record.Reason); + writer.WriteString(record.InnerReason); + writer.WriteString(record.Type); + writer.WriteString(record.StackTrace); var after = writer.Length; return after - before; } @@ -866,47 +863,34 @@ internal static int __EncodeInto(global::BorderlessGaming.Logic.Models.UserPrefe [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - internal static global::BorderlessGaming.Logic.Models.UserPreferences __DecodeFrom(ref global::Bebop.Runtime.BebopReader reader) { + internal static global::BorderlessGaming.Logic.Models.RuntimeException __DecodeFrom(ref global::Bebop.Runtime.BebopReader reader) { - global::BorderlessGaming.Logic.Models.Favorite[] field0; - { - var length0 = unchecked((int)reader.ReadUInt32()); - field0 = new global::BorderlessGaming.Logic.Models.Favorite[length0]; - for (var i0 = 0; i0 < length0; i0++) { - global::BorderlessGaming.Logic.Models.Favorite x0; - x0 = global::BorderlessGaming.Logic.Models.Favorite.__DecodeFrom(ref reader); - field0[i0] = x0; - } - } - string[] field1; - { - var length0 = unchecked((int)reader.ReadUInt32()); - field1 = new string[length0]; - for (var i0 = 0; i0 < length0; i0++) { - string x0; - x0 = reader.ReadString(); - field1[i0] = x0; - } - } - global::BorderlessGaming.Logic.Models.AppSettings field2; - field2 = global::BorderlessGaming.Logic.Models.AppSettings.__DecodeFrom(ref reader); - return new global::BorderlessGaming.Logic.Models.UserPreferences { - Favorites = field0, - HiddenProcesses = field1, - Settings = field2, + string field0; + field0 = reader.ReadString(); + string field1; + field1 = reader.ReadString(); + string field2; + field2 = reader.ReadString(); + string field3; + field3 = reader.ReadString(); + return new global::BorderlessGaming.Logic.Models.RuntimeException { + Reason = field0, + InnerReason = field1, + Type = field2, + StackTrace = field3, }; } #endregion #region Equality - public bool Equals(global::BorderlessGaming.Logic.Models.UserPreferences other) { + public bool Equals(global::BorderlessGaming.Logic.Models.RuntimeException other) { if (ReferenceEquals(null, other)) { return false; } if (ReferenceEquals(this, other)) { return true; } - return (Favorites is null ? other.Favorites is null : other.Favorites is not null && global::System.Linq.Enumerable.SequenceEqual(Favorites, other.Favorites)) && (HiddenProcesses is null ? other.HiddenProcesses is null : other.HiddenProcesses is not null && global::System.Linq.Enumerable.SequenceEqual(HiddenProcesses, other.HiddenProcesses)) && Settings == other.Settings; + return Reason == other.Reason && InnerReason == other.InnerReason && Type == other.Type && StackTrace == other.StackTrace; } public override bool Equals(object obj) { @@ -916,7 +900,7 @@ public override bool Equals(object obj) { if (ReferenceEquals(this, obj)) { return true; } - if (obj is not global::BorderlessGaming.Logic.Models.UserPreferences baseType) { + if (obj is not global::BorderlessGaming.Logic.Models.RuntimeException baseType) { return false; } return Equals(baseType); @@ -924,59 +908,67 @@ public override bool Equals(object obj) { public override int GetHashCode() { int hash = 1; - hash ^= Favorites.GetHashCode(); - hash ^= HiddenProcesses.GetHashCode(); - hash ^= Settings.GetHashCode(); + hash ^= Reason.GetHashCode(); + hash ^= InnerReason.GetHashCode(); + hash ^= Type.GetHashCode(); + hash ^= StackTrace.GetHashCode(); return hash; } - public static bool operator ==(global::BorderlessGaming.Logic.Models.UserPreferences left, global::BorderlessGaming.Logic.Models.UserPreferences right) => Equals(left, right); - public static bool operator !=(global::BorderlessGaming.Logic.Models.UserPreferences left, global::BorderlessGaming.Logic.Models.UserPreferences right) => !Equals(left, right); + public static bool operator ==(global::BorderlessGaming.Logic.Models.RuntimeException left, global::BorderlessGaming.Logic.Models.RuntimeException right) => Equals(left, right); + public static bool operator !=(global::BorderlessGaming.Logic.Models.RuntimeException left, global::BorderlessGaming.Logic.Models.RuntimeException right) => !Equals(left, right); #endregion } - [global::System.CodeDom.Compiler.GeneratedCode("bebopc", "2.7.4")] + [global::System.CodeDom.Compiler.GeneratedCode("bebopc", "2.8.7")] [global::Bebop.Attributes.BebopRecord(global::Bebop.Runtime.BebopKind.Struct)] - public partial class ProcessRectangle : global::Bebop.Runtime.BaseBebopRecord, global::System.IEquatable { + public partial class UserPreferences : global::Bebop.Runtime.BaseBebopRecord, global::System.IEquatable { /// public sealed override int MaxByteCount => GetMaxByteCount(); /// public sealed override int ByteCount => GetByteCount(); [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] - public int X { get; set; } - [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] - public int Y { get; set; } + public global::BorderlessGaming.Logic.Models.Favorite[] Favorites { get; set; } [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] - public int Width { get; set; } + public string[] HiddenProcesses { get; set; } [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] - public int Height { get; set; } + public global::BorderlessGaming.Logic.Models.AppSettings Settings { get; set; } /// /// - public ProcessRectangle() : base() { } + public UserPreferences() : base() { } /// /// - /// - /// - /// + /// /// - /// + /// /// - /// + /// /// - public ProcessRectangle([global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] int x, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] int y, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] int width, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] int height) => (X, Y, Width, Height) = (x, y, width, height); - public ProcessRectangle([global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] ProcessRectangle original) => (X, Y, Width, Height) = (original.X, original.Y, original.Width, original.Height); - public void Deconstruct([global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out int x, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out int y, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out int width, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out int height) => (x, y, width, height) = (X, Y, Width, Height); + public UserPreferences([global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] global::BorderlessGaming.Logic.Models.Favorite[] favorites, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] string[] hiddenProcesses, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] global::BorderlessGaming.Logic.Models.AppSettings settings) => (Favorites, HiddenProcesses, Settings) = (favorites, hiddenProcesses, settings); + public UserPreferences([global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] UserPreferences original) => (Favorites, HiddenProcesses, Settings) = (original.Favorites, original.HiddenProcesses, original.Settings); + public void Deconstruct([global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out global::BorderlessGaming.Logic.Models.Favorite[] favorites, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out string[] hiddenProcesses, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out global::BorderlessGaming.Logic.Models.AppSettings settings) => (favorites, hiddenProcesses, settings) = (Favorites, HiddenProcesses, Settings); /// Calculates the maximum number of bytes produced by encoding the current record. [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] private protected int GetMaxByteCount() { int byteCount = 0; - byteCount += sizeof(int); - byteCount += sizeof(int); - byteCount += sizeof(int); - byteCount += sizeof(int); + { + var length0 = unchecked((uint)Favorites.Length); + byteCount += sizeof(uint); + for (var i0 = 0; i0 < length0; i0++) { + byteCount += Favorites[i0].MaxByteCount; + } + } + { + var length0 = unchecked((uint)HiddenProcesses.Length); + byteCount += sizeof(uint); + for (var i0 = 0; i0 < length0; i0++) { + byteCount += sizeof(uint) + global::System.Text.Encoding.UTF8.GetMaxByteCount(HiddenProcesses[i0].Length); + } + } + byteCount += Settings.MaxByteCount; return byteCount; } @@ -985,10 +977,21 @@ private protected int GetMaxByteCount() { [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] private protected int GetByteCount() { int byteCount = 0; - byteCount += sizeof(int); - byteCount += sizeof(int); - byteCount += sizeof(int); - byteCount += sizeof(int); + { + var length0 = unchecked((uint)Favorites.Length); + byteCount += sizeof(uint); + for (var i0 = 0; i0 < length0; i0++) { + byteCount += Favorites[i0].ByteCount; + } + } + { + var length0 = unchecked((uint)HiddenProcesses.Length); + byteCount += sizeof(uint); + for (var i0 = 0; i0 < length0; i0++) { + byteCount += sizeof(uint) + global::System.Text.Encoding.UTF8.GetByteCount(HiddenProcesses[i0]); + } + } + byteCount += Settings.ByteCount; return byteCount; } @@ -999,7 +1002,7 @@ public sealed override byte[] Encode() { return writer.ToArray(); } [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] - public static byte[] Encode(global::BorderlessGaming.Logic.Models.ProcessRectangle record) { + public static byte[] Encode(global::BorderlessGaming.Logic.Models.UserPreferences record) { var writer = global::Bebop.Runtime.BebopWriter.Create(); __EncodeInto(record, ref writer); return writer.ToArray(); @@ -1012,7 +1015,7 @@ public sealed override byte[] Encode(int initialCapacity) { return writer.ToArray(); } [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] - public static byte[] Encode(global::BorderlessGaming.Logic.Models.ProcessRectangle record, int initialCapacity) { + public static byte[] Encode(global::BorderlessGaming.Logic.Models.UserPreferences record, int initialCapacity) { var writer = global::Bebop.Runtime.BebopWriter.Create(initialCapacity); __EncodeInto(record, ref writer); return writer.ToArray(); @@ -1025,7 +1028,7 @@ public static byte[] Encode(global::BorderlessGaming.Logic.Models.ProcessRectang return writer.ToImmutableArray(); } [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] - public static global::System.Collections.Immutable.ImmutableArray EncodeImmutably(global::BorderlessGaming.Logic.Models.ProcessRectangle record) { + public static global::System.Collections.Immutable.ImmutableArray EncodeImmutably(global::BorderlessGaming.Logic.Models.UserPreferences record) { var writer = global::Bebop.Runtime.BebopWriter.Create(); __EncodeInto(record, ref writer); return writer.ToImmutableArray(); @@ -1038,7 +1041,7 @@ public static byte[] Encode(global::BorderlessGaming.Logic.Models.ProcessRectang return writer.ToImmutableArray(); } [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] - public static global::System.Collections.Immutable.ImmutableArray EncodeImmutably(global::BorderlessGaming.Logic.Models.ProcessRectangle record, int initialCapacity) { + public static global::System.Collections.Immutable.ImmutableArray EncodeImmutably(global::BorderlessGaming.Logic.Models.UserPreferences record, int initialCapacity) { var writer = global::Bebop.Runtime.BebopWriter.Create(initialCapacity); __EncodeInto(record, ref writer); return writer.ToImmutableArray(); @@ -1050,38 +1053,38 @@ public sealed override int EncodeIntoBuffer(byte[] outBuffer) { return __EncodeInto(this, ref writer); } [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] - public static int EncodeIntoBuffer(global::BorderlessGaming.Logic.Models.ProcessRectangle record, byte[] outBuffer) { + public static int EncodeIntoBuffer(global::BorderlessGaming.Logic.Models.UserPreferences record, byte[] outBuffer) { var writer = global::Bebop.Runtime.BebopWriter.Create(outBuffer); return __EncodeInto(record, ref writer); } #region Static Decode Methods [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] - public static global::BorderlessGaming.Logic.Models.ProcessRectangle Decode(byte[] record) { + public static global::BorderlessGaming.Logic.Models.UserPreferences Decode(byte[] record) { var reader = global::Bebop.Runtime.BebopReader.From(record); return __DecodeFrom(ref reader); } [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] - public static global::BorderlessGaming.Logic.Models.ProcessRectangle Decode(global::System.ReadOnlySpan record) { + public static global::BorderlessGaming.Logic.Models.UserPreferences Decode(global::System.ReadOnlySpan record) { var reader = global::Bebop.Runtime.BebopReader.From(record); return __DecodeFrom(ref reader); } [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] - public static global::BorderlessGaming.Logic.Models.ProcessRectangle Decode(global::System.ReadOnlyMemory record) { + public static global::BorderlessGaming.Logic.Models.UserPreferences Decode(global::System.ReadOnlyMemory record) { var reader = global::Bebop.Runtime.BebopReader.From(record); return __DecodeFrom(ref reader); } [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] - public static global::BorderlessGaming.Logic.Models.ProcessRectangle Decode(global::System.ArraySegment record) { + public static global::BorderlessGaming.Logic.Models.UserPreferences Decode(global::System.ArraySegment record) { var reader = global::Bebop.Runtime.BebopReader.From(record); return __DecodeFrom(ref reader); } [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] - public static global::BorderlessGaming.Logic.Models.ProcessRectangle Decode(global::System.Collections.Immutable.ImmutableArray record) { + public static global::BorderlessGaming.Logic.Models.UserPreferences Decode(global::System.Collections.Immutable.ImmutableArray record) { var reader = global::Bebop.Runtime.BebopReader.From(record); return __DecodeFrom(ref reader); } @@ -1092,12 +1095,23 @@ public static int EncodeIntoBuffer(global::BorderlessGaming.Logic.Models.Process [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - internal static int __EncodeInto(global::BorderlessGaming.Logic.Models.ProcessRectangle record, ref global::Bebop.Runtime.BebopWriter writer) { + internal static int __EncodeInto(global::BorderlessGaming.Logic.Models.UserPreferences record, ref global::Bebop.Runtime.BebopWriter writer) { var before = writer.Length; - writer.WriteInt32(record.X); - writer.WriteInt32(record.Y); - writer.WriteInt32(record.Width); - writer.WriteInt32(record.Height); + { + var length0 = unchecked((uint)record.Favorites.Length); + writer.WriteUInt32(length0); + for (var i0 = 0; i0 < length0; i0++) { + global::BorderlessGaming.Logic.Models.Favorite.__EncodeInto(record.Favorites[i0], ref writer); + } + } + { + var length0 = unchecked((uint)record.HiddenProcesses.Length); + writer.WriteUInt32(length0); + for (var i0 = 0; i0 < length0; i0++) { + writer.WriteString(record.HiddenProcesses[i0]); + } + } + global::BorderlessGaming.Logic.Models.AppSettings.__EncodeInto(record.Settings, ref writer); var after = writer.Length; return after - before; } @@ -1107,34 +1121,47 @@ internal static int __EncodeInto(global::BorderlessGaming.Logic.Models.ProcessRe [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - internal static global::BorderlessGaming.Logic.Models.ProcessRectangle __DecodeFrom(ref global::Bebop.Runtime.BebopReader reader) { + internal static global::BorderlessGaming.Logic.Models.UserPreferences __DecodeFrom(ref global::Bebop.Runtime.BebopReader reader) { - int field0; - field0 = reader.ReadInt32(); - int field1; - field1 = reader.ReadInt32(); - int field2; - field2 = reader.ReadInt32(); - int field3; - field3 = reader.ReadInt32(); - return new global::BorderlessGaming.Logic.Models.ProcessRectangle { - X = field0, - Y = field1, - Width = field2, - Height = field3, + global::BorderlessGaming.Logic.Models.Favorite[] field0; + { + var length0 = unchecked((int)reader.ReadUInt32()); + field0 = new global::BorderlessGaming.Logic.Models.Favorite[length0]; + for (var i0 = 0; i0 < length0; i0++) { + global::BorderlessGaming.Logic.Models.Favorite x0; + x0 = global::BorderlessGaming.Logic.Models.Favorite.__DecodeFrom(ref reader); + field0[i0] = x0; + } + } + string[] field1; + { + var length0 = unchecked((int)reader.ReadUInt32()); + field1 = new string[length0]; + for (var i0 = 0; i0 < length0; i0++) { + string x0; + x0 = reader.ReadString(); + field1[i0] = x0; + } + } + global::BorderlessGaming.Logic.Models.AppSettings field2; + field2 = global::BorderlessGaming.Logic.Models.AppSettings.__DecodeFrom(ref reader); + return new global::BorderlessGaming.Logic.Models.UserPreferences { + Favorites = field0, + HiddenProcesses = field1, + Settings = field2, }; } #endregion #region Equality - public bool Equals(global::BorderlessGaming.Logic.Models.ProcessRectangle other) { + public bool Equals(global::BorderlessGaming.Logic.Models.UserPreferences other) { if (ReferenceEquals(null, other)) { return false; } if (ReferenceEquals(this, other)) { return true; } - return X == other.X && Y == other.Y && Width == other.Width && Height == other.Height; + return (Favorites is null ? other.Favorites is null : other.Favorites is not null && global::System.Linq.Enumerable.SequenceEqual(Favorites, other.Favorites)) && (HiddenProcesses is null ? other.HiddenProcesses is null : other.HiddenProcesses is not null && global::System.Linq.Enumerable.SequenceEqual(HiddenProcesses, other.HiddenProcesses)) && Settings == other.Settings; } public override bool Equals(object obj) { @@ -1144,7 +1171,7 @@ public override bool Equals(object obj) { if (ReferenceEquals(this, obj)) { return true; } - if (obj is not global::BorderlessGaming.Logic.Models.ProcessRectangle baseType) { + if (obj is not global::BorderlessGaming.Logic.Models.UserPreferences baseType) { return false; } return Equals(baseType); @@ -1152,138 +1179,152 @@ public override bool Equals(object obj) { public override int GetHashCode() { int hash = 1; - hash ^= X.GetHashCode(); - hash ^= Y.GetHashCode(); - hash ^= Width.GetHashCode(); - hash ^= Height.GetHashCode(); + hash ^= Favorites.GetHashCode(); + hash ^= HiddenProcesses.GetHashCode(); + hash ^= Settings.GetHashCode(); return hash; } - public static bool operator ==(global::BorderlessGaming.Logic.Models.ProcessRectangle left, global::BorderlessGaming.Logic.Models.ProcessRectangle right) => Equals(left, right); - public static bool operator !=(global::BorderlessGaming.Logic.Models.ProcessRectangle left, global::BorderlessGaming.Logic.Models.ProcessRectangle right) => !Equals(left, right); + public static bool operator ==(global::BorderlessGaming.Logic.Models.UserPreferences left, global::BorderlessGaming.Logic.Models.UserPreferences right) => Equals(left, right); + public static bool operator !=(global::BorderlessGaming.Logic.Models.UserPreferences left, global::BorderlessGaming.Logic.Models.UserPreferences right) => !Equals(left, right); #endregion } - [global::System.CodeDom.Compiler.GeneratedCode("bebopc", "2.7.4")] - [global::Bebop.Attributes.BebopRecord(global::Bebop.Runtime.BebopKind.Message)] - public partial class AppSettings : global::Bebop.Runtime.BaseBebopRecord, global::System.IEquatable { - #nullable enable + [global::System.CodeDom.Compiler.GeneratedCode("bebopc", "2.8.7")] + [global::Bebop.Attributes.BebopRecord(global::Bebop.Runtime.BebopKind.Enum)] + public enum FavoriteSize : byte { + Invalid = 0, + FullScreen = 1, + SpecificSize = 2, + NoChange = 3 + } + + [global::System.CodeDom.Compiler.GeneratedCode("bebopc", "2.8.7")] + [global::Bebop.Attributes.BebopRecord(global::Bebop.Runtime.BebopKind.Enum)] + public enum FavoriteType : byte { + Invalid = 0, + Process = 1, + Title = 2, + Regex = 3 + } + + [global::System.CodeDom.Compiler.GeneratedCode("bebopc", "2.8.7")] + [global::Bebop.Attributes.BebopRecord(global::Bebop.Runtime.BebopKind.Struct)] + public partial class Favorite : global::Bebop.Runtime.BaseBebopRecord, global::System.IEquatable { /// public sealed override int MaxByteCount => GetMaxByteCount(); /// public sealed override int ByteCount => GetByteCount(); - [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] - public bool? SlowWindowDetection { get; set; } - [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] - public bool? ViewAllProcessDetails { get; set; } - [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] - public bool? RunOnStartup { get; set; } - [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] - public bool? UseGlobalHotkey { get; set; } - [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] - public bool? UseMouseLockHotKey { get; set; } - [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] - public bool? UseMouseHideHotKey { get; set; } - [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] - public bool? StartMinimized { get; set; } - [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] - public bool? HideBalloonTips { get; set; } - [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] - public bool? CloseToTray { get; set; } - [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] - public bool? CheckForUpdates { get; set; } - [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] - public bool? DisableSteamIntegration { get; set; } - [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] - public string? Culture { get; set; } + [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] + public global::BorderlessGaming.Logic.Models.FavoriteType Type { get; set; } + [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] + public global::BorderlessGaming.Logic.Models.FavoriteSize Size { get; set; } + [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] + public string SearchText { get; set; } + [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] + public global::BorderlessGaming.Logic.Models.ProcessRectangle Screen { get; set; } + [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] + public int OffsetLeft { get; set; } + [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] + public int OffsetTop { get; set; } + [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] + public int OffsetRight { get; set; } + [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] + public int OffsetBottom { get; set; } + [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] + public bool ShouldMaximize { get; set; } + [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] + public int PositionX { get; set; } + [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] + public int PositionY { get; set; } + [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] + public int PositionWidth { get; set; } + [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] + public int PositionHeight { get; set; } + [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] + public bool RemoveMenus { get; set; } + [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] + public bool TopMost { get; set; } + [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] + public bool HideWindowsTaskbar { get; set; } + [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] + public bool HideMouseCursor { get; set; } + [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] + public bool DelayBorderless { get; set; } + [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] + public bool MuteInBackground { get; set; } /// /// - public AppSettings() : base() { } + public Favorite() : base() { } /// /// - /// + /// /// - /// + /// /// - /// + /// /// - /// + /// /// - /// + /// /// - /// + /// /// - /// + /// /// - /// + /// /// - /// + /// /// - /// + /// /// - /// + /// /// - /// + /// /// - public AppSettings([global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] bool? slowWindowDetection, [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] bool? viewAllProcessDetails, [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] bool? runOnStartup, [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] bool? useGlobalHotkey, [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] bool? useMouseLockHotKey, [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] bool? useMouseHideHotKey, [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] bool? startMinimized, [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] bool? hideBalloonTips, [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] bool? closeToTray, [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] bool? checkForUpdates, [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] bool? disableSteamIntegration, [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] string? culture) => (SlowWindowDetection, ViewAllProcessDetails, RunOnStartup, UseGlobalHotkey, UseMouseLockHotKey, UseMouseHideHotKey, StartMinimized, HideBalloonTips, CloseToTray, CheckForUpdates, DisableSteamIntegration, Culture) = (slowWindowDetection, viewAllProcessDetails, runOnStartup, useGlobalHotkey, useMouseLockHotKey, useMouseHideHotKey, startMinimized, hideBalloonTips, closeToTray, checkForUpdates, disableSteamIntegration, culture); - public AppSettings([global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] AppSettings? original) => (SlowWindowDetection, ViewAllProcessDetails, RunOnStartup, UseGlobalHotkey, UseMouseLockHotKey, UseMouseHideHotKey, StartMinimized, HideBalloonTips, CloseToTray, CheckForUpdates, DisableSteamIntegration, Culture) = (original?.SlowWindowDetection, original?.ViewAllProcessDetails, original?.RunOnStartup, original?.UseGlobalHotkey, original?.UseMouseLockHotKey, original?.UseMouseHideHotKey, original?.StartMinimized, original?.HideBalloonTips, original?.CloseToTray, original?.CheckForUpdates, original?.DisableSteamIntegration, original?.Culture); - public void Deconstruct([global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] out bool? slowWindowDetection, [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] out bool? viewAllProcessDetails, [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] out bool? runOnStartup, [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] out bool? useGlobalHotkey, [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] out bool? useMouseLockHotKey, [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] out bool? useMouseHideHotKey, [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] out bool? startMinimized, [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] out bool? hideBalloonTips, [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] out bool? closeToTray, [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] out bool? checkForUpdates, [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] out bool? disableSteamIntegration, [global::System.Diagnostics.CodeAnalysis.MaybeNull, global::System.Diagnostics.CodeAnalysis.AllowNull] out string? culture) => (slowWindowDetection, viewAllProcessDetails, runOnStartup, useGlobalHotkey, useMouseLockHotKey, useMouseHideHotKey, startMinimized, hideBalloonTips, closeToTray, checkForUpdates, disableSteamIntegration, culture) = (SlowWindowDetection, ViewAllProcessDetails, RunOnStartup, UseGlobalHotkey, UseMouseLockHotKey, UseMouseHideHotKey, StartMinimized, HideBalloonTips, CloseToTray, CheckForUpdates, DisableSteamIntegration, Culture); + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public Favorite([global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] global::BorderlessGaming.Logic.Models.FavoriteType type, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] global::BorderlessGaming.Logic.Models.FavoriteSize size, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] string searchText, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] global::BorderlessGaming.Logic.Models.ProcessRectangle screen, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] int offsetLeft, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] int offsetTop, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] int offsetRight, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] int offsetBottom, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] bool shouldMaximize, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] int positionX, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] int positionY, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] int positionWidth, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] int positionHeight, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] bool removeMenus, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] bool topMost, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] bool hideWindowsTaskbar, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] bool hideMouseCursor, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] bool delayBorderless, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] bool muteInBackground) => (Type, Size, SearchText, Screen, OffsetLeft, OffsetTop, OffsetRight, OffsetBottom, ShouldMaximize, PositionX, PositionY, PositionWidth, PositionHeight, RemoveMenus, TopMost, HideWindowsTaskbar, HideMouseCursor, DelayBorderless, MuteInBackground) = (type, size, searchText, screen, offsetLeft, offsetTop, offsetRight, offsetBottom, shouldMaximize, positionX, positionY, positionWidth, positionHeight, removeMenus, topMost, hideWindowsTaskbar, hideMouseCursor, delayBorderless, muteInBackground); + public Favorite([global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] Favorite original) => (Type, Size, SearchText, Screen, OffsetLeft, OffsetTop, OffsetRight, OffsetBottom, ShouldMaximize, PositionX, PositionY, PositionWidth, PositionHeight, RemoveMenus, TopMost, HideWindowsTaskbar, HideMouseCursor, DelayBorderless, MuteInBackground) = (original.Type, original.Size, original.SearchText, original.Screen, original.OffsetLeft, original.OffsetTop, original.OffsetRight, original.OffsetBottom, original.ShouldMaximize, original.PositionX, original.PositionY, original.PositionWidth, original.PositionHeight, original.RemoveMenus, original.TopMost, original.HideWindowsTaskbar, original.HideMouseCursor, original.DelayBorderless, original.MuteInBackground); + public void Deconstruct([global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out global::BorderlessGaming.Logic.Models.FavoriteType type, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out global::BorderlessGaming.Logic.Models.FavoriteSize size, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out string searchText, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out global::BorderlessGaming.Logic.Models.ProcessRectangle screen, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out int offsetLeft, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out int offsetTop, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out int offsetRight, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out int offsetBottom, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out bool shouldMaximize, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out int positionX, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out int positionY, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out int positionWidth, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out int positionHeight, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out bool removeMenus, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out bool topMost, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out bool hideWindowsTaskbar, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out bool hideMouseCursor, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out bool delayBorderless, [global::System.Diagnostics.CodeAnalysis.NotNull, global::System.Diagnostics.CodeAnalysis.DisallowNull] out bool muteInBackground) => (type, size, searchText, screen, offsetLeft, offsetTop, offsetRight, offsetBottom, shouldMaximize, positionX, positionY, positionWidth, positionHeight, removeMenus, topMost, hideWindowsTaskbar, hideMouseCursor, delayBorderless, muteInBackground) = (Type, Size, SearchText, Screen, OffsetLeft, OffsetTop, OffsetRight, OffsetBottom, ShouldMaximize, PositionX, PositionY, PositionWidth, PositionHeight, RemoveMenus, TopMost, HideWindowsTaskbar, HideMouseCursor, DelayBorderless, MuteInBackground); /// Calculates the maximum number of bytes produced by encoding the current record. [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] private protected int GetMaxByteCount() { int byteCount = 0; - byteCount += 5; - if (SlowWindowDetection is not null) { - byteCount += sizeof(byte); - byteCount += sizeof(bool); - } - if (ViewAllProcessDetails is not null) { - byteCount += sizeof(byte); - byteCount += sizeof(bool); - } - if (RunOnStartup is not null) { - byteCount += sizeof(byte); - byteCount += sizeof(bool); - } - if (UseGlobalHotkey is not null) { - byteCount += sizeof(byte); - byteCount += sizeof(bool); - } - if (UseMouseLockHotKey is not null) { - byteCount += sizeof(byte); - byteCount += sizeof(bool); - } - if (UseMouseHideHotKey is not null) { - byteCount += sizeof(byte); - byteCount += sizeof(bool); - } - if (StartMinimized is not null) { - byteCount += sizeof(byte); - byteCount += sizeof(bool); - } - if (HideBalloonTips is not null) { - byteCount += sizeof(byte); - byteCount += sizeof(bool); - } - if (CloseToTray is not null) { - byteCount += sizeof(byte); - byteCount += sizeof(bool); - } - if (CheckForUpdates is not null) { - byteCount += sizeof(byte); - byteCount += sizeof(bool); - } - if (DisableSteamIntegration is not null) { - byteCount += sizeof(byte); - byteCount += sizeof(bool); - } - if (Culture is not null) { - byteCount += sizeof(byte); - byteCount += sizeof(uint) + global::System.Text.Encoding.UTF8.GetMaxByteCount(Culture.Length); - } + byteCount += sizeof(byte); + byteCount += sizeof(byte); + byteCount += sizeof(uint) + global::System.Text.Encoding.UTF8.GetMaxByteCount(SearchText.Length); + byteCount += Screen.MaxByteCount; + byteCount += sizeof(int); + byteCount += sizeof(int); + byteCount += sizeof(int); + byteCount += sizeof(int); + byteCount += sizeof(bool); + byteCount += sizeof(int); + byteCount += sizeof(int); + byteCount += sizeof(int); + byteCount += sizeof(int); + byteCount += sizeof(bool); + byteCount += sizeof(bool); + byteCount += sizeof(bool); + byteCount += sizeof(bool); + byteCount += sizeof(bool); + byteCount += sizeof(bool); return byteCount; } @@ -1292,60 +1333,28 @@ private protected int GetMaxByteCount() { [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] private protected int GetByteCount() { int byteCount = 0; - byteCount += 5; - if (SlowWindowDetection is not null) { - byteCount += sizeof(byte); - byteCount += sizeof(bool); - } - if (ViewAllProcessDetails is not null) { - byteCount += sizeof(byte); - byteCount += sizeof(bool); - } - if (RunOnStartup is not null) { - byteCount += sizeof(byte); - byteCount += sizeof(bool); - } - if (UseGlobalHotkey is not null) { - byteCount += sizeof(byte); - byteCount += sizeof(bool); - } - if (UseMouseLockHotKey is not null) { - byteCount += sizeof(byte); - byteCount += sizeof(bool); - } - if (UseMouseHideHotKey is not null) { - byteCount += sizeof(byte); - byteCount += sizeof(bool); - } - if (StartMinimized is not null) { - byteCount += sizeof(byte); - byteCount += sizeof(bool); - } - if (HideBalloonTips is not null) { - byteCount += sizeof(byte); - byteCount += sizeof(bool); - } - if (CloseToTray is not null) { - byteCount += sizeof(byte); - byteCount += sizeof(bool); - } - if (CheckForUpdates is not null) { - byteCount += sizeof(byte); - byteCount += sizeof(bool); - } - if (DisableSteamIntegration is not null) { - byteCount += sizeof(byte); - byteCount += sizeof(bool); - } - if (Culture is not null) { - byteCount += sizeof(byte); - byteCount += sizeof(uint) + global::System.Text.Encoding.UTF8.GetByteCount(Culture); - } + byteCount += sizeof(byte); + byteCount += sizeof(byte); + byteCount += sizeof(uint) + global::System.Text.Encoding.UTF8.GetByteCount(SearchText); + byteCount += Screen.ByteCount; + byteCount += sizeof(int); + byteCount += sizeof(int); + byteCount += sizeof(int); + byteCount += sizeof(int); + byteCount += sizeof(bool); + byteCount += sizeof(int); + byteCount += sizeof(int); + byteCount += sizeof(int); + byteCount += sizeof(int); + byteCount += sizeof(bool); + byteCount += sizeof(bool); + byteCount += sizeof(bool); + byteCount += sizeof(bool); + byteCount += sizeof(bool); + byteCount += sizeof(bool); return byteCount; } - #nullable disable - [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] public sealed override byte[] Encode() { var writer = global::Bebop.Runtime.BebopWriter.Create(); @@ -1353,7 +1362,7 @@ public sealed override byte[] Encode() { return writer.ToArray(); } [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] - public static byte[] Encode(global::BorderlessGaming.Logic.Models.AppSettings record) { + public static byte[] Encode(global::BorderlessGaming.Logic.Models.Favorite record) { var writer = global::Bebop.Runtime.BebopWriter.Create(); __EncodeInto(record, ref writer); return writer.ToArray(); @@ -1366,7 +1375,7 @@ public sealed override byte[] Encode(int initialCapacity) { return writer.ToArray(); } [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] - public static byte[] Encode(global::BorderlessGaming.Logic.Models.AppSettings record, int initialCapacity) { + public static byte[] Encode(global::BorderlessGaming.Logic.Models.Favorite record, int initialCapacity) { var writer = global::Bebop.Runtime.BebopWriter.Create(initialCapacity); __EncodeInto(record, ref writer); return writer.ToArray(); @@ -1379,7 +1388,7 @@ public static byte[] Encode(global::BorderlessGaming.Logic.Models.AppSettings re return writer.ToImmutableArray(); } [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] - public static global::System.Collections.Immutable.ImmutableArray EncodeImmutably(global::BorderlessGaming.Logic.Models.AppSettings record) { + public static global::System.Collections.Immutable.ImmutableArray EncodeImmutably(global::BorderlessGaming.Logic.Models.Favorite record) { var writer = global::Bebop.Runtime.BebopWriter.Create(); __EncodeInto(record, ref writer); return writer.ToImmutableArray(); @@ -1392,7 +1401,7 @@ public static byte[] Encode(global::BorderlessGaming.Logic.Models.AppSettings re return writer.ToImmutableArray(); } [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] - public static global::System.Collections.Immutable.ImmutableArray EncodeImmutably(global::BorderlessGaming.Logic.Models.AppSettings record, int initialCapacity) { + public static global::System.Collections.Immutable.ImmutableArray EncodeImmutably(global::BorderlessGaming.Logic.Models.Favorite record, int initialCapacity) { var writer = global::Bebop.Runtime.BebopWriter.Create(initialCapacity); __EncodeInto(record, ref writer); return writer.ToImmutableArray(); @@ -1404,38 +1413,38 @@ public sealed override int EncodeIntoBuffer(byte[] outBuffer) { return __EncodeInto(this, ref writer); } [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] - public static int EncodeIntoBuffer(global::BorderlessGaming.Logic.Models.AppSettings record, byte[] outBuffer) { + public static int EncodeIntoBuffer(global::BorderlessGaming.Logic.Models.Favorite record, byte[] outBuffer) { var writer = global::Bebop.Runtime.BebopWriter.Create(outBuffer); return __EncodeInto(record, ref writer); } #region Static Decode Methods [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] - public static global::BorderlessGaming.Logic.Models.AppSettings Decode(byte[] record) { + public static global::BorderlessGaming.Logic.Models.Favorite Decode(byte[] record) { var reader = global::Bebop.Runtime.BebopReader.From(record); return __DecodeFrom(ref reader); } [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] - public static global::BorderlessGaming.Logic.Models.AppSettings Decode(global::System.ReadOnlySpan record) { + public static global::BorderlessGaming.Logic.Models.Favorite Decode(global::System.ReadOnlySpan record) { var reader = global::Bebop.Runtime.BebopReader.From(record); return __DecodeFrom(ref reader); } [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] - public static global::BorderlessGaming.Logic.Models.AppSettings Decode(global::System.ReadOnlyMemory record) { + public static global::BorderlessGaming.Logic.Models.Favorite Decode(global::System.ReadOnlyMemory record) { var reader = global::Bebop.Runtime.BebopReader.From(record); return __DecodeFrom(ref reader); } [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] - public static global::BorderlessGaming.Logic.Models.AppSettings Decode(global::System.ArraySegment record) { + public static global::BorderlessGaming.Logic.Models.Favorite Decode(global::System.ArraySegment record) { var reader = global::Bebop.Runtime.BebopReader.From(record); return __DecodeFrom(ref reader); } [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] - public static global::BorderlessGaming.Logic.Models.AppSettings Decode(global::System.Collections.Immutable.ImmutableArray record) { + public static global::BorderlessGaming.Logic.Models.Favorite Decode(global::System.Collections.Immutable.ImmutableArray record) { var reader = global::Bebop.Runtime.BebopReader.From(record); return __DecodeFrom(ref reader); } @@ -1446,73 +1455,27 @@ public static int EncodeIntoBuffer(global::BorderlessGaming.Logic.Models.AppSett [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - internal static int __EncodeInto(global::BorderlessGaming.Logic.Models.AppSettings record, ref global::Bebop.Runtime.BebopWriter writer) { + internal static int __EncodeInto(global::BorderlessGaming.Logic.Models.Favorite record, ref global::Bebop.Runtime.BebopWriter writer) { var before = writer.Length; - var pos = writer.ReserveRecordLength(); - var start = writer.Length; - - if (record.SlowWindowDetection is not null) { - writer.WriteByte(1); - writer.WriteByte(record.SlowWindowDetection.Value); - } - - if (record.ViewAllProcessDetails is not null) { - writer.WriteByte(2); - writer.WriteByte(record.ViewAllProcessDetails.Value); - } - - if (record.RunOnStartup is not null) { - writer.WriteByte(3); - writer.WriteByte(record.RunOnStartup.Value); - } - - if (record.UseGlobalHotkey is not null) { - writer.WriteByte(4); - writer.WriteByte(record.UseGlobalHotkey.Value); - } - - if (record.UseMouseLockHotKey is not null) { - writer.WriteByte(5); - writer.WriteByte(record.UseMouseLockHotKey.Value); - } - - if (record.UseMouseHideHotKey is not null) { - writer.WriteByte(6); - writer.WriteByte(record.UseMouseHideHotKey.Value); - } - - if (record.StartMinimized is not null) { - writer.WriteByte(7); - writer.WriteByte(record.StartMinimized.Value); - } - - if (record.HideBalloonTips is not null) { - writer.WriteByte(8); - writer.WriteByte(record.HideBalloonTips.Value); - } - - if (record.CloseToTray is not null) { - writer.WriteByte(9); - writer.WriteByte(record.CloseToTray.Value); - } - - if (record.CheckForUpdates is not null) { - writer.WriteByte(10); - writer.WriteByte(record.CheckForUpdates.Value); - } - - if (record.DisableSteamIntegration is not null) { - writer.WriteByte(11); - writer.WriteByte(record.DisableSteamIntegration.Value); - } - - if (record.Culture is not null) { - writer.WriteByte(12); - writer.WriteString(record.Culture); - } - writer.WriteByte(0); - var end = writer.Length; - writer.FillRecordLength(pos, unchecked((uint) unchecked(end - start))); + writer.WriteByte(System.Runtime.CompilerServices.Unsafe.As(ref System.Runtime.CompilerServices.Unsafe.AsRef(record.Type))); + writer.WriteByte(System.Runtime.CompilerServices.Unsafe.As(ref System.Runtime.CompilerServices.Unsafe.AsRef(record.Size))); + writer.WriteString(record.SearchText); + global::BorderlessGaming.Logic.Models.ProcessRectangle.__EncodeInto(record.Screen, ref writer); + writer.WriteInt32(record.OffsetLeft); + writer.WriteInt32(record.OffsetTop); + writer.WriteInt32(record.OffsetRight); + writer.WriteInt32(record.OffsetBottom); + writer.WriteByte(record.ShouldMaximize); + writer.WriteInt32(record.PositionX); + writer.WriteInt32(record.PositionY); + writer.WriteInt32(record.PositionWidth); + writer.WriteInt32(record.PositionHeight); + writer.WriteByte(record.RemoveMenus); + writer.WriteByte(record.TopMost); + writer.WriteByte(record.HideWindowsTaskbar); + writer.WriteByte(record.HideMouseCursor); + writer.WriteByte(record.DelayBorderless); + writer.WriteByte(record.MuteInBackground); var after = writer.Length; return after - before; } @@ -1522,68 +1485,79 @@ internal static int __EncodeInto(global::BorderlessGaming.Logic.Models.AppSettin [global::System.Runtime.CompilerServices.MethodImpl(global::Bebop.Runtime.BebopConstants.HotPath)] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - internal static global::BorderlessGaming.Logic.Models.AppSettings __DecodeFrom(ref global::Bebop.Runtime.BebopReader reader) { + internal static global::BorderlessGaming.Logic.Models.Favorite __DecodeFrom(ref global::Bebop.Runtime.BebopReader reader) { - var record = new global::BorderlessGaming.Logic.Models.AppSettings(); - var length = reader.ReadRecordLength(); - var end = unchecked((int) (reader.Position + length)); - while (true) { - switch (reader.ReadByte()) { - case 0: - return record; - case 1: - record.SlowWindowDetection = reader.ReadByte() != 0; - break; - case 2: - record.ViewAllProcessDetails = reader.ReadByte() != 0; - break; - case 3: - record.RunOnStartup = reader.ReadByte() != 0; - break; - case 4: - record.UseGlobalHotkey = reader.ReadByte() != 0; - break; - case 5: - record.UseMouseLockHotKey = reader.ReadByte() != 0; - break; - case 6: - record.UseMouseHideHotKey = reader.ReadByte() != 0; - break; - case 7: - record.StartMinimized = reader.ReadByte() != 0; - break; - case 8: - record.HideBalloonTips = reader.ReadByte() != 0; - break; - case 9: - record.CloseToTray = reader.ReadByte() != 0; - break; - case 10: - record.CheckForUpdates = reader.ReadByte() != 0; - break; - case 11: - record.DisableSteamIntegration = reader.ReadByte() != 0; - break; - case 12: - record.Culture = reader.ReadString(); - break; - default: - reader.Position = end; - return record; - } - } + global::BorderlessGaming.Logic.Models.FavoriteType field0; + field0 = System.Runtime.CompilerServices.Unsafe.As(ref System.Runtime.CompilerServices.Unsafe.AsRef(reader.ReadByte())); + global::BorderlessGaming.Logic.Models.FavoriteSize field1; + field1 = System.Runtime.CompilerServices.Unsafe.As(ref System.Runtime.CompilerServices.Unsafe.AsRef(reader.ReadByte())); + string field2; + field2 = reader.ReadString(); + global::BorderlessGaming.Logic.Models.ProcessRectangle field3; + field3 = global::BorderlessGaming.Logic.Models.ProcessRectangle.__DecodeFrom(ref reader); + int field4; + field4 = reader.ReadInt32(); + int field5; + field5 = reader.ReadInt32(); + int field6; + field6 = reader.ReadInt32(); + int field7; + field7 = reader.ReadInt32(); + bool field8; + field8 = reader.ReadByte() != 0; + int field9; + field9 = reader.ReadInt32(); + int field10; + field10 = reader.ReadInt32(); + int field11; + field11 = reader.ReadInt32(); + int field12; + field12 = reader.ReadInt32(); + bool field13; + field13 = reader.ReadByte() != 0; + bool field14; + field14 = reader.ReadByte() != 0; + bool field15; + field15 = reader.ReadByte() != 0; + bool field16; + field16 = reader.ReadByte() != 0; + bool field17; + field17 = reader.ReadByte() != 0; + bool field18; + field18 = reader.ReadByte() != 0; + return new global::BorderlessGaming.Logic.Models.Favorite { + Type = field0, + Size = field1, + SearchText = field2, + Screen = field3, + OffsetLeft = field4, + OffsetTop = field5, + OffsetRight = field6, + OffsetBottom = field7, + ShouldMaximize = field8, + PositionX = field9, + PositionY = field10, + PositionWidth = field11, + PositionHeight = field12, + RemoveMenus = field13, + TopMost = field14, + HideWindowsTaskbar = field15, + HideMouseCursor = field16, + DelayBorderless = field17, + MuteInBackground = field18, + }; } #endregion #region Equality - public bool Equals(global::BorderlessGaming.Logic.Models.AppSettings other) { + public bool Equals(global::BorderlessGaming.Logic.Models.Favorite other) { if (ReferenceEquals(null, other)) { return false; } if (ReferenceEquals(this, other)) { return true; } - return SlowWindowDetection == other.SlowWindowDetection && ViewAllProcessDetails == other.ViewAllProcessDetails && RunOnStartup == other.RunOnStartup && UseGlobalHotkey == other.UseGlobalHotkey && UseMouseLockHotKey == other.UseMouseLockHotKey && UseMouseHideHotKey == other.UseMouseHideHotKey && StartMinimized == other.StartMinimized && HideBalloonTips == other.HideBalloonTips && CloseToTray == other.CloseToTray && CheckForUpdates == other.CheckForUpdates && DisableSteamIntegration == other.DisableSteamIntegration && Culture == other.Culture; + return Type == other.Type && Size == other.Size && SearchText == other.SearchText && Screen == other.Screen && OffsetLeft == other.OffsetLeft && OffsetTop == other.OffsetTop && OffsetRight == other.OffsetRight && OffsetBottom == other.OffsetBottom && ShouldMaximize == other.ShouldMaximize && PositionX == other.PositionX && PositionY == other.PositionY && PositionWidth == other.PositionWidth && PositionHeight == other.PositionHeight && RemoveMenus == other.RemoveMenus && TopMost == other.TopMost && HideWindowsTaskbar == other.HideWindowsTaskbar && HideMouseCursor == other.HideMouseCursor && DelayBorderless == other.DelayBorderless && MuteInBackground == other.MuteInBackground; } public override bool Equals(object obj) { @@ -1593,7 +1567,7 @@ public override bool Equals(object obj) { if (ReferenceEquals(this, obj)) { return true; } - if (obj is not global::BorderlessGaming.Logic.Models.AppSettings baseType) { + if (obj is not global::BorderlessGaming.Logic.Models.Favorite baseType) { return false; } return Equals(baseType); @@ -1601,23 +1575,30 @@ public override bool Equals(object obj) { public override int GetHashCode() { int hash = 1; - if (SlowWindowDetection is not null) hash ^= SlowWindowDetection.Value.GetHashCode(); - if (ViewAllProcessDetails is not null) hash ^= ViewAllProcessDetails.Value.GetHashCode(); - if (RunOnStartup is not null) hash ^= RunOnStartup.Value.GetHashCode(); - if (UseGlobalHotkey is not null) hash ^= UseGlobalHotkey.Value.GetHashCode(); - if (UseMouseLockHotKey is not null) hash ^= UseMouseLockHotKey.Value.GetHashCode(); - if (UseMouseHideHotKey is not null) hash ^= UseMouseHideHotKey.Value.GetHashCode(); - if (StartMinimized is not null) hash ^= StartMinimized.Value.GetHashCode(); - if (HideBalloonTips is not null) hash ^= HideBalloonTips.Value.GetHashCode(); - if (CloseToTray is not null) hash ^= CloseToTray.Value.GetHashCode(); - if (CheckForUpdates is not null) hash ^= CheckForUpdates.Value.GetHashCode(); - if (DisableSteamIntegration is not null) hash ^= DisableSteamIntegration.Value.GetHashCode(); - if (Culture is not null) hash ^= Culture.GetHashCode(); + hash ^= Type.GetHashCode(); + hash ^= Size.GetHashCode(); + hash ^= SearchText.GetHashCode(); + hash ^= Screen.GetHashCode(); + hash ^= OffsetLeft.GetHashCode(); + hash ^= OffsetTop.GetHashCode(); + hash ^= OffsetRight.GetHashCode(); + hash ^= OffsetBottom.GetHashCode(); + hash ^= ShouldMaximize.GetHashCode(); + hash ^= PositionX.GetHashCode(); + hash ^= PositionY.GetHashCode(); + hash ^= PositionWidth.GetHashCode(); + hash ^= PositionHeight.GetHashCode(); + hash ^= RemoveMenus.GetHashCode(); + hash ^= TopMost.GetHashCode(); + hash ^= HideWindowsTaskbar.GetHashCode(); + hash ^= HideMouseCursor.GetHashCode(); + hash ^= DelayBorderless.GetHashCode(); + hash ^= MuteInBackground.GetHashCode(); return hash; } - public static bool operator ==(global::BorderlessGaming.Logic.Models.AppSettings left, global::BorderlessGaming.Logic.Models.AppSettings right) => Equals(left, right); - public static bool operator !=(global::BorderlessGaming.Logic.Models.AppSettings left, global::BorderlessGaming.Logic.Models.AppSettings right) => !Equals(left, right); + public static bool operator ==(global::BorderlessGaming.Logic.Models.Favorite left, global::BorderlessGaming.Logic.Models.Favorite right) => Equals(left, right); + public static bool operator !=(global::BorderlessGaming.Logic.Models.Favorite left, global::BorderlessGaming.Logic.Models.Favorite right) => !Equals(left, right); #endregion } diff --git a/BorderlessGaming/Logic/Models/UserPreferences.HiddenProcess.cs b/BorderlessGaming/Logic/Models/UserPreferences.HiddenProcess.cs index 584ede1..94d6a6f 100644 --- a/BorderlessGaming/Logic/Models/UserPreferences.HiddenProcess.cs +++ b/BorderlessGaming/Logic/Models/UserPreferences.HiddenProcess.cs @@ -38,7 +38,8 @@ public partial class UserPreferences "iw4 console", "steam", "origin", - "uplay" + "uplay", + "msedge" // Let them hide the rest manually }; diff --git a/BorderlessGaming/Logic/Steam/SteamAPI.cs b/BorderlessGaming/Logic/Steam/SteamAPI.cs index 63a720a..d643af5 100644 --- a/BorderlessGaming/Logic/Steam/SteamAPI.cs +++ b/BorderlessGaming/Logic/Steam/SteamAPI.cs @@ -30,7 +30,7 @@ public static void Init() IsLoaded = true; } catch (Exception ex) - { + { Console.WriteLine("Failed to load Steam."); ExceptionHandler.LogException(ex); } diff --git a/BorderlessGaming/Logic/Windows/ForegroundManager.cs b/BorderlessGaming/Logic/Windows/ForegroundManager.cs index 998d739..4a5f078 100644 --- a/BorderlessGaming/Logic/Windows/ForegroundManager.cs +++ b/BorderlessGaming/Logic/Windows/ForegroundManager.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Runtime.InteropServices; using System.Text; +using BorderlessGaming.Logic.Extensions; using BorderlessGaming.Logic.Models; namespace BorderlessGaming.Logic.Windows @@ -17,13 +18,13 @@ public static class ForegroundManager public static void Subscribe() { _dele = WinEventProc; - _mHhook = Native.SetWinEventHook(EventSystemForeground, EventSystemForeground, IntPtr.Zero, _dele, 0, 0, WineventOutofcontext); + _mHhook = Native.SetWinEventHook(EventSystemForeground, EventSystemForeground, IntPtr.Zero, _dele, 0, 0, WineventOutofcontext); } private const uint WineventOutofcontext = 0; private const uint EventSystemForeground = 3; - + public static void WinEventProc(IntPtr hWinEventHook, uint eventType, IntPtr hwnd, int idObject, int idChild, uint dwEventThread, uint dwmsEventTime) { if (UserPreferences.Instance.Favorites is not null) @@ -32,15 +33,20 @@ public static void WinEventProc(IntPtr hWinEventHook, uint eventType, IntPtr hwn { var handle = Native.GetForegroundWindow(); Native.GetWindowThreadProcessId(handle, out uint processId); - var details = new ProcessDetails(Process.GetProcessById((int)processId), handle); + var process = ProcessExtensions.GetProcessById((int)processId); + if (process is null) + { + return; + } + var details = new ProcessDetails(process, handle); foreach (var fav in UserPreferences.Instance.Favorites.Where(favorite => favorite.IsRunning && favorite.MuteInBackground)) { - + if (fav.Matches(details)) { - if (Native.IsMuted((int) processId)) + if (Native.IsMuted((int)processId)) { - Native.UnMuteProcess((int) processId); + Native.UnMuteProcess((int)processId); } } else @@ -51,14 +57,14 @@ public static void WinEventProc(IntPtr hWinEventHook, uint eventType, IntPtr hwn } } } - + } catch (Exception) { - // + // } } - + } } } \ No newline at end of file diff --git a/BorderlessGaming/Logic/Windows/Windows.cs b/BorderlessGaming/Logic/Windows/Windows.cs index 3d587b0..67fa1e6 100644 --- a/BorderlessGaming/Logic/Windows/Windows.cs +++ b/BorderlessGaming/Logic/Windows/Windows.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Drawing; +using BorderlessGaming.Logic.Extensions; using BorderlessGaming.Logic.Models; namespace BorderlessGaming.Logic.Windows @@ -31,7 +32,7 @@ bool Del(IntPtr hwnd, uint lParam) { if (Native.GetWindowRect(ptr, out Native.Rect rect)) { - if (((Rectangle) rect).IsEmpty) + if (((Rectangle)rect).IsEmpty) { continue; } @@ -43,7 +44,12 @@ bool Del(IntPtr hwnd, uint lParam) } uint processId; Native.GetWindowThreadProcessId(ptr, out processId); - callback(new ProcessDetails(Process.GetProcessById((int) processId), ptr) + var process = ProcessExtensions.GetProcessById((int)processId); + if (process is null) + { + continue; + } + callback(new ProcessDetails(process, ptr) { Manageable = true }); @@ -77,7 +83,7 @@ private static bool GetMainWindowForProcess_EnumWindows(List ptrList, In case 1: if (Native.IsWindowVisible(hWndEnumerated)) { - if ((uint) styleCurrentWindowStandard != 0) + if ((uint)styleCurrentWindowStandard != 0) { ptrList.Add(hWndEnumerated); } diff --git a/README.md b/README.md index ceb8b05..cbe99c9 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ or if you're suffering from crashes or bugs submit information [here](https://gi ## Contact info * **Twitter:** [@AndrewMD5](https://twitter.com/andrewmd5) -* **Blog:** [blog.andrew.im](http://blog.andrew.im) +* **Website:** [andrew.im](https://andrew.im) # Join our Steam Group! [Borderless Gaming on Steam](https://steamcommunity.com/app/388080/discussions/) diff --git a/scripts/build-release.ps1 b/scripts/build-release.ps1 index 9904d80..4c8e19d 100644 --- a/scripts/build-release.ps1 +++ b/scripts/build-release.ps1 @@ -11,5 +11,5 @@ $projectXml.Save($csproj) & bebopc & dotnet restore "$cjproj" -& dotnet publish "$csproj" +& dotnet publish "$csproj" -c Release -r win-x64 & iscc "$root\Installers\BorderlessGaming_Standalone_Admin.iss" \ No newline at end of file diff --git a/version.xml b/version.xml index e795c37..a9d0743 100644 --- a/version.xml +++ b/version.xml @@ -1,5 +1,5 @@ - 9.5.6 + 10.0.0 https://github.com/Codeusa/Borderless-Gaming/releases/latest