Esempio n. 1
0
        public static bool SaveToon(Toon toon)
        {
            if(Toons.ContainsKey(toon.PersistentID))
            {
                Logger.Error("Duplicate persistent toon id: {0}", toon.PersistentID);
                return false;
            }

            Toons.Add(toon.PersistentID, toon);
            toon.SaveToDB();
            return true;
        }
Esempio n. 2
0
        //Method only used when creating a Toon for the first time, ambiguous method name - Tharuler
        public static bool SaveToon(Toon toon)
        {

            if (Toons.ContainsKey(toon.PersistentID)) //this should never happen again thanks to hashcode, but lets leave it in for now - Tharuler
            {
                Logger.Error("Duplicate persistent toon id: {0}", toon.PersistentID);
                return false;
            }

            Toons.Add(toon.PersistentID, toon);
            toon.SaveToDB(); //possible concurrency problem? 2 toon created with same name at same time could introduce a race condition for the same hashcode(chance of 1 in (1000-amount of toons with that name))

            Logger.Trace("Character {0} with HashCode #{1} added to database", toon.Name, toon.HashCodeString);

            return true;
        }