emanzione / PATCH

The PATCH repository for issues tracking, wiki and shared material.
https://assetstore.unity.com/packages/tools/utilities/p-a-t-c-h-ultimate-patching-system-41417
MIT License
47 stars 7 forks source link

Patcher does not seem to recognize HyperV/Virtualized switches #70

Open Theoya opened 7 months ago

Theoya commented 7 months ago

This leads to “Network is not available or connectivity is low/weak, Check your connection!” and the installation failing

doomed999 commented 6 months ago

It recognizes it and fails it. Best option is to implement a new NetworkChecker and remove/fix this 👎

    private static bool IsNetworkInterfaceVirtual(NetworkInterface networkInterface)
    {
        string text = networkInterface.Description.ToLower();
        string text2 = networkInterface.Name.ToLower();
        bool result = text.IndexOf("virtual", StringComparison.OrdinalIgnoreCase) >= 0 || text2.IndexOf("virtual", StringComparison.OrdinalIgnoreCase) >= 0;
        if (text.IndexOf("hyper-v", StringComparison.OrdinalIgnoreCase) >= 0 && text2.IndexOf("mainswitch", StringComparison.OrdinalIgnoreCase) >= 0)
        {
            result = false;
        }
        return result;
    }

Maybe something more like this 💯

        public override bool IsNetworkAvailable(long minimumSpeed)
        {
            remoteUrl = GameObject.Find("LauncherData").GetComponent<LauncherData>().RemoteUrl;

            var host = new Uri(remoteUrl).DnsSafeHost;

            if (string.IsNullOrEmpty(host))
                host = "google.com";

            if (!NetworkInterface.GetIsNetworkAvailable())            
                return false;            

            if (Ping(host) || Ping("8.8.8.8") || Ping("1.1.1.1"))
                return true;

            return false;
        }