Esempio n. 1
0
        private static bool DeserializeProfiles(GenericReader reader)
        {
            var version = reader.GetVersion();

            switch (version)
            {
            case 0:
            {
                reader.ReadBlockDictionary(
                    r =>
                    {
                        var m = r.ReadMobile();
                        var p = new ArcadeProfile(r);

                        return(new KeyValuePair <Mobile, ArcadeProfile>(m, p));
                    },
                    Profiles);
            }
            break;
            }

            return(true);
        }
Esempio n. 2
0
        public static ArcadeProfile EnsureProfile(Mobile m)
        {
            if (m == null)
            {
                return(null);
            }

            var p = Profiles.GetValue(m);

            if (p == null || p.Owner != m)
            {
                if (!m.Player || m.Deleted)
                {
                    Profiles.Remove(m);

                    if (p != null)
                    {
                        p.Clear();
                        p = null;
                    }
                }
                else
                {
                    Profiles[m] = p = new ArcadeProfile(m);
                }
            }
            else if (!m.Player || m.Deleted)
            {
                Profiles.Remove(m);

                p.Clear();
                p = null;
            }

            return(p);
        }