From d0d10c0d9086e6a9d76039d7367358e860393e83 Mon Sep 17 00:00:00 2001 From: TH3C0D3R Date: Fri, 15 Sep 2023 10:36:59 +0200 Subject: [PATCH 1/2] fix git ignore --- .gitignore | 1 + GeForceNowWindowMover.csproj.user | 18 ------------------ 2 files changed, 1 insertion(+), 18 deletions(-) delete mode 100644 GeForceNowWindowMover.csproj.user diff --git a/.gitignore b/.gitignore index 2c9faf6..5fffe6f 100644 --- a/.gitignore +++ b/.gitignore @@ -132,3 +132,4 @@ $RECYCLE.BIN/ .DS_Store _NCrunch* +/GeForceNowWindowMover.csproj.user diff --git a/GeForceNowWindowMover.csproj.user b/GeForceNowWindowMover.csproj.user deleted file mode 100644 index bb4c13b..0000000 --- a/GeForceNowWindowMover.csproj.user +++ /dev/null @@ -1,18 +0,0 @@ - - - - publish\ - - - - - - de-DE - false - ProjectFiles - - - - - - \ No newline at end of file From 7a5fc4a56ab270ee82a545a75efd59cee5255e20 Mon Sep 17 00:00:00 2001 From: TH3C0D3R Date: Fri, 15 Sep 2023 10:37:24 +0200 Subject: [PATCH 2/2] v21 height + width cli flags --- Helper/Utils.cs | 41 +++++++++++++++++++++++++++++++++++------ Program.cs | 4 ++-- 2 files changed, 37 insertions(+), 8 deletions(-) diff --git a/Helper/Utils.cs b/Helper/Utils.cs index d66ecd9..b38126a 100644 --- a/Helper/Utils.cs +++ b/Helper/Utils.cs @@ -45,6 +45,8 @@ public static class Utils #region Arguments public static bool NoFixedWindow { get; set; } = false; public static string ProcessName { get; set; } = string.Empty; + public static int PreDefHeight { get; set; } = 720; + public static int PreDefWidth { get; set; } = 1280; #endregion #region Settings Wrapped @@ -118,7 +120,8 @@ public static Process GetProcessByName(string name) public static void callResizeForm() { FrmMessure form = new FrmMessure(); - + form.Height = PreDefHeight; + form.Width = PreDefWidth; DialogResult dlgRes = form.ShowDialog(); if (dlgRes != DialogResult.OK && Settings.Default.firstRun) @@ -167,10 +170,17 @@ public static void PrintConsoleHelp() { Console.WriteLine($""); Console.WriteLine($"Usage: "); - Console.WriteLine($" {Path.GetFileName(Assembly.GetEntryAssembly().Location)} (--nofixed | -n)"); - Console.WriteLine($" {Path.GetFileName(Assembly.GetEntryAssembly().Location)} (--nofixed | -n) --process|-p "); - Console.WriteLine($" {Path.GetFileName(Assembly.GetEntryAssembly().Location)} (--fixed | -f)"); - Console.WriteLine($" {Path.GetFileName(Assembly.GetEntryAssembly().Location)} (--fixed | -f) --process|-p "); + Console.WriteLine($" {Path.GetFileName(Assembly.GetEntryAssembly().Location)} [...Options]"); + Console.WriteLine($""); + Console.WriteLine($""); + Console.WriteLine($"Options: "); + Console.WriteLine($" --nofixed | -n : Use wrapper window"); + Console.WriteLine($" --process | -p : Predefine process to use"); + Console.WriteLine($" --fixed | -f : Use dummy window to define fixed size and position"); + Console.WriteLine($" --resizeOnly | -r : Only run dummy window to define fixed size and position"); + Console.WriteLine($" --height : Predefine Height (ex. 720 or 1080)"); + Console.WriteLine($" --width : Predefine Width (ex. 1280 or 1920)"); + Console.WriteLine($" --help | -h : Show this"); Console.WriteLine($""); Console.WriteLine($""); Console.WriteLine($"PROCESSNAME WITHOUT .EXE/EXTENSION (e.g: GeForceNOW instead of GeForceNOW.exe"); @@ -232,8 +242,27 @@ public static object ArgHelper(string[] args) callResizeForm(); returnValue = false; break; + case "height": + if (args[i + 1].Length > 0 && !args[i + 1].StartsWith("-")) + { + if(int.TryParse(args[i + 1].Trim(' '),out int height)) + { + PreDefHeight = height; + } + returnValue = true; + } + break; + case "width": + if (args[i + 1].Length > 0 && !args[i + 1].StartsWith("-")) + { + if (int.TryParse(args[i + 1].Trim(' '), out int width)) + { + PreDefWidth = width; + } + returnValue = true; + } + break; default: - returnValue = false; break; } } diff --git a/Program.cs b/Program.cs index 6a8ba37..91eb596 100644 --- a/Program.cs +++ b/Program.cs @@ -17,7 +17,7 @@ static void Main(string[] args) Application.SetCompatibleTextRenderingDefault(false); Console.SetWindowSize(113, 19); Console.SetBufferSize(113, 3000); - if (Settings.Default.lastProcess.Length > 0 || Settings.Default.lastProcess != null) + if (Settings.Default.lastProcess.Length > 0 && Settings.Default.lastProcess != null) { lastProcess = Utils.GetProcessByName(Settings.Default.lastProcess); } @@ -67,7 +67,7 @@ private static void Menu() Console.Clear(); Process proc = null; int option = -1; - Console.WriteLine("If you want to resize the window (fixed position and size), enter '-1' into the next menu!!\n\n"); + Console.WriteLine("If you want to resize/move the window (fixed position and size), enter '-1' into the next menu!!\n\n"); Console.WriteLine("Please select the method to modify the game window: "); Console.WriteLine($"1 ) [BUGGY] Wrapper Form (the GeForce Now window will be wrapped inside a form which can be moved and resized)"); Console.WriteLine($"2 ) [RECOMMENDED] Fixed Position and Size (predefine a fixed position and size for the GeForce Now window)");