Beispiel #1
0
        public static void SerializeToFile(string fileName, PresetFile rulesData)
        {
            XmlSerializer xmlSerializer = new XmlSerializer(typeof(PresetFile));

            using (var sww = new FileStream(fileName, FileMode.Create))
            {
                xmlSerializer.Serialize(sww, rulesData);
            }
        }
Beispiel #2
0
        private void tsbNextRule_Click(object sender, EventArgs e)
        {
            if ((PresetFile == null) || (rule == null))
            {
                return;
            }
            int index = PresetFile.GetIndexByRule(rule);

            if (index >= PresetFile.rulesStorage.Count - 1)
            {
                return;
            }
            Rule = PresetFile.rulesStorage[index + 1];
        }
Beispiel #3
0
        private void tsbPrevRule_Click(object sender, EventArgs e)
        {
            if ((PresetFile == null) || (rule == null))
            {
                return;
            }
            int index = PresetFile.GetIndexByRule(rule);

            if (index <= 0)
            {
                return;
            }
            Rule = PresetFile.rulesStorage[index - 1];
        }
Beispiel #4
0
 private void tsbSave_Click(object sender, EventArgs e)
 {
     if (EditRule == null)
     {
         return;
     }
     EditRule.RuleName       = editName.Text;
     EditRule.StopProcessing = editStopProcessing.Checked;
     // Change object in storage, if
     if ((Rule != null) && (PresetFile != null))
     {
         PresetFile.ReplaceRule(Rule, EditRule);
         Rule = EditRule;
         int index = PresetFile.GetIndexByRule(Rule);
         OnSaveRule?.Invoke(this, Rule, index);
     }
 }