Ejemplo n.º 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;
        }
Ejemplo n.º 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;
        }
Ejemplo n.º 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>()
                       ));
        }
Ejemplo n.º 4
0
 public override int GetHashCode() => OptionDefinition.GetHashCode();
Ejemplo n.º 5
0
 public override string ToString() => OptionDefinition.ToString();
Ejemplo n.º 6
0
 internal Option(OptionDefinition optionDefinition, ImmutableArray <OptionStorageLocation> storageLocations)
 {
     _optionDefinition     = optionDefinition;
     this.StorageLocations = storageLocations;
 }
Ejemplo n.º 7
0
 internal PerLanguageOption(OptionDefinition optionDefinition, ImmutableArray <OptionStorageLocation> storageLocations)
 {
     _optionDefinition = optionDefinition;
     StorageLocations  = storageLocations;
 }