コード例 #1
0
 public void WriteToFile(Configuration configuration, string filePath)
 {
     using (TextWriter textWriter = new StreamWriter(filePath))
     {
         _serializer.Serialize(textWriter, configuration);
     }
 }
コード例 #2
0
        public void WriteXmlToFile()
        {
            var rules = new Rule[3];
            rules[0] = new Rule { Identifier = "TEMP001", Enabled = true };
            rules[1] = new Rule { Identifier = "TEMP002", Enabled = false };
            rules[2] = new Rule { Identifier = "TEMP003", Enabled = true };
            var configuration = new DustyTome.PFC.Configuration.Configuration();
            configuration.RuleSet = new RuleSet();
            configuration.RuleSet.Rules = rules;

            var serializer = new ConfigurationSerializer();
            serializer.WriteToFile(configuration, @"testFile.xml");
        }