Пример #1
0
        public static List <Rule> LoadSettingsFromFile(string file_name)
        {
            List <Rule> res = new List <Rule>();

            if (file_name.Like("http://") || file_name.Like("https://"))
            {
                var r = HttpQuery.CallServiceGet(file_name).GetAwaiter().GetResult();
                if (r.Item2 == System.Net.HttpStatusCode.OK)
                {
                    res.AddRange(LoadSettings(r.Item1));
                }
            }
            else if (!file_name.IsNullOrWhiteSpace() && File.Exists(file_name))
            {
                string s = File.ReadAllText(file_name);

                res.AddRange(LoadSettings(s));
            }
            else
            {
            }
            return(res);
        }