예제 #1
0
        public List <ProfileModel> GetAllProfiles()
        {
            List <ProfileModel> profiles = new List <ProfileModel>();

            using (SQLiteConnection db = new SQLiteConnection(dbArgs))
            {
                db.Open();

                using (SQLiteDataReader reader = new SQLiteCommand("SELECT * from profiles", db).ExecuteReader())
                {
                    while (reader.Read())
                    {
                        profiles.Add(ProfileFactory.NewProfileModel(
                                         reader.GetInt32(0),
                                         reader.GetString(1),
                                         reader.GetInt32(2),
                                         reader.GetString(3),
                                         reader.GetInt32(4)));
                    }
                    reader.Close();
                }

                db.Close();
            }

            return(profiles);
        }
        public void Execute()
        {
            string fileName = ToFileName(args.Value);
            string filePath = Path.Combine(location.LocalDirectoryProfiles, fileName); // TODO tester les noms de fichier

            File.Copy(location.HudTemplateFile, filePath);

            BackgroundModel background = screen.Background;

            ProfileModel newProfile = ProfileFactory.NewProfileModel(args.Value, background.Id, fileName, assetsFactory.SelectedMotec.Id);

            layoutIO.WriteProfileLayout(newProfile, placeholderCollection.Items);

            database.AddProfile(newProfile);
            profileCollection.Add(newProfile);

            selectedProfile.SelectProfile(newProfile);
            layoutIO.DispatchSaveStatus();
        }