/// <summary>
        ///     The on associate command.
        /// </summary>
        private void OnAssociateCommand()
        {
            if (this.CommandText.Equals("Show " + this.name))
            {
                this.CommandText = "Hide " + this.name;
                var prop = new SonarQubeProperties();
                prop.Owner   = this.gridKey;
                prop.Value   = "true";
                prop.Key     = this.name + "Visible";
                prop.Context = Context.UIProperties;
                this.helper.WriteSetting(prop, true);
                this.model.RestoreUserSettingsInIssuesDataGrid();
                return;
            }

            if (this.CommandText.Equals("Hide " + this.name))
            {
                this.CommandText = "Show " + this.name;
                var prop = new SonarQubeProperties();
                prop.Owner   = this.gridKey;
                prop.Value   = "false";
                prop.Key     = this.name + "Visible";
                prop.Context = Context.UIProperties;
                this.helper.WriteSetting(prop, false);
                this.model.RestoreUserSettingsInIssuesDataGrid();
                return;
            }

            if (this.CommandText.Equals("Reset View"))
            {
                this.model.ResetColumnsView();
                return;
            }
        }
Пример #2
0
        /// <summary>
        /// The write setting.
        /// </summary>
        /// <param name="prop">The prop.</param>
        /// <param name="sync">The sync.</param>
        /// <param name="skipIfExist">The skip if exist.</param>
        public void WriteSetting(SonarQubeProperties prop, bool sync = false, bool skipIfExist = false)
        {
            var          bformatter = new BinaryFormatter();
            MemoryStream ms         = new MemoryStream();

            bformatter.Serialize(ms, prop);
            var baseRk = this.GetBaseRegistry(true);

            baseRk.SetValue(this.GetRegistryKey(prop), ms.GetBuffer());
        }
        public void WriteSetting(SonarQubeProperties prop, bool sync, bool skipifexist)
        {
            if (prop.Value == null)
            {
                return;
            }

            if (prop.Context.Equals(Context.AnalysisProject))
            {
                foreach (var property in this.tempproperties)
                {
                    if (property.Context.Equals(prop.Context) && property.Owner.Equals(prop.Owner) && property.Key.Equals(prop.Key))
                    {
                        if (skipifexist)
                        {
                            return;
                        }

                        property.Value = prop.Value;
                        return;
                    }
                }

                this.tempproperties.Add(prop);
                return;
            }

            foreach (var property in this.properties)
            {
                if (property.Context.Equals(prop.Context) && property.Owner.Equals(prop.Owner) && property.Key.Equals(prop.Key))
                {
                    if (skipifexist)
                    {
                        return;
                    }

                    property.Value = prop.Value;

                    if (sync)
                    {
                        this.SyncSettings();
                    }

                    return;
                }
            }

            this.properties.Add(prop);

            if (sync)
            {
                this.SyncSettings();
            }
        }
