private void LoadProjectFromPath() { try { SimpleZipper zipper = new SimpleZipper(); byte[] data = File.ReadAllBytes(settings.MapFilePath); zipper.Unzip(data, settings.StaticPath); string dataJson = File.ReadAllText(settings.StaticDataPath); interactiveMap = JsonUtility.FromJson <InteractiveMap>(dataJson); } catch (Exception ex) { Debug.LogError(ex.Message); Action <MessageResult> onComplete = (MessageResult result) => { Editor.GoToMainMenu(); }; MessageBox.ShowMessage(MessageType.OK, onComplete, OnLoadErrorMessage, OnLoadErrorCaption); } }
/// <summary> /// Loads a complete project. /// </summary> public void HardLoad(ref Timeline timeline, string path) { Debug.LogFormat("Attempting to load file from: ({0}) to ({1})", path, SoftSavePath); if (!Directory.Exists(SoftSavePath)) { Directory.CreateDirectory(SoftSavePath); } else { SaveLoad.CleanPath(SoftSavePath); } SimpleZipper zipper = new SimpleZipper(); zipper.Unzip(path, SoftSavePath); SoftLoad(ref timeline, Path.GetFileNameWithoutExtension(path)); timeline.ForEach((TimelineChapter tlc) => { if (Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.WindowsEditor) { tlc.VideoName = Path.Combine(SoftSavePath, Path.GetFileName(tlc.VideoName)); } else if (Application.platform == RuntimePlatform.Android) { // HACK: for some reason 'Path.GetFileName("")' does not work on Android. string[] splittedPath = tlc.VideoName.Split('/', '\\'); tlc.VideoName = Path.Combine(SoftSavePath, splittedPath[splittedPath.Length - 1]); } else { throw new System.Exception("Unpacking at unsupported platform"); } }); }