Exemplo n.º 1
0
		static void SensorList (String filename)
		{
			// try to open it for reading...
			Console.Write("Opening "+filename+" data-store for reading...");
			TinyOnDiskStorage data_store = new TinyOnDiskStorage(filename, false,100);
			Console.WriteLine("done");

			Dictionary<String,XS1_DataObject> Sensors = new Dictionary<string, XS1_DataObject>();

			foreach (OnDiscAdress ondisc in data_store.InMemoryIndex)
			{
				XS1_DataObject dataobject = new XS1_DataObject();
                try
                {
                    dataobject.Deserialize(data_store.Read(ondisc));
                    //Console.WriteLine(dataobject.Timecode.ToLongTimeString() + ";" + dataobject.Timecode.ToShortDateString() + ";" + dataobject.Name + ";" + dataobject.Type + ";" + dataobject.TypeName + ";" + dataobject.Value + ";" + dataobject.OriginalXS1Statement);
                    if (!Sensors.ContainsKey(dataobject.Name))
                        Sensors.Add(dataobject.Name, dataobject);
                }
                catch (Exception e)
                {
                    Console.WriteLine("Error: "+ondisc.CreationTime+" - "+ ondisc.Start +" - " + e.Message);
                }
			}

			foreach(XS1_DataObject dataobject in Sensors.Values)
			{
				Console.WriteLine(dataobject.Name+";"+dataobject.Type+";"+dataobject.TypeName+";"+dataobject.Value+";"+dataobject.OriginalXS1Statement);
			}

		}
Exemplo n.º 2
0
 public HttpServer(Int32 HTTP_Port, String HTTP_ListeningIP, String HTTP_DocumentRoot, TinyOnDiskStorage _Storage, XS1Configuration _XS1_Configuration, ConsoleOutputLogger Logger, MAXMonitoringThread _ELVMAXMonitoringThread)
 {
     HTTPServer_Port = HTTP_Port;
     HTTPServer_ListeningIP = HTTP_ListeningIP;
     HTTPServer_DocumentRoot = HTTP_DocumentRoot;
     Storage = _Storage;
     XS1_Configuration = _XS1_Configuration;
     ConsoleOutputLogger = Logger;
     ELVMAXMonitoringThread = _ELVMAXMonitoringThread;
 }
Exemplo n.º 3
0
 /// <summary>
 /// Each HTTP processor object handles one client.  If Keep-Alive is enabled then this
 /// object will be reused for subsequent requests until the client breaks keep-alive.
 /// This usually happens when it times out.  Because this could easily lead to a DoS
 /// attack, we keep track of the number of open processors and only allow 100 to be
 /// persistent active at any one time.  Additionally, we do not allow more than 500
 /// outstanding requests.
 /// </summary>
 /// <param name="docRoot">Root-Directory of the HTTP Server</param>
 /// <param name="s">the Socket to work with</param>
 /// <param name="webserver">the "master" HttpServer Object of this Client</param>
 public HttpProcessor(Socket s, String HTTP_DocumentRoot, TinyOnDiskStorage Storage, XS1Configuration _XS1_Configuration, ConsoleOutputLogger Logger, MAXMonitoringThread ELVMAXMonitoring)
 {
     this.s = s;
     HTTPServer_DocumentRoot = HTTP_DocumentRoot;
     JSON_Data = new JSONData(Storage,Logger);
     docRootFile = new FileInfo(HTTPServer_DocumentRoot);
     headers = new Hashtable();
     XS1_Configuration = _XS1_Configuration;
     ConsoleOutputLogger = Logger;
     internal_proxy = new HTTPProxy(ConsoleOutputLogger,ELVMAXMonitoring);
     ELVMAX = ELVMAXMonitoring;
     SensorDataStore = Storage;
 }
Exemplo n.º 4
0
        private ConcurrentQueue<XS1_DataObject> XS1_DataQueue; // use a thread safe list like structure to hold the messages coming in from the XS1

        #endregion Fields

        #region Constructors

        public LoggingThread(String _ServerName, ConsoleOutputLogger Logger,TinyOnDiskStorage _actor_store, TinyOnDiskStorage _sensor_store, TinyOnDiskStorage _unknown_store, String _Username, String _Password, Int32 _ConfigurationCacheMinutes)
        {
            actor_data_store = _actor_store;
            sensor_data_store = _sensor_store;
            unknown_data_store = _unknown_store;
            ServerName = _ServerName;
            UserName = _Username;
            Password = _Password;
            ConfigurationCacheMinutes = _ConfigurationCacheMinutes;
            ConsoleOutputLogger = Logger;
            XS1_DataQueue = new ConcurrentQueue<XS1_DataObject>();
            MAX_DataQueue = new ConcurrentQueue<IDeviceDiffSet>();
            SolarLog_DataQueue = new ConcurrentQueue<SolarLogDataSet>();
        }
