コード例 #1
0
ファイル: Url.cs プロジェクト: helephant/dotless
 private TextNode AdjustUrlPath(TextNode textValue)
 {
     if (Importer != null)
     {
         textValue.Value = Importer.AlterUrl(textValue.Value, ImportPaths);
     }
     return textValue;
 }
コード例 #2
0
ファイル: TextButton.cs プロジェクト: nikita-sky/SkidiKit
 public TextButton(ButtonFrames frames, SpriteFont font, int textSize, string text)
     : base(frames)
 {
     _text = new TextNode(font, textSize)
     {
         Text = text
     };
     Icon = _text;
 }
コード例 #3
0
ファイル: TextManager.cs プロジェクト: FourFangedCow/UnityVN
 // Given new text node
 public void Activate(TextNode tn)
 {
     CurNode = tn;
     Active = true;
     WritingText = true;
     Chat.text = "";
     Name.text = CurNode.Name;
     WritingIndex = 0;
 }
コード例 #4
0
ファイル: Program.cs プロジェクト: Kerdek/scaling-tribble
        static void Main()
        {
			ImaginaryHost h = new ImaginaryHost();
			TextNode t = new TextNode(h);
			Node tn = (Node)t;

			MemoryStream s = new MemoryStream();
			h.SerializeTo(s);
			s.Position = 0;
			
            System.Windows.Forms.Application.Run();
        }
コード例 #5
0
ファイル: XmlDocumentReader.cs プロジェクト: hjyao/compound
 public Node Read(string xmlString)
 {
     Node node = null;
     if (xmlString.Contains("?xml"))
     {
         node = new XmlDeclarationNode {Name = "Declaration", Value = xmlString};
     }
     else if (xmlString.Contains("<!--"))
     {
         node = new CommentNode {Name = "Comment", Value = xmlString.Substring(4, xmlString.Length - 7)};
     }else if (xmlString.Contains("\\"))
     {
         node = new CommentNode {Name = "ScriptComment", Value = xmlString.Substring(2, xmlString.Length - 2)};
     }
     else if (xmlString.Contains("<Item>"))
     {
         node = new TextNode {Name = "Text", Value = xmlString.Substring(6, xmlString.Length - 13)};
     }else if (xmlString.ToLower().Contains("<script>"))
     {
         node = new TextNode {Name = "script", Value = xmlString.Substring(8, xmlString.Length - 17)};
     }
     return node;
 }
コード例 #6
0
ファイル: Url.cs プロジェクト: NickCraver/dotless
        public Url(TextNode value, IEnumerable<string> paths)
        {
            // The following block is commented out, because we want to have the path verbatim,
            // not rewritten. Here's why: Say less/trilogy_base.less contains
            //
            //   background-image: url(img/sprites.png)
            //
            // and serverfault/all.less contains
            //
            //   @import "../less/trilogy_base"
            //
            // If relative paths where to be rewritten, the resulting serverfault/all.css would read
            //
            //   background-image: url(../less/img/sprites.png)
            //
            // which is obviously not what we want.

            /*if (!Regex.IsMatch(value.Value, @"^(http:\/)?\/") && paths.Any())
            {
                value.Value = paths.Concat(new[] {value.Value}).AggregatePaths();
            }*/

            Value = value;
        }
コード例 #7
0
ファイル: Glob.cs プロジェクト: atczyc/ironruby
 internal override GlobNode/*!*/ AddChar(char c) {
     TextNode node = new TextNode(this);
     _nodes.Add(node);
     return node.AddChar(c);
 }
コード例 #8
0
 public void Test()
 {
     Text     = "hoge";
     TextNode = new TextNode();
 }
コード例 #9
0
ファイル: HtmlToXml.cs プロジェクト: jim-lightfoot/mondo
            /*********************************************************************/
            public void ProcessAttributes(string strAttributes)
            {
                strAttributes = TextNode.Normalize(strAttributes).Trim();

                if (strAttributes == "")
                {
                    return;
                }

                string         strName      = "";
                string         strValue     = "";
                bool           bHaveQuote   = false;
                bool           bSingleQuote = false;
                AttributeState eState       = AttributeState.Nothing;

                foreach (char chFind in strAttributes)
                {
                    switch (chFind)
                    {
                    case ' ':
                    {
                        switch (eState)
                        {
                        // Found whitespace
                        case AttributeState.Name:
                            eState = AttributeState.AfterName;
                            break;

                        case AttributeState.InValue:
                        {
                            if (bHaveQuote)
                            {
                                strValue += " ";
                            }
                            else
                            {
                                AddAttribute(strName, strValue);
                                strName  = "";
                                strValue = "";
                                eState   = AttributeState.Nothing;
                            }

                            break;
                        }

                        // Ignore white space here
                        case AttributeState.Nothing:
                        case AttributeState.StartValue:
                        case AttributeState.AfterName:
                        default:
                            break;
                        }

                        break;
                    }

                    case '=':
                    {
                        switch (eState)
                        {
                        case AttributeState.Name:
                        case AttributeState.AfterName:
                            eState = AttributeState.StartValue;
                            break;

                        case AttributeState.InValue:
                        {
                            if (bHaveQuote)
                            {
                                strValue += "+";
                            }

                            break;
                        }

                        default:
                            // ??? this is bad??? Ignore for now!
                            break;
                        }

                        break;
                    }

                    case '\'':
                    {
                        switch (eState)
                        {
                        case AttributeState.StartValue:
                            eState       = AttributeState.InValue;
                            bHaveQuote   = true;
                            bSingleQuote = true;
                            break;

                        case AttributeState.InValue:
                        {
                            if (bHaveQuote && !bSingleQuote)
                            {
                                strValue += "\'";
                            }
                            else if (bHaveQuote && bSingleQuote)
                            {
                                bSingleQuote = false;
                                bHaveQuote   = false;
                                AddAttribute(strName, strValue);
                                strName  = "";
                                strValue = "";
                                eState   = AttributeState.Nothing;
                            }

                            break;
                        }

                        default:
                            // ??? this is bad??? Ignore for now!
                            break;
                        }

                        break;
                    }

                    case '\"':
                    {
                        switch (eState)
                        {
                        case AttributeState.StartValue:
                            eState       = AttributeState.InValue;
                            bHaveQuote   = true;
                            bSingleQuote = false;
                            break;

                        case AttributeState.InValue:
                        {
                            if (bHaveQuote && bSingleQuote)
                            {
                                strValue += "\"";
                            }
                            else if (bHaveQuote && !bSingleQuote)
                            {
                                bSingleQuote = false;
                                bHaveQuote   = false;
                                AddAttribute(strName, strValue);
                                strName  = "";
                                strValue = "";
                                eState   = AttributeState.Nothing;
                            }

                            break;
                        }

                        default:
                            // ??? this is bad??? Ignore for now!
                            break;
                        }

                        break;
                    }

                    default:
                    {
                        switch (eState)
                        {
                        case AttributeState.AfterName:
                        {
                            AddAttribute(strName, strName.ToLower());
                            strName  = "";
                            strValue = "";
                            eState   = AttributeState.Nothing;
                            break;
                        }

                        case AttributeState.StartValue:
                            strValue = chFind.ToString();
                            eState   = AttributeState.InValue;
                            break;

                        case AttributeState.Nothing:
                            strName += chFind;
                            eState   = AttributeState.Name;
                            break;

                        case AttributeState.Name:
                            strName += chFind;
                            break;

                        case AttributeState.InValue:
                            strValue += chFind;
                            break;

                        default:
                            break;
                        }

                        break;
                    }
                    }
                }

                AddAttribute(strName, strValue);
                return;
            }
		public virtual void VisitText(TextNode textNode)
		{
			VisitChildren(textNode);
		}
