private Coroutine Deserialize(string path, BoolFlag errorFlag)
        {
            DatabaseManager.Instance.ResetProgress();
            ProgressDialog.Instance.Show("Восстановление проекта");

            var completeFlag = new BoolFlag();

            var persistentPath = Application.persistentDataPath;
            var temporaryPath  = Application.temporaryCachePath;

            var task = new Task(async() =>
            {
                try
                {
                    await ProjectSerializer.Deserialize(path, persistentPath, temporaryPath);
                }
                catch (Exception ex)
                {
                    await new WaitForUpdate();

                    errorFlag.Flag    = true;
                    completeFlag.Flag = true;

                    ProgressDialog.Instance.Hide();
                    ErrorDialog.Instance.ShowError("Не удалось восстановить проект.", ex);
                    return;
                }

                await new WaitForUpdate();

                errorFlag.Flag    = false;
                completeFlag.Flag = true;

                _project.Path       = FileExplorer.Instance.LastResult;
                _project.WasChanged = false;

                ProgressDialog.Instance.Hide();
                PopupManager.Instance.PopSuccess("Проект успешно восстановлен");
            });

            task.Start();

            return(StartCoroutine(FlagRoutine(completeFlag)));
        }
Beispiel #2
0
        public void TestDeserializeShouldDeserializeSources()
        {
            var result = _serializer.Deserialize(_xProject);

            Assert.That(result.Sources, Is.Empty);
        }