/// <summary> /// Sets the state to the given memento. /// </summary> void IMementoCapable.SetMemento(ICSharpCode.Core.Properties memento) { SetStartupProject(memento.Get("StartupProject", "")); string configuration = memento.Get("ActiveConfiguration", activeConfiguration); string platform = memento.Get("ActivePlatform", activePlatform); // validate configuration and platform: IList <string> available = solution.GetConfigurationNames(); if (available.Count > 0 && !available.Contains(configuration)) { configuration = available[0]; } available = solution.GetPlatformNames(); if (available.Count > 0 && !available.Contains(platform)) { platform = available[0]; } this.ActiveConfiguration = configuration; this.ActivePlatform = platform; this.properties = memento; }
public static ICondition ReadComplexCondition(XmlReader reader, AddIn addIn) { Properties properties = Properties.ReadFromAttributes(reader); reader.Read(); ICondition condition = null; while (reader.Read()) { switch (reader.NodeType) { case XmlNodeType.Element: switch (reader.LocalName) { case "And": condition = AndCondition.Read(reader, addIn); goto exit; case "Or": condition = OrCondition.Read(reader, addIn); goto exit; case "Not": condition = NegatedCondition.Read(reader, addIn); goto exit; default: throw new AddInLoadException("Invalid element name '" + reader.LocalName + "', the first entry in a ComplexCondition " + "must be <And>, <Or> or <Not>"); } } } exit: if (condition != null) { ConditionFailedAction action = properties.Get("action", ConditionFailedAction.Exclude); condition.Action = action; } return(condition); }
public static ICondition ReadComplexCondition(XmlReader reader) { Properties properties = Properties.ReadFromAttributes(reader); reader.Read(); ICondition condition = null; while (reader.Read()) { switch (reader.NodeType) { case XmlNodeType.Element: switch (reader.LocalName) { case "And": condition = AndCondition.Read(reader); goto exit; case "Or": condition = OrCondition.Read(reader); goto exit; case "Not": condition = NegatedCondition.Read(reader); goto exit; case "Condition": condition = Condition.Read(reader); goto exit; } break; } } exit: if (condition != null) { ConditionFailedAction action = properties.Get("action", ConditionFailedAction.Exclude); condition.Action = action; } return(condition); }
/// <summary> /// Allow special syntax to retrieve property values: /// ${property:PropertyName} /// ${property:PropertyName??DefaultValue} /// ${property:ContainerName/PropertyName} /// ${property:ContainerName/PropertyName??DefaultValue} /// A container is a Properties instance stored in the PropertyService. This is /// used by many AddIns to group all their properties into one container. /// </summary> static string GetProperty(string propertyName) { string defaultValue = ""; int pos = propertyName.LastIndexOf("??", StringComparison.Ordinal); if (pos >= 0) { defaultValue = propertyName.Substring(pos + 2); propertyName = propertyName.Substring(0, pos); } Properties properties = ServiceSingleton.GetRequiredService <IPropertyService>().MainPropertiesContainer; pos = propertyName.IndexOf('/'); while (pos >= 0) { properties = properties.NestedProperties(propertyName.Substring(0, pos)); propertyName = propertyName.Substring(pos + 1); pos = propertyName.IndexOf('/'); } return(properties.Get(propertyName, defaultValue)); }
public void SetMemento(ICSharpCode.Core.Properties properties) { textEditorControl.ActiveTextAreaControl.Caret.Position = textEditorControl.Document.OffsetToPosition(Math.Min(textEditorControl.Document.TextLength, Math.Max(0, properties.Get("CaretOffset", textEditorControl.ActiveTextAreaControl.Caret.Offset)))); string highlightingName = properties.Get("HighlightingLanguage", string.Empty); if (!string.IsNullOrEmpty(highlightingName)) { if (highlightingName == textEditorControl.Document.HighlightingStrategy.Name) { textEditorControl.HighlightingExplicitlySet = true; } else { IHighlightingStrategy highlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategy(highlightingName); if (highlightingStrategy != null) { textEditorControl.HighlightingExplicitlySet = true; textEditorControl.Document.HighlightingStrategy = highlightingStrategy; } } } textEditorControl.ActiveTextAreaControl.TextArea.TextView.FirstVisibleLine = properties.Get("VisibleLine", 0); }
public static T Get <T>(string property, T defaultValue) { return(properties.Get(property, defaultValue)); }
public Condition(string name, Properties properties) { this.name = name; this.properties = properties; action = properties.Get("action", ConditionFailedAction.Exclude); }
/// <inheritdoc cref="Properties.Get{T}(string, T)"/> public T Get <T>(string key, T defaultValue) { return(properties.Get(key, defaultValue)); }
public Condition(string name, Properties properties) { this.name = name; this.properties = properties; this.action = properties.Get <ConditionAction>("action", ConditionAction.Exclude); }