/// <summary> /// Initializes a new instance of the <see cref="CommandLineOption"/> class. /// This constructor is used to create an unnamed parameter /// </summary> /// <param name="description"> Description of this parameter, to be used in the Usings function. </param> /// <param name="parameterType"> Type of parameter </param> /// <param name="setFunction"> Function to call when this parameter is found. Function parameter is found value </param> /// <param name="optional"> If false an exception will be thrown if this parameter can not be found. </param> public CommandLineOption(string description, ParameterType parameterType, SetOptionDelegate setFunction, bool optional = false) { this.ShortName = '\0'; this.LongName = null; this.Description = description; this.ParameterType = parameterType; this.SetFunction = setFunction; this.IsOptional = optional; }
/// <summary> /// Initializes a new instance of the <see cref="CommandLineOption"/> class. /// </summary> /// <param name="shortName"> Single character name of this parameter. Optional. </param> /// <param name="longName"> The long name of this parameter. Optional. </param> /// <param name="description"> Description of this parameter, to be used in the Usings function. </param> /// <param name="parameterType"> Type of parameter </param> /// <param name="setFunction"> Function to call when this parameter is found. Function parameter is found value </param> public CommandLineOption(char shortName, string longName, string description, ParameterType parameterType, SetOptionDelegate setFunction) { this.ShortName = shortName; this.LongName = longName; this.Description = description; this.ParameterType = parameterType; this.SetFunction = setFunction; this.IsOptional = true; }
/// <summary> /// Initializes a new instance of the <see cref="CommandLineOption"/> class. /// This constructor is used to create an unnamed parameter /// </summary> /// <param name="description"> Description of this parameter, to be used in the Usings function. </param> /// <param name="parameterType"> Type of parameter </param> /// <param name="setFunction"> Function to call when this parameter is found. Function parameter is found value </param> /// <param name="optional"> If false an exception will be thrown if this parameter can not be found. </param> public CommandLineOption(string description, ParameterType parameterType, SetOptionDelegate setFunction, bool optional = false) { ShortName = '\0'; LongName = null; Description = description; ParameterType = parameterType; SetFunction = setFunction; IsOptional = optional; }
/// <summary> /// Initializes a new instance of the <see cref="CommandLineOption"/> class. /// </summary> /// <param name="shortName"> Single character name of this parameter. Optional. </param> /// <param name="longName"> The long name of this parameter. Optional. </param> /// <param name="description"> Description of this parameter, to be used in the Usings function. </param> /// <param name="parameterType"> Type of parameter </param> /// <param name="setFunction"> Function to call when this parameter is found. Function parameter is found value </param> public CommandLineOption(char shortName, string longName, string description, ParameterType parameterType, SetOptionDelegate setFunction) { ShortName = shortName; LongName = longName; Description = description; ParameterType = parameterType; SetFunction = setFunction; IsOptional = true; }
private void InitializeOptions(SetOptionDelegate setOption) { var makeByteOption = ByteOption.CreateFactory(BaseAddress, this.onChange, "SoundPlay Settings", setOption); var makeBooleanOption = BooleanOption.CreateFactory(BaseAddress, this.onChange, "SoundPlay Settings", setOption); PlayMusicWhenMounted = makeBooleanOption(OptionKind.PlayMusicWhenMounted, OptionOffsets.PlayMusicWhenMounted, null); PlayMusicWhenMounted.Hack = false; EnableNormalBattleMusic = makeBooleanOption(OptionKind.EnableNormalBattleMusic, OptionOffsets.EnableNormalBattleMusic, null); EnableNormalBattleMusic.Hack = false; EnableCityStateBGM = makeBooleanOption(OptionKind.EnableCityStateBGM, OptionOffsets.EnableCityStateBGM, null); EnableCityStateBGM.Hack = false; PlaySystemSounds = makeBooleanOption(OptionKind.PlaySystemSounds, OptionOffsets.PlaySystemSounds, null); PlaySystemSounds.Hack = false; MasterVolume = makeByteOption(OptionKind.Master, OptionOffsets.MasterVolume, "SoundMaster"); Bgm = makeByteOption(OptionKind.Bgm, OptionOffsets.Bgm, "SoundBgm"); SoundEffects = makeByteOption(OptionKind.SoundEffects, OptionOffsets.SoundEffects, "SoundSe"); Voice = makeByteOption(OptionKind.Voice, OptionOffsets.Voice, "SoundVoice"); SystemSounds = makeByteOption(OptionKind.SystemSounds, OptionOffsets.SystemSounds, "SoundSystem"); AmbientSounds = makeByteOption(OptionKind.AmbientSounds, OptionOffsets.AmbientSounds, "SoundEnv"); Performance = makeByteOption(OptionKind.Performance, OptionOffsets.Performance, "SoundPerform"); Self = makeByteOption(OptionKind.Self, OptionOffsets.Self, "SoundPlayer"); Party = makeByteOption(OptionKind.Party, OptionOffsets.Party, "SoundParty"); OtherPCs = makeByteOption(OptionKind.OtherPCs, OptionOffsets.OtherPCs, "SoundOther"); MasterVolumeMuted = makeBooleanOption(OptionKind.MasterMuted, OptionOffsets.MasterVolumeMuted, "IsSndMaster"); BgmMuted = makeBooleanOption(OptionKind.BgmMuted, OptionOffsets.BgmMuted, "IsSndBgm"); SoundEffectsMuted = makeBooleanOption(OptionKind.SoundEffectsMuted, OptionOffsets.SoundEffectsMuted, "IsSndSe"); VoiceMuted = makeBooleanOption(OptionKind.VoiceMuted, OptionOffsets.VoiceMuted, "IsSndVoice"); SystemSoundsMuted = makeBooleanOption(OptionKind.SystemSoundsMuted, OptionOffsets.SystemSoundsMuted, "IsSndSystem"); AmbientSoundsMuted = makeBooleanOption(OptionKind.AmbientSoundsMuted, OptionOffsets.AmbientSoundsMuted, "IsSndEnv"); PerformanceMuted = makeBooleanOption(OptionKind.PerformanceMuted, OptionOffsets.PerformanceMuted, "IsSndPerform"); EqualizerMode = new EqualizerModeOption { BaseAddress = BaseAddress, Offset = OptionOffsets.EqualizerMode, Kind = OptionKind.EqualizerMode, CfgSection = "SoundPlay Settings", CfgSetting = "SoundEqualizerType", OnChange = this.onChange, SetFunction = setOption, }; }
public static Func <OptionKind, int, string, BooleanOption> CreateFactory(IntPtr baseAddress, Action <ExpandoObject> onChange, string cfgSection, SetOptionDelegate setFunction) { return((optionKind, offset, cfgSetting) => new BooleanOption { BaseAddress = baseAddress, Offset = offset, Kind = optionKind, CfgSection = cfgSection, CfgSetting = cfgSetting, OnChange = onChange, SetFunction = setFunction, }); }