コード例 #1
0
ファイル: JournalBuilder.cs プロジェクト: ideoma/nfsdb-csharp
        private static JournalElement UpdateConfiguration(JournalElement conf)
        {
            string         settingsFile   = Path.Combine(conf.DefaultPath, MetadataConstants.JOURNAL_SETTINGS_FILE_NAME);
            JournalElement existingConfig = null;

            if (File.Exists(settingsFile))
            {
                try
                {
                    using (var dbXml = File.OpenRead(settingsFile))
                    {
                        existingConfig = ConfigurationSerializer.ReadJournalConfiguration(dbXml);
                    }
                }
                catch (IOException)
                {
                }
                catch (InvalidOperationException)
                {
                }

                if (existingConfig != null)
                {
                    existingConfig.OpenPartitionTtl  = conf.OpenPartitionTtl;
                    existingConfig.MaxOpenPartitions = conf.MaxOpenPartitions;
                    existingConfig.LagHours          = conf.LagHours;
                    existingConfig.DefaultPath       = conf.DefaultPath;
                    existingConfig.SerializerName    = conf.SerializerName;
                    existingConfig.FromDisk          = true;
                    return(existingConfig);
                }
            }
            return(conf);
        }
コード例 #2
0
        public void SaveTo(Stream stream)
        {
            var existingConfig = GetConfig();

            ConfigurationSerializer.WriteJournalConfiguration(stream, existingConfig);
        }