예제 #1
0
        /// <summary>
        ///     Removes a given <see cref="DualShockProfile" />.
        /// </summary>
        /// <param name="profile">The <see cref="DualShockProfile" />to remove.</param>
        public void RemoveProfile(DualShockProfile profile)
        {
            lock (this)
            {
                using (var db = new ScpDb())
                {
                    db.Engine.DeleteDbEntity(ScpDb.TableProfiles, profile.Id.ToString());
                }
            }

            LoadProfiles();
        }
예제 #2
0
        /// <summary>
        ///     Stores a new <see cref="DualShockProfile" /> or overwrites an existing one.
        /// </summary>
        /// <param name="profile">The <see cref="DualShockProfile" /> to save.</param>
        public void SubmitProfile(DualShockProfile profile)
        {
            lock (this)
            {
                using (var db = new ScpDb())
                {
                    db.Engine.PutDbEntity(ScpDb.TableProfiles, profile.Id.ToString(), profile);
                }
            }

            LoadProfiles();
        }
예제 #3
0
        private DualShockProfileManager()
        {
            var profiles = new List <DualShockProfile>();

            foreach (var file in Directory.GetFiles(Path.Combine(GlobalConfiguration.AppDirectory, "Profiles"), "*.xml")
                     )
            {
                Log.InfoFormat("Loading profile from file {0}", file);

                var profile = DualShockProfile.Load(file);
                profiles.Add(profile);

                Log.InfoFormat("Successfully loaded profile {0}", profile.Name);
            }

            Profiles = profiles.AsReadOnly();
        }
        private void LoadProfiles()
        {
            lock (this)
            {
                var profiles = new List <DualShockProfile>();

                foreach (var file in Directory.GetFiles(ProfilesPath, ProfileFileFilter)
                         )
                {
                    Log.InfoFormat("Loading profile from file {0}", file);

                    var profile = DualShockProfile.Load(file);
                    profiles.Add(profile);

                    Log.InfoFormat("Successfully loaded profile {0}", profile.Name);
                }

                Profiles = profiles.AsReadOnly();
            }
        }
 public DualShockProfileViewModel()
 {
     CurrentProfile = new DualShockProfile();
 }