示例#1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SharpDocApp"/> class.
 /// </summary>
 public SharpDocApp()
 {
     Config       = new Config();
     StyleManager = new StyleManager();
 }
示例#2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SharpDocApp"/> class.
 /// </summary>
 public SharpDocApp()
 {
     Config = new Config();
     StyleManager = new StyleManager();
 }
示例#3
0
        /// <summary>
        /// Uses the style.
        /// </summary>
        /// <param name="styleName">Name of the style.</param>
        /// <returns></returns>
        internal void UseStyle(string styleName)
        {
            if (!StyleManager.StyleExist(styleName))
            {
                Logger.Fatal("Cannot us style [{0}]. Style doesn't exist", styleName);
            }

            CurrentStyleName = styleName;

            StyleDirectories.Clear();

            var includeBaseStyle = new List <string>();

            var styles = StyleManager.AvailableStyles;

            includeBaseStyle.Add(styleName);

            bool isNotComplete = true;

            // Compute directories to look, by following

            // In the same order they are declared
            while (isNotComplete)
            {
                isNotComplete = false;
                // Build directories to look for this specific style and all its base style);
                var toRemove = new List <StyleDefinition>();
                foreach (var style in styles)
                {
                    // Apply parameter inherited from style
                    if (style.Name == styleName)
                    {
                        foreach (var parameter in style.Parameters)
                        {
                            ((DynamicParam)Param).Properties.Remove(parameter.Name);
                            ((DynamicParam)Param).Properties.Add(parameter.Name, parameter.value);
                        }
                    }

                    if (includeBaseStyle.Contains(style.Name))
                    {
                        toRemove.Add(style);
                        StyleDirectories.Add(style.DirectoryPath);
                        isNotComplete = true;
                        if (style.HasBaseStyle)
                        {
                            includeBaseStyle.Add(style.BaseStyle);
                        }
                    }
                }

                // Remove the style that was processed by the previous loop
                foreach (var styleDefinition in toRemove)
                {
                    styles.Remove(styleDefinition);
                }
            }

            foreach (var styleDirectory in StyleDirectories)
            {
                Logger.Message("Using Style Directory [{0}]", styleDirectory);
            }
        }