Esempio n. 1
0
        public override ConfigKey CreateSubKey(string name)
        {
            var subKey = new FileConfigKey(name);

            subKeyData.Add(subKey);
            return(subKey);
        }
Esempio n. 2
0
 internal void LoadConfig()
 {
     lock ( fileLock )
     {
         var fileInfo = new FileInfo(configFilePath);
         if (fileInfo.Exists)
         {
             // Read into mem stream and desrialize from that. As the data is deserialized, it sets values
             // causing writes back to file.
             var memoryStream = new MemoryStream();
             using (var reader = new FileStream(configFilePath, FileMode.Open))
             {
                 reader.CopyTo(memoryStream);
             }
             memoryStream.Position = 0;
             rootKey = (FileConfigKey)serializer.ReadObject(memoryStream);
         }
         // ensure we have something
         rootKey = rootKey ?? new FileConfigKey(string.Empty);
     }
 }
 internal void LoadConfig()
 {
     lock ( fileLock )
     {
         var fileInfo = new FileInfo( configFilePath );
         if ( fileInfo.Exists )
         {
             // Read into mem stream and desrialize from that. As the data is deserialized, it sets values
             // causing writes back to file.
             var memoryStream = new MemoryStream();
             using ( var reader = new FileStream( configFilePath, FileMode.Open ) )
             {
                 reader.CopyTo( memoryStream );
             }
             memoryStream.Position = 0;
             rootKey = (FileConfigKey) serializer.ReadObject( memoryStream );
         }
         // ensure we have something
         rootKey = rootKey ?? new FileConfigKey( string.Empty );
     }
 }
Esempio n. 4
0
 public override ConfigKey CreateSubKey( string name )
 {
     var subKey = new FileConfigKey( name );
     subKeyData.Add( subKey );
     return subKey;
 }