Ejemplo n.º 1
0
        /// <summary>
        /// Writes the current state of the control to a persistent storage area.
        /// </summary>
        public void StoreState()
        {
            if (treeView.SelectedNode != null)
            {
                PersistentStorageData data = new PersistentStorageData(ToolName);

                data.Add(Settings_Path, treeView.SelectedNode.FullPath);
                data.Add(Settings_Favorites, ExportFavorites());

                PersistentStorageHelper.Save(data);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Loads the persistent storage data for particular tool.
        /// </summary>
        public static PersistentStorageData Load(string toolName)
        {
            try
            {
                PersistentStorageData data = new PersistentStorageData(toolName);
                RegistryKey           key  = OpenKey(toolName, false);

                if (key == null)
                {
                    return(data);
                }

                string[] names = key.GetValueNames();
                foreach (string k in names)
                {
                    object d = key.GetValue(k);
                    switch (key.GetValueKind(k))
                    {
                    case RegistryValueKind.MultiString:
                        data.Add(k, (string[])d);
                        break;

                    case RegistryValueKind.ExpandString:
                    case RegistryValueKind.String:
                        data.Add(k, (string)d);
                        break;

                    case RegistryValueKind.Binary:
                        data.Add(k, (byte[])d);
                        break;

                    case RegistryValueKind.DWord:
                    case RegistryValueKind.QWord:
                        data.Add(k, Convert.ToUInt32(d));
                        break;
                    }
                }

                CloseKey(key);
                return(data);
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.Message);
                Trace.WriteLine(ex.StackTrace);
                return(null);
            }
        }
Ejemplo n.º 3
0
        protected override void ConfigurationUpdate(out PersistentStorageData actionConfig)
        {
            // update configuration:
            config.Add(VisualStudioCloseQuestion.Config_Prompt, (uint)(promptOnClosing.Checked ? 1 : 0));

            actionConfig = config;
        }
Ejemplo n.º 4
0
        private void StoreConfig(MultiRenameForm dlg)
        {
            if (dlg != null)
            {
                if (config == null)
                {
                    config = ObjectFactory.LoadConfiguration(ConfigurationName);
                }

                StringHelper.CounterDetails counter = dlg.Counter;

                config.Add("Formula", dlg.Formula);
                config.Add("CounterStart", counter.Current);
                config.Add("CounterStep", counter.Step);
                config.Add("CounterDigits", (uint)counter.Digits);
                config.Add("FormatIndex", (uint)dlg.FormatIndex);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Destroy elements that belong to customizator's GUI.
        /// </summary>
        public void Destroy()
        {
            if (tytanToolbar != null)
            {
                // store the config option:
                config.Add(ShowTytanToolbarOption, (uint)(tytanToolbar.Visible ? 1 : 0));
                PersistentStorageHelper.Save(config);

                tytanToolbar.Visible = false;
            }
        }
Ejemplo n.º 6
0
        public void SaveState()
        {
            string[] storedFilter = FilterMessages;

            if (storedFilter != null && storedFilter.Length > 0)
            {
                PersistentStorageData data = new PersistentStorageData(ToolName);

                data.Add("Filter", storedFilter);

                PersistentStorageHelper.Save(data);
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Store inside the persistent storage, when the last update took place.
        /// </summary>
        private void StoreCheckState()
        {
            if (lastUpdateCheck == DateTime.MinValue)
            {
                return;
            }

            PersistentStorageData data = new PersistentStorageData(PersistantStorageName);

            data.Add("LastUpdateDate", lastUpdateCheck.ToShortDateString());

            // store:
            PersistentStorageHelper.Save(data);
        }
Ejemplo n.º 8
0
        protected override void ConfigurationUpdate(out PersistentStorageData actionConfig)
        {
            string[] assemblies = GetSerializedAssemblies();

            // set new set of system assemblies:
            if (assemblies != null)
            {
                config.Add(ReferenceProjectAction.Persistent_SystemAssemblies, assemblies);
            }
            else
            {
                config.Remove(ReferenceProjectAction.Persistent_SystemAssemblies);
            }

            actionConfig = config;
        }