private void UpdateCompatibility(KeyboardComponentFeatures compatibility)
 {
     EnableFeatureEditing          = compatibility.HasFlag(KeyboardComponentFeatures.Enhances);
     EnableCassetteOptionSelection = EnableFeatureEditing && UsesCassette;
     if (!EnableFeatureEditing)
     {
         UsesCassette   = false;
         UsesPrinter    = false;
         UsesMicrophone = false;
         Basic          = null;
     }
     else
     {
         if (Basic == null)
         {
             Basic = BasicOptions.First(b => b.Flags == (uint)KeyboardComponentFeatures.BasicTolerated);
         }
         if (compatibility == KeyboardComponentFeatures.Enhances)
         {
             if ((Basic != null) && (Basic.Flags == (uint)KeyboardComponentFeatures.BasicRequired))
             {
                 Basic = BasicOptions.First(b => b.Flags == (uint)KeyboardComponentFeatures.BasicTolerated);
             }
             if ((Cassette != null) && (Cassette.Flags == (uint)KeyboardComponentFeatures.TapeRequired))
             {
                 Cassette = CassetteOptions.First(c => c.Flags == (uint)KeyboardComponentFeatures.TapeOptional);
             }
         }
     }
 }
コード例 #2
0
        /// <summary>
        /// Converts KeyboardComponent features to LuigiFeatureFlags.
        /// </summary>
        /// <param name="features">The features to convert.</param>
        /// <returns>The compatibility represented as appropriate LuigiFeatureFlags.</returns>
        /// <remarks>The additional aspects described by <see cref="KeyboardComponentFeatures"/> are not retained in
        /// <see cref="LuigiFeatureFlags"/>, only basic compatibility.</remarks>
        public static LuigiFeatureFlags ToLuigiFeatureFlags(this KeyboardComponentFeatures features)
        {
            var compatibilty      = (FeatureCompatibility)features & FeatureCompatibilityHelpers.ValidFeaturesMask;
            var luigiFeatureFlags = compatibilty.ToLuigiFeatureFlags(FeatureCategory.KeyboardComponent);

            return(luigiFeatureFlags);
        }
        /// <summary>
        /// Initializes a new instance of the KeyboardComponentFeaturesConfigurationPageViewModel type.
        /// </summary>
        public KeyboardComponentFeaturesConfigurationPageViewModel()
        {
            var selectableOptions = new KeyboardComponentFeatures[] { KeyboardComponentFeatures.Incompatible, KeyboardComponentFeatures.Tolerates, KeyboardComponentFeatures.Enhances, KeyboardComponentFeatures.Requires };

            KeyboardComponentOptions = new ObservableCollection <ProgramFeatureImageViewModel>(selectableOptions.ToFeatureViewModels(KeyboardComponentFeatureSet.Data));
            selectableOptions        = new KeyboardComponentFeatures[] { KeyboardComponentFeatures.TapeOptional, KeyboardComponentFeatures.TapeRequired };
            CassetteOptions          = new ObservableCollection <ProgramFeatureImageViewModel>(selectableOptions.ToFeatureViewModels(KeyboardComponentFeatureSet.Data));
            selectableOptions        = new KeyboardComponentFeatures[] { KeyboardComponentFeatures.BasicIncompatible, KeyboardComponentFeatures.BasicTolerated, KeyboardComponentFeatures.BasicRequired };
            BasicOptions             = new ObservableCollection <ProgramFeatureImageViewModel>(selectableOptions.ToFeatureViewModels(KeyboardComponentFeatureSet.Data));
        }
コード例 #4
0
 /// <inheritdoc />
 public IProgramFeaturesBuilder WithKeyboardComponentFeatures(KeyboardComponentFeatures keyboardComponentFeatures)
 {
     _programFeatures.KeyboardComponent = keyboardComponentFeatures;
     return(this);
 }
コード例 #5
0
 /// <summary>
 /// Creates a new instance if the UnmergedProgram structure.
 /// </summary>
 /// <param name="code">INTV Funhouse code for the ROM.</param>
 /// <param name="title">The title of the program (typically title screen title).</param>
 /// <param name="vendor">Vendor who wrote the program.</param>
 /// <param name="year">The year the program was copyrighted (or released).</param>
 /// <param name="crcData">The CRC values of known versions of the program.</param>
 /// <param name="crcDescriptions">The descriptions of the known versions of the program for each CRC.</param>
 /// <param name="generalFeatures">Generic program features.</param>
 /// <param name="keyboardComponent">Keyboard component features.</param>
 internal UnmergedProgram(string code, string title, string vendor, string year, uint[] crcData, string[] crcDescriptions, GeneralFeatures generalFeatures, KeyboardComponentFeatures keyboardComponent)
 {
     Code                       = code;
     CrcData                    = crcData;
     CrcDescriptions            = crcDescriptions;
     CrcCfgs                    = Enumerable.Repeat(-1, crcData.Count()).ToArray();
     Year                       = year;
     Title                      = title;
     Vendor                     = vendor;
     Features                   = new ProgramFeatures();
     Features.GeneralFeatures   = generalFeatures;
     Features.KeyboardComponent = keyboardComponent;
 }