Exemplo n.º 5
0
		public HttpServer(Int32 HTTP_Port, String HTTP_ListeningIP, String HTTP_DocumentRoot, TinyOnDiskStorage _Storage, TinyOnDiskStorage _LatitudeStorage, XS1Configuration _XS1_Configuration, ConsoleOutputLogger Logger, MAXMonitoringThread _ELVMAXMonitoringThread, bool AuthEnabled, String Uname, String Pword, String StartAdrFilter)
        {
            HTTPServer_Port = HTTP_Port;
            HTTPServer_ListeningIP = HTTP_ListeningIP;
            HTTPServer_DocumentRoot = HTTP_DocumentRoot;
            Storage = _Storage;
            XS1_Configuration = _XS1_Configuration;
            ConsoleOutputLogger = Logger;
			ELVMAXMonitoringThread = _ELVMAXMonitoringThread;
			LatitudeStorage = _LatitudeStorage;
			AuthorizationEnabled = AuthEnabled;
			Username = Uname;
			Password = Pword;
            AuthDisabledForAdressesThatStartWith = StartAdrFilter;
        }
Exemplo n.º 6
0
		static void ExportKML(String filename, String Accountname)
		{
			Console.WriteLine ("<?xml version=\"1.0\" encoding=\"UTF-8\"?><kml xmlns=\"http://www.opengis.net/kml/2.2\"><Document><name>" + Accountname + "</name><open>1</open>");
			Console.WriteLine ("<Style id=\"trailsstyle\">");
			Console.WriteLine ("<LineStyle><color>7f0000ff</color><width>6</width></LineStyle></Style><description>n/a</description>");
			
			// try to open it for reading...			
			TinyOnDiskStorage data_store = new TinyOnDiskStorage(filename, false,100000);
			Console.WriteLine("<Placemark><styleUrl>#trailsstyle</styleUrl><name>"+Accountname+"</name><LineString>;<tessellate>1</tessellate>");
			Console.WriteLine("<coordinates>");

			foreach (OnDiscAdress ondisc in data_store.InMemoryIndex)
			{
				GoogleLatitudeDataObject dataobject = new GoogleLatitudeDataObject();
				dataobject.Deserialize(data_store.Read(ondisc));
				//Int32 CurrentDay = -1;

				if (dataobject.AccountName == Accountname) 
				{
					Console.WriteLine(String.Format("{0:F6}#{1:F6}#{0:F6}",dataobject.Latitude, dataobject.Longitude,dataobject.AccuracyInMeters).Replace(",",".").Replace("#",","));
					// check which date it is...
/*					if (CurrentDay == -1)
					{	// the first time...
						Console.WriteLine("<Placemark><styleUrl>#trailsstyle</styleUrl><name>"+DateTime.FromBinary (dataobject.Timecode).ToString()+"</name><LineString>;<tessellate>1</tessellate>");
						Console.WriteLine("<coordinates>");

						CurrentDay = DateTime.FromBinary (dataobject.Timecode).Day;
					}

					if (DateTime.FromBinary (dataobject.Timecode).Day == CurrentDay) 
					{
						Console.WriteLine(String.Format("{0:F6},{1:F6},{0:F6}",dataobject.Latitude, dataobject.Longitude,dataobject.AccuracyInMeters));
					}
					else
					{
						Console.WriteLine("</coordinates></LineString></Placemark>");
						Console.WriteLine("<Placemark><styleUrl>#trailsstyle</styleUrl><name>"+DateTime.FromBinary (dataobject.Timecode).ToString()+"</name><LineString>;<tessellate>1</tessellate>");
						Console.WriteLine("<coordinates>");
						Console.WriteLine(String.Format("{0:F6},{1:F6},{0:F6}",dataobject.Latitude, dataobject.Longitude,dataobject.AccuracyInMeters));
						CurrentDay = DateTime.FromBinary (dataobject.Timecode).Day;
					}*/
				}
			}
			Console.WriteLine("</coordinates></LineString></Placemark></Document></kml>");
		}
