Beispiel #1
0
        protected bool LoadAssetInfo(string json, ref AssetInfo assetInfo, PrefabObject o)
        {
            LauncherErrorManager launcherErrorManager = LauncherErrorManager.Instance;
            VRErrorManager       vrErrorManager       = VRErrorManager.Instance;

            try
            {
                assetInfo = json.JsonDeserialize <AssetInfo>();

                if (assetInfo.AssetName != null)
                {
                    return(true);
                }

                string message = $"Asset name can not be null. {o.Config.i18n.en} Bundle.json is not actual version!";
                LogManager.GetCurrentClassLogger().Fatal(message);
                RequestManager.Instance.StopRequestsWithError(message);

                if (launcherErrorManager != null)
                {
                    launcherErrorManager.ShowFatal($"{o.Config.i18n.en} not actual!", "null asset");
                }

                if (vrErrorManager != null)
                {
                    vrErrorManager.ShowFatal($"{o.Config.i18n.en} not actual!", "null asset");
                }

                return(false);
            }
            catch (Exception e)
            {
                string message = $"AssetInfo can not be loaded. {o.Config.i18n.en} Bundle.json is not actual version! Bundle.json = {json}";
                LogManager.GetCurrentClassLogger().Fatal(message);
                RequestManager.Instance.StopRequestsWithError(message);

                if (launcherErrorManager != null)
                {
                    launcherErrorManager.ShowFatal($"{o.Config.i18n.en} not actual!", e.StackTrace);
                }

                if (vrErrorManager != null)
                {
                    vrErrorManager.ShowFatal($"{o.Config.i18n.en} not actual!", e.StackTrace);
                }

                return(false);
            }
        }
        public static void ErrorHandler(string condition, string stackTrace, LogType logType)
        {
            if (logType != LogType.Exception)
            {
                return;
            }

            bool errorInObject = stackTrace.Contains("TM.Types");
            LauncherErrorManager launcherErrorManager = LauncherErrorManager.Instance;
            VRErrorManager       vrErrorManager       = VRErrorManager.Instance;

            if (!errorInObject)
            {
                string userMessage = GetErrorDescByCode(ErrorCode.UnknownError);

                if (NLoggerSettings.LogDebug)
                {
                    userMessage += "\n" + condition;
                }

                if (launcherErrorManager != null)
                {
                    launcherErrorManager.ShowFatal(userMessage, stackTrace);
                }

                if (vrErrorManager != null)
                {
                    vrErrorManager.ShowFatal(userMessage, stackTrace);
                }

                LogManager.GetCurrentClassLogger().Fatal("Unknown error! " + condition + " stackTrace = " + stackTrace);
            }

            else
            {
                string userMessage = LanguageManager.Instance.GetTextValue("EXCEPTION_IN_OBJECT");
                userMessage += " " + stackTrace.Split('\n')[0];

                if (vrErrorManager != null)
                {
                    vrErrorManager.Show(userMessage);
                }

                LogManager.GetCurrentClassLogger().Fatal("Object error! " + condition + " stackTrace = " + stackTrace);
            }
        }
        public static void DisplayErrorByCode(int errorCode)
        {
            string errorMessage =
                $"Error {errorCode}.\n {LanguageManager.Instance.GetTextValue(_errCodesToLocStrings[errorCode])}";

            VRErrorManager vrErrorManager = VRErrorManager.Instance;

            if (vrErrorManager != null)
            {
                vrErrorManager.ShowFatal(errorMessage);
            }

            LauncherErrorManager launcherErrorManager = LauncherErrorManager.Instance;

            if (launcherErrorManager != null)
            {
                launcherErrorManager.ShowFatal(errorMessage, null);
            }
        }