OfflineServer.Persona.getCurrentPersonaList C# (CSharp) Method

getCurrentPersonaList() public static method

Reads the registered personas from a fixed-string database file.
This is NOT dynamic, this only reads from the database.
public static getCurrentPersonaList ( ) : ObservableCollection
return ObservableCollection
        public static ObservableCollection<Persona> getCurrentPersonaList()
        {
            ObservableCollection<Persona> listPersona = new ObservableCollection<Persona>();

            using (var session = SessionManager.getSessionFactory().OpenSession())
            using (session.BeginTransaction())
            {
                IList<PersonaEntity> personas = session.CreateCriteria(typeof(PersonaEntity)).List<PersonaEntity>();

                foreach (PersonaEntity persona in personas)
                {
                    listPersona.Add(new Persona(persona));
                }
            }

            return listPersona;
        }

Usage Example

コード例 #1
0
        public void startSession()
        {
            PersonaList   = Persona.getCurrentPersonaList();
            ActivePersona = personaList[Engine.getDefaultPersonaIdx()];

            log.Info("Session started.");
        }