Exemplo n.º 7
0
Arquivo: hacs.cs Projeto: aheil/hacs
        static void Main(string[] args)
        {
            #region ConsoleOutputLogger
            ConsoleOutputLogger ConsoleOutputLogger = new xs1_data_logging.ConsoleOutputLogger();
            ConsoleOutputLogger.verbose = true;
            ConsoleOutputLogger.writeLogfile = false;
            #endregion

            #region Logo
            ConsoleOutputLogger.WriteLine("home automation control server " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString());
            ConsoleOutputLogger.WriteLine("(C) 2010-2012 Daniel Kirstenpfad - http://github.com/bietiekay/hacs");
            #endregion

            ConsoleOutputLogger.writeLogfile = true;

            TinyOnDiskStorage actor_data_store = new TinyOnDiskStorage("actor-data", false,xs1_data_logging.Properties.Settings.Default.DataObjectCacheSize);
            ConsoleOutputLogger.WriteLine("Initialized actor-data storage: "+actor_data_store.InMemoryIndex.Count);
            TinyOnDiskStorage sensor_data_store = new TinyOnDiskStorage("sensor-data", false,xs1_data_logging.Properties.Settings.Default.DataObjectCacheSize);
            ConsoleOutputLogger.WriteLine("Initialized sensor-data storage: "+sensor_data_store.InMemoryIndex.Count);
            TinyOnDiskStorage unknown_data_store = new TinyOnDiskStorage("unknown-data", false,xs1_data_logging.Properties.Settings.Default.DataObjectCacheSize);
            ConsoleOutputLogger.WriteLine("Initialized unknown-data storage: "+unknown_data_store.InMemoryIndex.Count);

            //List<Thread> LoggingThreads = new List<Thread>();
            ScriptingTimerThread _ScriptingTimerThread;

            ScriptingActorConfiguration.ReadConfiguration(Properties.Settings.Default.ScriptingActorConfigurationFilename);
            PowerSensorConfiguration.ReadConfiguration(Properties.Settings.Default.PowerSensorConfigurationFilename);
            ScriptingTimerConfiguration.ReadConfiguration(Properties.Settings.Default.ScriptingTimerConfigurationFilename);
            SensorCheckIgnoreConfiguration.ReadConfiguration(Properties.Settings.Default.SensorCheckIgnoreFile);
            HTTPProxyConfiguration.ReadConfiguration(Properties.Settings.Default.HTTPProxyConfigurationFilename);

            #region Logging and Actor Handling
            ConsoleOutputLogger.WriteLineToScreenOnly("Starting Logging for Server: " + Properties.Settings.Default.XS1);
            LoggingThread _Thread = new LoggingThread(Properties.Settings.Default.XS1, ConsoleOutputLogger, actor_data_store, sensor_data_store, unknown_data_store,Properties.Settings.Default.Username,Properties.Settings.Default.Password,Properties.Settings.Default.ConfigurationCacheMinutes);
            Thread LoggingThread = new Thread(new ThreadStart(_Thread.Run));
            LoggingThread.Start();
            #endregion

            #region Scripting Timer Handling
            ConsoleOutputLogger.WriteLineToScreenOnly("Starting Scripting Timer Handling.");
            _ScriptingTimerThread = new ScriptingTimerThread(_Thread,ConsoleOutputLogger);
            Thread ScriptingTThread = new Thread(new ThreadStart(_ScriptingTimerThread.Run));
            ScriptingTThread.Start();
            #endregion
        }
Exemplo n.º 8
0
		private static XS1_DataObject ReadFromCache(TinyOnDiskStorage sensor_data, OnDiscAdress adress)
		{
			XS1_DataObject dataobject = null;
			
			object cacheditem = sensor_data.Cache.ReadFromCache(adress);
			if (cacheditem == null)
			{
				// not found in cache, read from disk and add to cache
				dataobject.Deserialize(sensor_data.Read(adress));
				sensor_data.Cache.AddToCache(adress,dataobject);
			}
			else
			{
				// found in cache, take it...
				dataobject = (XS1_DataObject)cacheditem;
			}
			
			return dataobject;
		}
