コード例 #1
0
        protected void AddMarkup(Stream s)
        {
            string     l;
            MarkupPage currentPage = null;

            StreamReader sr = new StreamReader(s);

            while ((l = sr.ReadLine()) != null)
            {
                if (l.StartsWith("</"))
                {
                    if (l.StartsWith("</PAGE>"))
                    {
                        currentPage.Layout();
                        pages.Add(currentPage);
                        currentPage = null;
                    }
                    else if (l.StartsWith("</SCREENCENTER>"))
                    {
                        currentPage = new MarkupPage(PageLocation.Center, fnt, pal);
                    }
                    else if (l.StartsWith("</SCREENLEFT>"))
                    {
                        currentPage = new MarkupPage(PageLocation.Left, fnt, pal);
                    }
                    else if (l.StartsWith("</SCREENLOWERLEFT>"))
                    {
                        currentPage = new MarkupPage(PageLocation.LowerLeft, fnt, pal);
                    }
                    else if (l.StartsWith("</SCREENRIGHT>"))
                    {
                        currentPage = new MarkupPage(PageLocation.Right, fnt, pal);
                    }
                    else if (l.StartsWith("</SCREENTOP>"))
                    {
                        currentPage = new MarkupPage(PageLocation.Top, fnt, pal);
                    }
                    else if (l.StartsWith("</SCREENBOTTOM>"))
                    {
                        currentPage = new MarkupPage(PageLocation.Bottom, fnt, pal);
                    }
                    else if (l.StartsWith("</BACKGROUND "))
                    {
                        string bg = l.Substring("</BACKGROUND ".Length);
                        bg = bg.Substring(0, bg.Length - 1);
                        pages.Add(new MarkupPage((Stream)mpq.GetResource(bg)));
                    }
                    /* skip everything else */
#if false
                    else if (l.StartsWith("</FONTCOLOR") ||
                             l.StartsWith("</COMMENT") ||
                             l.StartsWith("</FADESPEED"))
                    {
                    }
#endif
                }
                else if (currentPage != null)
                {
                    currentPage.AddLine(l);
                }
            }
        }
コード例 #2
0
ファイル: MarkupScreen.cs プロジェクト: carriercomm/scsharp
		protected void AddMarkup (Stream s)
		{
			string l;
			MarkupPage currentPage = null;

			StreamReader sr = new StreamReader (s);

			while ((l = sr.ReadLine ()) != null) {
				if (l.StartsWith ("</")) {
					if (l.StartsWith ("</PAGE>")) {
						currentPage.Layout ();
						pages.Add (currentPage);
						currentPage = null;
					}
					else if (l.StartsWith ("</SCREENCENTER>")) {
						currentPage = new MarkupPage (PageLocation.Center, fnt, pal);
					}
					else if (l.StartsWith ("</SCREENLEFT>")) {
						currentPage = new MarkupPage (PageLocation.Left, fnt, pal);
					}
					else if (l.StartsWith ("</SCREENLOWERLEFT>")) {
						currentPage = new MarkupPage (PageLocation.LowerLeft, fnt, pal);
					}
					else if (l.StartsWith ("</SCREENRIGHT>")) {
						currentPage = new MarkupPage (PageLocation.Right, fnt, pal);
					}
					else if (l.StartsWith ("</SCREENTOP>")) {
						currentPage = new MarkupPage (PageLocation.Top, fnt, pal);
					}
					else if (l.StartsWith ("</SCREENBOTTOM>")) {
						currentPage = new MarkupPage (PageLocation.Bottom, fnt, pal);
					}
					else if (l.StartsWith ("</BACKGROUND ")) {
						string bg = l.Substring ("</BACKGROUND ".Length);
						bg = bg.Substring (0, bg.Length - 1);
						pages.Add (new MarkupPage ((Stream)mpq.GetResource (bg)));
					}
					/* skip everything else */
#if false
					else if (l.StartsWith ("</FONTCOLOR")
						 || l.StartsWith ("</COMMENT")
						 || l.StartsWith ("</FADESPEED")) {
					}
#endif

				}
				else if (currentPage != null)
					currentPage.AddLine(l);
			}
		}