Beispiel #1
0
        public IEnumerator CheckVersion()
        {
            UnityWebRequest www = UnityWebRequest.Get("https://api.github.com/repos/ToniMacaroni/TrickSaber/releases");

            www.SetRequestHeader("User-Agent", "TrickSaber-" + Version.GetVersionString());
            www.timeout = 10;
            yield return(www.SendWebRequest());

            try
            {
                if (!www.isNetworkError && !www.isHttpError)
                {
                    JSONNode releases      = JSON.Parse(www.downloadHandler.text);
                    JSONNode latestRelease = releases[0];
                    JSONNode jsonnode      = latestRelease["tag_name"];
                    string   githubVerStr  = (jsonnode != null) ? jsonnode.Value : null;
                    RemoteVersion   = new Version(githubVerStr);
                    IsNewestVersion = new Range($"<={Version}").IsSatisfied(RemoteVersion);
                }
            }
            catch (Exception ex)
            {
                Plugin.Log.Error("couldn't get version: " + ex.Message);
            }
        }
Beispiel #2
0
        IEnumerator Start()
        {
            var ver = Assembly.GetExecutingAssembly().GetName().Version;

            Version = new Version(ver.Major, ver.Minor, ver.Build);
            yield return(StartCoroutine(CheckVersion()));

            ControllerModel = GetControllerName();
            Initialized     = true;
            Plugin.Log.Debug($"TrickSaber version {Version.GetVersionString()} started");
        }
Beispiel #3
0
        public async void Initialize()
        {
            var ver = Assembly.GetExecutingAssembly().GetName().Version;

            Version = new Version(ver.Major, ver.Minor, ver.Build);
            await CheckVersion();

            ControllerModel = GetControllerName();
            Initialized     = true;

            _logger.Debug($"TrickSaber version {Version.GetVersionString()} started");
        }