Exemplo n.º 9
0
		/// <summary>
		/// Each HTTP processor object handles one client.  If Keep-Alive is enabled then this
		/// object will be reused for subsequent requests until the client breaks keep-alive.
		/// This usually happens when it times out.  Because this could easily lead to a DoS
		/// attack, we keep track of the number of open processors and only allow 100 to be
		/// persistent active at any one time.  Additionally, we do not allow more than 500
		/// outstanding requests.
		/// </summary>
		/// <param name="docRoot">Root-Directory of the HTTP Server</param>
		/// <param name="s">the Socket to work with</param>
		/// <param name="webserver">the "master" HttpServer Object of this Client</param>
		public HttpProcessor(Socket s, String HTTP_DocumentRoot, TinyOnDiskStorage Storage, TinyOnDiskStorage LatitudeStorage, XS1Configuration _XS1_Configuration, ConsoleOutputLogger Logger, MAXMonitoringThread ELVMAXMonitoring, bool AuthEnabled, String Uname, String Pword, String StartAddrFilter)
		{
			this.s = s;
			HTTPServer_DocumentRoot = HTTP_DocumentRoot;
			JSON_Data = new JSONData(Storage,Logger);
			docRootFile = new FileInfo(HTTPServer_DocumentRoot);
			headers = new Hashtable();
            XS1_Configuration = _XS1_Configuration;
            ConsoleOutputLogger = Logger;
			internal_proxy = new HTTPProxy(ConsoleOutputLogger,ELVMAXMonitoring);
			ELVMAX = ELVMAXMonitoring;
			SensorDataStore = Storage;
			//LatitudeDataStore = LatitudeStorage;
			//LatitudeGeoLocation = new Geolocation(LatitudeStorage,Logger);
			AuthorizationEnabled = AuthEnabled;
			Username = Uname;
			Password = Pword;
            AuthDisabledForAdressesThatStartWith = StartAddrFilter;
		}
Exemplo n.º 10
0
		public LoggingThread(String _ServerName, ConsoleOutputLogger Logger,TinyOnDiskStorage _actor_store, TinyOnDiskStorage _sensor_store, TinyOnDiskStorage _unknown_store, TinyOnDiskStorage _miataru_store, String _Username, String _Password, Int32 _ConfigurationCacheMinutes)
        {
            actor_data_store = _actor_store;
            sensor_data_store = _sensor_store;
            unknown_data_store = _unknown_store;
			miataru_data_store = _miataru_store;
            ServerName = _ServerName;
            UserName = _Username;
            Password = _Password;
            ConfigurationCacheMinutes = _ConfigurationCacheMinutes;
            ConsoleOutputLogger = Logger;
			XS1_DataQueue = new ConcurrentQueue<XS1_DataObject>();
			MAX_DataQueue = new ConcurrentQueue<IDeviceDiffSet>();
            SolarLog_DataQueue = new ConcurrentQueue<SolarLogDataSet>();
            NetworkMonitor_Queue = new ConcurrentQueue<NetworkMonitoringDataSet>();

			if (Properties.Settings.Default.AlarmingEnabled)
				Alarming_Queue = new ConcurrentQueue<IAlarmingEvent>();

        }
Exemplo n.º 11
0
		public static string Generate(MAXMonitoringThread ELVMAX,TinyOnDiskStorage SensorDataStore, String ObjectName, String ObjectTypeName, DateTime StartDateTime, DateTime EndDateTime)
		{
			SwimLaneRootObject _root = new SwimLaneRootObject();

			_root.items = new System.Collections.Generic.List<ItemJSON>();
			_root.lanes = new System.Collections.Generic.List<LaneJSON>();
			#region fill the lanes
			// we need to have the data here
			// we shall have a cache (it's private for the other json methods... what about it?)
			// we need to have a selector which sensors need to be outputted...
			lock (SensorDataStore.InMemoryIndex)
			{
				foreach (OnDiscAdress ondisc in SensorDataStore.InMemoryIndex)
				{
					if (ondisc.CreationTime >= StartDateTime.Ticks)
					{
						if (ondisc.CreationTime <= EndDateTime.Ticks)
						{
							// we are in the right timespan
							// is this the right sensor?
							XS1_DataObject dataobject = ReadFromCache(SensorDataStore,ondisc);

							if (dataobject.TypeName == ObjectTypeName)
							{
								if (dataobject.Name == ObjectName)
								{
									// okay we got what we want...
								}
							}
						}
					}
				}
			}
			#endregion

			return "";
		}
Exemplo n.º 12
0
		public AlarmingThread(ConsoleOutputLogger Logger, ConcurrentQueue<IAlarmingEvent> _AlarmQueue, TinyOnDiskStorage sensor_data, TinyOnDiskStorage actor_data, TinyOnDiskStorage latitude_data)
		{
			ConsoleOutputLogger = Logger;
			Alarming_Queue = _AlarmQueue;
			SMSGateway = new SMS77Gateway(Properties.Settings.Default.AlarmingSMS77Username,Properties.Settings.Default.AlarmingSMS77Password);
		}
