void Parse(Stream s)
        {
            s.Position = 0;
            var br = new BinaryReader(s);

            this.version          = br.ReadUInt32();
            this.unk02            = br.ReadUInt32();
            this.name_hash        = br.ReadUInt32();
            this.description_hash = br.ReadUInt32();
            this.price            = br.ReadInt32();
            this.unk05            = br.ReadUInt32();
            this.unk06            = br.ReadUInt32();
            this.unk07            = br.ReadUInt32();
            int tgi_count = br.ReadByte();

            this.ct_prduct_styles = new StyleList(this.OnResourceChanged, TGIBlock.Order.ITG, tgi_count, s);
            this.unk08            = br.ReadUInt16();
            this.tagList          = new UnknownShortList(this.OnResourceChanged, s);
            this.unk09            = br.ReadUInt32();
            this.unk10            = br.ReadUInt32();
            this.unk11            = br.ReadUInt32();
            this.unk12            = br.ReadUInt32();
            this.unk13            = br.ReadUInt32();
            this.unk14            = br.ReadUInt16();
            this.mlodList         = new MLODEntryList(this.OnResourceChanged, s);
            this.imgGroupList     = new ImgGroupList(this.OnResourceChanged, s);
            this.unk15            = br.ReadUInt32();
            this.colors           = new ColorList(this.OnResourceChanged, s);
            this.unkIID01         = br.ReadUInt64();
        }
Exemplo n.º 2
0
        public static void RegisterStyles(this PluginContainer pluginContainer, PluginStyleRegistry registry)
        {
            StyleList styles = new StyleList();

            pluginContainer.ExecuteMethod("RegisterStyles", styles);

            styles.ForEach(s => registry.Add(pluginContainer.Tag as Plugin, s.Url, psc => s.PageCondition(new StyleContext(psc))));
        }
Exemplo n.º 3
0
        private void AddStyles(HtmlFile h)
        {
            var styleEnumerator = StyleList.GetEnumerator();

            while (styleEnumerator.MoveNext())
            {
                h.AddStyle(styleEnumerator.Current.ToString());
            }
        }
Exemplo n.º 4
0
        static public bool CloneAttributeList(IAttributeListContainer From, IAttributeListContainer To, string ListName, bool Initialize)
        {
            IAttributeList toAdd = null;

            if (From != null)
            {
                toAdd = From.GetList(ListName);
                if (toAdd != null)
                {
                    toAdd = toAdd.Clone();
                }
            }
            if (toAdd == null)
            {
                switch (ListName)
                {
                case "ColorList":
                    toAdd = new ColorList();
                    break;

                case "LayerList":
                    toAdd = new LayerList();
                    break;

                case "HatchStyleList":
                    toAdd = new HatchStyleList();
                    break;

                case "DimensionStyleList":
                    toAdd = new DimensionStyleList();
                    break;

                case "LineWidthList":
                    toAdd = new LineWidthList();
                    break;

                case "LinePatternList":
                    toAdd = new LinePatternList();
                    break;

                case "StyleList":
                    toAdd = new StyleList();
                    break;

                default:
                    return(false);
                }
                if (Initialize)
                {
                    toAdd.Initialize();
                }
            }
            To.Add(ListName, toAdd);
            return(true);
        }
Exemplo n.º 5
0
 /// <summary>
 /// Constructor
 /// </summary>
 public BeerXmlData()
 {
     Equipment = new EquipmentList();
     Fermentables = new FermentableList();
     Hops = new HopList();
     Miscs = new MiscList();
     Recipes = new RecipeList();
     Styles = new StyleList();
     Waters = new WaterList();
     Yeasts = new YeastList();
 }
Exemplo n.º 6
0
        public void FilterCollection(string filteringSubstring)
        {
            filteringSubstring = filteringSubstring.Trim().ToLower();

            if (string.IsNullOrEmpty(filteringSubstring))
            {
                FilteredStylesList.Clear();
                return;
            }

            FilteredStylesList = StyleList.Where(x =>
                                                 x.Title.ToLower().Contains(filteringSubstring)).ToList();
        }
Exemplo n.º 7
0
        public async Task DeleteStyle(object style)
        {
            var styl = style as StyleModel;

            if (styl == null)
            {
                return;
            }

            await _stylesManager.RemoveStyle(styl.Id);

            StyleList.Remove(styl);
        }
