Stores file properties like FullName, DisplayName for recent files.
Example #1
0
        /// <summary>
        /// Save history / recent sql file names to configuration. It stores all entries in the history list. The remaining files are reset to "":
        /// </summary>
        public void Save()
        {
            int maxFileCount = MAX_FILE_COUNT_TO_REMEMBER;

            if (_lSqlHistoryFilesCfg.Count > maxFileCount)
            {
                maxFileCount = _lSqlHistoryFilesCfg.Count;
            }
            for (int i = 0; i < maxFileCount; i++)
            {
                string key   = $"{SqlHistoryFileCfgString}{i + 1}";
                string value = "";
                // store the existing history files
                if (i < _lSqlHistoryFilesCfg.Count)
                {
                    HistoryFile f = _lSqlHistoryFilesCfg[i];
                    value = f.FullName;
                }
                // make sure the key exists
                var parCfg = _config.AppSettings.Settings[key];
                if (parCfg != null)
                {
                    parCfg.Value = value;
                }
            }
        }
Example #2
0
        /// <summary>
        /// Save sql file names to configuration. Don't store duplicated file names
        /// <para/>Make sure the loaded amount is written back
        /// </summary>
        public void Save()
        {
            int maxOpenFileCount = MaxOpenFileCountToRemember;

            if (_lSqlLastOpenedFilesCfg.Count > maxOpenFileCount)
            {
                maxOpenFileCount = _lSqlLastOpenedFilesCfg.Count;
            }
            for (int i = 0; i < maxOpenFileCount; i++)
            {
                string key   = $"{SqlLastOpenedFileCfgString}{i + 1}";
                string value = "";
                // store the opened files
                if (i < _lSqlLastOpenedFilesCfg.Count)
                {
                    HistoryFile f = _lSqlLastOpenedFilesCfg[i];
                    value = f.FullName;
                }
                // make sure the key exists
                var parCfg = _config.AppSettings.Settings[key];
                if (parCfg != null)
                {
                    parCfg.Value = value;
                }
            }
        }