Esempio n. 1
0
 private void removeFromFile(string map, string code, string name) {
 	if (code == null) throw new ArgumentNullException("code");
 	var generator = new Booxml.BooxmlGenerator();
     var file = myapp.files.Resolve(filename, true);
     
     if (null == file) return;
     XElement x = new BxlParser().Parse(myapp.files.Read(filename));
     foreach (var e in x.Elements(map).ToArray()) {
         if(e.attr("code")==code && e.attr("name")==name) {
             e.Remove();
         }
     }
     myapp.files.Write(filename, generator.Generate(x));
 }
Esempio n. 2
0
        private void appendToFile(XElement e) {
            
            var generator = new Booxml.BooxmlGenerator();
            var file = myapp.files.Resolve(filename,true);
            XElement x = null;
            if (null == file) {
                x = new XElement("root");
            }else {
                var parser = new BxlParser();
                x = parser.Parse(myapp.files.Read(filename));
            }
            x.Add(e);
            myapp.files.Write(filename, generator.Generate(x));

        }