Exemplo n.º 8
0
            public IEnumerable <IToken> ParagraphStyles(Document document)
            {
                var styleId = Styles.OfType <ListStyleId>().FirstOrDefault();

                if (styleId == null || !document.ListStyles.TryGetValue(styleId.Value, out var listStyle))
                {
                    return(Styles
                           .Where(t => !HtmlVisitor.IsSpanElement(t)));
                }

                var levelNum = Styles.OfType <ListLevelNumber>().FirstOrDefault() ?? new ListLevelNumber(0);
                var result   = new StyleList(listStyle.Style.Levels[levelNum.Value]
                                             .Where(t => t.Type == TokenType.ParagraphFormat));

                result.MergeRange(Styles
                                  .Where(t => !HtmlVisitor.IsSpanElement(t)));
                return(result);
            }
Exemplo n.º 9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     _theme = Request.QueryString["t"];
     if (!File.Exists(this.FullCurrentFileName))
     {
         Response.Redirect("Default.aspx");
     }
     _styleSheet = new StyleSheet();
     _styleSheet.ProcessFile(this.FullCurrentFileName);
     _stylesDocument = new XmlDocument();
     _stylesDocument.Load(Server.MapPath("~/App_Data/Styles.xml"));
     AbleCommerce.Code.PageHelper.SetPickImageButton(BackgroundImage_Style, BrowseBackgroundImageUrl);
     if (!Page.IsPostBack)
     {
         StyleList.DataBind();
         BindCssEditor();
     }
 }
