public EncodingScrutatorFolder(DirectoryInfo folder, InspectFileWhiteListSetting inspectFileWhiteListSetting,
                                IncludeFileSetting includeFileSetting)
 {
     FaceFolder = folder;
     Name       = folder.Name;
     InspectFileWhiteListSetting = inspectFileWhiteListSetting;
     IncludeFileSetting          = includeFileSetting;
 }
Beispiel #2
0
        /// <summary>
        ///     获取文件配置白名单
        /// </summary>
        /// <param name="file">文件</param>
        /// <returns>白名单</returns>
        public static InspectFileWhiteListSetting ReadWhiteListSetting(string file)
        {
            if (!File.Exists(file))
            {
                throw new ArgumentException("文件不存在" + file);
            }

            var whiteList = new List <string>();

            using (StreamReader stream = new StreamReader(new FileStream(file, FileMode.Open)))
            {
                whiteList.AddRange(stream.ReadToEnd().Split('\n').Select(temp => temp.Replace("\r", "").Trim()));
            }

            InspectFileWhiteListSetting inspectFileWhiteListSetting = new InspectFileWhiteListSetting(whiteList);

            return(inspectFileWhiteListSetting);
        }