コード例 #11
0
        /// <summary>
        /// 从网页版微博中获取微博信息
        /// </summary>
        /// <param name="fansList">保存爬得的粉丝数组</param>
        public void GetInfoFromHtml(List <Fan> fansList)
        {
            Lexer  lexer  = new Lexer(currentHtmlContent);
            Parser parser = new Parser(lexer);
            //获取包含每条微博的div标记列表
            NodeList fansNodeList = parser.Parse(fanFilter);

            for (int i = 0; i < fansNodeList.Size(); i++)
            {
                Fan fan = new Fan();
                //获取包含一个粉丝的<li>标记
                Bullet fanBullet = (Bullet)fansNodeList[i];

                #region 获取该粉丝头像
                NodeList fanPortraitNodeList = fanBullet.Children.ExtractAllNodesThatMatch(portraitFilter, true);
                if (fanPortraitNodeList.Size() == 1)
                {
                    Div      fanPortraitDiv = (Div)fanPortraitNodeList[0];
                    NodeList imgNodeList    = fanPortraitDiv.Children.ExtractAllNodesThatMatch(new NodeClassFilter(typeof(ImageTag)), true);
                    if (imgNodeList.Size() == 1)
                    {
                        ImageTag imgNode = (ImageTag)imgNodeList[0];
                        if (imgNode.Attributes.ContainsKey("SRC") && imgNode.Attributes.ContainsKey("ALT"))
                        {
                            string imgUrl  = imgNode.GetAttribute("SRC");
                            string imgName = imgNode.GetAttribute("ALT");
                            fan.Name = imgName;
                            WebClient wc = new WebClient();//使用WebClient是因为下载用户头像不用登录cookie
                            wc.DownloadFileAsync(new Uri(imgUrl), @"portrait\" + imgName + ".jpg");
                            wc.DownloadFileCompleted += wc_DownloadFileCompleted;
                        }
                        else
                        {
                            Console.WriteLine("第" + i + "个粉丝中,<img>标记缺少必要的属性!");
                        }
                    }
                    else
                    {
                        Console.WriteLine("第" + i + "个粉丝中,获取img标记出错!");
                    }
                }
                else
                {
                    Console.WriteLine("第" + i + "个粉丝中,获取粉丝头像的标准出错!");
                }
                #endregion

                #region 获取该粉丝的关注数/粉丝数/微博数
                NodeList fanConnectNodeList = fanBullet.Children.ExtractAllNodesThatMatch(fanConnectFilter, true);
                if (fanConnectNodeList.Size() == 1)
                {
                    NodeList ATagList = fanConnectNodeList[0].Children.ExtractAllNodesThatMatch(new NodeClassFilter(typeof(ATag)), true);
                    if (ATagList.Size() == 3)
                    {
                        for (int j = 0; j < 3; j++)
                        {
                            ATag aTag = (ATag)ATagList[j];
                            switch (j)
                            {
                            case 0:
                                if (aTag.Attributes.ContainsKey("HREF") && aTag.GetAttribute("HREF").Contains("follow"))
                                {
                                    fan.FollowCount = Int32.Parse(aTag.StringText);
                                }
                                else
                                {
                                    Console.WriteLine("第" + i + "个粉丝中,获取粉丝的关注数出错!");
                                }
                                break;

                            case 1:
                                if (aTag.Attributes.ContainsKey("HREF") && aTag.GetAttribute("HREF").Contains("fans"))
                                {
                                    fan.FansCount = Int32.Parse(aTag.StringText);
                                }
                                else
                                {
                                    Console.WriteLine("第" + i + "个粉丝中,获取粉丝的粉丝数出错!");
                                }
                                break;

                            default:
                                fan.FeedsCount = Int32.Parse(aTag.StringText);
                                break;
                            }
                        }
                    }
                    else
                    {
                        Console.WriteLine("第" + i + "个粉丝中,获取粉丝关注数/粉丝数/微博数的数量出错!");
                    }
                }
                else
                {
                    Console.WriteLine("第" + i + "个粉丝中,获取粉丝关注数/粉丝数/微博数的标准出错!");
                }
                #endregion

                #region 获取该粉丝的简介信息
                NodeList fanInfoNodeList = fanBullet.Children.ExtractAllNodesThatMatch(fanInfoFilter, true);
                if (fanInfoNodeList.Size() == 1)
                {
                    //Console.WriteLine(fanInfoNodeList[0].Parent.ToHtml());
                    Div    fanInfoDiv = (Div)fanInfoNodeList[0];
                    string intro      = fanInfoDiv.StringText;
                    if (intro.Substring(0, 2).Equals("简介"))
                    {
                        fan.Introduction = intro.Substring(3, intro.Length - 3).Replace("\n", " ").Replace("\t", " ");
                    }
                }
                else
                {
                    if (fanInfoNodeList.Size() == 0)
                    {
                        fan.Introduction = "";
                    }
                    else
                    {
                        Console.WriteLine("第" + i + "个粉丝中,获取粉丝简介的标准出错!");
                    }
                }
                #endregion

                #region 获取该粉丝的UserID、地点和性别信息;校验该粉丝的用户名信息
                NodeList fanLocationNodeList = fanBullet.Children.ExtractAllNodesThatMatch(fanNameFilter, true);
                if (fanLocationNodeList.Size() == 1)
                {
                    //获取粉丝的UserID信息;校验该粉丝的用户名信息
                    NodeList aTagNodeList = fanLocationNodeList[0].Children.ExtractAllNodesThatMatch(new NodeClassFilter(typeof(ATag)), true);
                    if (aTagNodeList.Size() >= 1)
                    {
                        ATag nameNode = (ATag)aTagNodeList[0];
                        if (nameNode.Attributes.ContainsKey("USERCARD") && nameNode.Attributes.ContainsKey("HREF"))
                        {
                            //获取粉丝的UserID信息
                            string uidStr = nameNode.GetAttribute("USERCARD");
                            if (uidStr.Substring(0, 3).Equals("id="))
                            {
                                fan.UserID = uidStr.Substring(3, uidStr.Length - 3);
                            }

                            //获取粉丝的微博链接
                            string linkUrl = nameNode.GetAttribute("HREF");
                            fan.LinkURL = "http://www.weibo.com" + linkUrl;
                        }
                        else
                        {
                            Console.WriteLine("第" + i + "个粉丝中,包含用户id和链接的<a>标记中缺少必要的属性!");
                        }
                        //校验该粉丝的用户名信息
                        if (!nameNode.StringText.Equals(fan.Name))
                        {
                            Console.WriteLine("第" + i + "个粉丝中,用户名与用户头像文字描述不一致!");
                        }
                    }

                    //获取粉丝的性别和地点信息
                    NodeList locationNodeList = fanLocationNodeList[0].Children.ExtractAllNodesThatMatch(new HasAttributeFilter("class", "addr"), true);
                    if (locationNodeList.Size() == 1)
                    {
                        string locationStr = "";
                        for (int j = 0; j < locationNodeList[0].Children.Size(); j++)
                        {
                            INode node = locationNodeList[0].Children[j];
                            if (node.GetType().Equals(typeof(TextNode)))
                            {
                                TextNode tNode = (TextNode)node;
                                locationStr += tNode.ToPlainTextString();
                            }
                            if (node.GetType().Equals(typeof(TagNode)))
                            {
                                TagNode tNode = (TagNode)node;
                                if (tNode.Attributes.ContainsKey("CLASS"))
                                {
                                    if (tNode.GetAttribute("CLASS").Contains("female"))//必须先female,因为female中也含有male,如果male在前,则所有用户均符合该条件了= =
                                    {
                                        fan.Gender = "female";
                                    }
                                    else
                                    {
                                        if (tNode.GetAttribute("CLASS").Contains("male"))
                                        {
                                            fan.Gender = "male";
                                        }
                                        else
                                        {
                                            fan.Gender = "unknown";
                                            Console.WriteLine("第" + i + "个粉丝性别不明!");
                                        }
                                    }
                                }
                            }
                        }
                        fan.Location = locationStr.Trim();
                    }
                    else
                    {
                        Console.WriteLine("第" + i + "个粉丝中,获取粉丝地点的标准出错!");
                    }
                }
                else
                {
                    Console.WriteLine("第" + i + "个粉丝中,获取该粉丝的UserID、地点和性别信息的标准出错!");
                }
                #endregion

                #region 获取该粉丝关注用户的方式
                NodeList followMethodNodeList = fanBullet.Children.ExtractAllNodesThatMatch(followMethodFilter, true);
                if (followMethodNodeList.Size() == 1)
                {
                    NodeList methodNodeList = followMethodNodeList[0].Children.ExtractAllNodesThatMatch(new NodeClassFilter(typeof(ATag)));
                    if (methodNodeList.Size() == 1)
                    {
                        ATag methodNode = (ATag)methodNodeList[0];
                        fan.FollowMethod = methodNode.StringText.Trim();
                    }
                    else
                    {
                        Console.WriteLine("第" + i + "个粉丝中,获取该粉丝关注用户的方式的数量出错!");
                    }
                }
                else
                {
                    Console.WriteLine("第" + i + "个粉丝中,获取该粉丝关注用户的方式的标准出错!");
                }
                #endregion

                fansList.Add(fan);
            }
        }
コード例 #12
0
ファイル: Glob.cs プロジェクト: MicroHealthLLC/mCleaner
 internal override GlobNode AddChar(char c)
 {
     var node = new TextNode(this);
     nodes.Add(node);
     return node.AddChar(c);
 }
コード例 #13
0
        public string ConvertFromCSharp(TextNode node)
        {
            var sb = new StringBuilder();

            if (node.Text == "List")
            {
                sb.Append(ConvertFromCSharp(node.Children[0]));
                sb.Append("[]");
            }
            else if (node.Text == "Dictionary")
            {
                sb.Append("{ [index:");
                sb.Append(ConvertFromCSharp(node.Children[0]));
                sb.Append("]: ");
                sb.Append(ConvertFromCSharp(node.Children[1]));
                sb.Append("; }");
            }
            else
            {
                sb.Append(TypeAlias(node.Text));
                if (node.Children.Count > 0)
                {
                    sb.Append("<");
                    for (var i = 0; i < node.Children.Count; i++)
                    {
                        var childNode = node.Children[i];

                        if (i > 0)
                            sb.Append(",");

                        sb.Append(ConvertFromCSharp(childNode));
                    }
                    sb.Append(">");
                }
            }

            return sb.ToString();
        }
コード例 #14
0
ファイル: GrammarWindow.cs プロジェクト: tedneward/katahdin
 private void AddNode(TreeIter parent, TextNode textNode)
 {
     store.AppendValues(parent, TextEscape.Quote(textNode.Text), textNode);
 }
コード例 #15
0
ファイル: Form1.cs プロジェクト: yyangrns/winforms-demos
        private void InitializeDiagram(SymbolPalette palette)
        {
            float x = 150;
            float y = 150;
            int   rowNodeCnt = 1, j = 0;

            string[] strRow = new string[] { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J" };

            TextNode txtNode = new TextNode("View and Change Seats", new RectangleF(250, 20, 400, 70));

            txtNode.FontColorStyle.Color  = Color.White;
            txtNode.FontStyle.Family      = "Arial";
            txtNode.FontStyle.Size        = 17;
            txtNode.HorizontalAlignment   = StringAlignment.Center;
            txtNode.FontStyle.Bold        = true;
            txtNode.LineStyle.LineColor   = Color.Transparent;
            txtNode.EditStyle.AllowSelect = false;
            diagram1.Model.AppendChild(txtNode);

            Group availSeats = new Group(palette.Nodes["Seat"] as Group);

            availSeats.Name                 = "availSeats";
            availSeats.PinPoint             = new PointF(250, 80);
            availSeats.Size                 = new SizeF(20, 20);
            availSeats.EditStyle.AllowMoveX = false;
            availSeats.EditStyle.AllowMoveY = false;
            UpdateEditStyle(availSeats);
            diagram1.Model.AppendChild(availSeats);
            TextNode availTNode = new TextNode("Available Seats", new RectangleF(265, 70, 90, 20));

            availTNode.FontStyle.Family      = "Arial";
            availTNode.FontColorStyle.Color  = Color.White;
            availTNode.FontStyle.Size        = 8;
            availTNode.VerticalAlignment     = StringAlignment.Center;
            availTNode.LineStyle.LineColor   = Color.Transparent;
            availTNode.EditStyle.AllowSelect = false;
            diagram1.Model.AppendChild(availTNode);

            Group bookedSeats = new Group(palette.Nodes["Seat"] as Group);

            bookedSeats.Name                 = "bookedSeats";
            bookedSeats.PinPoint             = new PointF(380, 80);
            bookedSeats.Size                 = new SizeF(20, 20);
            bookedSeats.EditStyle.AllowMoveX = false;
            bookedSeats.EditStyle.AllowMoveY = false;
            UpdateEditStyle(bookedSeats);
            foreach (Node node in bookedSeats.Nodes)
            {
                if (node is FilledPath)
                {
                    ((FilledPath)node).FillStyle.Color     = Color.FromArgb(134, 134, 134);
                    ((FilledPath)node).FillStyle.ForeColor = Color.FromArgb(163, 163, 163);
                    node.LineStyle.LineColor = Color.DarkGray;
                }
            }
            diagram1.Model.AppendChild(bookedSeats);
            TextNode bookedTNode = new TextNode("Booked Seats", new RectangleF(395, 70, 90, 20));

            bookedTNode.FontStyle.Family      = "Arial";
            bookedTNode.FontColorStyle.Color  = Color.White;
            bookedTNode.FontStyle.Size        = 8;
            bookedTNode.VerticalAlignment     = StringAlignment.Center;
            bookedTNode.LineStyle.LineColor   = Color.Transparent;
            bookedTNode.EditStyle.AllowSelect = false;
            diagram1.Model.AppendChild(bookedTNode);

            Group curSelSeats = new Group(palette.Nodes["Seat"] as Group);

            curSelSeats.PinPoint             = new PointF(500, 80);
            curSelSeats.Size                 = new SizeF(20, 20);
            curSelSeats.EditStyle.AllowMoveX = false;
            curSelSeats.EditStyle.AllowMoveY = false;
            UpdateEditStyle(curSelSeats);
            foreach (Node node in curSelSeats.Nodes)
            {
                if (node is FilledPath)
                {
                    ((FilledPath)node).FillStyle.Color     = Color.FromArgb(0, 155, 0);
                    ((FilledPath)node).FillStyle.ForeColor = Color.FromArgb(80, 255, 89);
                    node.LineStyle.LineColor = Color.Black;
                }
            }
            diagram1.Model.AppendChild(curSelSeats);
            TextNode CurSelTNode = new TextNode("Current Selection", new RectangleF(515, 70, 90, 20));

            CurSelTNode.FontStyle.Family      = "Arial";
            CurSelTNode.FontColorStyle.Color  = Color.White;
            CurSelTNode.FontStyle.Size        = 8;
            CurSelTNode.VerticalAlignment     = StringAlignment.Center;
            CurSelTNode.LineStyle.LineColor   = Color.Transparent;
            CurSelTNode.EditStyle.AllowSelect = false;
            diagram1.Model.AppendChild(CurSelTNode);

            for (int i = 1; i < 106; i++)
            {
                Group seatNode = new Group(palette.Nodes["Seat"] as Group);
                Syncfusion.Windows.Forms.Diagram.Label lbl = new Syncfusion.Windows.Forms.Diagram.Label(seatNode, i.ToString());
                lbl.FontStyle.Family     = "Arial";
                lbl.FontColorStyle.Color = Color.White;
                seatNode.Labels.Add(lbl);
                seatNode.Size                 = new SizeF(30, 30);
                seatNode.PinPoint             = new PointF(x, y);
                seatNode.EditStyle.AllowMoveX = false;
                seatNode.EditStyle.AllowMoveY = false;
                UpdateEditStyle(seatNode);
                seatNode.EditStyle.DefaultHandleEditMode = HandleEditMode.None;
                diagram1.Model.AppendChild(seatNode);
                seats.Add(seatNode);

                if (rowNodeCnt == 10)
                {
                    x = x + 80;
                }
                else
                {
                    x = x + 40;
                }

                if (rowNodeCnt == 15)
                {
                    Syncfusion.Windows.Forms.Diagram.Rectangle rowNode = new Syncfusion.Windows.Forms.Diagram.Rectangle(100, y - 10, 20, 20);
                    rowNode.FillStyle.Color       = Color.Goldenrod;
                    rowNode.FillStyle.ForeColor   = Color.Yellow;
                    rowNode.FillStyle.Type        = FillStyleType.LinearGradient;
                    rowNode.LineStyle.LineColor   = Color.Goldenrod;
                    rowNode.EditStyle.AllowSelect = false;
                    Syncfusion.Windows.Forms.Diagram.Label lbl1 = new Syncfusion.Windows.Forms.Diagram.Label(rowNode, strRow[j]);
                    lbl1.FontStyle.Family     = "Arial";
                    lbl1.FontColorStyle.Color = Color.Black;
                    rowNode.Labels.Add(lbl1);
                    diagram1.Model.AppendChild(rowNode);
                    x          = 150;
                    y          = y + 40;
                    rowNodeCnt = 0;
                    j++;
                }
                rowNodeCnt++;
            }
            Syncfusion.Windows.Forms.Diagram.Rectangle rect = new Syncfusion.Windows.Forms.Diagram.Rectangle(150, y + 40, 600, 50);
            rect.FillStyle.Color     = Color.WhiteSmoke;
            rect.LineStyle.LineColor = Color.LightGray;
            Syncfusion.Windows.Forms.Diagram.Label label = new Syncfusion.Windows.Forms.Diagram.Label(rect, "Screen this way");
            label.FontStyle.Bold   = true;
            label.FontStyle.Size   = 16;
            label.FontStyle.Family = "Segoe UI";
            rect.Labels.Add(label);
            diagram1.Model.AppendChild(rect);
            diagram1.BeginUpdate();
            ReserveSeats();
            diagram1.EndUpdate();
        }
コード例 #16
0
 public TextNodeContainer(ParseData parseData) : base(parseData, true)
 {
     Node = new TextNode <string>(parseData.Source, parseData.Value);
 }
コード例 #17
0
    public HeaderRectanglePlan()
    {
        Syncfusion.Windows.Forms.Diagram.Rectangle MainRect = new Syncfusion.Windows.Forms.Diagram.Rectangle(0, 0, 200, 150);
        MainRect.FillStyle.Color     = Color.White;
        MainRect.LineStyle.LineColor = Color.Black;

        Syncfusion.Windows.Forms.Diagram.Rectangle HeadContent = new Syncfusion.Windows.Forms.Diagram.Rectangle(MainRect.BoundingRectangle.Width / 2 - 50, -10, 100, 20);
        HeadContent.FillStyle.Color = Color.LightYellow;
        Syncfusion.Windows.Forms.Diagram.Label lbl = new Syncfusion.Windows.Forms.Diagram.Label();
        lbl.Text           = "Plan";
        lbl.SizeToNode     = true;
        lbl.Position       = Position.Center;
        lbl.FontStyle.Size = 12;
        lbl.FontStyle.Bold = true;
        HeadContent.Labels.Add(lbl);
        this.AppendChild(MainRect);
        this.AppendChild(HeadContent);

        Syncfusion.Windows.Forms.Diagram.Rectangle rects;
        rects = new Syncfusion.Windows.Forms.Diagram.Rectangle(15, 30, 10, 10);
        rects.FillStyle.Color     = Color.Yellow;
        rects.LineStyle.LineColor = Color.Black;
        this.AppendChild(rects);

        rects = new Syncfusion.Windows.Forms.Diagram.Rectangle(20, 35, 10, 10);
        rects.FillStyle.Color     = Color.Yellow;
        rects.LineStyle.LineColor = Color.Black;
        this.AppendChild(rects);

        RectangleF rect       = new RectangleF(40, 30, 150, 25);
        TextNode   txtContent = new TextNode("-Planning", rect);

        txtContent.BackgroundStyle.Color = Color.Transparent;
        txtContent.LineStyle.LineWidth   = 0;
        txtContent.FontStyle.Size        = 10;
        txtContent.ReadOnly            = true;
        txtContent.HorizontalAlignment = StringAlignment.Near;
        txtContent.VerticalAlignment   = StringAlignment.Center;
        this.AppendChild(txtContent);

        PointF[] pts = new PointF[] { new PointF(25, 5), new PointF(5, 5), new PointF(15, 15) };
        Syncfusion.Windows.Forms.Diagram.Polygon triangle = new Syncfusion.Windows.Forms.Diagram.Polygon(pts);
        triangle.PinPoint        = new PointF(15 + triangle.BoundingRectangle.Width / 2, 65);
        triangle.FillStyle.Color = Color.White;
        this.AppendChild(triangle);

        rect       = new RectangleF(40, 52.5f, 150, 25);
        txtContent = new TextNode("-Activity", rect);
        txtContent.BackgroundStyle.Color = Color.Transparent;
        txtContent.LineStyle.LineWidth   = 0;
        txtContent.FontStyle.Size        = 10;
        txtContent.ReadOnly            = true;
        txtContent.HorizontalAlignment = StringAlignment.Near;
        txtContent.VerticalAlignment   = StringAlignment.Center;
        this.AppendChild(txtContent);


        pts = new PointF[] { new PointF(15, 15), new PointF(0, 15), new PointF(5, 5), new PointF(10, 5), new PointF(10, 0), new PointF(15, 0) };
        Syncfusion.Windows.Forms.Diagram.PolylineNode star = new Syncfusion.Windows.Forms.Diagram.PolylineNode(pts);
        star.PinPoint            = new PointF(15 + triangle.BoundingRectangle.Width / 2, 88);
        star.LineStyle.LineColor = Color.Black;
        this.AppendChild(star);

        rect       = new RectangleF(40, 77.5f, 150, 25);
        txtContent = new TextNode("-StartUp", rect);
        txtContent.BackgroundStyle.Color = Color.Transparent;
        txtContent.LineStyle.LineWidth   = 0;
        txtContent.FontStyle.Size        = 10;
        txtContent.ReadOnly            = true;
        txtContent.HorizontalAlignment = StringAlignment.Near;
        txtContent.VerticalAlignment   = StringAlignment.Center;
        this.AppendChild(txtContent);

        Syncfusion.Windows.Forms.Diagram.Ellipse ellipse;
        ellipse = new Syncfusion.Windows.Forms.Diagram.Ellipse(18, 105, 15, 15);
        ellipse.FillStyle.Color     = Color.Blue;
        ellipse.LineStyle.LineWidth = 0;
        this.AppendChild(ellipse);

        ellipse = new Syncfusion.Windows.Forms.Diagram.Ellipse(20.5f, 107.5f, 10, 10);
        ellipse.FillStyle.Color     = Color.Gray;
        ellipse.LineStyle.LineWidth = 0;
        this.AppendChild(ellipse);

        rect       = new RectangleF(40, 100, 150, 25);
        txtContent = new TextNode("-Cost Savings Sort", rect);
        txtContent.BackgroundStyle.Color = Color.Transparent;
        txtContent.LineStyle.LineWidth   = 0;
        txtContent.FontStyle.Size        = 10;
        txtContent.ReadOnly            = true;
        txtContent.HorizontalAlignment = StringAlignment.Near;
        txtContent.VerticalAlignment   = StringAlignment.Center;
        this.AppendChild(txtContent);

        pts = new PointF[] { new PointF(0, 5), new PointF(5, 5), new PointF(10, 0), new PointF(15, 5), new PointF(20, 5), new PointF(15, 10), new PointF(20, 15), new PointF(15, 15), new PointF(10, 20), new PointF(5, 15), new PointF(0, 15), new PointF(5, 10), new PointF(0, 5) };
        Syncfusion.Windows.Forms.Diagram.Polygon star1 = new Syncfusion.Windows.Forms.Diagram.Polygon(pts);
        star1.PinPoint        = new PointF(17 + star1.BoundingRectangle.Width / 2, 140);
        star1.FillStyle.Color = Color.Gray;
        this.AppendChild(star1);

        rect       = new RectangleF(40, 127, 150, 25);
        txtContent = new TextNode("-Evaluate & Close", rect);
        txtContent.BackgroundStyle.Color = Color.Transparent;
        txtContent.LineStyle.LineWidth   = 0;
        txtContent.FontStyle.Size        = 10;
        txtContent.ReadOnly            = true;
        txtContent.HorizontalAlignment = StringAlignment.Near;
        txtContent.VerticalAlignment   = StringAlignment.Center;
        this.AppendChild(txtContent);
        this.EditStyle.AllowSelect = false;
    }
コード例 #18
0
ファイル: MainNode.cs プロジェクト: nanaka0012/BlackJack
        public MainNode()
        {
            Deck   = new Deck();
            Player = new Player(Deck);
            Dealer = new Dealer(Deck);

            //タイトル
            Title                = new SpriteNode();
            Title.Texture        = Texture2D.Load("resources/title.png");
            Title.Position       = Engine.WindowSize / 2;
            Title.CenterPosition = Title.ContentSize / 2;
            Title.ZOrder         = 5;
            AddChildNode(Title);

            //勝ち表示
            Win                = new SpriteNode();
            Win.Texture        = Texture2D.Load("resources/win.png");
            Win.Position       = Engine.WindowSize / 2;
            Win.CenterPosition = Win.ContentSize / 2;
            Win.ZOrder         = 10;
            Win.IsDrawn        = false;
            AddChildNode(Win);

            //負け表示
            Lose                = new SpriteNode();
            Lose.Texture        = Texture2D.Load("resources/lose.png");
            Lose.Position       = Engine.WindowSize / 2;
            Lose.CenterPosition = Lose.ContentSize / 2;
            Lose.ZOrder         = 10;
            Lose.IsDrawn        = false;
            AddChildNode(Lose);

            //引き分け
            Draw                = new SpriteNode();
            Draw.Texture        = Texture2D.Load("resources/draw.png");
            Draw.Position       = Engine.WindowSize / 2;
            Draw.CenterPosition = Draw.ContentSize / 2;
            Draw.ZOrder         = 10;
            Draw.IsDrawn        = false;
            AddChildNode(Draw);

            //バスト
            Bust                = new SpriteNode();
            Bust.Texture        = Texture2D.Load("resources/bust.png");
            Bust.Position       = Engine.WindowSize / 2;
            Bust.CenterPosition = Bust.ContentSize / 2;
            Bust.ZOrder         = 10;
            Bust.IsDrawn        = false;
            AddChildNode(Bust);

            //ブラックジャック
            Blackjack                = new SpriteNode();
            Blackjack.Texture        = Texture2D.Load("resources/jack.png");
            Blackjack.Position       = Engine.WindowSize / 2;
            Blackjack.CenterPosition = Blackjack.ContentSize / 2;
            Blackjack.ZOrder         = 10;
            Blackjack.IsDrawn        = false;
            AddChildNode(Blackjack);

            PCardPointSum                = new TextNode();
            PCardPointSum.Font           = Font.LoadDynamicFont("resources/mplus-1m-regular.ttf", 60);
            PCardPointSum.CenterPosition = PCardPointSum.ContentSize / 2;
            PCardPointSum.Position       = new Vector2F(520, 665);
            PCardPointSum.ZOrder         = 5;
            AddChildNode(PCardPointSum);

            DCardPointSum                = new TextNode();
            DCardPointSum.Font           = Font.LoadDynamicFont("resources/mplus-1m-regular.ttf", 60);
            DCardPointSum.CenterPosition = DCardPointSum.ContentSize / 2;
            DCardPointSum.Position       = new Vector2F(520, 83);
            DCardPointSum.ZOrder         = 5;
            DCardPointSum.Text           = "?";
            AddChildNode(DCardPointSum);

            RoundText                = new TextNode();
            RoundText.Text           = Round.ToString();
            RoundText.Font           = Font.LoadDynamicFont("resources/mplus-1m-regular.ttf", 70);
            RoundText.CenterPosition = RoundText.ContentSize / 2;
            RoundText.Position       = new Vector2F(837, 645);
            RoundText.ZOrder         = 2;
            AddChildNode(RoundText);

            //リザルトのマスク
            Mask                = new SpriteNode();
            Mask.Texture        = Texture2D.Load("resources/mask.png");
            Mask.Position       = Engine.WindowSize / 2;
            Mask.CenterPosition = Mask.ContentSize / 2;
            Mask.ZOrder         = 15;
            Mask.Color          = new Color(0, 0, 0, 0);
            AddChildNode(Mask);

            //リザルトのマスク
            Mask                = new SpriteNode();
            Mask.Texture        = Texture2D.Load("resources/mask.png");
            Mask.Position       = Engine.WindowSize / 2;
            Mask.CenterPosition = Mask.ContentSize / 2;
            Mask.ZOrder         = 15;
            Mask.Color          = new Color(0, 0, 0, 0);
            AddChildNode(Mask);

            //リザルトタイトル
            ResultTitle                = new SpriteNode();
            ResultTitle.Texture        = Texture2D.Load("resources/resultTitle.png");
            ResultTitle.Position       = new Vector2F(Engine.WindowSize.X / 2, Engine.WindowSize.Y / 5);
            ResultTitle.CenterPosition = ResultTitle.ContentSize / 2;
            ResultTitle.ZOrder         = 16;
            ResultTitle.IsDrawn        = false;
            AddChildNode(ResultTitle);

            //リザルトのPlayer, Dealer表示
            ResultHolder                = new SpriteNode();
            ResultHolder.Texture        = Texture2D.Load("resources/score.png");
            ResultHolder.Position       = new Vector2F(Engine.WindowSize.X / 2, Engine.WindowSize.Y / 2 - 70);
            ResultHolder.CenterPosition = ResultHolder.ContentSize / 2;
            ResultHolder.ZOrder         = 16;
            ResultHolder.IsDrawn        = false;
            AddChildNode(ResultHolder);

            //スコアの間の棒
            ResultBar                = new SpriteNode();
            ResultBar.Texture        = Texture2D.Load("resources/resultBar.png");
            ResultBar.Position       = Engine.WindowSize / 2;
            ResultBar.CenterPosition = ResultBar.ContentSize / 2;
            ResultBar.ZOrder         = 16;
            ResultBar.IsDrawn        = false;
            AddChildNode(ResultBar);

            //リザルトメッセージ
            ResultMessage          = new SpriteNode();
            ResultMessage.Position = new Vector2F(Engine.WindowSize.X / 2, (Engine.WindowSize.Y / 3) * 2 + 20);
            ResultMessage.ZOrder   = 16;
            AddChildNode(ResultMessage);

            //リザルトのスコア表示
            Score                = new TextNode();
            Score.Font           = Font.LoadDynamicFont("resources/mplus-1m-regular.ttf", 100);
            Score.CenterPosition = Score.ContentSize / 2;
            Score.Position       = Engine.WindowSize / 2;
            Score.ZOrder         = 16;
            Score.Text           = "";
            AddChildNode(Score);

            coroutine = PlayCoroutine(Update());
        }
コード例 #19
0
 public void VisitTextNode(TextNode element)
 {
     Console.WriteLine("visiting textnode" + element);
 }
コード例 #20
0
 public TreeTabScreen(TextNode node) : this()
 {
 }
コード例 #21
0
ファイル: WriterUtils.cs プロジェクト: aarondandy/pigeoid
 public bool Add(TextNode textNode)
 {
     if(Contains(textNode.Text)) {
         foreach (var child in Children) {
             if (child.Add(textNode)) {
                 return true;
             }
         }
         Children.Add(textNode);
         return true;
     }
     return false;
 }
コード例 #22
0
 internal virtual void Insert(Token.Character characterToken)
 {
     iText.StyledXmlParser.Jsoup.Nodes.Node node = new TextNode(characterToken.GetData(), baseUri);
     InsertNode(node);
 }
コード例 #23
0
ファイル: JcShellFormat.cs プロジェクト: watsug/JcShellFormat
        public string Evaluate()
        {
            IExpressionNode root = new TextNode(null);
            IExpressionNode node = root;

            for (int i = 0; i < _expr.Length; i++)
            {
                IExpressionNode tmp = null;

                switch (_expr[i])
                {
                case Tokens.VariableMark:
                {
                    // the next character exists, and is '{'
                    if (i + 1 < _expr.Length && _expr[i + 1] == Tokens.VariableStart)
                    {
                        // skip '{' - it belongs to '$'
                        tmp = new VariableNode(node, Resolve);
                        i++;
                    }
                    else
                    {
                        node = node.Push(_expr[i]);
                    }
                } break;

                case Tokens.VariableStart:
                    if (!_options.HasFlag(Options.LegacyVariables))
                    {
                        throw new JcShellFormatException("Legacy variables format is not enabled!");
                    }

                    tmp = new VariableNode(node, Resolve);
                    break;

                case Tokens.LengthMark:
                    tmp = new LengthNode(node);
                    break;

                case Tokens.LengthBerMark:
                    tmp = new BerLengthNode(node);
                    break;

                case Tokens.AsciiToHex:
                    if (node is AsciiToHexNode)
                    {
                        node = node.Parent;
                    }
                    else
                    {
                        tmp = new AsciiToHexNode(node);
                    }
                    break;

                default:
                    node = node.Push(_expr[i]);
                    break;
                }

                if (tmp == null)
                {
                    continue;
                }
                node.Push(tmp);
                node = tmp;
            }

            return(root.Evaluate());
        }
コード例 #24
0
 protected internal virtual SyntaxTreeNode Visit(TextNode node)
 {
     return(node);
 }
コード例 #25
0
ファイル: Url.cs プロジェクト: heinrichbreedt/dotless
 private TextNode AdjustUrlPath(TextNode textValue)
 {
     if (Importer != null && !Regex.IsMatch(textValue.Value, @"^(([a-zA-Z]+:)|(\/))"))
     {
         textValue.Value = Importer.AlterUrl(textValue.Value, ImportPaths);
     }
     return textValue;
 }
コード例 #26
0
 public void Reset()
 {
     index       = 0;
     currentNode = nodes[index];
 }
コード例 #27
0
 /// <summary>
 ///     Add a string for the system to draw. Strings are drawn in a FIFO basis, so calling this method
 ///     does not guarantee the string will immediately begin drawing.
 /// </summary>
 /// <param name="str">String to draw</param>
 /// <param name="delay">Optional param, to specify delay before the message is written</param>
 public void AcceptNodePackage(TextNode.NodePackage package, bool skipCurrent = false)
 {
     if (skipCurrent) { SkipCurrentSequence(); }
     toDisplay.Enqueue(package);
     PackageAddedToQueue();
 }
コード例 #28
0
        public void GetInfoFromHtml(int currentPage)
        {
            Lexer    lexer       = new Lexer(currentHtml);
            Parser   parser      = new Parser(lexer);
            NodeList poiHeadList = parser.Parse(poiListFilter);

            if (poiHeadList.Count == 1)
            {
                NodeList poiNodeList = poiHeadList[0].Children.ExtractAllNodesThatMatch(poiFilter, false);
                int      numCount    = 0;
                for (int i = 0; i < poiNodeList.Count; i++)
                {
                    POI poi = new POI();
                    DefinitionListBullet poiNode = (DefinitionListBullet)poiNodeList[i];
                    if (poiNode.TagName.Equals("DD"))
                    {
                        numCount++;
                        poi.Page   = currentPage;
                        poi.Number = numCount;
                        #region 获取口味、环境和服务评分,以及获取星级
                        NodeList tasteNodeList       = poiNode.Children.ExtractAllNodesThatMatch(tasteFilter, true);
                        NodeList environmentNodeList = poiNode.Children.ExtractAllNodesThatMatch(environmentFilter, true);
                        NodeList serviceNodeList     = poiNode.Children.ExtractAllNodesThatMatch(serviceFilter, true);
                        if (tasteNodeList.Count == 1 && environmentNodeList.Count == 1 && serviceNodeList.Count == 1)
                        {
                            Span spanNode = (Span)tasteNodeList[0];
                            if (!spanNode.ToPlainTextString().Equals("-"))
                            {
                                poi.TasteRemark = Int32.Parse(spanNode.ToPlainTextString());
                            }
                            spanNode = (Span)environmentNodeList[0];
                            if (!spanNode.ToPlainTextString().Equals("-"))
                            {
                                poi.EnvironmentRemark = Int32.Parse(spanNode.ToPlainTextString());
                            }
                            spanNode = (Span)serviceNodeList[0];
                            if (!spanNode.ToPlainTextString().Equals("-"))
                            {
                                poi.ServiceRemark = Int32.Parse(spanNode.ToPlainTextString());
                            }
                            #region 获取星级
                            INode rankNodeOfParent = spanNode.Parent.NextSibling.NextSibling;
                            if (rankNodeOfParent.Children != null && rankNodeOfParent.Children.Count >= 1)
                            {
                                INode rankNodeCandidate = rankNodeOfParent.Children[0];
                                if (rankNodeCandidate.GetType().Equals(typeof(Span)))
                                {
                                    Span   rankNode = (Span)rankNodeCandidate;
                                    string rank     = rankNode.GetAttribute("TITLE");
                                    if (rank.Contains("五"))
                                    {
                                        poi.Rank = 5;
                                    }
                                    else
                                    {
                                        if (rank.Contains("四"))
                                        {
                                            poi.Rank = 4;
                                        }
                                        else
                                        {
                                            if (rank.Contains("三"))
                                            {
                                                poi.Rank = 3;
                                            }
                                            else
                                            {
                                                if (rank.Contains("二"))
                                                {
                                                    poi.Rank = 2;
                                                }
                                                else
                                                {
                                                    if (rank.Contains("一"))
                                                    {
                                                        poi.Rank = 1;
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                            #endregion
                        }
                        else
                        {
                            Console.WriteLine("第" + i + "条POI中,判断口味、环境和服务的标准出错!");
                        }
                        #endregion
                        #region 获取平均消费
                        NodeList averageNodeList = poiNode.Children.ExtractAllNodesThatMatch(averageFilter, true);
                        if (averageNodeList.Count == 1)
                        {
                            INode averageNode = averageNodeList[0];
                            if (averageNode.NextSibling.NextSibling.GetType().Equals(typeof(TextNode)))
                            {
                                string cost = ((TextNode)averageNode.NextSibling.NextSibling).ToPlainTextString();
                                poi.AverageCost = Int32.Parse(cost);
                            }
                        }
                        else
                        {
                            Console.WriteLine("第" + i + "条POI中,判断平均消费的标准出错!");
                        }
                        #endregion
                        #region 获取点评数
                        NodeList commentNodeList = poiNode.Children.ExtractAllNodesThatMatch(commentFilter, true);
                        if (commentNodeList.Count == 1)
                        {
                            INode commentNode = commentNodeList[0];
                            if (commentNode.GetType().Equals(typeof(ATag)))
                            {
                                string commentNum = ((ATag)commentNode).StringText;
                                if (commentNum.Substring(commentNum.Length - 3, 3).Equals("封点评"))
                                {
                                    commentNum = commentNum.Substring(0, commentNum.Length - 3);
                                }
                                poi.CommentCount = Int32.Parse(commentNum);
                            }
                        }
                        else
                        {
                            Console.WriteLine("第" + i + "条POI中,判断点评数的标准出错!");
                        }
                        #endregion
                        #region 获取店名
                        NodeList nameNodeList = poiNode.Children.ExtractAllNodesThatMatch(nameFilter, true);
                        if (nameNodeList.Count == 1)
                        {
                            INode nameNode = nameNodeList[0];
                            if (nameNode.GetType().Equals(typeof(ATag)))
                            {
                                poi.Name = ((ATag)nameNode).StringText;
                            }
                        }
                        else
                        {
                            Console.WriteLine("第" + i + "条POI中,判断店名的标准出错!");
                        }
                        #endregion
                        #region 获取地址和电话
                        NodeList addressNodeList = poiNode.Children.ExtractAllNodesThatMatch(addressFilter, true);
                        if (addressNodeList.Count == 1)
                        {
                            NodeList districtNodeList = addressNodeList[0].Children.ExtractAllNodesThatMatch(new NodeClassFilter(typeof(ATag)));
                            if (districtNodeList.Count == 1)
                            {
                                ATag   districtTag = (ATag)districtNodeList[0];
                                string address     = districtTag.ToPlainTextString();
                                if (districtTag.NextSibling.GetType().Equals(typeof(TextNode)))
                                {
                                    TextNode detailAddressNode = (TextNode)districtTag.NextSibling;
                                    string   detailAddress     = detailAddressNode.ToPlainTextString();
                                    detailAddress = detailAddress.Trim();
                                    string phoneStr = detailAddress.Substring(detailAddress.Length - 8, 8);
                                    poi.Phone = phoneStr;
                                    address  += detailAddress.Substring(0, detailAddress.Length - 8);
                                }
                                char[] removeChrVector = { ' ', '\n', '\t' };
                                address = address.Trim(removeChrVector);
                                foreach (char c in removeChrVector)
                                {
                                    address = address.Replace(c.ToString(), "");
                                }
                                poi.Address = address;
                            }
                            else
                            {
                                Console.WriteLine("第" + i + "条POI中,判断含地址的<a>标记的标准出错!");
                            }
                        }
                        else
                        {
                            Console.WriteLine("第" + i + "条POI中,判断地址的标准出错!");
                        }
                        #endregion
                        #region 获取标签
                        NodeList tagsNodeList = poiNode.Children.ExtractAllNodesThatMatch(tagsFilter, true);
                        if (tagsNodeList.Count == 1)
                        {
                            INode tagsNode = tagsNodeList[0];
                            if (tagsNode.Children != null)
                            {
                                for (int j = 0; j < tagsNode.Children.Count; j++)
                                {
                                    INode node = tagsNode.Children[j];
                                    if (node.GetType().Equals(typeof(ATag)))
                                    {
                                        poi.Tags.Add(node.ToPlainTextString());
                                    }
                                }
                            }
                        }
                        else
                        {
                            Console.WriteLine("第" + i + "条POI中,判断标签的标准出错!");
                        }
                        #endregion
                        poiList.Add(poi);
                    }
                }
            }
            else
            {
                Console.WriteLine("获取POI列表出错");
            }
        }
コード例 #29
0
ファイル: CSharpOutputVisitor.cs プロジェクト: x-strong/ILSpy
		public void VisitText(TextNode textNode)
		{
			// unused
		}
コード例 #30
0
 protected virtual MarkdownNode VisitText(TextNode text) => text;
コード例 #31
0
ファイル: Bone.cs プロジェクト: LksWllmnn/Fusee
        private SceneContainer CreateGui()
        {
            var vsTex  = AssetStorage.Get <string>("texture.vert");
            var psTex  = AssetStorage.Get <string>("texture.frag");
            var psText = AssetStorage.Get <string>("text.frag");

            var canvasWidth  = Width / 100f;
            var canvasHeight = Height / 100f;

            var btnFuseeLogo = new GUIButton
            {
                Name = "Canvas_Button"
            };

            btnFuseeLogo.OnMouseEnter += BtnLogoEnter;
            btnFuseeLogo.OnMouseExit  += BtnLogoExit;
            btnFuseeLogo.OnMouseDown  += BtnLogoDown;

            var guiFuseeLogo = new Texture(AssetStorage.Get <ImageData>("FuseeText.png"));
            var fuseeLogo    = new TextureNode(
                "fuseeLogo",
                vsTex,
                psTex,
                //Set the albedo texture you want to use.
                guiFuseeLogo,
                //Define anchor points. They are given in percent, seen from the lower left corner, respectively to the width/height of the parent.
                //In this setup the element will stretch horizontally but stay the same vertically if the parent element is scaled.
                UIElementPosition.GetAnchors(AnchorPos.TopTopLeft),
                //Define Offset and therefor the size of the element.
                UIElementPosition.CalcOffsets(AnchorPos.TopTopLeft, new float2(0, canvasHeight - 0.5f), canvasHeight, canvasWidth, new float2(1.75f, 0.5f)),
                float2.One
                );

            fuseeLogo.AddComponent(btnFuseeLogo);

            var fontLato     = AssetStorage.Get <Font>("Lato-Black.ttf");
            var guiLatoBlack = new FontMap(fontLato, 24);

            var text = new TextNode(
                "FUSEE Picking Example",
                "ButtonText",
                vsTex,
                psText,
                UIElementPosition.GetAnchors(AnchorPos.StretchHorizontal),
                UIElementPosition.CalcOffsets(AnchorPos.StretchHorizontal, new float2(canvasWidth / 2 - 4, 0), canvasHeight, canvasWidth, new float2(8, 1)),
                guiLatoBlack,
                (float4)ColorUint.Greenery,
                HorizontalTextAlignment.Center,
                VerticalTextAlignment.Center);

            var canvas = new CanvasNode(
                "Canvas",
                CanvasRenderMode.Screen,
                new MinMaxRect
            {
                Min = new float2(-canvasWidth / 2, -canvasHeight / 2f),
                Max = new float2(canvasWidth / 2, canvasHeight / 2f)
            })
            {
                Children = new ChildList()
                {
                    //Simple Texture Node, contains the fusee logo.
                    fuseeLogo,
                    text
                }
            };

            return(new SceneContainer
            {
                Children = new List <SceneNode>
                {
                    //Add canvas.
                    canvas
                }
            });
        }
コード例 #32
0
ファイル: SvgTextElement.cs プロジェクト: djpnewton/ddraw
 public SvgTspanElement(string s, float x, float y)
 {
     TextNode tn = new TextNode(s);
     AddChild(tn);
     X=x;
     Y=y;
 }
コード例 #33
0
 public JsNode VisitText(TextNode node)
 {
     throw new NotImplementedException();
 }
コード例 #34
0
ファイル: JadeParser.cs プロジェクト: rnrn/Jade4Net
        private Node parseInclude()
        {
            Token token = expect(typeof (Include));
            Include includeToken = (Include) token;
            String templateName = includeToken.getValue().Trim();

            String extension = Path.GetExtension(templateName);
            if (!"".Equals(extension) && !"jade".Equals(extension))
            {
                FilterNode node = new FilterNode();
                node.setLineNumber(_jadeLexer.getLineno());
                node.setFileName(filename);
                node.setValue(extension);
                try
                {
                    TextReader reader = templateLoader.getReader(resolvePath(templateName));
                    Node textNode = new TextNode();
                    textNode.setFileName(filename);
                    textNode.setLineNumber(_jadeLexer.getLineno());
                    textNode.setValue(reader.ReadToEnd());
                    node.setTextBlock(textNode);
                }
                catch (IOException e)
                {
                    throw new JadeParserException(filename, _jadeLexer.getLineno(), templateLoader,
                        "the included file [" + templateName + "] could not be opened\n" + e.Message);
                }
                return node;
            }

            JadeParser jadeParser = createParser(templateName);
            jadeParser.setBlocks(blocks);
            contexts.AddLast(jadeParser);
            Node ast = jadeParser.parse();
            contexts.RemoveLast();

            if (peek() is Indent && ast is BlockNode)
            {
                ((BlockNode) ast).getIncludeBlock().push(block());
            }

            return ast;
        }
コード例 #35
0
 public BlockNode(TextNode owner)
 {
     this.owner = owner;
 }
コード例 #36
0
ファイル: JadeParser.cs プロジェクト: rnrn/Jade4Net
        private Node parseTextBlock()
        {
            TextNode textNode = new TextNode();
            textNode.setLineNumber(line());
            textNode.setFileName(filename);
            Token token = expect(typeof (Indent));
            Indent indentToken = (Indent) token;
            int spaces = indentToken.getIndents();
            if (null == this._spaces)
                this._spaces = spaces;
            String indentStr = StringUtils.repeat(" ", spaces - this._spaces.Value);
            while (!(peek() is Outdent))
            {
                if (peek() is Eos)
                    break;

                if (peek() is Newline)
                {
                    textNode.appendText("\n");
                    this.nextToken();
                }
                else if (peek() is Indent)
                {
                    textNode.appendText("\n");
                    textNode.appendText(this.parseTextBlock().getValue());
                    textNode.appendText("\n");
                }
                else
                {
                    textNode.appendText(indentStr + this.nextToken().getValue());
                }
            }

            if (spaces == this._spaces)
                this._spaces = null;

            if (peek() is Eos)
                return textNode;
            token = expect(typeof(Outdent));
            return textNode;
        }
コード例 #37
0
ファイル: WriterUtils.cs プロジェクト: aarondandy/pigeoid
        public static void WriteWordLookUp(EpsgData data, BinaryWriter textWriter, BinaryWriter indexWriter)
        {
            var roots = new List<TextNode>();
            foreach(var text in data.WordLookUpList) {
                var containerRoot = TextNode.FindContainingRoot(roots, text);
                if(null == containerRoot) {
                    containerRoot = new TextNode(text);
                    var containedRoots = roots.Where(r => containerRoot.Contains(r.Text)).ToList();
                    foreach(var containedRoot in containedRoots) {
                        roots.Remove(containedRoot);
                        if(!containerRoot.Add(containedRoot)) {
                            throw new InvalidOperationException();
                        }
                    }
                    roots.Add(containerRoot);
                }else {
                    if(!containerRoot.Add(text)) {
                        throw new InvalidOperationException();
                    }
                }
            }

            for (int quality = Math.Min(6,roots.Select(x => x.Text.Length).Max()/2); quality >= 0; quality--) {
                for (int i = 0; i < roots.Count; i++) {
                    for (int j = i + 1; j < roots.Count; j++) {
                        int overlapAt = StringUtils.OverlapIndex(roots[i].Text, roots[j].Text);
                        if (overlapAt >= 0 && (roots[i].Text.Length - overlapAt) >= quality) {
                            var newText = roots[i].Text.Substring(0, overlapAt) + roots[j].Text;
                            var newNode = new TextNode(newText, new[]{roots[i], roots[j]});
                            roots.RemoveAt(j);
                            roots[i] = newNode;
                            i--;
                            break;
                        }
                        overlapAt = StringUtils.OverlapIndex(roots[j].Text, roots[i].Text);
                        if (overlapAt >= 0 && (roots[j].Text.Length - overlapAt) >= quality) {
                            var newText = roots[j].Text.Substring(0, overlapAt) + roots[i].Text;
                            var newNode = new TextNode(newText, new[]{roots[j], roots[i]});
                            roots.RemoveAt(j);
                            roots[i] = newNode;
                            i--;
                            break;
                        }
                    }
                }
            }

            var offsetLookUp = new Dictionary<string, int>();
            int rootOffset = 0;
            foreach(var root in roots) {
                var rootText = root.Text;
                var rootBytes = Encoding.UTF8.GetBytes(rootText);
                textWriter.Write(rootBytes);
                foreach(var text in root.GetAllString()) {
                    int startIndex = rootText.IndexOf(text, StringComparison.Ordinal);
                    var localOffset = Encoding.UTF8.GetByteCount(rootText.Substring(0, startIndex));
                    offsetLookUp.Add(text, rootOffset + localOffset);
                }
                rootOffset += rootBytes.Length;
            }

            foreach(var word in data.WordLookUpList) {
                indexWriter.Write((ushort)offsetLookUp[word]);
                indexWriter.Write((byte)(Encoding.UTF8.GetByteCount(word)));
            }
        }
コード例 #38
0
ファイル: SvgTitleElement.cs プロジェクト: djpnewton/ddraw
 public SvgTitleElement()
 {
     TextNode tn = new TextNode("");
     AddChild(tn);
 }
コード例 #39
0
ファイル: NodeVisitor.cs プロジェクト: yhtsnda/spark
 protected override void Visit(TextNode node)
 {
     Nodes.Add(node);
 }
コード例 #40
0
        public virtual INode CreateNode(PseudoList item)
        {
            if (item == null)
            {
                throw new ArgumentNullException(nameof(item));
            }

            try
            {
                var   car = item.GetCarSymbolName();
                INode node;

                switch (car)
                {
                case "EXACT-TEXT":
                    node = new ExactTextNode(
                        item.GetSingleKeywordArgument <StringAtom>(":value").Value,
                        this.ParseTextClasses(item.GetAllKeywordArguments(":classes")),
                        _isCaseSensitive,
                        null,
                        this.NodeFamily,
                        item.GetItemName());
                    break;

                case "SOME-TEXT":
                    node = new TextNode(
                        this.ParseTextClasses(item.GetAllKeywordArguments(":classes")),
                        null,
                        this.NodeFamily,
                        item.GetItemName());
                    break;

                case "MULTI-TEXT":
                    node = new MultiTextNode(
                        item.GetAllKeywordArguments(":values").Cast <StringAtom>().Select(x => x.Value),
                        this.ParseTextClasses(item.GetAllKeywordArguments(":classes")),
                        _isCaseSensitive,
                        null,
                        this.NodeFamily,
                        item.GetItemName());
                    break;

                case "EXACT-PUNCTUATION":
                    node = new ExactPunctuationNode(
                        item.GetSingleKeywordArgument <StringAtom>(":value").Value.Single(),
                        null,
                        this.NodeFamily,
                        item.GetItemName());
                    break;

// todo: some-number?
                case "SOME-INTEGER":
                    node = new IntegerNode(
                        null,
                        this.NodeFamily,
                        item.GetItemName());
                    break;

                case "FALLBACK":
                    var name = item.GetItemName();
                    if (name == null)
                    {
                        throw new BuildingException("Fallback node must have a name.");
                    }

                    node = new FallbackNode(
                        this.CreateFallbackPredicate(name),
                        this.NodeFamily,
                        name);

                    break;

                default:
                    return(null);
                }

                return(node);
            }
            catch (Exception ex)
            {
                throw new BuildingException($"Could not build a node from item {item}.", ex);
            }
        }
コード例 #41
0
 public void VisitTextNode(TextNode textNode)
 {
     throw new NotImplementedException();
 }
コード例 #42
0
ファイル: DrawnNode.cs プロジェクト: nasa03/Altseed2-csharp
        public void Anchor()
        {
            var tc = new TestCore(new Configuration()
            {
                VisibleTransformInfo = true
            });

            tc.Init();

            var font = Font.LoadDynamicFont("TestData/Font/mplus-1m-regular.ttf", 30);

            Assert.NotNull(font);

            var texture = Texture2D.Load(@"TestData/IO/AltseedPink.png");

            Assert.NotNull(texture);

            var sprite = new SpriteNode();

            sprite.Texture = texture;
            sprite.ZOrder  = 5;

            Vector2F rectSize = texture.Size;
            var      parent   = new AnchorTransformerNode();

            parent.Position   = Engine.WindowSize / 2;
            parent.Size       = rectSize;
            parent.AnchorMode = AnchorMode.Fill;
            Engine.AddNode(sprite);
            sprite.AddChildNode(parent);

            var sprite2 = new SpriteNode();

            sprite2.Texture = texture;
            sprite2.Color   = new Color(255, 0, 0, 200);
            sprite2.ZOrder  = 10;

            var child = new AnchorTransformerNode();

            child.Position            = rectSize / 2;
            child.Pivot               = new Vector2F(0.5f, 0.5f);
            child.AnchorMin           = new Vector2F(0.0f, 0.0f);
            child.AnchorMax           = new Vector2F(1f, 1f);
            child.HorizontalAlignment = HorizontalAlignment.Left;
            child.VerticalAlignment   = VerticalAlignment.Center;
            child.Size       = sprite2.ContentSize;
            child.AnchorMode = AnchorMode.KeepAspect;
            sprite.AddChildNode(sprite2);
            sprite2.AddChildNode(child);

            var text = new TextNode();

            text.Font   = font;
            text.Color  = new Color(0, 0, 0);
            text.Text   = "あいうえお";
            text.ZOrder = 15;

            var childText = new AnchorTransformerNode();

            childText.Pivot     = new Vector2F(0.5f, 0.5f);
            childText.AnchorMin = new Vector2F(0.5f, 0.5f);
            childText.AnchorMax = new Vector2F(0.5f, 0.5f);
            childText.Size      = text.ContentSize;
            //childText.HorizontalAlignment = HorizontalAlignment.Center;
            //childText.VerticalAlignment = VerticalAlignment.Center;
            childText.AnchorMode = AnchorMode.ContentSize;
            sprite2.AddChildNode(text);
            text.AddChildNode(childText);

            var text2 = new TextNode()
            {
                Font   = font,
                Text   = "",
                ZOrder = 10,
                Scale  = new Vector2F(0.8f, 0.8f),
                Color  = new Color(255, 128, 0)
            };

            Engine.AddNode(text2);

            tc.Duration = 10000;

            string infoText(AnchorTransformerNode n) =>
            $"Scale:{n.Scale}\n" +
            $"Position:{n.Position}\n" +
            $"Pivot:{n.Pivot}\n" +
            $"Size:{n.Size}\n" +
            $"Margin: LT:{n.LeftTop} RB:{n.RightBottom}\n" +
            $"Anchor: {n.AnchorMin} {n.AnchorMax}\n";

            tc.LoopBody(c =>
            {
                if (Engine.Keyboard.GetKeyState(Key.Right) == ButtonState.Hold)
                {
                    rectSize.X += 1.5f;
                }
                if (Engine.Keyboard.GetKeyState(Key.Left) == ButtonState.Hold)
                {
                    rectSize.X -= 1.5f;
                }
                if (Engine.Keyboard.GetKeyState(Key.Down) == ButtonState.Hold)
                {
                    rectSize.Y += 1.5f;
                }
                if (Engine.Keyboard.GetKeyState(Key.Up) == ButtonState.Hold)
                {
                    rectSize.Y -= 1.5f;
                }

                if (Engine.Keyboard.GetKeyState(Key.D) == ButtonState.Hold)
                {
                    parent.Position += new Vector2F(1.5f, 0);
                }
                if (Engine.Keyboard.GetKeyState(Key.A) == ButtonState.Hold)
                {
                    parent.Position += new Vector2F(-1.5f, 0);
                }
                if (Engine.Keyboard.GetKeyState(Key.S) == ButtonState.Hold)
                {
                    parent.Position += new Vector2F(0, 1.5f);
                }
                if (Engine.Keyboard.GetKeyState(Key.W) == ButtonState.Hold)
                {
                    parent.Position += new Vector2F(0, -1.5f);
                }

                if (Engine.Keyboard.GetKeyState(Key.Q) == ButtonState.Hold)
                {
                    child.Angle += 1.5f;
                }
                if (Engine.Keyboard.GetKeyState(Key.E) == ButtonState.Hold)
                {
                    child.Angle -= 1.5f;
                }

                if (Engine.Keyboard.GetKeyState(Key.Z) == ButtonState.Hold)
                {
                    parent.Scale += new Vector2F(0.1f, 0);
                }
                if (Engine.Keyboard.GetKeyState(Key.C) == ButtonState.Hold)
                {
                    parent.Scale -= new Vector2F(0.1f, 0);
                }

                parent.Size = rectSize;

                text2.Text = infoText(parent) + '\n' + infoText(child) + '\n' + infoText(childText);
            }, null);

            tc.End();
        }
コード例 #43
0
ファイル: JadeParser.cs プロジェクト: rnrn/Jade4Net
 private Node parseText()
 {
     Token token = expect(typeof (Text))
     ;
     Node node = new TextNode();
     node.setValue(token.getValue());
     node.setLineNumber(token.getLineNumber());
     node.setFileName(filename);
     return node;
 }
コード例 #44
0
        private void InitializeComponents()
        {
            this.usernameTb = new TextBox(
                this.Position + new Vector2(20, 20),
                new Vector2(200, 30),
                Color.Black,
                Color.White);

            this.passwordTb = new TextBox(
                this.Position + new Vector2(20, 60),
                new Vector2(200, 30),
                Color.Black,
                Color.White);

            this.confirmPasswordTb = new TextBox(
                this.Position + new Vector2(20, 100),
                new Vector2(200, 30),
                Color.Black,
                Color.White);


            var usernameTbDefaultTextNode = new TextNode(
                this.usernameTb,
                new Vector2(30, 0),
                Vector2.One,
                "Username",
                SpriteFontManager.Instance.GetFont("Arial_Italic_22"),
                Color.Gray);

            var passwordDefaultTextNode = new TextNode(
                this.passwordTb,
                new Vector2(30, 0),
                Vector2.One,
                "Password",
                SpriteFontManager.Instance.GetFont("Arial_Italic_22"),
                Color.Gray);

            var passwordConfirmDefaultTextNode = new TextNode(
                this.confirmPasswordTb,
                new Vector2(5, 5),
                new Vector2(0.8f, 0.8f),
                "Confirm Password",
                SpriteFontManager.Instance.GetFont("Arial_Italic_22"),
                Color.Gray);

            var usernameTbPartialTextNode = new PartialTextNode(
                this.usernameTb,
                new Vector2(8, 0),
                Vector2.One,
                SpriteFontManager.Instance.GetFont("Arial_22"),
                Color.Black,
                12,
                12);

            var passwordTbPartialTextNode = new PasswordTextNode(
                this.passwordTb,
                new Vector2(15, 3),
                Vector2.One,
                SpriteFontManager.Instance.GetFont("Arial_26"),
                Color.Black,
                12,
                '*',
                12);

            var passwordConfirmTbPartialTextNode = new PasswordTextNode(
                this.confirmPasswordTb,
                new Vector2(15, 3),
                Vector2.One,
                SpriteFontManager.Instance.GetFont("Arial_26"),
                Color.Black,
                12,
                '*',
                12);


            this.usernameTb.DefaultTextNode        = usernameTbDefaultTextNode;
            this.passwordTb.DefaultTextNode        = passwordDefaultTextNode;
            this.confirmPasswordTb.DefaultTextNode = passwordConfirmDefaultTextNode;

            this.usernameTb.TextNode        = usernameTbPartialTextNode;
            this.passwordTb.TextNode        = passwordTbPartialTextNode;
            this.confirmPasswordTb.TextNode = passwordConfirmTbPartialTextNode;


            this.TextBoxes.Add(this.usernameTb);
            this.TextBoxes.Add(this.passwordTb);
            this.TextBoxes.Add(this.confirmPasswordTb);

            this.registerButton = new Button(
                this.Position + new Vector2(20, 140),
                PointTextures.TransparentBlackPoint,
                new Vector2(200, 30),
                Color.Black,
                2,
                () =>
            {
                if (string.IsNullOrWhiteSpace(this.usernameTb.TextNode.TextContent))
                {
                    this.usernameEmpty       = true;
                    this.passwordEmpty       = false;
                    this.passwordsDoNotMatch = false;
                }
                else if (string.IsNullOrWhiteSpace(this.passwordTb.TextNode.TextContent))
                {
                    this.passwordEmpty       = true;
                    this.passwordsDoNotMatch = false;
                    this.usernameEmpty       = false;
                }
                else if (this.passwordTb.TextNode.TextContent == this.confirmPasswordTb.TextNode.TextContent)
                {
                    UsersManager.RegisterUser(
                        this.usernameTb.TextNode.TextContent,
                        this.passwordTb.TextNode.TextContent);
                }
                else
                {
                    this.passwordsDoNotMatch = true;
                    this.passwordEmpty       = false;
                    this.usernameEmpty       = false;
                }
            });

            var registerButtonTextNode = new TextNode(this.registerButton, new Vector2(50, 0), Vector2.One, "Register", SpriteFontManager.Instance.GetFont("Arial_22"), Color.White);

            this.registerButton.TextNode = registerButtonTextNode;

            this.Buttons.Add(this.registerButton);
        }
コード例 #45
0
ファイル: SvgTitleElement.cs プロジェクト: djpnewton/ddraw
 public SvgDescElement()
 {
     TextNode tn = new TextNode("");
     AddChild(tn);
 }
コード例 #46
0
ファイル: NodeExtensions.cs プロジェクト: ananace/FList-sharp
 public static Inline ToInline(this TextNode node, Channel chan = null)
 {
     return(new Run(node.Text));
 }
コード例 #47
0
ファイル: SvgTitleElement.cs プロジェクト: djpnewton/ddraw
 public SvgTitleElement(string s)
 {
     TextNode tn = new TextNode(s);
     AddChild(tn);
 }
コード例 #48
0
ファイル: GridGroup.cs プロジェクト: zuozhu315/winforms-demos
    public GridGroup()
    {
        Syncfusion.Windows.Forms.Diagram.Rectangle nodeRectBorder = new Syncfusion.Windows.Forms.Diagram.Rectangle(0, 0, 350, 50);
        nodeRectBorder.FillStyle.Color     = Color.LightBlue;
        nodeRectBorder.LineStyle.LineWidth = 1;
        //Row1
        RectangleF rect;

        rect = new RectangleF(0, 0, 70, 20);
        TextNode r1c1 = new TextNode("Rev #", rect);

        r1c1.BackgroundStyle.Color = Color.Gray;
        r1c1.FontColorStyle.Color  = Color.White;
        r1c1.LineStyle.LineWidth   = 1;
        r1c1.FontStyle.Size        = 11;
        r1c1.ReadOnly            = true;
        r1c1.HorizontalAlignment = StringAlignment.Center;

        rect = new RectangleF(70, 0, 120, 20);
        TextNode r1c2 = new TextNode("Revison Date", rect);

        r1c2.BackgroundStyle.Color = Color.Gray;
        r1c2.FontColorStyle.Color  = Color.White;
        r1c2.LineStyle.LineWidth   = 1;
        r1c2.FontStyle.Size        = 11;
        r1c2.ReadOnly            = true;
        r1c2.HorizontalAlignment = StringAlignment.Center;
        rect = new RectangleF(190, 0, 150, 20);
        TextNode r1c3 = new TextNode("Reason", rect);

        r1c3.BackgroundStyle.Color = Color.Gray;
        r1c3.FontColorStyle.Color  = Color.White;
        r1c3.LineStyle.LineWidth   = 1;
        r1c3.FontStyle.Size        = 11;
        r1c3.ReadOnly            = true;
        r1c3.HorizontalAlignment = StringAlignment.Center;
        rect = new RectangleF(340, 0, 100, 20);
        TextNode r1c4 = new TextNode("Who", rect);

        r1c4.BackgroundStyle.Color = Color.Gray;
        r1c4.FontColorStyle.Color  = Color.White;
        r1c4.LineStyle.LineWidth   = 1;
        r1c4.FontStyle.Size        = 11;
        r1c4.ReadOnly            = true;
        r1c4.HorizontalAlignment = StringAlignment.Center;
        //Row2
        rect = new RectangleF(0, 20, 70, 20);
        TextNode r2c1 = new TextNode("", rect);

        r2c1.BackgroundStyle.Color = Color.White;
        r2c1.LineStyle.LineWidth   = 1;
        r2c1.FontStyle.Size        = 11;


        rect = new RectangleF(70, 20, 120, 20);
        TextNode r2c2 = new TextNode("", rect);

        r2c2.BackgroundStyle.Color = Color.White;
        r2c2.LineStyle.LineWidth   = 1;
        r2c2.FontStyle.Size        = 11;


        rect = new RectangleF(190, 20, 150, 20);
        TextNode r2c3 = new TextNode("", rect);

        r2c3.BackgroundStyle.Color = Color.White;
        r2c3.LineStyle.LineWidth   = 1;
        r2c3.FontStyle.Size        = 11;


        rect = new RectangleF(340, 20, 100, 20);
        TextNode r2c4 = new TextNode("", rect);

        r2c4.BackgroundStyle.Color = Color.White;
        r2c4.LineStyle.LineWidth   = 1;
        r2c4.FontStyle.Size        = 11;

        //Row3
        rect = new RectangleF(0, 40, 70, 20);
        TextNode r3c1 = new TextNode("", rect);

        r3c1.BackgroundStyle.Color = Color.White;
        r3c1.LineStyle.LineWidth   = 1;
        r3c1.FontStyle.Size        = 11;


        rect = new RectangleF(70, 40, 120, 20);
        TextNode r3c2 = new TextNode("", rect);

        r3c2.BackgroundStyle.Color = Color.White;
        r3c2.LineStyle.LineWidth   = 1;
        r3c2.FontStyle.Size        = 11;


        rect = new RectangleF(190, 40, 150, 20);
        TextNode r3c3 = new TextNode("", rect);

        r3c3.BackgroundStyle.Color = Color.White;
        r3c3.LineStyle.LineWidth   = 1;
        r3c3.FontStyle.Size        = 11;


        rect = new RectangleF(340, 40, 100, 20);
        TextNode r3c4 = new TextNode("", rect);

        r3c4.BackgroundStyle.Color = Color.White;
        r3c4.LineStyle.LineWidth   = 1;
        r3c4.FontStyle.Size        = 11;

        //Row4
        rect = new RectangleF(0, 60, 70, 20);
        TextNode r4c1 = new TextNode("", rect);

        r4c1.BackgroundStyle.Color = Color.White;
        r4c1.LineStyle.LineWidth   = 1;
        r4c1.FontStyle.Size        = 11;


        rect = new RectangleF(70, 60, 120, 20);
        TextNode r4c2 = new TextNode("", rect);

        r4c2.BackgroundStyle.Color = Color.White;
        r4c2.LineStyle.LineWidth   = 1;
        r4c2.FontStyle.Size        = 11;


        rect = new RectangleF(190, 60, 150, 20);
        TextNode r4c3 = new TextNode("", rect);

        r4c3.BackgroundStyle.Color = Color.White;
        r4c3.LineStyle.LineWidth   = 1;
        r4c3.FontStyle.Size        = 11;


        rect = new RectangleF(340, 60, 100, 20);
        TextNode r4c4 = new TextNode("", rect);

        r4c4.BackgroundStyle.Color = Color.White;
        r4c4.LineStyle.LineWidth   = 1;
        r4c4.FontStyle.Size        = 11;

        this.AppendChild(r1c1); this.AppendChild(r1c2); this.AppendChild(r1c3); this.AppendChild(r1c4);
        this.AppendChild(r2c1); this.AppendChild(r2c2); this.AppendChild(r2c3); this.AppendChild(r2c4);
        this.AppendChild(r3c1); this.AppendChild(r3c2); this.AppendChild(r3c3); this.AppendChild(r3c4);
        this.AppendChild(r4c1); this.AppendChild(r4c2); this.AppendChild(r4c3); this.AppendChild(r4c4);
        this.EditStyle.AllowSelect = false;
    }
コード例 #49
0
ファイル: Writer.cs プロジェクト: simonegli8/Silversite
 public virtual void Write(TextNode t)
 {
     if (t is DocumentNode) { Write((DocumentNode)t); return; }
     if (t is Token) { WriteToken((Token)t); return; }
 }
コード例 #50
0
        private void createWindow(int id, int money)
        {
            _node.Src      = new RectF(0, 680, 300, 220);
            _node.Position = new Vector2F(150, 170);
            _node.ZOrder   = Common.Parameter.ZOrder.NumberInput;

            _node2          = new SpriteNode();
            _node2.Texture  = Texture.SeedWindow;
            _node2.Src      = new RectF(600, 680, 300, 220);
            _node2.Position = new Vector2F(450, 170);
            _node2.Scale    = new Vector2F(1.0f, 1.5f);
            _node2.ZOrder   = Common.Parameter.ZOrder.NumberInput;

            _itemName       = new TextNode();
            _itemName.Font  = Font.LoadDynamicFontStrict("HachiMaruPop-Regular.ttf", 40);
            _itemName.Color = new Color(0, 0, 0);
            if (_quority == Common.Parameter.Quality.Empty)
            {
                _itemName.Text = Function.SearchItemById(id).name;
            }
            else
            {
                _itemName.Text = Function.SearchItemById(id).name + "(品質:" + Function.Quolity2String(_quority) + ")";
            }
            _itemName.Position = new Vector2F(200, 200);
            _itemName.ZOrder   = Common.Parameter.ZOrder.NumberInput;

            _upButton[1]          = new TextNode();
            _upButton[1].Font     = Font.LoadDynamicFontStrict("HachiMaruPop-Regular.ttf", 40);
            _upButton[1].Color    = new Color(0, 0, 0);
            _upButton[1].Text     = upString;
            _upButton[1].Position = new Vector2F(xPosition, yPosition);
            _upButton[1].ZOrder   = Common.Parameter.ZOrder.NumberInput;

            _upButton[0]          = new TextNode();
            _upButton[0].Font     = Font.LoadDynamicFontStrict("HachiMaruPop-Regular.ttf", 40);
            _upButton[0].Color    = new Color(0, 0, 0);
            _upButton[0].Text     = upString;
            _upButton[0].Position = new Vector2F(xPosition + xInterval, yPosition);
            _upButton[0].ZOrder   = Common.Parameter.ZOrder.NumberInput;

            _number[1]          = new TextNode();
            _number[1].Font     = Font.LoadDynamicFontStrict("HachiMaruPop-Regular.ttf", 40);
            _number[1].Color    = new Color(0, 0, 0);
            _number[1].Text     = _inputValue[1].ToString();
            _number[1].Position = new Vector2F(xPosition, yPosition + yInterval);
            _number[1].ZOrder   = Common.Parameter.ZOrder.NumberInput;

            _number[0]          = new TextNode();
            _number[0].Font     = Font.LoadDynamicFontStrict("HachiMaruPop-Regular.ttf", 40);
            _number[0].Color    = new Color(0, 0, 0);
            _number[0].Text     = _inputValue[0].ToString();
            _number[0].Position = new Vector2F(xPosition + xInterval, yPosition + yInterval);
            _number[0].ZOrder   = Common.Parameter.ZOrder.NumberInput;

            _downButton[1]          = new TextNode();
            _downButton[1].Font     = Font.LoadDynamicFontStrict("HachiMaruPop-Regular.ttf", 40);
            _downButton[1].Color    = new Color(0, 0, 0);
            _downButton[1].Text     = downString;
            _downButton[1].Position = new Vector2F(xPosition, yPosition + yInterval * 2);
            _downButton[1].ZOrder   = Common.Parameter.ZOrder.NumberInput;

            _downButton[0]          = new TextNode();
            _downButton[0].Font     = Font.LoadDynamicFontStrict("HachiMaruPop-Regular.ttf", 40);
            _downButton[0].Color    = new Color(0, 0, 0);
            _downButton[0].Text     = downString;
            _downButton[0].Position = new Vector2F(xPosition + xInterval, yPosition + yInterval * 2);
            _downButton[0].ZOrder   = Common.Parameter.ZOrder.NumberInput;

            _calcNumber          = new TextNode();
            _calcNumber.Font     = Font.LoadDynamicFontStrict("HachiMaruPop-Regular.ttf", 40);
            _calcNumber.Color    = new Color(0, 0, 0);
            _calcNumber.Text     = "個(" + money.ToString() + "G)";
            _calcNumber.Position = new Vector2F(xPosition + xInterval * 2, yPosition + yInterval);
            _calcNumber.ZOrder   = Common.Parameter.ZOrder.NumberInput;

            _okButton = new Button(Texture.OKButton, Texture.OKButtonHover, Texture.OKButtonClick);
            _okButton.SetPosition(new Vector2F(230, 410));
            _okButton.SetScale(buttonScale);
            _okButton.SetZOrder(Common.Parameter.ZOrder.NumberInput);
            _cancelButton = new Button(Texture.CancelButton, Texture.CancelButtonHover, Texture.CancelButtonClick);
            _cancelButton.SetPosition(new Vector2F(430, 410));
            _cancelButton.SetScale(buttonScale);
            _cancelButton.SetZOrder(Common.Parameter.ZOrder.NumberInput);
        }
コード例 #51
0
 public virtual void VisitText(TextNode textNode)
 {
     if (this.ThrowException)
     {
         throw (Exception)this.CreateException(textNode);
     }
 }
コード例 #52
0
ファイル: MainForm.cs プロジェクト: zuozhu315/winforms-demos
        /// <summary>
        /// Initialize the diagram
        /// </summary>
        protected void InitailizeDiagram()
        {
            // Add a TextNode to highlight the Diagram Name
            Syncfusion.Windows.Forms.Diagram.TextNode txtnode = new TextNode("Simple Flow Diagram");
            txtnode.FontStyle.Size       = 17;
            txtnode.FontStyle.Bold       = true;
            txtnode.FontStyle.Family     = "Arial";
            txtnode.FontColorStyle.Color = Color.Black;
            txtnode.LineStyle.LineColor  = Color.Transparent;
            txtnode.SizeToText(Size.Empty);
            InsertNode(txtnode, new PointF(290, 15));

            if (this.paletteGroupBar1.CurrentSymbolPalette == null)
            {
                return;
            }

            // Insert the Network Symbols.
            // Insert start
            Node start = InsertNodeFromPallete("Start/End", new PointF(295, 37), "Start", new SizeF(120, 45));
            //Insert process1
            Node process1 = InsertNodeFromPallete("Process", new PointF(325, 102), "Answer Phone", new SizeF(120, 45));
            // Insert decision1
            Node decision1 = InsertNodeFromPallete("Decision", new PointF(325, 175), "How can we help?", new SizeF(120, 60));
            //Insert process2
            Node process2 = InsertNodeFromPallete("Process", new PointF(70, 252), "Take name and company", new SizeF(120, 45));
            // Insert process3
            Node process3 = InsertNodeFromPallete("Process", new PointF(70, 327), "Transfer to sales", new SizeF(120, 45));
            //Insert end1
            Node end1 = InsertNodeFromPallete("Start/End", new PointF(40, 402), "Finish", new SizeF(120, 45));
            //Insert decision2
            Node decision2 = InsertNodeFromPallete("Decision", new PointF(325, 255), "What is problem?", new SizeF(120, 60));
            //Insert process4
            Node process4 = InsertNodeFromPallete("Process", new PointF(325, 330), "Take name and company", new SizeF(120, 45));
            //Insert process5
            Node process5 = InsertNodeFromPallete("Process", new PointF(325, 390), "Transfer to help", new SizeF(120, 45));
            //Insert end2
            Node end2 = InsertNodeFromPallete("Start/End", new PointF(295, 465), "Finish", new SizeF(120, 45));

            //	Add TextNodes to display Layer Names
            InsertTextNode("Product info, or help placing order", new PointF(130, 180), new SizeF(135, 35));
            InsertTextNode("Other", new PointF(480, 200), new SizeF(90, 30));
            InsertTextNode("Shipping", new PointF(235, 280), new SizeF(90, 30));
            InsertTextNode("Billing", new PointF(480, 280), new SizeF(90, 30));
            InsertTextNode("Problems with product?", new PointF(272, 316), new SizeF(90, 30));


            // Create Links between the NetworkSymbols.
            ConnectNodes(start, process1);
            ConnectNodes(process1, decision1);
            ConnectNodes(decision1, process2);
            ConnectNodes(process2, process3);
            ConnectNodes(process3, end1);
            ConnectNodes(decision1, decision2);
            ConnectNodes(decision2, process4);
            ConnectNodes(process4, process5);
            ConnectNodes(process5, end2);

            ConnectNodes(decision1, "right");
            ConnectNodes(decision2, "right");
            ConnectNodes(decision2, "left");
        }
コード例 #53
0
 public Url Url(TextNode value, IEnumerable<string> paths, int index)
 {
     return new Url(value, paths) { Index = index };
 }
コード例 #54
0
        // DrillDown is implemented by just changing the diagram models
        protected override void OnMouseClick(EventArgs e)
        {
            try
            {
                int flag = 0;
                // Get node root.
                Syncfusion.Windows.Forms.Diagram.Model diagramModel = this.Root;
                Node node = this as IGraphNode as Node;

                if (node is TextNode)
                {
                    //|| node is MyGroup2 || node is MyGroup3)
                    node.EditStyle.AllowSelect = false;
                }
                else
                {
                    if (flag == 0)
                    {
                        this.dig.Controller.SelectAll();
                        this.dig.Controller.Delete();
                        this.mod1.Nodes.Clear();
                        flag = 1;
                    }

                    Syncfusion.Windows.Forms.Diagram.TextNode txtnode1 = new TextNode(" Coevals Diagram ");
                    txtnode1.FontStyle.Size   = 16;
                    txtnode1.FontStyle.Family = "Arial";
                    txtnode1.FontStyle.Bold   = true;

                    txtnode1.FontColorStyle.Color = Color.MidnightBlue;
                    txtnode1.LineStyle.LineColor  = Color.Transparent;
                    txtnode1.SizeToText(new Size(1000, 1000));
                    txtnode1.PinPoint = new PointF(335, 25);
                    this.dig.Model.AppendChild(txtnode1);

                    this.dig.Model.AppendChild(new HomeNode(this.dig, this.mod1, this.mod2));

                    // Grand Mother
                    GM          = new GrandMotherSymbolClass();
                    GM.PinPoint = new PointF(305, 145);

                    this.dig.Model.AppendChild(GM);

                    // GrandMothers Daiughter
                    GMDaughter.PinPoint = new PointF(150, 200);
                    this.dig.Model.AppendChild(GMDaughter);

                    // Connection b/w Grandma and her daughter
                    ConnectNodes(GM, GMDaughter);

                    // GrandMothers Son
                    GMSon          = new ManSymbolClass();
                    GMSon.PinPoint = new PointF(450, 200);
                    this.dig.Model.AppendChild(GMSon);

                    // Connection b/w Grandma and her Son
                    ConnectNodes(GM, GMSon);



                    // Boy
                    BoySymbolClass mySymbolBoy3 = new BoySymbolClass("Boys", this.dig, this.mod1, this.mod2);
                    mySymbolBoy3.Name     = "Boys";
                    mySymbolBoy3.PinPoint = new PointF(450, 290);

                    //ToolTip
                    this.dig.Model.AppendChild(mySymbolBoy3);


                    //mySymbolBoy3 = new MySymbol4Girl();

                    // Connection b/w Father and his girl
                    ConnectNodes(GMSon, mySymbolBoy3);

                    // Girl
                    mySymbolGirl          = new GirlSymbolClass();
                    mySymbolGirl.PinPoint = new PointF(370, 290);
                    this.dig.Model.AppendChild(mySymbolGirl);

                    // Connection b/w Father and his girl
                    ConnectNodes(GMSon, mySymbolGirl);

                    // Girl
                    mySymbolGirl          = new GirlSymbolClass();
                    mySymbolGirl.PinPoint = new PointF(520, 290);
                    this.dig.Model.AppendChild(mySymbolGirl);

                    // Connection b/w Father and his girl
                    ConnectNodes(GMSon, mySymbolGirl);

                    // Mother Childerns
                    // Girl
                    mySymbolGirl          = new GirlSymbolClass();
                    mySymbolGirl.PinPoint = new PointF(150, 290);
                    this.dig.Model.AppendChild(mySymbolGirl);

                    // Connection b/w Father and his girl
                    ConnectNodes(GMDaughter, mySymbolGirl);

                    // Girl
                    GirlSymbolClass mySymbolGirl3 = new GirlSymbolClass("Girls", this.dig, this.mod1, this.mod2);
                    mySymbolGirl3.Name     = "Girls";
                    mySymbolGirl3.PinPoint = new PointF(220, 290);
                    this.dig.Model.AppendChild(mySymbolGirl3);

                    // Connection b/w Mother and his girl
                    ConnectNodes(GMDaughter, mySymbolGirl3);

                    // Boy
                    mySymbolBoy          = new BoySymbolClass();
                    mySymbolBoy.PinPoint = new PointF(280, 290);
                    this.dig.Model.AppendChild(mySymbolBoy);
                    // Connection b/w Mother and his girl
                    ConnectNodes(GMDaughter, mySymbolBoy);

                    // Boy
                    mySymbolBoy          = new BoySymbolClass();
                    mySymbolBoy.PinPoint = new PointF(90, 290);
                    this.dig.Model.AppendChild(mySymbolBoy);

                    // Connection b/w Mother and his Boy
                    ConnectNodes(GMDaughter, mySymbolBoy);


                    this.Nodes.Clear();
                    this.dig.View.SelectionList.Clear();
                }
            }
            catch { }
        }
コード例 #55
0
ファイル: FileReferenceVisitor.cs プロジェクト: Eilon/spark
 protected override void Visit(TextNode textNode)
 {
 }
コード例 #56
0
        // GET: DrillDown
        public ActionResult DrillDown()
        {
            DiagramProperties model = new DiagramProperties();

            model.Width  = "600px";
            model.Height = "600px";
            model.PageSettings.ScrollLimit = ScrollLimit.Diagram;
            model.Layout.Type   = LayoutTypes.HierarchicalTree;
            model.Layout.Margin = new Margin()
            {
                Top = 60
            };
            model.Layout.VerticalSpacing       = 60;
            model.PageSettings.PageWidth       = 600;
            model.PageSettings.PageHeight      = 600;
            model.PageSettings.PageBorderColor = "#f5f5f5";
            model.PageSettings.PageBorderWidth = 2;


            ImageNode node = new ImageNode();

            node.Name   = "Image1";
            node.Source = "../Images/diagram/drilldown/image2.png";
            Dictionary <string, object> addinfo = new Dictionary <string, object>();

            addinfo.Add("toolvalue", "Click on node to drill down");
            node.AddInfo = addinfo;
            model.Nodes.Add(node);

            TextNode text = new TextNode();

            text.Name                 = "textNode";
            text.Width                = 200;
            text.Height               = 60;
            text.Constraints          = NodeConstraints.None;
            text.OffsetX              = 310;
            text.OffsetY              = 30;
            text.ExcludeFromLayout    = true;
            text.TextBlock.Text       = "Coevals Diagram";
            text.TextBlock.FontColor  = "blue";
            text.TextBlock.FontSize   = 20;
            text.TextBlock.FontFamily = "Segoe UI";
            model.Nodes.Add(text);

            model.DefaultSettings.Node = new ImageNode()
            {
                Width       = 50,
                Height      = 50,
                BorderColor = "transparent",
                Labels      = new Collection()
                {
                    new Label()
                    {
                        ReadOnly = true
                    }
                }
            };
            model.DefaultSettings.Connector = new Connector()
            {
                Segments = new Collection()
                {
                    new Segment()
                    {
                        Type = Segments.Orthogonal
                    }
                }
            };
            model.Click = "click";
            model.SnapSettings.SnapConstraints = SnapConstraints.None;
            model.SelectedItems.Constraints    = SelectorConstraints.None;
            model.DoubleClick = "doubleclick";
            model.Tooltip     = new Tooltip()
            {
                TemplateId = "mouseovertooltip"
            };
            model.Tooltip.Alignment = new Alignment()
            {
                Horizontal = HorizontalAlignment.Center, Vertical = VerticalAlignment.Bottom
            };
            ViewData["diagramModel"] = model;
            return(View());
        }
コード例 #57
0
 public void VisitTextNode(TextNode textNode)
 {
     // no op
 }
コード例 #58
0
 protected override SyntaxTreeNode Visit(TextNode node)
 {
     return(new TextNode(node.Text + "x", node.HtmlTemplate));
 }
コード例 #59
0
ファイル: JavaGenerator.cs プロジェクト: CLupica/ServiceStack
        public string ConvertFromCSharp(TextNode node)
        {
            var sb = new StringBuilder();

            if (node.Text == "List")
            {
                sb.Append("ArrayList<");
                sb.Append(ConvertFromCSharp(node.Children[0]));
                sb.Append(">");
            }
            else if (node.Text == "Dictionary")
            {
                sb.Append("HashMap<");
                sb.Append(ConvertFromCSharp(node.Children[0]));
                sb.Append(",");
                sb.Append(ConvertFromCSharp(node.Children[1]));
                sb.Append(">");
            }
            else
            {
                sb.Append(TypeAlias(node.Text));
                if (node.Children.Count > 0)
                {
                    sb.Append("<");
                    for (var i = 0; i < node.Children.Count; i++)
                    {
                        var childNode = node.Children[i];

                        if (i > 0)
                            sb.Append(",");

                        sb.Append(ConvertFromCSharp(childNode));
                    }
                    sb.Append(">");
                }
            }

            var typeName = sb.ToString();
            return typeName.LastRightPart('.'); //remove nested class
        }
コード例 #60
0
 public override void Visit(TextNode node)
 {
     debugString.Append('\t', indent);
     debugString.Append(node.ToString());
     debugString.AppendLine();
 }