Exemplo n.º 10
0
        public static DataSet GetStyleList()
        {
            DataSet    set;
            EntityData allStyleList = new EntityData();

            try
            {
                allStyleList = StyleList.GetAllStyleList();
                set          = allStyleList;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            finally
            {
                allStyleList.Dispose();
            }
            return(set);
        }
Exemplo n.º 11
0
        /// <summary>
        /// 分析对话内容
        /// </summary>
        /// <param name="runtime">脚本运行环境</param>
        /// <param name="raw">原始对话内容</param>
        /// <param name="language">语言(不提供则使用脚本运行环境的语言)</param>
        /// <returns></returns>
        public static (List <IDialogueItem> Content, bool NoWait, bool NoClear) CreateDialogueContent(ScriptRuntime runtime, IStringConverter raw, string language = null)
        {
            var result  = new List <IDialogueItem>();
            var content = new StringBuilder();
            var style   = new StyleList();
            var noWait  = false;
            var noClear = false;
            var i       = -1;

            language = language ?? runtime.ActiveLanguage;
            var data = raw.ConvertToString(language);

            if (data.StartsWith("[noclear]", StringComparison.OrdinalIgnoreCase))
            {
                noClear = true;
                i       = 8;
            }

            void FlushCache()
            {
                result.Add(style.Combine(content.ToString()));
                content.Clear();
            }

            void ApplyDefault(string command)
            {
                content.Append($"[{command}]");
            }

            for (; ++i < data.Length;)
            {
                switch (data[i])
                {
                // 转义字符
                case '\\' when i < data.Length - 1:
                    switch (data[i + 1])
                    {
                    case 'n':
                        content.Append('\n');
                        break;

                    case 't':
                        content.Append('\t');
                        break;

                    case 's':
                        content.Append(' ');
                        break;

                    default:
                        content.Append(data[i + 1]);
                        break;
                    }
                    ++i;
                    break;

                // 最后一个字符是[时的容错处理
                case '[' when i == data.Length - 1:
                    content.Append('[');
                    break;

                // 指令
                case '[':
                    var endIndex = data.IndexOf(']', i + 1);
                    if (endIndex <= i)       // 容错处理
                    {
                        content.Append('[');
                        break;
                    }
                    var command = data.Substring(i + 1, endIndex - i - 1);
                    i = endIndex;
                    if (string.IsNullOrEmpty(command))       // 空指令不处理
                    {
                        content.Append("[]");
                    }
                    else if (command.StartsWith("@#"))         // 常量
                    {
                        var constantName = command.Substring(2);
                        if (string.IsNullOrEmpty(constantName))
                        {
                            throw new ArgumentException($"Unable to create dialog command: missing constant name at {i}");
                        }
                        var constant = runtime.ActiveScope?.FindVariable(constantName, true, VariableSearchMode.OnlyConstant);
                        if (constant == null)
                        {
                            ApplyDefault(command);
                        }
                        else
                        {
                            content.Append(constant.Value is IStringConverter stringConverter ? stringConverter.ConvertToString() : constant.Value.ToString());
                        }
                    }
                    else if (command.StartsWith("@"))         // 变量
                    {
                        var variableName = command.Substring(1);
                        if (string.IsNullOrEmpty(variableName))
                        {
                            throw new ArgumentException($"Unable to create dialog command: missing variable name at {i}");
                        }
                        var variable = runtime.ActiveScope?.FindVariable(variableName, true, VariableSearchMode.All);
                        if (variable == null)
                        {
                            ApplyDefault(command);
                        }
                        else
                        {
                            content.Append(variable.Value is IStringConverter stringConverter ? stringConverter.ConvertToString() : variable.Value.ToString());
                        }
                    }
                    else
                    {
                        var commandContent = command.ToLower().Trim();
                        if (commandContent.StartsWith("size"))       // 字号
                        {
                            var parameter = ExtractParameter(commandContent);
                            var relative  = parameter.Value.Value.StartsWith("+") || parameter.Value.Value.StartsWith("-");
                            if (parameter.HasValue && float.TryParse(parameter.Value.Value, out var number))
                            {
                                FlushCache();
                                style.Size.AddLast((Mathf.RoundToInt(number), relative));
                            }
                            else
                            {
                                ApplyDefault(command);
                            }
                        }
                        else if (commandContent == "/size")         // 取消字号
                        {
                            if (style.Size.Any())
                            {
                                FlushCache();
                                style.Size.RemoveLast();
                            }
                            else
                            {
                                ApplyDefault(command);
                            }
                        }
                        else if (commandContent.StartsWith("color"))         // 颜色
                        {
                            var parameter = ExtractParameter(commandContent);
                            if (parameter.HasValue)
                            {
                                FlushCache();
                                style.Color.AddLast(parameter.Value.Value);
                            }
                            else
                            {
                                ApplyDefault(command);
                            }
                        }
                        else if (commandContent == "/color")         // 取消颜色
                        {
                            if (style.Color.Any())
                            {
                                FlushCache();
                                style.Color.RemoveLast();
                            }
                            else
                            {
                                ApplyDefault(command);
                            }
                        }
                        else if (commandContent.StartsWith("pause"))         // 暂停
                        {
                            if (commandContent == "pause")
                            {
                                FlushCache();
                                result.Add(new PauseDialogueItem {
                                    Time = null
                                });
                            }
                            else
                            {
                                var parameter = ExtractParameter(commandContent);
                                if (parameter.HasValue && float.TryParse(parameter.Value.Value, out var number))
                                {
                                    FlushCache();
                                    result.Add(new PauseDialogueItem {
                                        Time = number
                                    });
                                    break;
                                }
                                ApplyDefault(command);
                            }
                        }
                        else
                        {
                            switch (commandContent)
                            {
                            case "clear":     // 清空
                                FlushCache();
                                result.Add(new ClearDialogueItem());
                                break;

                            case "nowait":
                                if (i == data.Length - 1)
                                {
                                    noWait = true;
                                }
                                break;

                            default:
                                switch (command)
                                {
                                case "b":         // 粗体
                                    FlushCache();
                                    style.Bold = true;
                                    break;

                                case "/b":         // 取消粗体
                                    FlushCache();
                                    style.Bold = false;
                                    break;

                                case "i":         // 斜体
                                    FlushCache();
                                    style.Italic = true;
                                    break;

                                case "/i":         // 取消斜体
                                    FlushCache();
                                    style.Italic = false;
                                    break;

                                case "s":         // 删除线
                                    FlushCache();
                                    style.Strikethrough = true;
                                    break;

                                case "/s":         // 取消删除线
                                    FlushCache();
                                    style.Strikethrough = false;
                                    break;

                                case "u":         // 下划线
                                    FlushCache();
                                    style.Underline = true;
                                    break;

                                case "/u":         // 取消下划线
                                    FlushCache();
                                    style.Underline = false;
                                    break;

                                default:
                                    ApplyDefault(command);
                                    break;
                                }
                                break;
                            }
                        }
                    }
                    break;

                default:
                    content.Append(data[i]);
                    break;
                }
            }
            if (content.Length > 0)
            {
                result.Add(style.Combine(content.ToString()));
            }
            return(result, noWait, noClear);
        }
Exemplo n.º 12
0
 public void RegisterStyles(StyleList styles)
 {
     styles.Add("base.css", "ListForAdmin");
     styles.Add("base.css", "Item");
 }
Exemplo n.º 13
0
 public void AddStyle(string style)
 {
     StyleList.Add(style);
 }
Exemplo n.º 14
0
        void OnGUI()
        {
            if (_styles == null)
            {
                _styles = EnumerateStyles();
            }

            if (Style == null)
            {
                Style = GetStyle(null, GUIStyle.none);
            }

            if (Content == null)
            {
                ResetContent();
            }

            _splitter.OnGui();

            using (new GUILayout.AreaScope(_splitter.LeftSide))
            {
                using (var scroll = new EditorGUILayout.ScrollViewScope(_leftScrollPosition))
                {
                    using (var changes = new EditorGUI.ChangeCheckScope())
                    {
                        _selectedStyle = EditorGUILayout.Popup("Select Style", _selectedStyle, _styles.Names);

                        if (changes.changed)
                        {
                            Style = GetStyle(_styles.Skins[_selectedStyle], _styles.Styles[_selectedStyle]);
                        }
                    }

                    EditorGUILayout.LabelField("Positioning", EditorStyles.boldLabel);
                    Style.margin = RectOffsetField("Margin", Style.margin);

                    EditorGUILayout.LabelField("Sizing", EditorStyles.boldLabel);
                    Style.fixedWidth    = EditorGUILayout.FloatField("Fixed Width", Style.fixedWidth);
                    Style.fixedHeight   = EditorGUILayout.FloatField("Fixed Height", Style.fixedHeight);
                    Style.stretchWidth  = EditorGUILayout.Toggle("Stretch Width", Style.stretchWidth);
                    Style.stretchHeight = EditorGUILayout.Toggle("Stretch Height", Style.stretchHeight);

                    EditorGUILayout.LabelField("Background", EditorStyles.boldLabel);
                    Style.border               = RectOffsetField("Border", Style.border);
                    Style.overflow             = RectOffsetField("Overflow", Style.overflow);
                    Style.normal.background    = _normal.OnGui();
                    Style.onNormal.background  = _onNormal.OnGui();
                    Style.hover.background     = _hover.OnGui();
                    Style.onHover.background   = _onHover.OnGui();
                    Style.focused.background   = _focused.OnGui();
                    Style.onFocused.background = _onFocused.OnGui();
                    Style.active.background    = _active.OnGui();
                    Style.onActive.background  = _onActive.OnGui();

                    EditorGUILayout.LabelField("Content", EditorStyles.boldLabel);
                    Style.padding       = RectOffsetField("Padding", Style.padding);
                    Style.contentOffset = EditorGUILayout.Vector2Field("Content Offset", Style.contentOffset);
                    Style.clipping      = (TextClipping)EditorGUILayout.EnumPopup("Clipping", Style.clipping);

                    EditorGUILayout.LabelField("Text", EditorStyles.boldLabel);
                    Style.font                = (Font)EditorGUILayout.ObjectField("Font", Style.font, typeof(Font), false);
                    Style.fontSize            = EditorGUILayout.IntSlider("Size", Style.fontSize, 1, 200);
                    Style.fontStyle           = (FontStyle)EditorGUILayout.EnumPopup("Style", Style.fontStyle);
                    Style.alignment           = (TextAnchor)EditorGUILayout.EnumPopup("Alignment", Style.alignment);
                    Style.wordWrap            = EditorGUILayout.Toggle("Word Wrap", Style.wordWrap);
                    Style.richText            = EditorGUILayout.Toggle("Use Rich Text", Style.richText);
                    Style.normal.textColor    = EditorGUILayout.ColorField("Normal Color", Style.normal.textColor);
                    Style.onNormal.textColor  = EditorGUILayout.ColorField("On Normal Color", Style.onNormal.textColor);
                    Style.hover.textColor     = EditorGUILayout.ColorField("Hovered Color", Style.hover.textColor);
                    Style.onHover.textColor   = EditorGUILayout.ColorField("On Hovered Color", Style.onHover.textColor);
                    Style.focused.textColor   = EditorGUILayout.ColorField("Focused Color", Style.focused.textColor);
                    Style.onFocused.textColor = EditorGUILayout.ColorField("On Focused Color", Style.onFocused.textColor);
                    Style.active.textColor    = EditorGUILayout.ColorField("Active Color", Style.active.textColor);
                    Style.onActive.textColor  = EditorGUILayout.ColorField("On Active Color", Style.onActive.textColor);

                    EditorGUILayout.LabelField("Image", EditorStyles.boldLabel);
                    Style.imagePosition = (ImagePosition)EditorGUILayout.EnumPopup("Position", Style.imagePosition);

                    _leftScrollPosition = scroll.scrollPosition;
                }
            }

            using (new GUILayout.AreaScope(_splitter.RightSide))
            {
                using (var scroll = new EditorGUILayout.ScrollViewScope(_rightScrollPosition))
                {
                    EditorGUILayout.LabelField("Content", EditorStyles.boldLabel);

                    Content.image   = (Texture)EditorGUILayout.ObjectField("Image Content", Content.image, typeof(Texture), false);
                    Content.text    = GUILayout.TextArea(Content.text);
                    Color           = EditorGUILayout.ColorField("Color", Color);
                    BackgroundColor = EditorGUILayout.ColorField("Background Color", BackgroundColor);
                    ContentColor    = EditorGUILayout.ColorField("Content Color", ContentColor);

                    EditorGUILayout.LabelField("Layout Options", EditorStyles.boldLabel);

                    if (FloatLayoutOptionField("Width", Width, ref _useWidth, ref _width))
                    {
                        Width = _useWidth ? GUILayout.Width(_width) : null;
                    }
                    if (FloatLayoutOptionField("Height", Height, ref _useHeight, ref _height))
                    {
                        Height = _useHeight ? GUILayout.Height(_height) : null;
                    }
                    if (FloatLayoutOptionField("Minimum Width", MinWidth, ref _useMinWidth, ref _minWidth))
                    {
                        MinWidth = _useMinWidth ? GUILayout.MinWidth(_minWidth) : null;
                    }
                    if (FloatLayoutOptionField("Minimum Height", MinHeight, ref _useMinHeight, ref _minHeight))
                    {
                        MinHeight = _useMinHeight ? GUILayout.MinHeight(_minHeight) : null;
                    }
                    if (FloatLayoutOptionField("Maximum Width", MaxWidth, ref _useMaxWidth, ref _maxWidth))
                    {
                        MaxWidth = _useMaxWidth ? GUILayout.MaxWidth(_maxWidth) : null;
                    }
                    if (FloatLayoutOptionField("Maximum Height", MaxHeight, ref _useMaxHeight, ref _maxHeight))
                    {
                        MaxHeight = _useMaxHeight ? GUILayout.MaxHeight(_maxHeight) : null;
                    }
                    if (BoolLayoutOptionField("Expand Width", ExpandWidth, ref _useExpandWidth, ref _expandWidth))
                    {
                        ExpandWidth = _useExpandWidth ? GUILayout.ExpandWidth(_expandWidth) : null;
                    }
                    if (BoolLayoutOptionField("Expand Height", ExpandHeight, ref _useExpandHeight, ref _expandHeight))
                    {
                        ExpandHeight = _useExpandHeight ? GUILayout.ExpandHeight(_expandHeight) : null;
                    }

                    EditorGUILayout.LabelField("Preview", EditorStyles.boldLabel);
                    _previewControl = EditorGUILayout.Popup("Control Type", _previewControl, _controlTypes);
                    _useLayout      = EditorGUILayout.Toggle("Use Layout", _useLayout);

                    if (!_useLayout)
                    {
                        _area = EditorGUILayout.Vector2Field("Size", _area);
                    }

                    EditorHelper.Separator(Color.black);

                    var color           = GUI.color;
                    var backgroundColor = GUI.backgroundColor;
                    var contentColor    = GUI.contentColor;

                    GUI.color           = Color;
                    GUI.backgroundColor = BackgroundColor;
                    GUI.contentColor    = ContentColor;

                    var rect = new Rect();

                    if (!_useLayout)
                    {
                        rect        = GUILayoutUtility.GetRect(0, 0);
                        rect.width  = _area.x;
                        rect.height = _area.y;
                        GUI.DrawTexture(rect, Texture2D.whiteTexture);
                    }

                    switch (_previewControl)
                    {
                    case 0: DrawBox(rect); break;

                    case 1: DrawButton(rect); break;

                    case 2: DrawHorizontalScrollbar(rect); break;

                    case 3: DrawHorizontalSlider(rect); break;

                    case 4: DrawLabel(rect); break;

                    case 5: DrawPasswordField(rect); break;

                    case 6: DrawRepeatButton(rect); break;

                    case 7: DrawSelectionGrid(rect); break;

                    case 8: DrawTextArea(rect); break;

                    case 9: DrawTextField(rect); break;

                    case 10: DrawToggle(rect); break;

                    case 11: DrawToolbar(rect); break;

                    case 12: DrawVerticalScrollbar(rect); break;

                    case 13: DrawVerticalSlider(rect); break;

                    case 14: DrawWindow(rect); break;

                    case 15: DrawEditorBoundsField(rect); break;

                    case 16: DrawEditorBoundsIntField(rect); break;

                    case 17: DrawEditorColorField(rect); break;

                    case 18: DrawEditorCurveField(rect); break;

                    case 19: DrawEditorDoubleField(rect); break;

                    case 20: DrawEditorDropDownButton(rect); break;

                    case 21: DrawEditorDropShadowLabel(rect); break;

                    case 22: DrawEditorEnumFlagsField(rect); break;

                    case 23: DrawEditorEnumPopup(rect); break;

                    case 24: DrawEditorFloatField(rect); break;

                    case 25: DrawEditorFoldout(rect); break;

                    case 26: DrawEditorHelpBox(rect); break;

                    case 27: DrawEditorInspectorTitlebar(rect); break;

                    case 28: DrawEditorIntField(rect); break;

                    case 29: DrawEditorIntPopup(rect); break;

                    case 30: DrawEditorIntSlider(rect); break;

                    case 31: DrawEditorLabelField(rect); break;

                    case 32: DrawEditorLayerField(rect); break;

                    case 33: DrawEditorLongField(rect); break;

                    case 34: DrawEditorMaskField(rect); break;

                    case 35: DrawEditorMinMaxSlider(rect); break;

                    case 36: DrawEditorObjectField(rect); break;

                    case 37: DrawEditorPasswordField(rect); break;

                    case 38: DrawEditorPopup(rect); break;

                    case 39: DrawEditorPrefixLabel(rect); break;

                    case 40: DrawEditorProgressBar(rect); break;

                    case 41: DrawEditorRectField(rect); break;

                    case 42: DrawEditorRectIntField(rect); break;

                    case 43: DrawEditorSelectableLabel(rect); break;

                    case 44: DrawEditorSlider(rect); break;

                    case 45: DrawEditorTagField(rect); break;

                    case 46: DrawEditorTextArea(rect); break;

                    case 47: DrawEditorTextField(rect); break;

                    case 48: DrawEditorToggle(rect); break;

                    case 49: DrawEditorToggleLeft(rect); break;

                    case 50: DrawEditorVector2Field(rect); break;

                    case 51: DrawEditorVector2IntField(rect); break;

                    case 52: DrawEditorVector3Field(rect); break;

                    case 53: DrawEditorVector3IntField(rect); break;

                    case 54: DrawEditorVector4Field(rect); break;
                    }

                    GUI.color           = color;
                    GUI.backgroundColor = backgroundColor;
                    GUI.contentColor    = contentColor;

                    _rightScrollPosition = scroll.scrollPosition;
                }
            }
        }
Exemplo n.º 15
0
 public void RegisterStyles(StyleList styles)
 {
     styles.Add("base.css", "ListForAdmin");
     styles.Add("base.css", sc => sc.PageName == "Item" && sc.HttpContext.User.Identity.IsAuthenticated);
 }