Exemplo n.º 1
0
    //////////////////////////////////////////////////////////////////////////

    static public void UpdateCheckVersion()
    {
        if (wwwVersionCheck.isDone)
        {
            EditorApplication.update -= UpdateCheckVersion;

            // Call Found Latest Version
#if UNITY_2018_3_OR_NEWER
            string resultText = wwwVersionCheck.downloadHandler.text;
#else
            string resultText = wwwVersionCheck.text;
#endif
            if (!string.IsNullOrEmpty(resultText) && resultText.StartsWith("VERSION"))
            {
                int    index = resultText.IndexOf("\n", 0);
                string latestVersionString = resultText.Substring(8, index - 8);
                string latestVersionRaw    = latestVersionString;

                // Remove any dots except the first one
                int firstDot = latestVersionString.IndexOf('.');
                int lastDot  = latestVersionString.LastIndexOf('.');
                while (lastDot > firstDot)
                {
                    latestVersionString = latestVersionString.Remove(lastDot, 1);
                    lastDot             = latestVersionString.LastIndexOf('.');
                }

                //Debug.Log("[Accessibility] Version check returned: Latest Version: " + latestVersionRaw + "   Your Version: " + UAP_AccessibilityManager.PluginVersion);
                float latestVersion = UAP_AccessibilityManager.PluginVersionAsFloat;
                if (float.TryParse(latestVersionString, out latestVersion))
                {
                    // Check whether this version is supposed to be skipped
                    if (!automaticCheck || ignoreVersion.CompareTo(latestVersionRaw) != 0)
                    {
                        // The window isn't open yet
                        if (automaticCheck)
                        {
                            UAP_UpdateWindow.Init();
                        }
                        FoundLatestVersion(latestVersion, latestVersionRaw, resultText);
                    }
                }
            }
            else
            {
                if (!automaticCheck)
                {
                    UAP_UpdateWindow.NoInternet();
                }
                //Debug.LogError("[Accessibility] Could not check for updates, because the online version check URL could not be reached.");
            }

            ignoreVersion       = "";
            automaticCheck      = false;
            VersionCheckRunning = false;
            wwwVersionCheck     = null;
        }
    }