Exemplo n.º 1
0
        public static List <Rule> LoadRule(string filename)
        {
            FileStream s = File.OpenRead(filename);

            //BinaryFormatter b = new BinaryFormatter();
            System.Xml.Serialization.XmlSerializer b = new System.Xml.Serialization.XmlSerializer(typeof(RuleSerializer));
            RuleSerializer rs = (RuleSerializer)b.Deserialize(s);

            s.Close();

            return(rs.Rule);
        }
Exemplo n.º 2
0
        public static void SaveRule(List <Rule> rule, string filename)
        {
            RuleSerializer rs = new RuleSerializer {
                Rule = rule
            };

            FileStream s = File.Create(filename);

            //BinaryFormatter b = new BinaryFormatter();
            System.Xml.Serialization.XmlSerializer b = new System.Xml.Serialization.XmlSerializer(typeof(RuleSerializer));
            b.Serialize(s, rs);
            s.Close();
        }