Exemplo n.º 13
0
 public JSONData(TinyOnDiskStorage sensor_data_storage, ConsoleOutputLogger Logger)
 {
     sensor_data = sensor_data_storage;
     ConsoleOutputLogger_ = Logger;
 }
Exemplo n.º 14
0
        static void Main(string[] args)
        {
            #region ConsoleOutputLogger
            ConsoleOutputLogger ConsoleOutputLogger = new hacs.ConsoleOutputLogger();
            ConsoleOutputLogger.verbose = true;
            ConsoleOutputLogger.writeLogfile = false;
            #endregion

            #region Logo
            ConsoleOutputLogger.WriteLine("home automation control server " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString());
            ConsoleOutputLogger.WriteLine("(C) 2010-2013 Daniel Kirstenpfad - http://github.com/bietiekay/hacs");
            #endregion
						
            ConsoleOutputLogger.writeLogfile = true;

            TinyOnDiskStorage actor_data_store = new TinyOnDiskStorage(Properties.Settings.Default.DataDirectory + Path.DirectorySeparatorChar + "actor-data", false, hacs.Properties.Settings.Default.DataObjectCacheSize);
			ConsoleOutputLogger.WriteLine("Initialized actor-data storage: "+actor_data_store.InMemoryIndex.Count);
            TinyOnDiskStorage sensor_data_store = new TinyOnDiskStorage(Properties.Settings.Default.DataDirectory + Path.DirectorySeparatorChar + "sensor-data", false, hacs.Properties.Settings.Default.DataObjectCacheSize);
			ConsoleOutputLogger.WriteLine("Initialized sensor-data storage: "+sensor_data_store.InMemoryIndex.Count);
            TinyOnDiskStorage unknown_data_store = new TinyOnDiskStorage(Properties.Settings.Default.DataDirectory + Path.DirectorySeparatorChar + "unknown-data", false, hacs.Properties.Settings.Default.DataObjectCacheSize);
			ConsoleOutputLogger.WriteLine("Initialized unknown-data storage: "+unknown_data_store.InMemoryIndex.Count);
			TinyOnDiskStorage miataru_data_store = null;

			if (hacs.Properties.Settings.Default.MiataruEnabled)
			{
				miataru_data_store = new TinyOnDiskStorage(Properties.Settings.Default.DataDirectory + Path.DirectorySeparatorChar + "miataru-data", false, hacs.Properties.Settings.Default.DataObjectCacheSize);
				ConsoleOutputLogger.WriteLine("Initialized Miataru storage: "+miataru_data_store.InMemoryIndex.Count);
			}


            //List<Thread> LoggingThreads = new List<Thread>();
            ScriptingTimerThread _ScriptingTimerThread;

            ScriptingActorConfiguration.ReadConfiguration(Properties.Settings.Default.ConfigurationDirectory + Path.DirectorySeparatorChar + Properties.Settings.Default.ScriptingActorConfigurationFilename);
            PowerSensorConfiguration.ReadConfiguration(Properties.Settings.Default.ConfigurationDirectory + Path.DirectorySeparatorChar + Properties.Settings.Default.PowerSensorConfigurationFilename);
            ScriptingTimerConfiguration.ReadConfiguration(Properties.Settings.Default.ConfigurationDirectory + Path.DirectorySeparatorChar + Properties.Settings.Default.ScriptingTimerConfigurationFilename);
            SensorCheckIgnoreConfiguration.ReadConfiguration(Properties.Settings.Default.ConfigurationDirectory + Path.DirectorySeparatorChar + Properties.Settings.Default.SensorCheckIgnoreFile);
            HTTPProxyConfiguration.ReadConfiguration(Properties.Settings.Default.ConfigurationDirectory + Path.DirectorySeparatorChar + Properties.Settings.Default.HTTPProxyConfigurationFilename);
			
            if (Properties.Settings.Default.AlarmingEnabled)
                AlarmingConfiguration.ReadConfiguration(Properties.Settings.Default.ConfigurationDirectory + Path.DirectorySeparatorChar + Properties.Settings.Default.AlarmingConfigurationFilename);

            if (Properties.Settings.Default.MiataruEnabled)
				MiataruConfiguration.ReadConfiguration(Properties.Settings.Default.ConfigurationDirectory + Path.DirectorySeparatorChar + Properties.Settings.Default.MiataruConfigurationFilename);

			#region add NetworkMonitor sensors to sensorcheckignore list
			if (Properties.Settings.Default.NetworkMonitorEnabled)
			{
                NetworkMonitorConfiguration.ReadConfiguration(Properties.Settings.Default.ConfigurationDirectory + Path.DirectorySeparatorChar + Properties.Settings.Default.NetworkMonitorConfigurationFilename);

				foreach(NetworkMonitoringHost Host in NetworkMonitorConfiguration.NetworkHosts)
				{
					SensorCheckIgnoreConfiguration.AddToIgnoreList(Host.IPAdressOrHostname);
				}
			}
			#endregion

            #region Logging and Actor Handling
            ConsoleOutputLogger.WriteLineToScreenOnly("Starting Logging for Server: " + Properties.Settings.Default.XS1);                        
			LoggingThread _Thread = new LoggingThread(Properties.Settings.Default.XS1, ConsoleOutputLogger, actor_data_store, sensor_data_store, unknown_data_store,miataru_data_store,Properties.Settings.Default.Username,Properties.Settings.Default.Password,Properties.Settings.Default.ConfigurationCacheMinutes);
            Thread LoggingThread = new Thread(new ThreadStart(_Thread.Run));
            LoggingThread.Start();
            #endregion

            #region Scripting Timer Handling
            ConsoleOutputLogger.WriteLineToScreenOnly("Starting Scripting Timer Handling.");
            _ScriptingTimerThread = new ScriptingTimerThread(_Thread,ConsoleOutputLogger);
            Thread ScriptingTThread = new Thread(new ThreadStart(_ScriptingTimerThread.Run));
            ScriptingTThread.Start();
            #endregion
        }
