Esempio n. 1
0
        public void RenameProfile(string profileId, string newProfileId)
        {
            if (IsProfileReadOnly(profileId))
            {
                throw new ArgumentException("Cannot rename read-only profile", nameof(profileId));
            }

            if (newProfileId == ShortcutManager.defaultProfileId)
            {
                throw new ArgumentException("Duplicate profile id", nameof(newProfileId));
            }

            var profile = m_ShortcutProfileManager.GetProfileById(profileId);

            switch (m_ShortcutProfileManager.CanRenameProfile(profile, newProfileId))
            {
            case CanRenameProfileResult.Success:
                m_ShortcutProfileManager.RenameProfile(profile, newProfileId);
                break;

            case CanRenameProfileResult.InvalidProfileId:
                throw new ArgumentException("Profile not available", nameof(profileId));

            case CanRenameProfileResult.DuplicateProfileId:
                throw new ArgumentException("Duplicate profile id", nameof(newProfileId));

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Esempio n. 2
0
        public void RenameActiveProfile(string newProfileId)
        {
            if (m_ShortcutProfileManager.activeProfile == null)
            {
                return;
            }

            m_ShortcutProfileManager.RenameProfile(m_ShortcutProfileManager.activeProfile, newProfileId);
        }