public static FeatureDefinition ToFeatureDefinition(this SPFeatureDefinition spFeatureDefinition, string definitionInstallationScope) { var cultureInfo = new System.Globalization.CultureInfo(1033); if (spFeatureDefinition == null) { return(null); } var fd = FeatureDefinitionFactory.GetFeatureDefinition( spFeatureDefinition.Id, spFeatureDefinition.CompatibilityLevel, spFeatureDefinition.GetDescription(cultureInfo), spFeatureDefinition.DisplayName, spFeatureDefinition.Hidden, spFeatureDefinition.Name, spFeatureDefinition.Properties == null ? null : spFeatureDefinition.Properties.ToProperties(), spFeatureDefinition.Scope.ToScope(), spFeatureDefinition.GetTitle(cultureInfo), spFeatureDefinition.SolutionId, spFeatureDefinition.UIVersion, spFeatureDefinition.Version, definitionInstallationScope); return(fd); }
public FeatureNode(object spParent, SPFeatureDefinition definition, int imageIndex, bool installed) { this.Tag = definition; this.SPParent = spParent; this.ImageIndex = imageIndex; this.SelectedImageIndex = imageIndex; this.IsInstalled = installed; try { if (definition.Hidden) { _Text = definition.GetTitle(SPMConfig.Instance.CultureInfo) + " (Hidden)"; this.ForeColor = Color.DarkGray; } else { _Text = definition.GetTitle(SPMConfig.Instance.CultureInfo); } _ToolTip = definition.GetDescription(SPMConfig.Instance.CultureInfo); _Name = definition.Id.ToString(); this.Setup(); this.Nodes.Add(new ExplorerNodeBase("Dummy")); } catch(Exception ex) { this.ForeColor = Color.DarkRed; if (definition != null) { _Text = definition.RootDirectory.ToLower() + " (error)"; _ToolTip = ex.Message; _Name = definition.Id.ToString(); } else { _Text = "(Error: Can not find feature definition)"; _ToolTip = ex.Message; _Name = Guid.Empty.ToString(); } } }
public FeatureNode(object spParent, SPFeatureDefinition definition, int imageIndex, bool installed) { this.Tag = definition; this.SPParent = spParent; this.ImageIndex = imageIndex; this.SelectedImageIndex = imageIndex; this.IsInstalled = installed; try { if (definition.Hidden) { _Text = definition.GetTitle(SPMConfig.Instance.CultureInfo) + " (Hidden)"; this.ForeColor = Color.DarkGray; } else { _Text = definition.GetTitle(SPMConfig.Instance.CultureInfo); } _ToolTip = definition.GetDescription(SPMConfig.Instance.CultureInfo); _Name = definition.Id.ToString(); this.Setup(); this.Nodes.Add(new ExplorerNodeBase("Dummy")); } catch (Exception ex) { this.ForeColor = Color.DarkRed; if (definition != null) { _Text = definition.RootDirectory.ToLower() + " (error)"; _ToolTip = ex.Message; _Name = definition.Id.ToString(); } else { _Text = "(Error: Can not find feature definition)"; _ToolTip = ex.Message; _Name = Guid.Empty.ToString(); } } }
/// <summary> /// Builds the data row from a feature definition. /// </summary> /// <param name="dtblFeatures">The data table features.</param> /// <param name="languageCulture">The language culture.</param> /// <param name="featdef">The feat definition</param> /// <param name="fActive">if set to <c>true</c> [f active].</param> /// <returns></returns> private static DataRow BuildDataRowFromFeatureDefinition(DataTable dtblFeatures, CultureInfo languageCulture, SPFeatureDefinition featdef, bool fActive) { DataRow row = dtblFeatures.NewRow(); row["FeatureId"] = featdef.Id.ToString(); row["Title"] = featdef.GetTitle(languageCulture); row["DisplayName"] = featdef.DisplayName; row["Description"] = featdef.GetDescription(languageCulture); row["Scope"] = featdef.Scope.ToString(); if (!fActive) { row["Status"] = "Inactive"; } else { row["Status"] = "Active"; } return(row); }
public FeatureDefinitionNode(object spParent, SPFeatureDefinition definition, int installedIndex, int unInstalledIndex) { this.Tag = definition; this.SPParent = spParent; this.InstalledIndex = installedIndex; this.UnInstalledIndex = unInstalledIndex; _Text = definition.GetTitle(SPMConfig.Instance.CultureInfo); _ToolTip = definition.GetDescription(SPMConfig.Instance.CultureInfo); _Name = definition.Id.ToString(); if (definition.Status != SPObjectStatus.Online) { _Text += " (" + definition.Status.ToString() + ")"; } this.ImageIndex = InstalledIndex; this.SelectedImageIndex = InstalledIndex; this.Setup(); this.Nodes.Add(new ExplorerNodeBase("Dummy")); }
public static FeatureDefinition ToFeatureDefinition(this SPFeatureDefinition spFeatureDefinition, string sandboxedSolutionLocationId) { var cultureInfo = new System.Globalization.CultureInfo(1033); if (spFeatureDefinition == null) { return(null); } // If a feature definition is removed or orphaned, scope is set to undefined // therefore, scope is checked first and set in all exceptions later Scope defScope; try { defScope = spFeatureDefinition.Scope.ToScope(); } catch (Exception) { defScope = Scope.ScopeInvalid; } Guid defId; try { defId = spFeatureDefinition.Id; } catch (Exception) { defId = Guid.Empty; defScope = Scope.ScopeInvalid; } int defCompatibilityLevel; try { defCompatibilityLevel = spFeatureDefinition.CompatibilityLevel; } catch (Exception) { defCompatibilityLevel = 0; defScope = Scope.ScopeInvalid; } string defDescription; try { defDescription = spFeatureDefinition.GetDescription(cultureInfo); } catch (Exception ex) { defDescription = ex.Message; defScope = Scope.ScopeInvalid; } string defDisplayName; try { defDisplayName = spFeatureDefinition.DisplayName; } catch (Exception ex) { defDisplayName = ex.Message; defScope = Scope.ScopeInvalid; } bool defHidden; try { defHidden = spFeatureDefinition.Hidden; } catch (Exception) { defHidden = false; defScope = Scope.ScopeInvalid; } string defName; try { defName = spFeatureDefinition.Name; } catch (Exception ex) { defName = ex.Message; defScope = Scope.ScopeInvalid; } Dictionary <string, string> defProperties; try { defProperties = spFeatureDefinition.Properties == null ? null : spFeatureDefinition.Properties.ToProperties(); } catch (Exception) { defProperties = null; defScope = Scope.ScopeInvalid; } string defTitle; try { defTitle = spFeatureDefinition.GetTitle(cultureInfo); } catch (Exception ex) { defTitle = ex.Message; defScope = Scope.ScopeInvalid; } Guid defSolutionId; try { defSolutionId = spFeatureDefinition.SolutionId; } catch (Exception) { defSolutionId = Guid.Empty; defScope = Scope.ScopeInvalid; } string defUIVersion; try { defUIVersion = spFeatureDefinition.UIVersion; } catch (Exception) { defUIVersion = string.Empty; defScope = Scope.ScopeInvalid; } Version defVersion; try { defVersion = spFeatureDefinition.Version; } catch (Exception) { defVersion = new Version("0.0.0.0"); defScope = Scope.ScopeInvalid; } var fd = FeatureDefinitionFactory.GetFeatureDefinition( defId, defCompatibilityLevel, defDescription, defDisplayName, defHidden, defName, defProperties, defScope, defTitle, defSolutionId, defUIVersion, defVersion, sandboxedSolutionLocationId); return(fd); }