Beispiel #1
0
        public void actualizarProjecto(Projecto p)
        {
            string file, schema;
            file = getFicheiro(p.getNome());
            if (file.Length == 0)
            {
                file = p.getNome() + ".xml";
                schema = file.Remove(file.Length - 4) + ".xsd";
                File.Copy("exemplo.xml", file);

            }
            else { schema = file.Remove(file.Length - 4) + ".xsd"; }
            DataSet ds = new DataSet();

            FileStream finschema = new FileStream("exemplo.xsd", FileMode.OpenOrCreate, FileAccess.Read, FileShare.Read);
            ds.ReadXmlSchema(finschema);
            finschema.Close();
            FileStream findata = new FileStream(file, FileMode.OpenOrCreate, FileAccess.Read, FileShare.ReadWrite);
            ds.ReadXml(findata);
            findata.Close();

            foreach (DataRow dr in ds.Tables["projecto"].Rows)
            {
                dr["nome"] = p.getNome();
                dr["data"] = DateTime.Now;
                dr["Filtros"] = p.getFiltros();
            }

            foreach (DataRow dr in ds.Tables["Propriedades"].Rows)
            {
                dr["url"] = p.getUrlInicial();
            }

            foreach (DataRow dr in ds.Tables["Propriedades"].Rows)
            {
                dr["pasta"] = p.getPasta();
                dr["visualizacaolocal"] = p.getvisualizacaolocal();
                dr["niveis"] = p.getNivel();
                dr["imagensremotas"] = p.getImagensRemotas();
                dr["aceitarrejeitar"] = p.getAceitarRejeitar();
            }

            FileStream fout = new FileStream(file, FileMode.Truncate,
                    FileAccess.Write, FileShare.ReadWrite);
            //Only write the Xml data to the stream
            ds.WriteXml(fout);
            //Close the Stream
            fout.Close();
        }
Beispiel #2
0
 public Motor(Projecto temp, RichTextBox r, int act, Label la1, Label la2, Label la3, Label la4)
 {
     log = r;
     r.Text = "Motor criado\n";
     pasta = temp.getPasta();
     fNivel = temp.getNivel();
     p = temp;
     criarfiltro(p.getFiltros());
     actualizar = act;
     l1 = la1;
     l2 = la2;
     l3 = la3;
     l4 = la4;
     l1.Text = "0";
     l2.Text = "0";
     l3.Text = "0";
     l4.Text = "0";
     l1.Visible = true;
     l2.Visible = true;
     l3.Visible = true;
     l4.Visible = true;
 }