Exemplo n.º 1
0
        public static void TestUnzipped()
        {
            DateTime t1, t2;
            TimeSpan dt;

            Foo o = new Foo();

            o.Fill(100000);

            t1 = DateTime.Now;
            XmlDocumentSerializationInfo info = new XmlDocumentSerializationInfo();

            info.AddValue("FooNode", o);
            info.Doc.Save(@"C:\temp\xmltest03.xml");
            t2 = DateTime.Now;
            dt = t2 - t1;
            Console.WriteLine("Document saved, duration {0}.", dt);

            t1 = DateTime.Now;
            XmlDocument doc3 = new XmlDocument();

            doc3.Load(@"C:\TEMP\xmltest03.xml");
            XmlDocumentSerializationInfo info3 = new XmlDocumentSerializationInfo(doc3);
            Foo o3 = (Foo)info3.GetValue(null);

            t2 = DateTime.Now;
            dt = t2 - t1;
            Console.WriteLine("Document restored, duration {0}.", dt);
        }
Exemplo n.º 2
0
        public static void TestZipped()
        {
            DateTime t1, t2;
            TimeSpan dt;


            Foo o = new Foo();

            o.Fill(100000);


            t1 = DateTime.Now;
            XmlDocumentSerializationInfo info = new XmlDocumentSerializationInfo();

            info.AddValue("FooNode", o);

            System.IO.FileStream zipoutfile = System.IO.File.Create(@"C:\temp\xmltest03.xml.zip");
            ZipOutputStream      ZipStream  = new ZipOutputStream(zipoutfile);
            ZipEntry             ZipEntry   = new ZipEntry("Table/Table1.xml");

            ZipStream.PutNextEntry(ZipEntry);
            ZipStream.SetLevel(7);
            info.Doc.Save(ZipStream);
            ZipStream.Finish();
            ZipStream.Close();
            zipoutfile.Close();


            t2 = DateTime.Now;
            dt = t2 - t1;
            Console.WriteLine("Document saved, duration {0}.", dt);


            t1 = DateTime.Now;
            ZipFile zipfile = new ZipFile(@"C:\temp\xmltest03.xml.zip");

            System.IO.Stream zipinpstream = zipfile.GetInputStream(new ZipEntry("Table/Table1.xml"));
            XmlDocument      doc3         = new XmlDocument();

            doc3.Load(zipinpstream);
            XmlDocumentSerializationInfo info3 = new XmlDocumentSerializationInfo(doc3);
            Foo o3 = (Foo)info3.GetValue(null);

            zipinpstream.Close();
            zipfile.Close();
            t2 = DateTime.Now;
            dt = t2 - t1;

            Console.WriteLine("Document restored, duration {0}.", dt);
        }
Exemplo n.º 3
0
    public static void TestZipped()
    {
      DateTime t1, t2;
      TimeSpan dt;

      Foo o = new Foo();
      o.Fill(100000);

      t1 = DateTime.Now;
      XmlDocumentSerializationInfo info = new XmlDocumentSerializationInfo();
      info.AddValue("FooNode",o);

      System.IO.FileStream zipoutfile = System.IO.File.Create(@"C:\temp\xmltest03.xml.zip");
      ZipOutputStream ZipStream = new ZipOutputStream(zipoutfile);
      ZipEntry ZipEntry = new ZipEntry("Table/Table1.xml");
      ZipStream.PutNextEntry(ZipEntry);
      ZipStream.SetLevel(7);
      info.Doc.Save(ZipStream);
      ZipStream.Finish();
      ZipStream.Close();
      zipoutfile.Close();

      t2 = DateTime.Now;
      dt = t2-t1;
      Console.WriteLine("Document saved, duration {0}.",dt);

      t1 = DateTime.Now;
      ZipFile zipfile = new ZipFile(@"C:\temp\xmltest03.xml.zip");
      System.IO.Stream zipinpstream = zipfile.GetInputStream(new ZipEntry("Table/Table1.xml"));
      XmlDocument doc3 = new XmlDocument();
      doc3.Load(zipinpstream);
      XmlDocumentSerializationInfo info3 = new XmlDocumentSerializationInfo(doc3);
      Foo o3 = (Foo)info3.GetValue(null);
      zipinpstream.Close();
      zipfile.Close();
      t2 = DateTime.Now;
      dt = t2-t1;

      Console.WriteLine("Document restored, duration {0}.",dt);
    }
Exemplo n.º 4
0
    public static void TestUnzipped()
    {
      DateTime t1, t2;
      TimeSpan dt;

      Foo o = new Foo();
      o.Fill(100000);

      t1 = DateTime.Now;
      XmlDocumentSerializationInfo info = new XmlDocumentSerializationInfo();
      info.AddValue("FooNode",o);
      info.Doc.Save(@"C:\temp\xmltest03.xml");
      t2 = DateTime.Now;
      dt = t2-t1;
      Console.WriteLine("Document saved, duration {0}.",dt);

      t1 = DateTime.Now;
      XmlDocument doc3 = new XmlDocument();
      doc3.Load(@"C:\TEMP\xmltest03.xml");
      XmlDocumentSerializationInfo info3 = new XmlDocumentSerializationInfo(doc3);
      Foo o3 = (Foo)info3.GetValue(null);
      t2 = DateTime.Now;
      dt = t2-t1;
      Console.WriteLine("Document restored, duration {0}.",dt);
    }