Пример #1
0
        public static void Load(GeneralSettings generalSettings, BindingList<Action> actions, string fileName)
        {
            var lines = new List<string>();
            using (var stream = new StreamReader(fileName))
            {
                string line;
                while ((line = stream.ReadLine()) != null)
                {
                    lines.Add(line);
                }
            }

            var generalSettingsSections = GetSections(Strings.GeneralSettings, lines);
            var actionSections = GetSections(Strings.Action, lines);

            if (generalSettingsSections.Count > 0)
            {
                generalSettings.LoadFromStringList(generalSettingsSections[0]);
            }

            actions.Clear();
            foreach (var actionSection in actionSections)
            {
                var action = Action.CreateFromActionName(actionSection);
                actions.Add(action);
            }
        }