private CreatorCard(LayoutEditor newCreator, int newCardID, int newUID, string newTag, List <eObject> newObjects, int newIndex) { _cardID = newCardID; _uid = newUID; _tag = newTag; _objects = new List <CreatorObject>(); index = newIndex; creator = newCreator; originalCard = null; CreatorObject curNewObj; foreach (eObject curEObj in newObjects) { curNewObj = CreatorObject.newFromEObject(creator, curEObj, (objects.Count * 2) + 10); objects.Add(curNewObj); } }
/// <summary> /// Makes a deep copy of deck, duplicating all its cards, /// objects, and files, and sets it to be the current deck. /// </summary> /// <param name="otherDeck">Deck to copy</param> /// <returns>Deck object of copy of deck</returns> private eFlash.Data.Deck deepCopy(eFlash.Data.Deck otherDeck) { otherDeck.load(); _deck = new eFlash.Data.Deck(-1, otherDeck.type, otherDeck.category, otherDeck.subcategory, otherDeck.title, ProfileManager.getCurrentUserID(), ProfileManager.getCurrentNetID()); // Put deck entry into DB saveDeck(); Card newCard; eObject newObj; CreatorObject newCreatorObj; foreach (Card curCard in otherDeck.cardList) { newCard = new Card(curCard.tag, ProfileManager.getCurrentUserID()); // Add each card to the DB newCard.cardID = dbAccess.insertLocalDB.insertToCards(newCard); dbAccess.insertLocalDB.insertToCDRelations(deck.id, newCard.cardID); foreach (eObject curObj in curCard.eObjectList) { newObj = new eObject(newCard.cardID, curObj.side, curObj.type, curObj.x1, curObj.x2, curObj.y1, curObj.y2, curObj.data); // Make a CreatorObject to let it load up the data file newCreatorObj = CreatorObject.newFromEObject(this, newObj, 0); newCreatorObj.initialize(); newObj.actualFilename = newObj.generateFileName(); // Save each object to DB and file saveObject(newCreatorObj); } } return(deck); }