Example #1
0
        internal PerLanguageOption2(string feature, OptionGroup group, string name, T defaultValue, ImmutableArray <OptionStorageLocation2> storageLocations)
        {
            if (string.IsNullOrWhiteSpace(feature))
            {
                throw new ArgumentNullException(nameof(feature));
            }

            if (string.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentException(nameof(name));
            }

            OptionDefinition      = new OptionDefinition(feature, group, name, defaultValue, typeof(T), isPerLanguage: true);
            this.StorageLocations = storageLocations;
        }
Example #2
0
        public Option2(string feature, OptionGroup group, string name, T defaultValue, ImmutableArray <OptionStorageLocation2> storageLocations, string?languageName)
        {
            if (string.IsNullOrWhiteSpace(feature))
            {
                throw new ArgumentNullException(nameof(feature));
            }

            if (string.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentException(nameof(name));
            }

            OptionDefinition      = new OptionDefinition(feature, group, name, defaultValue, typeof(T));
            this.StorageLocations = storageLocations;
            LanguageName          = languageName;
        }
Example #3
0
        public static PerLanguageOption <CodeStyleOption <T> > ToPublicOption <T>(
            this PerLanguageOption2 <CodeStyleOption2 <T> > option
            )
        {
            RoslynDebug.Assert(option != null);

            var codeStyleOption  = new CodeStyleOption <T>(option.DefaultValue);
            var optionDefinition = new OptionDefinition(
                option.Feature,
                option.Group,
                option.Name,
                defaultValue: codeStyleOption,
                type: typeof(CodeStyleOption <T>),
                isPerLanguage: true
                );

            return(new PerLanguageOption <CodeStyleOption <T> >(
                       optionDefinition,
                       option.StorageLocations.As <OptionStorageLocation>()
                       ));
        }
Example #4
0
 public override int GetHashCode() => OptionDefinition.GetHashCode();
Example #5
0
 public override string ToString() => OptionDefinition.ToString();
Example #6
0
 internal Option(OptionDefinition optionDefinition, ImmutableArray <OptionStorageLocation> storageLocations)
 {
     _optionDefinition     = optionDefinition;
     this.StorageLocations = storageLocations;
 }
 internal PerLanguageOption(OptionDefinition optionDefinition, ImmutableArray <OptionStorageLocation> storageLocations)
 {
     _optionDefinition = optionDefinition;
     StorageLocations  = storageLocations;
 }