Пример #4
0
        /// <summary>
        /// The on extension debug mode enabled changed.
        /// </summary>
        public void OnExtensionDebugModeEnabledChanged()
        {
            var prp = new SonarQubeProperties
            {
                Context = Context.GlobalPropsId,
                Owner   = OwnersId.ApplicationOwnerId,
                Key     = "ExtensionDebugModeEnabled",
                Value   = this.ExtensionDebugModeEnabled ? "TRUE" : "FALSE"
            };

            this.configurationHelper.WriteSetting(prp);
        }
 /// <summary>
 /// Gets the registry key.
 /// </summary>
 /// <param name="prop">The property.</param>
 /// <returns></returns>
 private string GetRegistryKey(SonarQubeProperties prop)
 {
     return prop.Context + "_" + prop.Owner + "_" + prop.Key;
 }
 /// <summary>
 /// The write setting.
 /// </summary>
 /// <param name="prop">The prop.</param>
 /// <param name="sync">The sync.</param>
 /// <param name="skipIfExist">The skip if exist.</param>
 public void WriteSetting(SonarQubeProperties prop, bool sync = false, bool skipIfExist = false)
 {
     var bformatter = new BinaryFormatter();
     MemoryStream ms = new MemoryStream();
     bformatter.Serialize(ms, prop);
     var baseRk = this.GetBaseRegistry(true);
     baseRk.SetValue(this.GetRegistryKey(prop), ms.GetBuffer());
 }
        /// <summary>
        /// The on extension debug mode enabled changed.
        /// </summary>
        public void OnExtensionDebugModeEnabledChanged()
        {
            var prp = new SonarQubeProperties
            {
                Context = Context.GlobalPropsId,
                Owner = OwnersId.ApplicationOwnerId,
                Key = "ExtensionDebugModeEnabled",
                Value = this.ExtensionDebugModeEnabled ? "TRUE" : "FALSE"
            };

            this.configurationHelper.WriteSetting(prp);
        }
        /// <summary>
        /// Writes the setting.
        /// </summary>
        /// <param name="prop">The property.</param>
        /// <param name="sync">if set to <c>true</c> [synchronize].</param>
        /// <param name="skipifexist">if set to <c>true</c> [skipifexist].</param>
        public void WriteSetting(SonarQubeProperties prop, bool sync, bool skipifexist)
        {
            if (prop.Value == null)
            {
                return;
            }

            if (prop.Context.Equals(Context.AnalysisProject))
            {
                foreach (var property in this.tempproperties)
                {
                    if (property.Context.Equals(prop.Context) && property.Owner.Equals(prop.Owner) && property.Key.Equals(prop.Key))
                    {
                        if (skipifexist)
                        {
                            return;
                        }

                        property.Value = prop.Value;
                        return;
                    }
                }

                this.tempproperties.Add(prop);
                return;
            }

            foreach (var property in this.properties)
            {
                if (property.Context.Equals(prop.Context) && property.Owner.Equals(prop.Owner) && property.Key.Equals(prop.Key))
                {
                    if (skipifexist)
                    {
                        return;
                    }

                    property.Value = prop.Value;

                    if (sync)
                    {
                        this.SyncSettings();
                    }

                    return;
                }
            }

            this.properties.Add(prop);

            if (sync)
            {
                this.SyncSettings();
            }
        }
        /// <summary>
        ///     The on associate command.
        /// </summary>
        private void OnAssociateCommand()
        {
            if (this.CommandText.Equals("Show " + this.name))
            {
                this.CommandText = "Hide " + this.name;
                var prop = new SonarQubeProperties();
                prop.Owner = this.gridKey;
                prop.Value = "true";
                prop.Key = this.name + "Visible";
                prop.Context = Context.UIProperties;
                this.helper.WriteSetting(prop, true);
                this.model.RestoreUserSettingsInIssuesDataGrid();
                return;
            }

            if (this.CommandText.Equals("Hide " + this.name))
            {
                this.CommandText = "Show " + this.name;
                var prop = new SonarQubeProperties();
                prop.Owner = this.gridKey;
                prop.Value = "false";
                prop.Key = this.name + "Visible";
                prop.Context = Context.UIProperties;
                this.helper.WriteSetting(prop, false);
                this.model.RestoreUserSettingsInIssuesDataGrid();
                return;
            }

            if (this.CommandText.Equals("Reset View"))
            {
                this.model.ResetColumnsView();
                return;
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="SonarQubeProperties"/> class.
 /// </summary>
 /// <param name="prop">
 /// The prop.
 /// </param>
 public SonarQubeProperties(SonarQubeProperties prop)
 {
     this.Key = prop.Key;
     this.Value = prop.Value;
     this.ValueInServer = prop.ValueInServer;
 }
Пример #11
0
 /// <summary>
 /// Gets the registry key.
 /// </summary>
 /// <param name="prop">The property.</param>
 /// <returns></returns>
 private string GetRegistryKey(SonarQubeProperties prop)
 {
     return(prop.Context + "_" + prop.Owner + "_" + prop.Key);
 }