Ejemplo n.º 1
0
        public static bool LoadLastProfile()
        {
            string  name = LastProfileName;
            Profile p;

            if (!string.IsNullOrWhiteSpace(name))
            {
                p = new Profile(name);
                if (p.Load())
                {
                    if (m_Current != null)
                    {
                        m_Current.Unload();
                    }
                    m_Current = p;
                    return(true);
                }
            }

            LastProfileName = "default";
            p = new Profile("default");
            if (!p.Load())
            {
                p.MakeDefault();
                p.Save();
            }

            if (m_Current != null)
            {
                m_Current.Unload();
            }
            m_Current = p;

            return(true);
        }
Ejemplo n.º 2
0
        public static void LoadProfileFor(PlayerData player)
        {
            if (m_Chars == null)
            {
                m_Chars = new Dictionary <Serial, string>();
            }

            string prof;

            if (m_Chars.TryGetValue(player.Serial, out prof) && prof != null)
            {
                if (m_Current != null && (m_Current.Name == prof || m_Current.Name.Trim() == prof.Trim()))
                {
                    return;
                }

                Save();

                if (!LoadProfile(prof))
                {
                    if (prof != "default")
                    {
                        if (!LoadProfile("default"))
                        {
                            m_Current.MakeDefault();
                        }
                    }
                    else
                    {
                        m_Current.MakeDefault();
                    }
                }

                Engine.MainWindow.InitConfig();
            }
            else
            {
                m_Chars[player.Serial] = (m_Current != null ? m_Current.Name : "default");
            }

            Engine.MainWindow.SelectProfile(m_Current != null ? m_Current.Name : "default");
        }
Ejemplo n.º 3
0
        public static void LoadProfileFor(PlayerData player)
        {
            if (m_Chars == null)
            {
                m_Chars = new Hashtable();
            }
            string prof = m_Chars[player.Serial] as string;

            if (m_Current != null && prof != null && (m_Current.Name == prof || m_Current.Name.Trim() == prof.Trim()))
            {
                return;
            }

            if (prof != null)
            {
                Save();

                if (!LoadProfile(prof))
                {
                    if (prof != "default")
                    {
                        if (!LoadProfile("default"))
                        {
                            m_Current.MakeDefault();
                        }
                    }
                    else
                    {
                        m_Current.MakeDefault();
                    }
                }

                Engine.MainWindow.InitConfig();
            }
            else
            {
                m_Chars.Add(player.Serial, m_Current != null ? m_Current.Name : "default");
            }
            Engine.MainWindow.SelectProfile(m_Current == null ? "default" : m_Current.Name);
        }