Exemplo n.º 1
0
        public static void Import(FileInfo fileInfo, ExportImportFlags flags)
        {
            Stream fs = new FileStream(fileInfo.FullName, FileMode.Open, FileAccess.Read);

            ConfigManager.Import(fs, flags);
            fs.Close();
        }
Exemplo n.º 2
0
        private static List <T> ReplaceOrKeepExisting <T>(ExportImportFlags flags, List <T> existingList, List <T> newList)
        {
            if ((flags & ExportImportFlags.KeepExisting) == ExportImportFlags.KeepExisting)
            {
                return(existingList.Union(newList).ToList());
            }

            return(newList);
        }
Exemplo n.º 3
0
 private void okButton_Click(object sender, EventArgs e)
 {
     this.ImportFlags = ExportImportFlags.None;
     this.FileName    = this.fileNameTextBox.Text;
     foreach (Control ctl in this.optionsGroupBox.Controls)
     {
         if (ctl.Tag != null)
         {
             if ((ctl as CheckBox).Checked)
             {
                 this.ImportFlags = this.ImportFlags | (ExportImportFlags)long.Parse(ctl.Tag as string);
             }
         }
     }
 }
Exemplo n.º 4
0
        private void okButton_Click(object sender, EventArgs e)
        {
            ImportFlags = ExportImportFlags.None;
            FileName    = textBoxFileName.Text;

            foreach (Control ctl in groupBoxImportOptions.Controls)
            {
                if (ctl.Tag != null)
                {
                    if (((CheckBox)ctl).Checked)
                    {
                        ImportFlags = ImportFlags | (ExportImportFlags)long.Parse(ctl.Tag as string ?? string.Empty);
                    }
                }
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Imports all or some of the settings/prefs stored in the inpute stream.
        /// This will overwrite appropriate parts of the current (own) settings with the imported ones.
        /// </summary>
        /// <param name="fs"></param>
        /// <param name="flags">Flags to indicate which parts shall be imported</param>
        private Settings Import(Settings currentSettings, Stream fs, ExportImportFlags flags)
        {
            Settings importSettings = LoadOrCreateNew(fs);
            Settings ownSettings    = ObjectClone.Clone(currentSettings);
            Settings newSettings;

            // at first check for 'Other' as this are the most options.
            if ((flags & ExportImportFlags.Other) == ExportImportFlags.Other)
            {
                newSettings             = ownSettings;
                newSettings.preferences = ObjectClone.Clone(importSettings.preferences);
                newSettings.preferences.columnizerMaskList = ownSettings.preferences.columnizerMaskList;
                newSettings.preferences.highlightMaskList  = ownSettings.preferences.highlightMaskList;
                newSettings.hilightGroupList        = ownSettings.hilightGroupList;
                newSettings.preferences.toolEntries = ownSettings.preferences.toolEntries;
            }
            else
            {
                newSettings = ownSettings;
            }

            if ((flags & ExportImportFlags.ColumnizerMasks) == ExportImportFlags.ColumnizerMasks)
            {
                newSettings.preferences.columnizerMaskList = importSettings.preferences.columnizerMaskList;
            }
            if ((flags & ExportImportFlags.HighlightMasks) == ExportImportFlags.HighlightMasks)
            {
                newSettings.preferences.highlightMaskList = importSettings.preferences.highlightMaskList;
            }
            if ((flags & ExportImportFlags.HighlightSettings) == ExportImportFlags.HighlightSettings)
            {
                newSettings.hilightGroupList = importSettings.hilightGroupList;
            }
            if ((flags & ExportImportFlags.ToolEntries) == ExportImportFlags.ToolEntries)
            {
                newSettings.preferences.toolEntries = importSettings.preferences.toolEntries;
            }

            return(newSettings);
        }
Exemplo n.º 6
0
		/// <summary>
		/// Imports all or some of the settings/prefs stored in the inpute stream.
		/// This will overwrite appropriate parts of the current (own) settings with the imported ones.
		/// </summary>
		/// <param name="fs"></param>
		/// <param name="flags">Flags to indicate which parts shall be imported</param>
		private Settings Import(Settings currentSettings, Stream fs, ExportImportFlags flags)
		{
			Settings importSettings = LoadOrCreateNew(fs);
			Settings ownSettings = ObjectClone.Clone<Settings>(currentSettings);
			Settings newSettings;

			// at first check for 'Other' as this are the most options.
			if ((flags & ExportImportFlags.Other) == ExportImportFlags.Other)
			{
				newSettings = ownSettings;
				newSettings.preferences = ObjectClone.Clone<Preferences>(importSettings.preferences);
				newSettings.preferences.columnizerMaskList = ownSettings.preferences.columnizerMaskList;
				newSettings.preferences.highlightMaskList = ownSettings.preferences.highlightMaskList;
				newSettings.hilightGroupList = ownSettings.hilightGroupList;
				newSettings.preferences.toolEntries = ownSettings.preferences.toolEntries;
			}
			else
			{
				newSettings = ownSettings;
			}

			if ((flags & ExportImportFlags.ColumnizerMasks) == ExportImportFlags.ColumnizerMasks)
			{
				newSettings.preferences.columnizerMaskList = importSettings.preferences.columnizerMaskList;
			}
			if ((flags & ExportImportFlags.HighlightMasks) == ExportImportFlags.HighlightMasks)
			{
				newSettings.preferences.highlightMaskList = importSettings.preferences.highlightMaskList;
			}
			if ((flags & ExportImportFlags.HighlightSettings) == ExportImportFlags.HighlightSettings)
			{
				newSettings.hilightGroupList = importSettings.hilightGroupList;
			}
			if ((flags & ExportImportFlags.ToolEntries) == ExportImportFlags.ToolEntries)
			{
				newSettings.preferences.toolEntries = importSettings.preferences.toolEntries;
			}

			return newSettings;
		}
Exemplo n.º 7
0
		public static void Import(Stream fs, ExportImportFlags flags)
		{
			Instance.settings = Instance.Import(Instance.settings, fs, flags);
			Save(SettingsFlags.All);
		}
Exemplo n.º 8
0
 public static void Import(Stream fs, ExportImportFlags flags)
 {
     Instance._settings = Instance.Import(Instance._settings, fs, flags);
     Save(SettingsFlags.All);
 }
Exemplo n.º 9
0
 public static void Import(FileInfo fileInfo, ExportImportFlags flags)
 {
     Instance._settings = Instance.Import(Instance._settings, fileInfo, flags);
     Save(SettingsFlags.All);
 }