Beispiel #1
0
            /// <summary>
            /// Accepts a value that is either a comma-separated list of DUNS numbers or in the form @filename in which
            /// filename is a file containing DUNS numbers
            /// </summary>
            /// <param name="Key"></param>
            /// <param name="Value"></param>
            /// <returns></returns>

            public override bool Accept(string Key, string Value)
            {
                if (Key.ToLower() == SettingKey.ToLower())
                {
                    if (Value != string.Empty && Value.Substring(0, 1) == "@")
                    {
                        using (StreamReader sr = new StreamReader(Value.Substring(1)))
                        {
                            while ((Value = sr.ReadLine()) != null)
                            {
                                SettingValue.AddRange(Value.Split(','));
                                SettingInitialized = true;
                            }
                        }
                    }
                    else
                    {
                        SettingValue.AddRange(Value.Split(','));
                        SettingInitialized = true;
                    }
                    SettingValue.RemoveAll(Str => string.IsNullOrEmpty(Str)); // ensure there are no empties
                    return(true);
                }
                return(false);
            }