public void SaveProject() { Action <MessageResult> onComplete = (MessageResult result) => { if (result == MessageResult.Yes) { string mapJson = JsonUtility.ToJson(interactiveMap, false); File.WriteAllText(settings.StaticDataPath, mapJson); SimpleZipper zipper = new SimpleZipper(); string targetPath = settings.IsNewProject ? Path.ChangeExtension( Path.Combine( settings.StoragePath, settings.Name), "irm") : settings.MapFilePath; zipper.Zip(settings.StaticPath, targetPath); if (endingSession) { ClearAppData(); } Editor.SessionEnded(); } else { endingSession = false; } }; MessageBox.ShowMessage(MessageType.YesNoCancel, onComplete, OnSaveProjectMessage, OnSaveProjectCaption); }
/// <summary> /// Saves a compiled project to the provided path. /// Should only be used in the editor. /// </summary> public void HardSave(Timeline timeline, string path) { Debug.LogFormat("Attempting to load save file to ({0})", path); // TODO: Make this aSync HardSavePath = path; SoftSave(timeline); List <string> filePaths = new List <string>(); string timelinePath = Path.Combine(SoftSavePath, Path.ChangeExtension(timeline.Name, TIMELINEEXTENTION)); filePaths.Add(timelinePath); // Copies all videos to buildpath. timeline.ForEach((TimelineChapter chapter) => { string videoName = chapter.VideoName; if (!filePaths.Contains(videoName)) { filePaths.Add(videoName); } }); // Creates filepath. string target = Path.ChangeExtension((Path.Combine(HardSavePath, timeline.Name)), PROJECTEXTENTION); if (File.Exists(target)) { File.Delete(target); } // Zips the file. SimpleZipper zipper = new SimpleZipper(); zipper.Zip(filePaths, target); }