Exemplo n.º 15
0
		static void Main(string[] args)
		{
			Console.WriteLine("hacs storage performance tuning project: benchmark");
			Console.WriteLine("(C) 2013 Daniel Kirstenpfad - http://technology-ninja.com");
			Console.WriteLine();

			int number = 100000;
			int cachefactor = 1;
			Stopwatch sw = new Stopwatch();

			#region Generating benchmark data set
			if (Directory.Exists("benchmark-data"))
			{
				Directory.Delete("benchmark-data",true);
				Directory.CreateDirectory("benchmark-data");
			}
			else
				Directory.CreateDirectory("benchmark-data");
			sw.Start();
			TinyOnDiskStorage benchmark_storage = new TinyOnDiskStorage("benchmark-data" + Path.DirectorySeparatorChar + "benchmark-data", false, number/cachefactor);
			sw.Stop();
			Console.WriteLine("Initialized benchmark-data storage in "+sw.ElapsedMilliseconds+" ms");

			sw.Reset();

			Console.Write("Generating data ("+number+") - ");

			int CursorLeft = Console.CursorLeft;
			int CursorTop = Console.CursorTop;

			sw.Start ();
			for (int i=0;i<=number;i++)
			{
				//Console.SetCursorPosition(CursorLeft,CursorTop);
				//Console.Write(i+"/"+number);

				// now generating the file...
				XS1_DataObject data = new XS1_DataObject("ServerName","Name",ObjectTypes.Actor,"TypeName",DateTime.Now,i,i);

				benchmark_storage.Write(data.Serialize());
			}
			sw.Stop();
			Console.WriteLine("done in "+sw.ElapsedMilliseconds+" ms");

			sw.Reset();
			Console.WriteLine("Resetting...");

			benchmark_storage.Shutdown();

			sw.Start();
			benchmark_storage = new TinyOnDiskStorage("benchmark-data" + Path.DirectorySeparatorChar + "benchmark-data", false, number/2);
			sw.Stop();
			Console.WriteLine("Initialized benchmark-data storage in "+sw.ElapsedMilliseconds+" ms");
			sw.Reset();

			Console.Write("Reading ("+number+") - ");
			int o = 0;
			sw.Start();
			foreach(OnDiscAdress addr in benchmark_storage.InMemoryIndex)
			{
				XS1_DataObject data = new XS1_DataObject();
				data.Deserialize(benchmark_storage.Read(addr));
				if (data.XS1ObjectID != o)
					Console.WriteLine(data.Timecode.ToString());
				o++;
			}
			o--;
			sw.Stop();
			Console.WriteLine("done ("+o+") in "+sw.ElapsedMilliseconds+" ms");
			sw.Reset();
			#endregion
		}