public static async Task <Card> addNewCardAsync(string name) { //TODO: DO NOT ALLOW DUPLICATE CARD NAMES //if (allCardsDict.ContainsKey(name)) throw new Exception("ERROR: New Card name already exists, this may corrupt file structure"); // For now alllow overwrite of existing card, this happens when an online card is accepted again if (allCardsDict.ContainsKey(name)) { allCardsDict.Remove(name); } //Create new card and add to album and storage Card newCard = new Card { name = name, creationTime = DateTime.Now, linkManager = new LinkManager() }; allCardsDict.Add(name, newCard); //Serialize JSON to a newly created file IFile newCardFile = await FileSystem.Current.LocalStorage.CreateFileAsync(Path.Combine(FilePaths.allCardsPath, name), CreationCollisionOption.ReplaceExisting); JSONSerialManager.serialize(newCardFile.Path, newCard); return(newCard); }
public static void saveMediaLinkManager() { JSONSerialManager.serialize(Path.Combine(FilePaths.rootPath, "AllMediaLinkManager"), mediaLinkManager); }