Esempio n. 1
0
        public void StopProcess()
        {
            try
            {
                Process process = Process;
                if (process != null)
                {
                    if (!process.CloseMainWindow())
                    {
                        GotoLog.Warn($"Failed to exit profile {profile} process {pid}, application refused to close window.");
                        process.Kill();
                    }

                    if (!process.WaitForExit(10000))
                    {
                        GotoLog.Warn($"Failed to exit profile {profile} process {pid}, waited 10 seconds but its still alive.");
                        process.Kill();
                    }
                }
            }
            catch
            {
                GotoLog.Warn($"Failed to exit profile {profile} process {pid}");
            }
        }
Esempio n. 2
0
        private void Update()
        {
#if UNITY_EDITOR
            if (_clicked || APIUser.CurrentUser == null)
            {
                return;
            }
            try
            {
                RuntimeWorldCreation worldCreation = FindObjectOfType <RuntimeWorldCreation>();
                if (worldCreation == null || string.IsNullOrWhiteSpace(worldCreation.blueprintName.text))
                {
                    return;
                }
                PipelineManager pipelineManager = worldCreation.pipelineManager;
                if (!pipelineManager.completedSDKPipeline || !APIUser.Exists(pipelineManager.user))
                {
                    return;
                }
                _clicked = true;
                worldCreation.uploadButton.onClick.Invoke();
            }
            catch (Exception e)
            {
                _clicked = true;
                GotoLog.Exception("Failed automated publish", e);
            }
#endif
        }
Esempio n. 3
0
        public static void Update(ReleaseAsset asset, Action <UpdateResult> callback)
        {
            GotoLog.Log($"Downloading update ({asset.Name}) from {asset.DownloadUrl}");
            UnityWebRequest www = UnityWebRequest.Get(asset.DownloadUrl);

            try
            {
                string downloadLocation = FileUtil.GetUniqueTempPathInProject();
                www.downloadHandler = new DownloadHandlerFile(downloadLocation);
                UnityWebRequestAsyncOperation action = www.SendWebRequest();
                action.completed += operation =>
                {
                    UnityWebRequest request      = action.webRequest;
                    var             responseCode = request.responseCode;
                    if (responseCode != 200)
                    {
                        GotoLog.Error("Failed to download update: " + request.error);
                        callback(new UpdateResult {
                            Error = "Failed to download" + request.error
                        });
                        www.Dispose();
                        return;
                    }

                    callback(new UpdateResult {
                        DownloadPath = downloadLocation
                    });
                    www.Dispose();
                };
            }
            catch (Exception exception)
            {
                GotoLog.Exception("Failed to request for update: " + exception.Message, exception);
                www.Dispose();
            }
        }
Esempio n. 4
0
        public static void GetNewestVersion(string author, string repository, Action <ReleaseResponse> callback)
        {
            string          url = $"https://api.github.com/repos/{author}/{repository}/releases/latest";
            UnityWebRequest www = UnityWebRequest.Get(url);

            try
            {
                UnityWebRequestAsyncOperation action = www.SendWebRequest();
                DownloadHandler downloadHandler      = www.downloadHandler;
                action.completed += operation =>
                {
                    UnityWebRequest request      = action.webRequest;
                    var             responseCode = request.responseCode;
                    if (responseCode != 200)
                    {
                        callback(new ReleaseResponse
                        {
                            Error = $"Failed to check for new version: {request.error}"
                        });
                        www.Dispose();
                        return;
                    }

                    GithubRespone githubRespone = JsonUtility.FromJson <GithubRespone>(downloadHandler.text);
                    try
                    {
                        callback(new ReleaseResponse
                        {
                            ReleaseInfo = new ReleaseInfo
                            {
                                Name        = githubRespone.name,
                                Version     = githubRespone.tag_name,
                                Description = githubRespone.body,
                                Assets      = ReadAssets(githubRespone.assets)
                            }
                        });
                    }
                    catch (Exception exception)
                    {
                        ReleaseResponse response = new ReleaseResponse
                        {
                            Error = "Failed to read response from Gtihub API: " + exception.Message
                        };
                        GotoLog.Exception(response.Error, exception);
                        callback(response);
                    }
                    finally
                    {
                        www.Dispose();
                    }
                };
            }
            catch (Exception exception)
            {
                www.Dispose();
                ReleaseResponse response = new ReleaseResponse
                {
                    Error = "Failed to send request to check update: " + exception.Message
                };
                GotoLog.Exception(response.Error, exception);
                callback(response);
            }
        }
Esempio n. 5
0
        public static void GetNewestSdkVersion(Action <ReleaseResponse> callback)
        {
            string url = "https://raw.githubusercontent.com/GotoFinal/GotoUdon/master/Assets/GotoUdon/Settings/VRCSDKVersion";

            UnityWebRequest www = UnityWebRequest.Get(url);

            try
            {
                UnityWebRequestAsyncOperation action = www.SendWebRequest();
                DownloadHandler downloadHandler      = www.downloadHandler;
                action.completed += operation =>
                {
                    try
                    {
                        UnityWebRequest request      = action.webRequest;
                        var             responseCode = request.responseCode;
                        if (responseCode != 200)
                        {
                            callback(new ReleaseResponse
                            {
                                Error = $"Failed to check for new VrChat SDK version: {request.error}"
                            });
                            www.Dispose();
                            return;
                        }

                        string version     = downloadHandler.text;
                        string description = version == GotoUdonEditor.ImplementedSDKVersion
                            ? "This is recommended version of VRChat SDK for GotoUdon!"
                            : "This version might not be fully supported by GotoUdon. If there is new version of GotoUdon available first update SDK then GotoUdon for best compatibility.";
                        callback(new ReleaseResponse
                        {
                            ReleaseInfo = new ReleaseInfo
                            {
                                Name        = $"VRCSDK3-WORLD-{version}_Public",
                                Version     = version,
                                Description = description,
                                Assets      = new List <ReleaseAsset>
                                {
                                    new ReleaseAsset
                                    {
                                        Name        = $"VRCSDK3-WORLD-{version}_Public.unitypackage",
                                        DownloadUrl = "https://vrchat.com/download/sdk3-worlds"
                                    }
                                }
                            }
                        });
                    }
                    catch (Exception exception)
                    {
                        ReleaseResponse response = new ReleaseResponse
                        {
                            Error = "Failed to read response from GotoUdon GitHub sdk file: " + exception.Message
                        };
                        GotoLog.Exception(response.Error, exception);
                        callback(response);
                    }
                    finally
                    {
                        www.Dispose();
                    }
                };
            }
            catch (Exception exception)
            {
                www.Dispose();
                ReleaseResponse response = new ReleaseResponse
                {
                    Error = "Failed to send request to check VRChat SDK update: " + exception.Message
                };
                GotoLog.Exception(response.Error, exception);
                callback(response);
            }
        }