~ubuntu-branches/ubuntu/wily/openmcdf/wily

« back to all changes in this revision

Viewing changes to src/OpenMcdfPerfTest/Program.cs

  • Committer: Package Import Robot
  • Author(s): Mathieu Malaterre
  • Date: 2013-04-08 11:02:15 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20130408110215-aleqo4zhjc3qgxnb
Tags: 1.5.4-1
* New upstream: 1.5.4
  - Use Hexbox for hexadecimal viewing

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
using System;
 
2
using System.Collections.Generic;
 
3
using System.Text;
 
4
using OpenMcdf;
 
5
using System.IO;
 
6
 
 
7
namespace OpenMcdfPerfTest
 
8
{
 
9
    class Program
 
10
    {
 
11
        static int MAX_STREAM_COUNT = 1000;
 
12
        static String fileName = "PerfLoad.cfs";
 
13
 
 
14
        static void Main(string[] args)
 
15
        {
 
16
            File.Delete(fileName);
 
17
            if (!File.Exists(fileName))
 
18
            {
 
19
                CreateFile(fileName);
 
20
            }
 
21
 
 
22
            CompoundFile cf = new CompoundFile(fileName);
 
23
            DateTime dt = DateTime.Now;
 
24
            CFStream s = cf.RootStorage.GetStream("Test1");
 
25
            TimeSpan ts = DateTime.Now.Subtract(dt);
 
26
            Console.WriteLine(ts.TotalMilliseconds.ToString());
 
27
            Console.Read();
 
28
        }
 
29
 
 
30
        private static void CreateFile(String fn)
 
31
        {
 
32
            CompoundFile cf = new CompoundFile();
 
33
            for (int i = 0; i < MAX_STREAM_COUNT; i++)
 
34
            {
 
35
                cf.RootStorage.AddStream("Test" + i.ToString()).SetData(Helpers.GetBuffer(300));
 
36
            }
 
37
            cf.Save(fileName);
 
38
            cf.Close();
 
39
        }
 
40
    }
 
41
}