Esempio n. 1
0
        private void ThreadLoadPatcherData()
        {
            try
            {
                DebugLogger.Log("Loading patcher data...");
                _state.Value = PatcherState.LoadingPatcherData;

#if UNITY_EDITOR
                UnityDispatcher.Invoke(() =>
                {
                    DebugLogger.Log("Using Unity Editor patcher data.");
                    _data.Value = new PatcherData
                    {
                        AppSecret   = EditorAppSecret,
                        AppDataPath =
                            Application.dataPath.Replace("/Assets",
                                                         string.Format("/Temp/PatcherApp{0}", EditorAppSecret)),
                        OverrideLatestVersionId = EditorOverrideLatestVersionId
                    };
                }).WaitOne();
#else
                DebugLogger.Log("Using command line patcher data reader.");
                var inputArgumentsPatcherDataReader = new InputArgumentsPatcherDataReader();
                _data.Value = inputArgumentsPatcherDataReader.Read();
#endif
                DebugLogger.LogVariable(_data.Value.AppSecret, "Data.AppSecret");
                DebugLogger.LogVariable(_data.Value.AppDataPath, "Data.AppDataPath");
                DebugLogger.LogVariable(_data.Value.OverrideLatestVersionId, "Data.OverrideLatestVersionId");
                DebugLogger.LogVariable(_data.Value.LockFilePath, "Data.LockFilePath");

                DebugLogger.Log("Patcher data loaded.");
            }
            catch (ThreadInterruptedException)
            {
                DebugLogger.Log("Loading patcher data interrupted: thread has been interrupted. Rethrowing exception.");
                throw;
            }
            catch (ThreadAbortException)
            {
                DebugLogger.Log("Loading patcher data aborted: thread has been aborted. Rethrowing exception.");
                throw;
            }
            catch (Exception)
            {
                DebugLogger.LogError("Error while loading patcher data: an exception has occured. Rethrowing exception.");
                throw;
            }
        }
Esempio n. 2
0
        private void ThreadLoadPatcherData()
        {
            try
            {
                DebugLogger.Log("Loading patcher data...");
                _state.Value = PatcherState.LoadingPatcherData;

#if UNITY_EDITOR
                UnityDispatcher.Invoke(() =>
                {
                    DebugLogger.Log("Using Unity Editor patcher data.");
                    _data.Value = new PatcherData
                    {
                        AppSecret   = EditorAppSecret,
                        AppDataPath =
                            Application.dataPath.Replace("/Assets",
                                                         string.Format("/Temp/PatcherApp{0}", EditorAppSecret)),
                        OverrideLatestVersionId = EditorOverrideLatestVersionId,
                        IsOnline = null
                    };
                }).WaitOne();
#else
                DebugLogger.Log("Using command line patcher data reader.");
                var inputArgumentsPatcherDataReader = new InputArgumentsPatcherDataReader();
                _data.Value = inputArgumentsPatcherDataReader.Read();
#endif
                DebugLogger.LogVariable(_data.Value.AppSecret, "Data.AppSecret");
                DebugLogger.LogVariable(_data.Value.AppDataPath, "Data.AppDataPath");
                DebugLogger.LogVariable(_data.Value.OverrideLatestVersionId, "Data.OverrideLatestVersionId");
                DebugLogger.LogVariable(_data.Value.LockFilePath, "Data.LockFilePath");
                DebugLogger.LogVariable(_data.Value.IsOnline, "Data.IsOnline");


                if (_data.Value.IsOnline.HasValue &&
                    !_data.Value.IsOnline.Value)
                {
                    DebugLogger.Log("Disabling auto-updating because patcher is in offline mode.");

                    _hasAutomaticallyInstalledApp        = true;
                    _hasAutomaticallyCheckedForAppUpdate = true;

                    _warning.Value = "Working in offline mode";
                }

                DebugLogger.Log("Patcher data loaded.");
            }
            catch (ThreadInterruptedException)
            {
                DebugLogger.Log("Loading patcher data interrupted: thread has been interrupted. Rethrowing exception.");
                throw;
            }
            catch (ThreadAbortException)
            {
                DebugLogger.Log("Loading patcher data aborted: thread has been aborted. Rethrowing exception.");
                throw;
            }
            catch (Exception)
            {
                DebugLogger.LogError("Error while loading patcher data: an exception has occured. Rethrowing exception.");
                throw;
            }
        }