public static FiSysTattlerConfiguration LoadConfiguration(string filePath)
        {
            if (!File.Exists(filePath))
            {
                throw new FileNotFoundException("The filepath: {0}, could not be found.", filePath);
            }

            var config = new FiSysTattlerConfiguration();

            using (var fileStream = File.OpenRead(filePath))
            using (var memStream = new MemoryStream())
            {
                memStream.SetLength(fileStream.Length);
                fileStream.Read(memStream.GetBuffer(), 0, (int)fileStream.Length);
                memStream.Seek(0, SeekOrigin.Begin);

                config = SerializationHelper.DeSerializerFromXmlText<FiSysTattlerConfiguration>(memStream);
            }

            return config;
        }
Exemplo n.º 2
0
 public void AddConfig(object key, FiSysTattlerConfiguration watcherConfig)
 {
     InitializeWatchList(key, watcherConfig.Watches);
 }