Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: oureveryday/DepotDownloaderMod
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: DepotDownloaderMod_2.7.3
Choose a base ref
...
head repository: oureveryday/DepotDownloaderMod
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
  • 19 commits
  • 26 files changed
  • 1 contributor

Commits on Nov 5, 2024

  1. Fix manifest loader

    oureveryday committed Nov 5, 2024

    Verified

    This commit was signed with the committer’s verified signature.
    nickzelei Nick Zelei
    Copy the full SHA
    771d56e View commit details

Commits on Dec 20, 2024

  1. Update to 2.7.4

    oureveryday committed Dec 20, 2024
    Copy the full SHA
    79e5509 View commit details

Commits on Jan 4, 2025

  1. Update script

    oureveryday committed Jan 4, 2025
    Copy the full SHA
    6e53aae View commit details

Commits on Jan 6, 2025

  1. Update script

    oureveryday committed Jan 6, 2025
    Copy the full SHA
    7e32a92 View commit details
  2. Update script

    oureveryday committed Jan 6, 2025
    Copy the full SHA
    26e0f7c View commit details
  3. Update script

    oureveryday committed Jan 6, 2025
    Copy the full SHA
    ab7ba1d View commit details
  4. Update script

    oureveryday committed Jan 6, 2025
    Copy the full SHA
    1437a71 View commit details

Commits on Jan 21, 2025

  1. Update to 3.0.0

    oureveryday committed Jan 21, 2025
    Copy the full SHA
    398bf88 View commit details

Commits on Jan 22, 2025

  1. Update script

    oureveryday committed Jan 22, 2025
    Copy the full SHA
    b3e8baa View commit details

Commits on Jan 23, 2025

  1. Update script

    oureveryday committed Jan 23, 2025
    Copy the full SHA
    4ad5311 View commit details

Commits on Feb 1, 2025

  1. Update script

    oureveryday committed Feb 1, 2025
    Copy the full SHA
    0e01be5 View commit details
  2. Update script

    oureveryday committed Feb 1, 2025
    Copy the full SHA
    84b98c0 View commit details

Commits on Feb 8, 2025

  1. Update Script

    oureveryday committed Feb 8, 2025
    Copy the full SHA
    c684d02 View commit details
  2. Update Script

    oureveryday committed Feb 8, 2025
    Copy the full SHA
    df787f5 View commit details

Commits on Feb 9, 2025

  1. Update Script

    oureveryday committed Feb 9, 2025
    Copy the full SHA
    643b830 View commit details

Commits on Feb 10, 2025

  1. Update script

    oureveryday committed Feb 10, 2025
    Copy the full SHA
    a863a14 View commit details

Commits on Feb 14, 2025

  1. Update Script

    oureveryday committed Feb 14, 2025
    Copy the full SHA
    ab83a4d View commit details
  2. Update Script

    oureveryday committed Feb 14, 2025
    Copy the full SHA
    31ae10b View commit details

Commits on Feb 26, 2025

  1. Update Script

    oureveryday committed Feb 26, 2025
    Copy the full SHA
    f1b602b View commit details
5 changes: 5 additions & 0 deletions DepotDownloader/Ansi.cs
Original file line number Diff line number Diff line change
@@ -30,6 +30,11 @@ public static void Init()
{
return;
}

if (OperatingSystem.IsLinux())
{
return;
}

var (supportsAnsi, legacyConsole) = AnsiDetector.Detect(stdError: false, upgrade: true);

83 changes: 33 additions & 50 deletions DepotDownloader/AnsiDetector.cs
Original file line number Diff line number Diff line change
@@ -7,6 +7,8 @@
using System.Linq;
using System.Runtime.InteropServices;
using System.Text.RegularExpressions;
using Windows.Win32;
using Windows.Win32.System.Console;

namespace Spectre.Console;

@@ -45,7 +47,7 @@ public static (bool SupportsAnsi, bool LegacyConsole) Detect(bool stdError, bool
return (true, false);
}

var supportsAnsi = Windows.SupportsAnsi(upgrade, stdError, out var legacyConsole);
var supportsAnsi = WindowsSupportsAnsi(upgrade, stdError, out var legacyConsole);
return (supportsAnsi, legacyConsole);
}

@@ -67,68 +69,49 @@ private static (bool SupportsAnsi, bool LegacyConsole) DetectFromTerm()
return (false, true);
}

private static class Windows
private static bool WindowsSupportsAnsi(bool upgrade, bool stdError, out bool isLegacy)
{
private const int STD_OUTPUT_HANDLE = -11;
private const int STD_ERROR_HANDLE = -12;
private const uint ENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x0004;
private const uint DISABLE_NEWLINE_AUTO_RETURN = 0x0008;
isLegacy = false;

[DllImport("kernel32.dll")]
private static extern bool GetConsoleMode(IntPtr hConsoleHandle, out uint lpMode);

[DllImport("kernel32.dll")]
private static extern bool SetConsoleMode(IntPtr hConsoleHandle, uint dwMode);

[DllImport("kernel32.dll", SetLastError = true)]
private static extern IntPtr GetStdHandle(int nStdHandle);
try
{
var @out = PInvoke.GetStdHandle_SafeHandle(stdError ? STD_HANDLE.STD_ERROR_HANDLE :STD_HANDLE.STD_OUTPUT_HANDLE);

[DllImport("kernel32.dll")]
public static extern uint GetLastError();
if (!PInvoke.GetConsoleMode(@out, out var mode))
{
// Could not get console mode, try TERM (set in cygwin, WSL-Shell).
var (ansiFromTerm, legacyFromTerm) = DetectFromTerm();

public static bool SupportsAnsi(bool upgrade, bool stdError, out bool isLegacy)
{
isLegacy = false;
isLegacy = ansiFromTerm ? legacyFromTerm : isLegacy;
return ansiFromTerm;
}

try
if ((mode & CONSOLE_MODE.ENABLE_VIRTUAL_TERMINAL_PROCESSING) == 0||true)
{
var @out = GetStdHandle(stdError ? STD_ERROR_HANDLE : STD_OUTPUT_HANDLE);
if (!GetConsoleMode(@out, out var mode))
{
// Could not get console mode, try TERM (set in cygwin, WSL-Shell).
var (ansiFromTerm, legacyFromTerm) = DetectFromTerm();
isLegacy = true;

isLegacy = ansiFromTerm ? legacyFromTerm : isLegacy;
return ansiFromTerm;
if (!upgrade)
{
return false;
}

if ((mode & ENABLE_VIRTUAL_TERMINAL_PROCESSING) == 0)
// Try enable ANSI support.
mode |= CONSOLE_MODE.ENABLE_VIRTUAL_TERMINAL_PROCESSING | CONSOLE_MODE.DISABLE_NEWLINE_AUTO_RETURN;
if (!PInvoke.SetConsoleMode(@out, mode))
{
isLegacy = true;

if (!upgrade)
{
return false;
}

// Try enable ANSI support.
mode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING | DISABLE_NEWLINE_AUTO_RETURN;
if (!SetConsoleMode(@out, mode))
{
// Enabling failed.
return false;
}

isLegacy = false;
// Enabling failed.
return false;
}

return true;
}
catch
{
// All we know here is that we don't support ANSI.
return false;
isLegacy = false;
}

return true;
}
catch
{
// All we know here is that we don't support ANSI.
return false;
}
}
}
Loading