1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- using System.Collections.Generic;
- using NTERA.EmuEra.Game.EraEmu.Sub;
- namespace NTERA.EmuEra.Game.EraEmu.Display
- {
- //TODO:1810~
- /* Emuera用Htmlもどきが実装すべき要素
- * (できるだけhtmlとConsoleDisplayLineとの1:1対応を目指す。<b>と<strong>とか同じ結果になるタグを重複して実装しない)
- * <p align=""></p> ALIGNMENT命令相当・行頭から行末のみ・行末省略可
- * <nobr></nobr> PRINTSINGLE相当・行頭から行末のみ・行末省略可
- * <b><i><u><s> フォント各種・オーバーラップ問題は保留
- * <button value=""></button> ボタン化・htmlでは明示しない限りボタン化しない
- * <font face="" color="" bcolor=""></font> フォント指定 色指定 ボタン選択中色指定
- * 追加<!-- --> コメント
- * <nonbutton title='~~'>
- * <img src='~~' srcb='~~'>
- * <shape type='rect' param='0,0,0,0'>
- * エスケープ
- * & > < " ' &<>"' ERBにおける利便性を考えると属性値の指定には"よりも'を使いたい。HTML4.1にはないがaposを入れておく
- * &#nn; &#xnn; Unicode参照 #xFFFF以上は却下
- */
- /* このクラスがサポートすべきもの
- * html から ConsoleDisplayLine[] //主に表示用
- * ConsoleDisplayLine[] から html //現在の表示をstr化して保存?
- * html から ConsoleDisplayLine[] を経て html //表示を行わずに改行が入る位置のチェックができるかも
- * html から PlainText(非エスケープ)//
- * Text から エスケープ済Text
- */
- /// <summary>
- /// EmueraConsoleのなんちゃってHtml解決用クラス
- /// </summary>
- public static class HtmlManager
- {
- public static string[] HtmlTagSplit(string str)
- {
- List<string> strList = new List<string>();
- StringStream st = new StringStream(str);
- int found = -1;
- while (!st.EOS)
- {
- found = st.Find('<');
- if (found < 0)
- {
- strList.Add(st.Substring());
- break;
- }
- if (found > 0)
- {
- strList.Add(st.Substring(st.CurrentPosition, found));
- st.CurrentPosition += found;
- }
- found = st.Find('>');
- if(found < 0)
- return null;
- found++;
- strList.Add(st.Substring(st.CurrentPosition, found));
- st.CurrentPosition += found;
- }
- string[] ret = new string[strList.Count];
- strList.CopyTo(ret);
- return ret;
- }
- }
- }
|