瀏覽代碼

Remove leftover graphics code and all DLLImports

Bepis 6 年之前
父節點
當前提交
bffbb93f86

+ 0 - 16
NTERA/Console/EraConsoleInstance.cs

@@ -3,7 +3,6 @@ using System.Text;
 using System.Threading;
 using MinorShift.Emuera.GameProc;
 using MinorShift.Emuera.Sub;
-using NTERA.Game.Display;
 using NTERA.Interop;
 
 namespace NTERA.Console
@@ -298,21 +297,6 @@ namespace NTERA.Console
 		{
 		}
 
-		public bool ButtonIsSelected(ConsoleButtonString button)
-		{
-			return false;
-		}
-
-		public ConsoleDisplayLine[] GetDisplayLines(long something)
-		{
-			return new ConsoleDisplayLine[] { };
-		}
-
-		public ConsoleDisplayLine[] PopDisplayingLines()
-		{
-			return new ConsoleDisplayLine[] { };
-		}
-
 		public string GetWindowTitle()
 		{
 			return "title";

+ 0 - 43
NTERA/Game/Display/AConsoleDisplayPart.cs

@@ -1,43 +0,0 @@
-using System.Drawing;
-using MinorShift.Emuera;
-
-namespace NTERA.Game.Display
-{
-	/// <summary>
-	/// 描画の最小単位
-	/// </summary>
-	public abstract class AConsoleDisplayPart
-	{
-		public bool Error { get; protected set; }
-
-		public string Str { get; protected set; }
-		public string AltText { get; protected set; }
-		public int PointX { get; set; }
-		public float XsubPixel { get; set; }
-		public float WidthF { get; set; }
-		public int Width { get; set; }
-		public virtual int Top => 0;
-		public virtual int Bottom => Config.FontSize;
-		public abstract bool CanDivide { get; }
-		
-		public abstract void DrawTo(Graphics graph, int pointY, bool isSelecting, bool isBackLog, TextDrawingMode mode);
-
-		public abstract void SetWidth(StringMeasure sm, float subPixel);
-		public override string ToString()
-		{
-			if (Str == null)
-				return "";
-			return Str;
-		}
-	}
-
-	/// <summary>
-	/// 色つき
-	/// </summary>
-	abstract class AConsoleColoredPart : AConsoleDisplayPart
-	{
-		protected Color Color { get; set; }
-		protected Color ButtonColor { get; set; }
-		protected bool colorChanged;
-	}
-}

+ 0 - 266
NTERA/Game/Display/ButtonStringCreator.cs

@@ -1,266 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Text.RegularExpressions;
-using MinorShift.Emuera.Sub;
-
-namespace NTERA.Game.Display
-{
-	internal sealed class ButtonPrimitive
-	{
-		public string Str = "";
-		public Int64 Input;
-		public bool CanSelect;
-		public override string ToString()
-		{
-			return Str;
-		}
-	}
-
-	internal static class ButtonStringCreator
-	{
-		public static List<string> Split(string printBuffer)
-		{
-			List<ButtonPrimitive> list = syn(printBuffer);
-			List<string> ret = new List<string>();
-			foreach(ButtonPrimitive p in list)
-				ret.Add(p.Str);
-			return ret;
-		}
-		public static List<ButtonPrimitive> SplitButton(string printBuffer)
-		{
-			return syn(printBuffer);
-		}
-
-		private static List<ButtonPrimitive> syn(string printBuffer)
-		{
-			string printString = printBuffer;
-			List<ButtonPrimitive> ret = new List<ButtonPrimitive>();
-			if (printString.Length == 0)
-				goto nonButton;
-			List<string> strs = null;
-			if ((!printString.Contains("[")) || (!printString.Contains("]")))
-				goto nonButton;
-			strs = lex(new StringStream(printString));
-			if (strs == null)
-				goto nonButton;
-			bool beforeButton = false;//最初のボタン("[1]"とか)より前にテキストがある
-			bool afterButton = false;//最後のボタン("[1]"とか)より後にテキストがある
-			int buttonCount = 0;
-			Int64 inpL = 0;
-			for (int i = 0; i < strs.Count; i++)
-			{
-				if (strs[i].Length == 0)
-					continue;
-				char c = strs[i][0];
-				if (LexicalAnalyzer.IsWhiteSpace(c))
-				{//ただの空白
-				}
-				//数値以外はボタン化しない方向にした。
-				//else if ((c == '[') && (!isSymbols(strArray[i])))
-				else if (isButtonCore(strs[i], ref inpL))
-				{//[]で囲まれた文字列。選択肢の核となるかどうかはこの段階では判定しない。
-					buttonCount++;
-					afterButton = false;
-				}
-				else
-				{//選択肢の説明になるかもしれない文字列
-                    afterButton = true;
-					if (buttonCount == 0)
-						beforeButton = true;
-				}
-			}
-			if (buttonCount <= 1)
-			{
-				ButtonPrimitive button = new ButtonPrimitive();
-				button.Str = printBuffer;
-				button.CanSelect = (buttonCount >= 1);
-				button.Input = inpL;
-				ret.Add(button);
-				return ret;
-			}
-			buttonCount = 0;
-			bool alignmentRight = !beforeButton && afterButton;//説明はボタンの右固定
-			bool alignmentLeft = beforeButton && !afterButton;//説明はボタンの左固定
-			bool alignmentEtc = !alignmentRight && !alignmentLeft;//臨機応変に
-			bool canSelect = false;
-			Int64 input = 0;
-
-			int state = 0;
-			StringBuilder buffer = new StringBuilder();
-			VoidMethod reduce = delegate
-			{
-				if (buffer.Length == 0)
-					return;
-				ButtonPrimitive button = new ButtonPrimitive();
-				button.Str = buffer.ToString();
-				button.CanSelect = canSelect;
-				button.Input = input;
-				ret.Add(button);
-				buffer.Remove(0, buffer.Length);
-				canSelect = false;
-				input = 0;
-			};
-			for (int i = 0; i < strs.Count; i++)
-			{
-				if (strs[i].Length == 0)
-					continue;
-				char c = strs[i][0];
-				if (LexicalAnalyzer.IsWhiteSpace(c))
-				{//ただの空白
-					if (((state & 3) == 3) && (alignmentEtc) && (strs[i].Length >= 2))
-					{//核と説明を含んだものが完成していればボタン生成。
-						//一文字以下のスペースはキニシナイ。キャラ購入画面対策
-                        reduce();
-						buffer.Append(strs[i]);
-						state = 0;
-					}
-					else
-					{
-						buffer.Append(strs[i]);
-					}
-					continue;
-				}
-				if(isButtonCore(strs[i], ref inpL))
-				{
-					buttonCount++;
-					if (((state & 1) == 1) || alignmentRight)
-					{//bufferが既に核を含んでいる、又は強制的に右配置
-						reduce();
-						buffer.Append(strs[i]);
-						input = inpL;
-						canSelect = true;
-						state = 1;
-					}//((state & 2) == 2) || 
-					else if (alignmentLeft)
-					{//bufferが説明を含んでいる、又は強制的に左配置
-						buffer.Append(strs[i]);
-						input = inpL;
-						canSelect = true;
-						reduce();
-						state = 0;
-					}
-					else
-					{//bufferが空または空白文字列
-						buffer.Append(strs[i]);
-						input = inpL;
-						canSelect = true;
-						state = 1;
-					}
-					continue;
-				}
-				//else
-				//{//選択肢の説明になるかもしれない文字列
-					
-					buffer.Append(strs[i]);
-					state |= 2;
-				//}
-				
-			};
-			reduce();
-			return ret;
-		nonButton:
-			ret = new List<ButtonPrimitive>();
-			ButtonPrimitive singleButton = new ButtonPrimitive();
-			singleButton.Str = printString;
-			ret.Add(singleButton);
-			return ret;
-		}
-		static readonly Regex numReg = new Regex(@"\[\s*([0][xXbB])?[+-]?[0-9]+([eEpP][0-9]+)?\s*\]");
-
-		/// <summary>
-		/// []付き文字列が数値的であるかどうかを調べる
-		/// </summary>
-		/// <param name="str"></param>
-		/// <returns></returns>
-		private static bool isNumericWord(string str)
-		{
-			return numReg.IsMatch(str);
-		}
-
-		/// <summary>
-		/// ボタンの核になるかどうか。とりあえずは整数のみ。
-		/// try-catchを利用するので少し重い。
-		/// </summary>
-		/// <param name="str"></param>
-		/// <param name="input"></param>
-		/// <returns></returns>
-		private static bool isButtonCore(string str, ref long input)
-		{
-			if((str == null)||(str.Length < 3)||(str[0] != '[')||(str[str.Length-1] != ']'))
-				return false;
-			if (!isNumericWord(str))
-				return false;
-			string buttonStr = str.Substring(1, str.Length - 2);
-			StringStream stInt = new StringStream(buttonStr);
-			LexicalAnalyzer.SkipAllSpace(stInt);
-			try
-			{
-				input = LexicalAnalyzer.ReadInt64(stInt, false);
-			}
-			catch
-			{
-				return false; 
-			}
-			return true;
-		}
-
-
-		delegate void VoidMethod();
-
-		/// <summary>
-		/// 字句分割
-		/// "[1] あ [2] いうえ "を"[1]"," ", "あ"," ","[2]"," ","いうえ"," "に分割
-		/// </summary>
-		/// <param name="st"></param>
-		/// <returns></returns>
-		private static List<string> lex(StringStream st)
-		{
-			List<string> strs = new List<string>();
-			int state = 0;
-			int startIndex = 0;
-			VoidMethod reduce = delegate
-			{
-				if (st.CurrentPosition == startIndex)
-					return;
-				int length = st.CurrentPosition - startIndex;
-				strs.Add(st.Substring(startIndex, length));
-				startIndex = st.CurrentPosition;
-			};
-			while (!st.EOS)
-			{
-				if (st.Current == '[')
-				{
-					if (state == 1)//"["内部
-						goto unanalyzable;
-					reduce();
-					state = 1;
-					st.ShiftNext();
-				}
-				else if (st.Current == ']')
-				{
-					if (state != 1)//"["外部
-						goto unanalyzable;
-					st.ShiftNext();
-					reduce();
-					state = 0;
-				}
-				else if ((state == 0) && (LexicalAnalyzer.IsWhiteSpace(st.Current)))
-				{
-					reduce();
-					LexicalAnalyzer.SkipAllSpace(st);
-					reduce();
-				}
-				else
-				{
-					st.ShiftNext();
-				}
-			}
-			reduce();
-			return strs;
-		unanalyzable:
-			return null;
-		}
-
-	}
-}

+ 0 - 240
NTERA/Game/Display/ConsoleButtonString.cs

@@ -1,240 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Drawing;
-using MinorShift.Emuera;
-using MinorShift.Emuera.Sub;
-using NTERA.Interop;
-
-namespace NTERA.Game.Display
-{
-	/// <summary>
-	/// ボタン。1つ以上の装飾付文字列(ConsoleStyledString)からなる。
-	/// </summary>
-	public sealed class ConsoleButtonString
-	{
-		public ConsoleButtonString(IConsole console, AConsoleDisplayPart[] strs)
-		{
-			parent = console;
-			strArray = strs;
-			IsButton = false;
-			PointX = -1;
-			Width = -1;
-            ErrPos = null;
-		}
-		public ConsoleButtonString(IConsole console, AConsoleDisplayPart[] strs, Int64 input)
-			:this(console, strs)
-		{
-			Input = input;
-			Inputs = input.ToString();
-			IsButton = true;
-			IsInteger = true;
-			if (console != null)
-			{
-				Generation = parent.NewButtonGeneration;
-				console.UpdateGeneration();
-			}
-            ErrPos = null;
-        }
-		public ConsoleButtonString(IConsole console, AConsoleDisplayPart[] strs, string inputs)
-			: this(console, strs)
-		{
-			Inputs = inputs;
-			IsButton = true;
-			IsInteger = false;
-			if (console != null)
-			{
-				Generation = parent.NewButtonGeneration;
-				console.UpdateGeneration();
-			}
-            ErrPos = null;
-        }
-
-		public ConsoleButtonString(IConsole console, AConsoleDisplayPart[] strs, Int64 input, string inputs)
-			: this(console, strs)
-		{
-			Input = input;
-			Inputs = inputs;
-			IsButton = true;
-			IsInteger = true;
-			if (console != null)
-			{
-				Generation = parent.NewButtonGeneration;
-				console.UpdateGeneration();
-			}
-            ErrPos = null;
-        }
-		public ConsoleButtonString(IConsole console, AConsoleDisplayPart[] strs, string inputs, ScriptPosition pos)
-            : this(console, strs)
-        {
-            Inputs = inputs;
-            IsButton = true;
-            IsInteger = false;
-			if (console != null)
-			{
-				Generation = parent.NewButtonGeneration;
-				console.UpdateGeneration();
-			}
-            ErrPos = pos;
-        }
-
-		AConsoleDisplayPart[] strArray;
-		public AConsoleDisplayPart[] StrArray => strArray;
-		IConsole parent;
-
-		public ConsoleDisplayLine ParentLine { get; set; }
-		public bool IsButton { get; private set; }
-		public bool IsInteger { get; private set; }
-		public Int64 Input { get; private set; }
-		public string Inputs { get; private set; }
-		public int PointX { get; set; }
-		public bool PointXisLocked { get; set; }
-		public int Width { get; set; }
-		public float XsubPixel { get; set; }
-		public Int64 Generation { get; private set; }
-		public ScriptPosition ErrPos { get; set; }
-		public string Title { get; set; }
-
-
-		public int RelativePointX { get; private set; }
-		public void LockPointX(int rel_px)
-		{
-			PointX = rel_px * Config.FontSize / 100;
-			XsubPixel = (rel_px * Config.FontSize / 100.0f) - PointX;
-			PointXisLocked = true;
-			RelativePointX = rel_px;
-		}
-
-		//indexの文字数の前方文字列とindex以降の後方文字列に分割
-		public ConsoleButtonString DivideAt(int divIndex, StringMeasure sm)
-		{
-			if (divIndex <= 0)
-				return null;
-			List<AConsoleDisplayPart> cssListA = new List<AConsoleDisplayPart>();
-			List<AConsoleDisplayPart> cssListB = new List<AConsoleDisplayPart>();
-			int index = 0;
-			int cssIndex = 0;
-			bool b = false;
-			for (cssIndex = 0; cssIndex < strArray.Length; cssIndex++)
-			{
-				if (b)
-				{
-					cssListB.Add(strArray[cssIndex]);
-					continue;
-				}
-				int length = strArray[cssIndex].Str.Length;
-				if (divIndex < index + length)
-				{
-					ConsoleStyledString oldcss = strArray[cssIndex] as ConsoleStyledString;
-					if (oldcss == null || !oldcss.CanDivide)
-						throw new ExeEE("文字列分割異常");
-					ConsoleStyledString newCss = oldcss.DivideAt(divIndex - index, sm);
-					cssListA.Add(oldcss);
-					if (newCss != null)
-						cssListB.Add(newCss);
-					b = true;
-					continue;
-				}
-
-				if (divIndex == index + length)
-				{
-					cssListA.Add(strArray[cssIndex]);
-					b = true;
-					continue;
-				}
-				index += length;
-				cssListA.Add(strArray[cssIndex]);
-			}
-			if ((cssIndex >= strArray.Length) && (cssListB.Count == 0))
-				return null;
-			AConsoleDisplayPart[] cssArrayA = new AConsoleDisplayPart[cssListA.Count];
-			AConsoleDisplayPart[] cssArrayB = new AConsoleDisplayPart[cssListB.Count];
-			cssListA.CopyTo(cssArrayA);
-			cssListB.CopyTo(cssArrayB);
-			strArray = cssArrayA;
-			ConsoleButtonString ret = new ConsoleButtonString(null, cssArrayB);
-			CalcWidth(sm, XsubPixel);
-			ret.CalcWidth(sm,0);
-			CalcPointX(PointX);
-			ret.CalcPointX(PointX + Width);
-			ret.parent = parent;
-			ret.ParentLine = ParentLine;
-			ret.IsButton = IsButton;
-			ret.IsInteger = IsInteger;
-			ret.Input = Input;
-			ret.Inputs = Inputs;
-			ret.Generation = Generation;
-			ret.ErrPos = ErrPos;
-			ret.Title = Title;
-			return ret;
-		}
-
-		public void CalcWidth(StringMeasure sm, float subpixel)
-		{
-			Width = -1;
-			if ((strArray != null) && (strArray.Length > 0))
-			{
-				Width = 0;
-				foreach (AConsoleDisplayPart css in strArray)
-				{
-					if(css.Width <= 0)
-						css.SetWidth(sm,subpixel);
-					Width += css.Width;
-					subpixel = css.XsubPixel;
-				}
-				if (Width <= 0)
-					Width = -1;
-			}
-			XsubPixel = subpixel;
-		}
-
-		/// <summary>
-		/// 先にCalcWidthすること。
-		/// </summary>
-		/// <param name="sm"></param>
-		public void CalcPointX(int pointx)
-		{
-			int px = pointx;
-			if (!PointXisLocked)
-				PointX = px;
-			else
-				px = PointX;
-			for (int i = 0; i < strArray.Length; i++)
-			{
-				strArray[i].PointX = px;
-				px += strArray[i].Width;
-			}
-			if (strArray.Length > 0)
-			{
-				PointX = strArray[0].PointX;
-				Width = strArray[strArray.Length - 1].PointX + strArray[strArray.Length - 1].Width - PointX;
-				//if (Width < 0)
-				//	Width = -1;
-			}
-		}
-
-		internal void ShiftPositionX(int shiftX)
-		{
-			PointX += shiftX;
-			foreach (AConsoleDisplayPart css in strArray)
-				css.PointX += shiftX;
-		}
-
-		public void DrawTo(Graphics graph, int pointY, bool isBackLog, TextDrawingMode mode)
-		{
-			bool isSelecting = (IsButton) && (parent.ButtonIsSelected(this));
-			foreach (AConsoleDisplayPart css in strArray)
-				css.DrawTo(graph, pointY, isSelecting, isBackLog, mode);
-		}
-		
-		public override string ToString()
-		{
-			if (strArray == null)
-				return "";
-			string str = "";
-			foreach (AConsoleDisplayPart css in strArray)
-				str += css.ToString();
-			return str;
-		}
-
-	}
-}

+ 0 - 145
NTERA/Game/Display/ConsoleDisplayLine.cs

@@ -1,145 +0,0 @@
-using System;
-using System.Drawing;
-using System.Reflection;
-using System.Text;
-using MinorShift.Emuera;
-using NTERA.Interop;
-
-namespace NTERA.Game.Display
-{
-	//難読化用属性。enum.ToString()やenum.Parse()を行うなら(Exclude=true)にすること。
-	[Obfuscation(Exclude=false)]
-	internal enum DisplayLineLastState
-	{
-		None = 0,
-		Normal = 1,
-		Selected = 2,
-		BackLog = 3
-	}
-
-    /// <summary>
-    /// Display line. It consists of one or more buttons (ConsoleButtonString)
-    /// </summary>
-    public sealed class ConsoleDisplayLine
-	{
-		
-		//public ConsoleDisplayLine(EmueraConsole parentWindow, ConsoleButtonString[] buttons, bool isLogical, bool temporary)
-		public ConsoleDisplayLine(ConsoleButtonString[] buttons, bool isLogical, bool temporary)
-		{
-			//parent = parentWindow;
-			if (buttons == null)
-			{
-				buttons = new ConsoleButtonString[0];
-				return;
-			}
-			this.buttons = buttons;
-			foreach (ConsoleButtonString button in buttons)
-            {
-                if (button == null)
-                    throw new Exception();
-                button.ParentLine = this;
-            }
-			IsLogicalLine = isLogical;
-			IsTemporary = temporary;
-		}
-		public int LineNo = -1;
-		
-		///論理行の最初となる場合だけtrue。表示の都合で改行された2行目以降はfalse
-		public readonly bool IsLogicalLine = true;
-		public readonly bool IsTemporary;
-		//EmueraConsole parent;
-		ConsoleButtonString[] buttons;
-		DisplayLineAlignment align;
-		public ConsoleButtonString[] Buttons => buttons;
-		public DisplayLineAlignment Align => align;
-		bool aligned;
-		public void SetAlignment(DisplayLineAlignment align)
-		{
-			if (aligned)
-				return;
-			aligned = true;
-			this.align = align;
-			if (buttons.Length == 0)
-				return;
-			//DisplayLineの幅
-			int width = 0;
-			foreach (ConsoleButtonString button in buttons)
-				width += button.Width;
-			//現在位置
-			int pointX = buttons[0].PointX;
-
-			//目標位置
-			int movetoX = 0;
-			if (align == DisplayLineAlignment.LEFT)
-			{
-				//位置固定に対応
-				if (IsLogicalLine)
-					return;
-				movetoX = 0;
-			}
-			else if (align == DisplayLineAlignment.CENTER)
-				movetoX = Config.WindowX / 2 - width / 2;
-			else if (align == DisplayLineAlignment.RIGHT)
-				movetoX = Config.WindowX - width;
-
-			//移動距離
-			int shiftX = movetoX - pointX;
-			if(shiftX != 0)
-				ShiftPositionX(shiftX);
-		}
-
-		public void ShiftPositionX(int shiftX)
-		{
-			foreach (ConsoleButtonString button in buttons)
-				button.ShiftPositionX(shiftX);
-		}
-
-		public void ChangeStr(ConsoleButtonString[] newButtons)
-        {
-            buttons = null;
-			foreach (ConsoleButtonString button in newButtons)
-				button.ParentLine = this;
-			buttons = newButtons;
-        }
-
-		public void Clear(Brush brush, Graphics graph, int pointY)
-		{
-            Rectangle rect = new Rectangle(0, pointY, Config.WindowX, Config.LineHeight);
-			graph.FillRectangle(brush, rect);
-		}
-
-		//public ConsoleButtonString GetPointingButton(int pointX)
-		//{
-		//	////1815 優先順位を逆順にする
-		//	////後から描画されるボタンが優先されるように
-		//	for (int i = 0; i < buttons.Length; i++)
-		//	{
-		//		ConsoleButtonString button = buttons[buttons.Length - i - 1];
-		//		if ((button.PointX <= pointX) && (button.PointX + button.Width >= pointX))
-		//			return button;
-		//	}
-		//	//foreach (ConsoleButtonString button in buttons)
-		//	//{
-		//	//    if ((button.PointX <= pointX) && (button.PointX + button.Width >= pointX))
-		//	//        return button;
-		//	//}
-		//	return null;
-		//}
-
-		public void DrawTo(Graphics graph, int pointY, bool isBackLog, bool force, TextDrawingMode mode)
-		{
-            foreach (ConsoleButtonString button in buttons)
-                button.DrawTo(graph, pointY, isBackLog, mode);
-		}
-		
-		public override string ToString()
-		{
-			if (buttons == null)
-				return "";
-			StringBuilder builder = new StringBuilder();
-			foreach (ConsoleButtonString button in buttons)
-				builder.Append(button);
-			return builder.ToString();
-		}
-	}
-}

+ 0 - 163
NTERA/Game/Display/ConsoleImagePart.cs

@@ -1,163 +0,0 @@
-using System.Drawing;
-using System.Drawing.Imaging;
-using System.Text;
-using System.Windows.Forms;
-using MinorShift.Emuera;
-using MinorShift.Emuera.Content;
-
-namespace NTERA.Game.Display
-{
-	class ConsoleImagePart : AConsoleDisplayPart
-	{
-		public ConsoleImagePart(string resName, string resNameb, int raw_height, int raw_width, int raw_ypos)
-		{
-			top = 0;
-			bottom = Config.FontSize;
-			Str = "";
-			ResourceName = resName ?? "";
-			ButtonResourceName = resNameb;
-			StringBuilder sb = new StringBuilder();
-			sb.Append("<img src='");
-			sb.Append(ResourceName);
-			if(ButtonResourceName != null)
-			{
-				sb.Append("' srcb='");
-				sb.Append(ButtonResourceName);
-			}
-			if(raw_height != 0)
-			{
-				sb.Append("' height='");
-				sb.Append(raw_height.ToString());
-			}
-			if(raw_width != 0)
-			{
-				sb.Append("' width='");
-				sb.Append(raw_height.ToString());
-			}
-			if(raw_ypos != 0)
-			{
-				sb.Append("' ypos='");
-				sb.Append(raw_height.ToString());
-			}
-			sb.Append("'>");
-			AltText = sb.ToString();
-			
-			cImage = AppContents.GetContent<CroppedImage>(ResourceName);
-			if (cImage != null && !cImage.Enabled)
-				cImage = null;
-			if (cImage == null)
-			{
-				Str = AltText;
-				return;
-			}
-			int height = 0;
-			if (cImage.NoResize)
-			{
-				height = cImage.Rectangle.Height;
-				Width = cImage.Rectangle.Width;
-			}
-			else
-			{
-				
-				if (raw_height == 0)
-					height = Config.FontSize;
-				else
-					height = Config.FontSize * raw_height / 100;
-				if (raw_width == 0)
-				{
-					Width = cImage.Rectangle.Width * height / cImage.Rectangle.Height;
-					XsubPixel = ((float)cImage.Rectangle.Width * height) / cImage.Rectangle.Height - Width;
-				}
-				else
-				{
-					Width = Config.FontSize * raw_width / 100;
-					XsubPixel = ((float)Config.FontSize * raw_width / 100f) - Width;
-				}
-			}
-			top = raw_ypos * Config.FontSize / 100;
-			destRect = new Rectangle(0, top, Width, height);
-			if (destRect.Width < 0)
-			{
-				destRect.X = -destRect.Width;
-				Width = -destRect.Width;
-			}
-			if (destRect.Height < 0)
-			{
-				destRect.Y = destRect.Y - destRect.Height;
-				height = -destRect.Height;
-			}
-			bottom = top + height;
-			//if(top > 0)
-			//	top = 0;
-			//if(bottom < Config.FontSize)
-			//	bottom = Config.FontSize;
-			if (ButtonResourceName != null)
-			{
-				cImageB = AppContents.GetContent<CroppedImage>(ButtonResourceName);
-				if (cImageB != null && !cImageB.Enabled)
-					cImageB = null;
-			}
-		}
-
-		private readonly CroppedImage cImage;
-		private readonly CroppedImage cImageB;
-		private readonly int top;
-		private readonly int bottom;
-		private readonly Rectangle destRect;
-		private readonly ImageAttributes ia;
-		public readonly string ResourceName;
-		public readonly string ButtonResourceName;
-		public override int Top => top;
-		public override int Bottom => bottom;
-
-		public override bool CanDivide => false;
-
-		public override void SetWidth(StringMeasure sm, float subPixel)
-		{
-			if (Error)
-			{
-				Width = 0;
-				return;
-			}
-			if (cImage != null)
-				return;
-			Width = sm.GetDisplayLength(Str, Config.Font);
-			XsubPixel = subPixel;
-		}
-
-		public override string ToString()
-		{
-			if (AltText == null)
-				return "";
-			return AltText;
-		}
-
-		public override void DrawTo(Graphics graph, int pointY, bool isSelecting, bool isBackLog, TextDrawingMode mode)
-		{
-			if (Error)
-				return;
-			CroppedImage img = cImage;
-			if (isSelecting && cImageB != null)
-				img = cImageB;
-			Rectangle rect = destRect;
-			//PointX微調整
-			rect.X = destRect.X + PointX + Config.DrawingParam_ShapePositionShift;
-			rect.Y = destRect.Y + pointY;
-
-			if (img != null)
-			{
-				if(ia == null)
-					graph.DrawImage(img.BaseImage.Bitmap, rect, img.Rectangle, GraphicsUnit.Pixel);
-				else
-					graph.DrawImage(img.BaseImage.Bitmap, rect, img.Rectangle.X,img.Rectangle.Y,img.Rectangle.Width,img.Rectangle.Height , GraphicsUnit.Pixel,ia);
-			}
-			else
-			{
-				if (mode == TextDrawingMode.GRAPHICS)
-					graph.DrawString(Str, Config.Font, new SolidBrush(Config.ForeColor), new Point(PointX, pointY));
-				else
-					TextRenderer.DrawText(graph, Str, Config.Font, new Point(PointX, pointY), Config.ForeColor, TextFormatFlags.NoPrefix);
-			}
-		}
-	}
-}

+ 0 - 187
NTERA/Game/Display/ConsoleShapePart.cs

@@ -1,187 +0,0 @@
-using System;
-using System.Drawing;
-using System.Text;
-using System.Windows.Forms;
-using MinorShift.Emuera;
-
-namespace NTERA.Game.Display
-{
-	abstract class ConsoleShapePart : AConsoleColoredPart
-	{
-		public static ConsoleShapePart CreateShape(string shapeType, int[] param, Color color, Color bcolor, bool colorchanged)
-		{
-			string type = shapeType.ToLower();
-			colorchanged = colorchanged || color != Config.ForeColor;
-			StringBuilder sb = new StringBuilder();
-			sb.Append("<shape type='");
-			sb.Append(type);
-			sb.Append("' param='");
-			for (int i = 0; i < param.Length;i++ )
-			{
-				sb.Append(param[i].ToString());
-				if (i < param.Length - 1)
-					sb.Append(", ");
-			}
-			sb.Append("'");
-			if(colorchanged)
-			{
-				sb.Append(" color='");
-				sb.Append(HtmlManager.GetColorToString(color));
-				sb.Append("'");
-			}
-			if(bcolor != Config.FocusColor)
-			{
-				sb.Append(" bcolor='");
-				sb.Append(HtmlManager.GetColorToString(bcolor));
-				sb.Append("'");
-			}
-			sb.Append(">");
-			ConsoleShapePart ret = null;
-			int lineHeight = Config.FontSize;
-			float[] paramPixel = new float[param.Length];
-			for (int i = 0; i < param.Length; i++)
-			{
-				paramPixel[i] = ((float)param[i] * lineHeight) / 100f;
-			}
-			RectangleF rectF;
-
-			switch (type)
-			{
-				case "space":
-					if (paramPixel.Length == 1 && paramPixel[0] >= 0)
-					{
-						rectF = new RectangleF(0, 0, paramPixel[0], lineHeight);
-						ret = new ConsoleSpacePart(rectF);
-					}
-					break;
-				case "rect":
-					if (paramPixel.Length == 1 && paramPixel[0] > 0)
-					{
-						rectF = new RectangleF(0, 0, paramPixel[0], lineHeight);
-						ret = new ConsoleRectangleShapePart(rectF);
-					}
-					else if (paramPixel.Length == 4)
-					{
-						rectF = new RectangleF(paramPixel[0], paramPixel[1], paramPixel[2], paramPixel[3]);
-						//1820a12 サイズ上限撤廃
-						if (rectF.X >= 0 && rectF.Width > 0 && rectF.Height > 0)
-						//	rectF.Y >= 0 && (rectF.Y + rectF.Height) <= lineHeight)
-						{
-							ret = new ConsoleRectangleShapePart(rectF);
-						}
-					}
-					break;
-				case "polygon":
-					break;
-			}
-			if (ret == null)
-			{
-				ret = new ConsoleErrorShapePart(sb.ToString());
-			}
-			ret.AltText = sb.ToString();
-			ret.Color = color;
-			ret.ButtonColor = bcolor;
-			ret.colorChanged = colorchanged;
-			return ret;
-		}
-
-		public override bool CanDivide => false;
-
-		public override string ToString()
-		{
-			if (AltText == null)
-				return "";
-			return AltText;
-		}
-	}
-	
-	internal sealed class ConsoleRectangleShapePart : ConsoleShapePart
-	{
-		public ConsoleRectangleShapePart(RectangleF theRect)
-		{
-			Str = "";
-			originalRectF = theRect;
-			WidthF = theRect.X + theRect.Width;
-			rect.Y = (int)theRect.Y;
-			//if (rect.Y == 0 && theRect.Y >= 0.001f)
-			//	rect.Y = 1;
-			rect.Height = (int)theRect.Height;
-			if (rect.Height == 0 && theRect.Height >= 0.001f)
-				rect.Height = 1;
-			top = Math.Min(0, rect.Y);
-			bottom = Math.Max(Config.FontSize, rect.Y + rect.Height);
-		}
-		private readonly int top;
-		private readonly int bottom;
-		public override int Top => top;
-		public override int Bottom => bottom;
-		readonly RectangleF originalRectF;
-		bool visible;
-		Rectangle rect;
-		public override void DrawTo(Graphics graph, int pointY, bool isSelecting, bool isBackLog, TextDrawingMode mode)
-		{
-			if (!visible)
-				return;
-			Rectangle targetRect = rect;
-			targetRect.X = targetRect.X + PointX;
-			targetRect.Y = targetRect.Y + pointY;
-			Color dcolor = isSelecting ? ButtonColor : Color;
-			graph.FillRectangle(new SolidBrush(dcolor), targetRect);
-		}
-		public override void SetWidth(StringMeasure sm, float subPixel)
-		{
-			float widF = (subPixel + WidthF);
-			Width = (int)(widF);
-			XsubPixel = widF - Width;
-			rect.X = (int)(subPixel + originalRectF.X);
-			rect.Width = Width - rect.X;
-			rect.X += Config.DrawingParam_ShapePositionShift;
-			visible = (rect.X >= 0 && rect.Width > 0);// && rect.Y >= 0 && (rect.Y + rect.Height) <= Config.FontSize);
-		}
-	}
-
-	internal sealed class ConsoleSpacePart : ConsoleShapePart
-	{
-		public ConsoleSpacePart(RectangleF theRect)
-		{
-			Str = "";
-			WidthF = theRect.Width;
-			//Width = width;
-		}
-
-		public override void DrawTo(Graphics graph, int pointY, bool isSelecting, bool isBackLog, TextDrawingMode mode) { }
-		public override void SetWidth(StringMeasure sm,float subPixel)
-		{
-			float widF = (subPixel + WidthF);
-			Width = (int)(widF);
-			XsubPixel = widF - Width;
-		}
-	}
-
-	internal sealed class ConsoleErrorShapePart : ConsoleShapePart
-	{
-		public ConsoleErrorShapePart(string errMes)
-		{
-			Str = errMes;
-			AltText = errMes;
-		}
-
-		public override void DrawTo(Graphics graph, int pointY, bool isSelecting, bool isBackLog, TextDrawingMode mode)
-		{
-			if (mode == TextDrawingMode.GRAPHICS)
-				graph.DrawString(Str, Config.Font, new SolidBrush(Config.ForeColor), new Point(PointX, pointY));
-			else
-				TextRenderer.DrawText(graph, Str, Config.Font, new Point(PointX, pointY), Config.ForeColor, TextFormatFlags.NoPrefix);
-		}
-		public override void SetWidth(StringMeasure sm, float subPixel)
-		{
-			if (Error)
-			{
-				Width = 0;
-				return;
-			}
-			Width = sm.GetDisplayLength(Str, Config.Font);
-			XsubPixel = subPixel;
-		}
-	}
-}

+ 0 - 97
NTERA/Game/Display/ConsoleStyledString.cs

@@ -1,97 +0,0 @@
-using System.Drawing;
-using System.Windows.Forms;
-using MinorShift.Emuera;
-using NTERA.Interop;
-
-namespace NTERA.Game.Display
-{
-	/// <summary>
-	/// 装飾付文字列。stringとStringStyleからなる。
-	/// </summary>
-	internal sealed class ConsoleStyledString : AConsoleColoredPart
-	{
-		private ConsoleStyledString() { }
-		public ConsoleStyledString(string str, StringStyle style)
-		{
-            //if ((StaticConfig.TextDrawingMode != TextDrawingMode.GRAPHICS) && (str.IndexOf('\t') >= 0))
-            //    str = str.Replace("\t", "");
-			Str = str;
-			StringStyle = style;
-			Font = Config.GetFont(style.Fontname, style.FontStyle);
-			if (Font == null)
-			{
-				Error = true;
-				return;
-			}
-			Color = style.Color;
-			ButtonColor = style.ButtonColor;
-            colorChanged = style.ColorChanged;
-			if (!colorChanged && Color != Config.ForeColor)
-				colorChanged = true;
-			PointX = -1;
-			Width = -1;
-		}
-		public Font Font{ get; private set;}
-		public StringStyle StringStyle{ get; private set;}
-		public override bool CanDivide => true;
-
-		//単一のボタンフラグ
-		//public bool IsButton { get; set; }
-		//indexの文字数の前方文字列とindex以降の後方文字列に分割
-		public ConsoleStyledString DivideAt(int index, StringMeasure sm)
-		{
-			//if ((index <= 0)||(index > Str.Length)||this.Error)
-			//	return null;
-			ConsoleStyledString ret = DivideAt(index);
-			if (ret == null)
-				return null;
-			SetWidth(sm, XsubPixel);
-			ret.SetWidth(sm, XsubPixel);
-			return ret;
-		}
-		public ConsoleStyledString DivideAt(int index)
-		{
-			if ((index <= 0) || (index > Str.Length) || Error)
-				return null;
-			string str = Str.Substring(index, Str.Length - index);
-			Str = Str.Substring(0, index);
-			ConsoleStyledString ret = new ConsoleStyledString();
-			ret.Font = Font;
-			ret.Str = str;
-			ret.Color = Color;
-			ret.ButtonColor = ButtonColor;
-			ret.colorChanged = colorChanged;
-			ret.StringStyle = StringStyle;
-			ret.XsubPixel = XsubPixel;
-			return ret;
-		}
-
-		public override void SetWidth(StringMeasure sm, float subPixel)
-		{
-			if (Error)
-			{
-				Width = 0;
-				return;
-			}
-			Width = sm.GetDisplayLength(Str, Font);
-			XsubPixel = subPixel;
-		}
-
-		public override void DrawTo(Graphics graph, int pointY, bool isSelecting, bool isBackLog, TextDrawingMode mode)
-		{
-			if (Error)
-				return;
-			Color color = Color;
-			if(isSelecting)
-				color = ButtonColor;
-			else if (isBackLog && !colorChanged)
-                color = Config.LogColor;
-				
-			if (mode == TextDrawingMode.GRAPHICS)
-				graph.DrawString(Str, Font, new SolidBrush(color), new Point(PointX, pointY));
-			else
-				TextRenderer.DrawText(graph, Str, Font, new Point(PointX, pointY), color, TextFormatFlags.NoPrefix);
-
-		}
-	}
-}

+ 1 - 979
NTERA/Game/Display/HTMLManager.cs

@@ -36,198 +36,8 @@ namespace NTERA.Game.Display
 	/// <summary>
 	/// EmueraConsoleのなんちゃってHtml解決用クラス
 	/// </summary>
-	internal static class HtmlManager
+	public static class HtmlManager
 	{
-		static HtmlManager()
-		{
-			repDic.Add('&', "&amp;");
-			repDic.Add('>', "&gt;");
-			repDic.Add('<', "&lt;");
-			repDic.Add('\"', "&quot;");
-			repDic.Add('\'', "&apos;");
-		}
-		static readonly char[] rep = { '&', '>', '<', '\"', '\'' };
-		static readonly Dictionary<char, string> repDic = new Dictionary<char, string>();
-		private sealed class HtmlAnalzeStateFontTag
-		{
-			public int Color = -1;
-			public int BColor = -1;
-			public string FontName;
-			//public int PointX = 0;
-			//public bool PointXisLocked = false;
-		}
-
-		private sealed class HtmlAnalzeStateButtonTag
-		{
-			public bool IsButton = true;
-			public bool IsButtonTag = true;
-			public int ButtonValueInt;
-			public string ButtonValueStr;
-			public string ButtonTitle;
-			public bool ButtonIsInteger;
-			public int PointX;
-			public bool PointXisLocked;
-		}
-
-		private sealed class HtmlAnalzeState
-		{
-			public bool LineHead = true;//行頭フラグ。一度もテキストが出てきてない状態
-			public FontStyle FontStyle = FontStyle.Regular;
-			public List<HtmlAnalzeStateFontTag> FonttagList = new List<HtmlAnalzeStateFontTag>();
-			public bool FlagNobr;//falseの時に</nobr>するとエラー
-			public bool FlagP;//falseの時に</p>するとエラー
-			public bool FlagNobrClosed;//trueの時に</nobr>するとエラー
-			public bool FlagPClosed;//trueの時に</p>するとエラー
-			public DisplayLineAlignment Alignment = DisplayLineAlignment.LEFT;
-
-			/// <summary>
-			/// 今まで追加された文字列についてのボタンタグ情報
-			/// </summary>
-			public HtmlAnalzeStateButtonTag LastButtonTag;
-			/// <summary>
-			/// 最新のボタンタグ情報
-			/// </summary>
-			public HtmlAnalzeStateButtonTag CurrentButtonTag;
-
-			public bool FlagBr;//<br>による強制改行の予約
-			public bool FlagButton;//<button></button>によるボタン化の予約
-
-			public StringStyle GetSS()
-			{
-				Color c = Config.ForeColor;
-				Color b = Config.FocusColor;
-				string fontname = null;
-				bool colorChanged = false;
-				if (FonttagList.Count > 0)
-				{
-					HtmlAnalzeStateFontTag font = FonttagList[FonttagList.Count - 1];
-					fontname = font.FontName;
-					if (font.Color >= 0)
-					{
-						colorChanged = true;
-						c = Color.FromArgb(font.Color >> 16, (font.Color >> 8) & 0xFF, font.Color & 0xFF);
-					}
-					if (font.BColor >= 0)
-					{
-						b = Color.FromArgb(font.BColor >> 16, (font.BColor >> 8) & 0xFF, font.BColor & 0xFF);
-					}
-				}
-				return new StringStyle(c, colorChanged, b, FontStyle, fontname);
-			}
-		}
-
-		/// <summary>
-		/// 表示行からhtmlへの変換
-		/// </summary>
-		/// <param name="lines"></param>
-		/// <returns></returns>
-		public static string DisplayLine2Html(ConsoleDisplayLine[] lines, bool needPandN)
-		{
-			if (lines == null || lines.Length == 0)
-				return "";
-			StringBuilder b = new StringBuilder();
-			if (needPandN)
-			{
-				switch (lines[0].Align)
-				{
-					case DisplayLineAlignment.LEFT:
-						b.Append("<p align='left'>");
-						break;
-					case DisplayLineAlignment.CENTER:
-						b.Append("<p align='center'>");
-						break;
-					case DisplayLineAlignment.RIGHT:
-						b.Append("<p align='right'>");
-						break;
-				}
-				b.Append("<nobr>");
-			}
-			for (int dispCounter = 0; dispCounter < lines.Length; dispCounter++)
-			{
-				if (dispCounter != 0)
-					b.Append("<br>");
-				ConsoleButtonString[] buttons = lines[dispCounter].Buttons;
-				for (int buttonCounter = 0; buttonCounter < buttons.Length; buttonCounter++)
-				{
-					string titleValue = null;
-					if (!string.IsNullOrEmpty(buttons[buttonCounter].Title))
-						titleValue = Escape(buttons[buttonCounter].Title);
-					bool hasTag = buttons[buttonCounter].IsButton || titleValue != null
-						|| buttons[buttonCounter].PointXisLocked;
-					if (hasTag)
-					{
-						if (buttons[buttonCounter].IsButton)
-						{
-							string attrValue = Escape(buttons[buttonCounter].Inputs);
-							b.Append("<button value='");
-							b.Append(attrValue);
-							b.Append("'");
-						}
-						else
-						{
-							b.Append("<nonbutton");
-						}
-						if (titleValue != null)
-						{
-							b.Append(" title='");
-							b.Append(titleValue);
-							b.Append("'");
-						}
-						if (buttons[buttonCounter].PointXisLocked)
-						{
-							b.Append(" pos='");
-							b.Append(buttons[buttonCounter].RelativePointX.ToString());
-							b.Append("'");
-						}
-						b.Append(">");
-					}
-					AConsoleDisplayPart[] parts = buttons[buttonCounter].StrArray;
-					for (int cssCounter = 0; cssCounter < parts.Length; cssCounter++)
-					{
-						if (parts[cssCounter] is ConsoleStyledString)
-						{
-							ConsoleStyledString css = parts[cssCounter] as ConsoleStyledString;
-							b.Append(getStringStyleStartingTag(css.StringStyle));
-							b.Append(Escape(css.Str));
-							b.Append(getClosingStyleStartingTag(css.StringStyle));
-						}
-						else if (parts[cssCounter] is ConsoleImagePart)
-						{
-							b.Append(parts[cssCounter].AltText);
-							//ConsoleImagePart img = (ConsoleImagePart)parts[cssCounter];
-							//b.Append("<img src='");
-							//b.Append(Escape(img.ResourceName));
-							//if(img.ButtonResourceName != null)
-							//{
-							//	b.Append("' srcb='");
-							//	b.Append(Escape(img.ButtonResourceName));
-							//}
-							//b.Append("'>");
-						}
-						else if (parts[cssCounter] is ConsoleShapePart)
-						{
-							b.Append(parts[cssCounter].AltText);
-						}
-
-					}
-					if (hasTag)
-					{
-						if (buttons[buttonCounter].IsButton)
-							b.Append("</button>");
-						else
-							b.Append("</nonbutton>");
-					}
-
-				}
-			}
-			if(needPandN)
-			{
-				b.Append("</nobr>");
-				b.Append("</p>");
-			}
-			return b.ToString();
-		}
-
 		public static string[] HtmlTagSplit(string str)
 		{
 			List<string> strList = new List<string>();
@@ -258,793 +68,5 @@ namespace NTERA.Game.Display
 			strList.CopyTo(ret);
 			return ret;
 		}
-		
-		/// <summary>
-		/// htmlから表示行の作成
-		/// </summary>
-		/// <param name="str">htmlテキスト</param>
-		/// <param name="sm"></param>
-		/// <param name="console">実際の表示に使わないならnullにする</param>
-        /// <param name="noLineBreak">Disable any line breaks in resulting ConsoleDisplayLine</param>
-		/// <returns></returns>
-		public static ConsoleDisplayLine[] Html2DisplayLine(string str, StringMeasure sm, IConsole console)
-        {
-            bool noBr = false;
-            DisplayLineAlignment alignment;
-            List<ConsoleButtonString> buttonList = Html2ButtonList(str, console, out noBr, out alignment);
-            ConsoleDisplayLine[] ret = PrintStringBuffer.ButtonsToDisplayLines(buttonList, sm, noBr, false);
-
-            foreach (ConsoleDisplayLine dl in ret)
-            {
-                dl.SetAlignment(alignment);
-            }
-            return ret;
-        }
-
-        public static List<ConsoleButtonString> Html2ButtonList(string str, IConsole console, out bool noBr, out DisplayLineAlignment alignment)
-        {
-            HtmlAnalzeState state;
-            List<ConsoleButtonString> buttonList = new List<ConsoleButtonString>();
-            List<AConsoleDisplayPart> cssList = new List<AConsoleDisplayPart>();
-            buttonList = new List<ConsoleButtonString>();
-            StringStream st = new StringStream(str);
-            int found;
-            bool hasComment = str.IndexOf("<!--") >= 0;
-            bool hasReturn = str.IndexOf('\n') >= 0;
-            state = new HtmlAnalzeState();
-            while (!st.EOS)
-            {
-                found = st.Find('<');
-                if (hasReturn)
-                {
-                    int rFound = st.Find('\n');
-                    if (rFound >= 0 && (found > rFound || found < 0))
-                        found = rFound;
-                }
-                if (found < 0)
-                {
-                    string txt = Unescape(st.Substring());
-                    cssList.Add(new ConsoleStyledString(txt, state.GetSS()));
-                    if (state.FlagPClosed)
-                        throw new CodeEE("</p>の後にテキストがあります");
-                    if (state.FlagNobrClosed)
-                        throw new CodeEE("</nobr>の後にテキストがあります");
-                    break;
-                }
-
-	            if (found > 0)
-	            {
-		            string txt = Unescape(st.Substring(st.CurrentPosition, found));
-		            cssList.Add(new ConsoleStyledString(txt, state.GetSS()));
-		            state.LineHead = false;
-		            st.CurrentPosition += found;
-	            }
-	            //コメントタグのみ特別扱い
-                if (hasComment && st.CurrentEqualTo("<!--"))
-                {
-                    st.CurrentPosition += 4;
-                    found = st.Find("-->");
-                    if (found < 0)
-                        throw new CodeEE("コメンdト終了タグ\"-->\"がみつかりません");
-                    st.CurrentPosition += found + 3;
-                    continue;
-                }
-                if (hasReturn && st.Current == '\n')//テキスト中の\nは<br>として扱う
-                {
-                    state.FlagBr = true;
-                    st.ShiftNext();
-                }
-                else//タグ解析
-                {
-                    st.ShiftNext();
-                    AConsoleDisplayPart part = tagAnalyze(state, st);
-                    if (st.Current != '>')
-                        throw new CodeEE("タグ終端'>'が見つかりません");
-                    if (part != null)
-                            cssList.Add(part);
-                    st.ShiftNext();
-                }
-
-                if (state.FlagBr)
-                {
-                    state.LastButtonTag = state.CurrentButtonTag;
-                    if (cssList.Count > 0)
-                        buttonList.Add(cssToButton(cssList, state, console));
-                    buttonList.Add(null);
-                }
-                if (state.FlagButton && cssList.Count > 0)
-                {
-                    buttonList.Add(cssToButton(cssList, state, console));
-                }
-                state.FlagBr = false;
-                state.FlagButton = false;
-                state.LastButtonTag = state.CurrentButtonTag;
-            }
-            //</nobr></p>は省略許可
-            if (state.CurrentButtonTag != null || state.FontStyle != FontStyle.Regular || state.FonttagList.Count > 0)
-                throw new CodeEE("閉じられていないタグがあります");
-            if (cssList.Count > 0)
-                buttonList.Add(cssToButton(cssList, state, console));
-
-            foreach (ConsoleButtonString button in buttonList)
-            {
-                if (button != null && button.PointXisLocked)
-                {
-                    if (!state.FlagNobr)
-                        throw new CodeEE("<nobr>が設定されていない行ではpos属性は使用できません");
-                    if (state.Alignment != DisplayLineAlignment.LEFT)
-                        throw new CodeEE("alignがleftでない行ではpos属性は使用できません");
-                    break;
-                }
-            }
-            alignment = state.Alignment;
-            noBr = state.FlagNobr;
-            return buttonList;
-        }
-
-        public static string Html2PlainText(string str)
-		{
-			string ret = Regex.Replace(str, "\\<[^<]*\\>", "");
-			return Unescape(ret);
-		}
-
-		public static string Escape(string str)
-		{
-			//Net4.5では便利なクラスがあるらしい
-			//return System.Web.HttpUtility.HtmlEncode(str);
-
-			int index = 0;
-			int found = 0;
-			StringBuilder b = new StringBuilder();
-			while (index < str.Length)
-			{
-				found = str.IndexOfAny(rep, index);
-				if (found < 0)//見つからなければ以降を追加して終了
-				{
-					b.Append(str.Substring(index));
-					break;
-				}
-				if (found > index)//間に非エスケープ文字があるなら追加しておく
-					b.Append(str.Substring(index, found - index));
-				string repnew = repDic[str[found]];
-				b.Append(repnew);
-				index = found + 1;
-			}
-			return b.ToString();
-		}
-
-		public static string Unescape(string str)
-		{
-			int index = 0;
-			int found = str.IndexOf('&', index);
-			if (found < 0)
-				return str;
-			StringBuilder b = new StringBuilder();
-			// &~; をひたすら置換するだけ
-			while (index < str.Length)
-			{
-				found = str.IndexOf('&', index);
-				if (found < 0)//見つからなければ以降を追加して終了
-				{
-					b.Append(str.Substring(index));
-					break;
-				}
-				if (found > index)//間に非エスケープ文字があるなら追加しておく
-					b.Append(str.Substring(index, found - index));
-				index = found;
-				found = str.IndexOf(';', index);
-				if (found <= index + 1)
-				{
-					if (found < 0)
-						throw new CodeEE("'&'に対応する';'がみつかりません");
-					throw new CodeEE("'&'と';'が連続しています");
-				}
-				string escWordRow = str.Substring(index + 1, found - index - 1);
-				index = found + 1;
-				string escWord = escWordRow.ToLower();
-				int unicode = 0;
-				switch (escWord)
-				{
-					case "nbsp": b.Append(" "); break;
-					case "amp": b.Append("&"); break;
-					case "gt": b.Append(">"); break;
-					case "lt": b.Append("<"); break;
-					case "quot": b.Append("\""); break;
-					case "apos": b.Append("\'"); break;
-					default:
-						{
-							int iBbase = 10;
-							if (escWord[0] != '#')
-								throw new CodeEE("\"&" + escWordRow + ";\"は適切な文字参照ではありません");
-							if (escWord.Length > 1 && escWord[1] == 'x')
-							{
-								iBbase = 16;
-								escWord = escWord.Substring(2);
-							}
-							else
-								escWord = escWord.Substring(1);
-							try
-							{
-								unicode = Convert.ToInt32(escWord, iBbase);
-							}
-							catch
-							{
-
-								throw new CodeEE("\"&" + escWordRow + ";\"は適切な文字参照ではありません");
-							}
-
-							if (unicode < 0 || unicode > 0xFFFF)
-								throw new CodeEE("\"&" + escWordRow + ";\"はUnicodeの範囲外です(サロゲートペアは使えません)");
-							b.Append((char)unicode);
-							break;
-						}
-				}
-			}
-			return b.ToString();
-		}
-
-		/// <summary>
-		/// ここまでのcssをボタン化。発生原因はbrタグ、行末、ボタンタグ
-		/// </summary>
-		/// <param name="cssList"></param>
-		/// <param name="isbutton"></param>
-		/// <param name="state"></param>
-		/// <param name="console"></param>
-		/// <returns></returns>
-		private static ConsoleButtonString cssToButton(List<AConsoleDisplayPart> cssList, HtmlAnalzeState state, IConsole console)
-		{
-			AConsoleDisplayPart[] css = new AConsoleDisplayPart[cssList.Count];
-			cssList.CopyTo(css);
-			cssList.Clear();
-			ConsoleButtonString ret = null;
-			if (state.LastButtonTag != null && state.LastButtonTag.IsButton)
-			{
-				if (state.LastButtonTag.ButtonIsInteger)
-					ret = new ConsoleButtonString(console, css, state.LastButtonTag.ButtonValueInt, state.LastButtonTag.ButtonValueStr);
-				else
-					ret = new ConsoleButtonString(console, css, state.LastButtonTag.ButtonValueStr);
-			}
-			else
-			{
-				ret = new ConsoleButtonString(console, css);
-				ret.Title = null;
-			}
-			if (state.LastButtonTag != null)
-			{
-				ret.Title = state.LastButtonTag.ButtonTitle;
-				if(state.LastButtonTag.PointXisLocked)
-				{
-					ret.LockPointX(state.LastButtonTag.PointX);
-				}
-			}
-			return ret;
-		}
-
-		public static string GetColorToString(Color color)
-		{
-			StringBuilder b = new StringBuilder();
-			b.Append("#");
-			int colorValue = color.R * 0x10000 + color.G * 0x100 + color.B;
-			b.Append(colorValue.ToString("X6"));
-			return b.ToString();
-		}
-		private static string getStringStyleStartingTag(StringStyle style)
-		{
-			bool fontChanged = !((style.Fontname == null || style.Fontname == Config.FontName)&& !style.ColorChanged && (style.ButtonColor == Config.FocusColor));
-			if (!fontChanged && style.FontStyle == FontStyle.Regular)
-				return "";
-			StringBuilder b = new StringBuilder();
-			if (fontChanged)
-			{
-				b.Append("<font");
-				if (style.Fontname != null && style.Fontname != Config.FontName)
-				{
-					b.Append(" face='");
-					b.Append(Escape(style.Fontname));
-					b.Append("'");
-				}
-				if (style.ColorChanged)
-				{
-					b.Append(" color='#");
-					int colorValue = style.Color.R * 0x10000 + style.Color.G * 0x100 + style.Color.B;
-					b.Append(colorValue.ToString("X6"));
-					b.Append("'");
-				}
-				if (style.ButtonColor != Config.FocusColor)
-				{
-					b.Append(" bcolor='#");
-					int colorValue = style.ButtonColor.R * 0x10000 + style.ButtonColor.G * 0x100 + style.ButtonColor.B;
-					b.Append(colorValue.ToString("X6"));
-					b.Append("'");
-				}
-				b.Append(">");
-			}
-			if (style.FontStyle != FontStyle.Regular)
-			{
-				if ((style.FontStyle & FontStyle.Strikeout) != FontStyle.Regular)
-					b.Append("<s>");
-				if ((style.FontStyle & FontStyle.Underline) != FontStyle.Regular)
-					b.Append("<u>");
-				if ((style.FontStyle & FontStyle.Italic) != FontStyle.Regular)
-					b.Append("<i>");
-				if ((style.FontStyle & FontStyle.Bold) != FontStyle.Regular)
-					b.Append("<b>");
-			}
-
-			return b.ToString();
-		}
-
-		private static string getClosingStyleStartingTag(StringStyle style)
-		{
-			bool fontChanged = !((style.Fontname == null || style.Fontname == Config.FontName) && !style.ColorChanged && (style.ButtonColor == Config.FocusColor));
-			if (!fontChanged && style.FontStyle == FontStyle.Regular)
-				return "";
-			StringBuilder b = new StringBuilder();
-			if (style.FontStyle != FontStyle.Regular)
-			{
-				if ((style.FontStyle & FontStyle.Bold) != FontStyle.Regular)
-					b.Append("</b>");
-				if ((style.FontStyle & FontStyle.Italic) != FontStyle.Regular)
-					b.Append("</i>");
-				if ((style.FontStyle & FontStyle.Underline) != FontStyle.Regular)
-					b.Append("</u>");
-				if ((style.FontStyle & FontStyle.Strikeout) != FontStyle.Regular)
-					b.Append("</s>");
-			}
-			if (fontChanged)
-				b.Append("</font>");
-			return b.ToString();
-		}
-
-		private static AConsoleDisplayPart tagAnalyze(HtmlAnalzeState state, StringStream st)
-		{
-			bool endTag = (st.Current == '/');
-			string tag;
-			if (endTag)
-			{
-				st.ShiftNext();
-				int found = st.Find('>');
-				if (found < 0)
-				{
-					st.CurrentPosition = st.RowString.Length;
-					return null;//戻り先でエラーを出す
-				}
-				tag = st.Substring(st.CurrentPosition, found).Trim();
-				st.CurrentPosition += found;
-				FontStyle endStyle = FontStyle.Strikeout;
-				switch (tag.ToLower())
-				{
-					case "b": endStyle = FontStyle.Bold; goto case "s";
-					case "i": endStyle = FontStyle.Italic; goto case "s";
-					case "u": endStyle = FontStyle.Underline; goto case "s";
-					case "s":
-						if ((state.FontStyle & endStyle) == FontStyle.Regular)
-							throw new CodeEE("</" + tag + ">の前に<" + tag + ">がありません");
-						state.FontStyle ^= endStyle;
-						return null;
-					case "p":
-						if ((!state.FlagP) || (state.FlagPClosed))
-							throw new CodeEE("</p>の前に<p>がありません");
-						state.FlagPClosed = true;
-						return null;
-					case "nobr":
-						if ((!state.FlagNobr) || (state.FlagNobrClosed))
-							throw new CodeEE("</nobr>の前に<nobr>がありません");
-						state.FlagNobrClosed = true;
-						return null;
-					case "font":
-						if (state.FonttagList.Count == 0)
-							throw new CodeEE("</font>の前に<font>がありません");
-						state.FonttagList.RemoveAt(state.FonttagList.Count - 1);
-						return null;
-					case "button":
-						if (state.CurrentButtonTag == null || !state.CurrentButtonTag.IsButtonTag)
-							throw new CodeEE("</button>の前に<button>がありません");
-						state.CurrentButtonTag = null;
-						state.FlagButton = true;
-						return null;
-					case "nonbutton":
-						if (state.CurrentButtonTag == null || state.CurrentButtonTag.IsButtonTag)
-							throw new CodeEE("</nonbutton>の前に<nonbutton>がありません");
-						state.CurrentButtonTag = null;
-						state.FlagButton = true;
-						return null;
-					default:
-						throw new CodeEE("終了タグ</"+tag+">は解釈できません");
-				}
-				//goto error;
-			}
-			//以降は開始タグ
-
-			bool tempUseMacro = LexicalAnalyzer.UseMacro;
-			WordCollection wc = null;
-			try
-			{
-				LexicalAnalyzer.UseMacro = false;//一時的にマクロ展開をやめる
-				tag = LexicalAnalyzer.ReadSingleIdentifier(st);
-				LexicalAnalyzer.SkipWhiteSpace(st);
-				if (st.Current != '>')
-					wc = LexicalAnalyzer.Analyse(st, LexEndWith.GreaterThan, LexAnalyzeFlag.AllowAssignment | LexAnalyzeFlag.AllowSingleQuotationStr);
-			}
-			finally
-			{
-				LexicalAnalyzer.UseMacro = tempUseMacro;
-			}
-			if (string.IsNullOrEmpty(tag))
-				goto error;
-			IdentifierWord word;
-			FontStyle newStyle = FontStyle.Strikeout;
-            switch (tag.ToLower())
-			{
-				case "b": newStyle = FontStyle.Bold; goto case "s";
-				case "i": newStyle = FontStyle.Italic; goto case "s";
-				case "u": newStyle = FontStyle.Underline; goto case "s";
-				case "s":
-					if (wc != null)
-						throw new CodeEE("<" + tag + ">タグにに属性が設定されています");
-					if ((state.FontStyle & newStyle) != FontStyle.Regular)
-						throw new CodeEE("<" + tag + ">が二重に使われています");
-					state.FontStyle |= newStyle;
-						return null;
-				case "br":
-					if (wc != null)
-						throw new CodeEE("<" + tag + ">タグにに属性が設定されています");
-					state.FlagBr = true;
-						return null;
-				case "nobr":
-					if (wc != null)
-						throw new CodeEE("<" + tag + ">タグに属性が設定されています");
-					if (!state.LineHead)
-						throw new CodeEE("<nobr>が行頭以外で使われています");
-					if (state.FlagNobr)
-						throw new CodeEE("<nobr>が2度以上使われています");
-					state.FlagNobr = true;
-						return null;
-				case "p":
-					{
-						if (wc == null)
-							throw new CodeEE("<" + tag + ">タグに属性が設定されていません");
-						if (!state.LineHead)
-							throw new CodeEE("<p>が行頭以外で使われています");
-						if (state.FlagNobr)
-							throw new CodeEE("<p>が2度以上使われています");
-						word = wc.Current as IdentifierWord;
-						wc.ShiftNext();
-						OperatorWord op = wc.Current as OperatorWord;
-						wc.ShiftNext();
-						LiteralStringWord attr = wc.Current as LiteralStringWord;
-						wc.ShiftNext();
-						if (!wc.EOL || word == null || op == null || op.Code != OperatorCode.Assignment || attr == null)
-							goto error;
-						if (!word.Code.Equals("align", StringComparison.OrdinalIgnoreCase))
-							throw new CodeEE("<p>タグの属性名" + word.Code + "は解釈できません");
-						string attrValue = Unescape(attr.Str);
-						switch (attrValue.ToLower())
-						{
-							case "left":
-								state.Alignment = DisplayLineAlignment.LEFT;
-								break;
-							case "center":
-								state.Alignment = DisplayLineAlignment.CENTER;
-								break;
-							case "right":
-								state.Alignment = DisplayLineAlignment.RIGHT;
-								break;
-							default:
-								throw new CodeEE("属性値" + attr.Str + "は解釈できません");
-						}
-						state.FlagP = true;
-						return null;
-					}
-				case "img":
-					{
-						if (wc == null)
-							throw new CodeEE("<" + tag + ">タグに属性が設定されていません");
-						string attrValue = null;
-						string src = null;
-						string srcb = null;
-						int height = 0;
-						int width = 0;
-						int ypos = 0;
-						while (wc != null && !wc.EOL)
-						{
-							word = wc.Current as IdentifierWord;
-							wc.ShiftNext();
-							OperatorWord op = wc.Current as OperatorWord;
-							wc.ShiftNext();
-							LiteralStringWord attr = wc.Current as LiteralStringWord;
-							wc.ShiftNext();
-							if (word == null || op == null || op.Code != OperatorCode.Assignment || attr == null)
-								goto error;
-							attrValue = Unescape(attr.Str);
-							if (word.Code.Equals("src", StringComparison.OrdinalIgnoreCase))
-							{
-								if (src != null)
-									throw new CodeEE("<" + tag + ">タグに" + word.Code + "属性が2度以上指定されています");
-								src = attrValue;
-							}
-							else if (word.Code.Equals("srcb", StringComparison.OrdinalIgnoreCase))
-							{
-								if (srcb != null)
-									throw new CodeEE("<" + tag + ">タグに" + word.Code + "属性が2度以上指定されています");
-								srcb = attrValue;
-							}
-							else if (word.Code.Equals("height", StringComparison.OrdinalIgnoreCase))
-							{
-								if (height != 0)
-									throw new CodeEE("<" + tag + ">タグに" + word.Code + "属性が2度以上指定されています");
-								if (!int.TryParse(attrValue, out height))
-									throw new CodeEE("<" + tag + ">タグのheight属性の属性値が数値として解釈できません");
-							}
-							else if (word.Code.Equals("width", StringComparison.OrdinalIgnoreCase))
-							{
-								if (width != 0)
-									throw new CodeEE("<" + tag + ">タグに" + word.Code + "属性が2度以上指定されています");
-								if (!int.TryParse(attrValue, out width))
-									throw new CodeEE("<" + tag + ">タグのwidth属性の属性値が数値として解釈できません");
-							}
-							else if (word.Code.Equals("ypos", StringComparison.OrdinalIgnoreCase))
-							{
-								if (ypos != 0)
-									throw new CodeEE("<" + tag + ">タグに" + word.Code + "属性が2度以上指定されています");
-								if (!int.TryParse(attrValue, out ypos))
-									throw new CodeEE("<" + tag + ">タグのypos属性の属性値が数値として解釈できません");
-							}
-							else
-								throw new CodeEE("<" + tag + ">タグの属性名" + word.Code + "は解釈できません");
-						}
-						if (src == null)
-							throw new CodeEE("<" + tag + ">タグにsrc属性が設定されていません");
-						return new ConsoleImagePart(src, srcb, height, width, ypos);
-					}
-
-				case "shape":
-					{
-						if (wc == null)
-							throw new CodeEE("<" + tag + ">タグに属性が設定されていません");
-						int[] param = null;
-						string type = null;
-						int color = -1;
-						int bcolor = -1;
-						while (!wc.EOL)
-						{
-							word = wc.Current as IdentifierWord;
-							wc.ShiftNext();
-							OperatorWord op = wc.Current as OperatorWord;
-							wc.ShiftNext();
-							LiteralStringWord attr = wc.Current as LiteralStringWord;
-							wc.ShiftNext();
-							if (word == null || op == null || op.Code != OperatorCode.Assignment || attr == null)
-								goto error;
-							string attrValue = Unescape(attr.Str);
-							switch (word.Code.ToLower())
-							{
-								case "color":
-									if (color >= 0)
-										throw new CodeEE("<" + tag + ">タグに" + word.Code + "属性が2度以上指定されています");
-									color = stringToColorInt32(attrValue);
-									break;
-								case "bcolor":
-									if (bcolor >= 0)
-										throw new CodeEE("<" + tag + ">タグに" + word.Code + "属性が2度以上指定されています");
-									bcolor = stringToColorInt32(attrValue);
-									break;
-								case "type":
-									if (type != null)
-										throw new CodeEE("<" + tag + ">タグに" + word.Code + "属性が2度以上指定されています");
-									type = attrValue;
-									break;
-								case "param":
-									if (param != null)
-										throw new CodeEE("<" + tag + ">タグに" + word.Code + "属性が2度以上指定されています");
-									{
-										string[] tokens = attrValue.Split(',');
-										param = new int[tokens.Length];
-										for (int i = 0; i < tokens.Length; i++)
-										{
-											if (!int.TryParse(tokens[i], out param[i]))
-												throw new CodeEE("<" + tag + ">タグの" + word.Code + "属性の属性値が数値として解釈できません");
-										}
-										break;
-									}
-								default:
-									throw new CodeEE("<" + tag + ">タグの属性名" + word.Code + "は解釈できません");
-							}
-						}
-						if (param == null)
-							throw new CodeEE("<" + tag + ">タグにparam属性が設定されていません");
-						if (type == null)
-							throw new CodeEE("<" + tag + ">タグにtype属性が設定されていません");
-						Color c = Config.ForeColor;
-						Color b = Config.FocusColor;
-						if (color >= 0)
-						{
-							c = Color.FromArgb(color >> 16, (color >> 8) & 0xFF, color & 0xFF);
-						}
-						if (bcolor >= 0)
-						{
-							b = Color.FromArgb(bcolor >> 16, (bcolor >> 8) & 0xFF, bcolor & 0xFF);
-						}
-						return ConsoleShapePart.CreateShape(type, param, c, b, color >= 0);
-					}
-				case "button":
-				case "nonbutton":
-					{
-						if (state.CurrentButtonTag != null)
-							throw new CodeEE("<button>又は<nonbutton>が入れ子にされています");
-						HtmlAnalzeStateButtonTag buttonTag = new HtmlAnalzeStateButtonTag();
-						bool isButton = tag.ToLower() == "button";
-						string attrValue = null;
-						string value = null;
-						//if (wc == null)
-						//	throw new CodeEE("<" + tag + ">タグに属性が設定されていません");
-						while (wc != null && !wc.EOL)
-						{
-							word = wc.Current as IdentifierWord;
-							wc.ShiftNext();
-							OperatorWord op = wc.Current as OperatorWord;
-							wc.ShiftNext();
-							LiteralStringWord attr = wc.Current as LiteralStringWord;
-							wc.ShiftNext();
-							if (word == null || op == null || op.Code != OperatorCode.Assignment || attr == null)
-								goto error;
-							attrValue = Unescape(attr.Str);
-							if (word.Code.Equals("value", StringComparison.OrdinalIgnoreCase))
-							{
-								if (!isButton)
-									throw new CodeEE("<" + tag + ">タグにvalue属性が設定されています");
-								if (value != null)
-										throw new CodeEE("<" + tag + ">タグに" + word.Code + "属性が2度以上指定されています");
-								value = attrValue;
-							}
-							else if (word.Code.Equals("title", StringComparison.OrdinalIgnoreCase))
-							{
-								if (buttonTag.ButtonTitle != null)
-										throw new CodeEE("<" + tag + ">タグに" + word.Code + "属性が2度以上指定されています");
-								buttonTag.ButtonTitle = attrValue;
-							}
-							else if (word.Code.Equals("pos", StringComparison.OrdinalIgnoreCase))
-							{
-								//throw new NotImplCodeEE();
-								int pos = 0;
-								if (buttonTag.PointXisLocked)
-										throw new CodeEE("<" + tag + ">タグに" + word.Code + "属性が2度以上指定されています");
-								if (!int.TryParse(attrValue, out pos))
-									throw new CodeEE("<" + tag + ">タグのpos属性の属性値が数値として解釈できません");
-								buttonTag.PointX = pos;
-								buttonTag.PointXisLocked = true;
-							}
-							else
-								throw new CodeEE("<" + tag + ">タグの属性名" + word.Code + "は解釈できません");
-						}
-						if (isButton)
-						{
-							//if (value == null)
-							//	throw new CodeEE("<" + tag + ">タグにvalue属性が設定されていません");
-							int intValue = 0;
-							buttonTag.ButtonIsInteger = (int.TryParse(value, out intValue));
-							buttonTag.ButtonValueInt = intValue;
-							buttonTag.ButtonValueStr = value;
-						}
-						buttonTag.IsButton = value != null;
-						buttonTag.IsButtonTag = isButton;
-						state.CurrentButtonTag = buttonTag;
-						state.FlagButton = true;
-						return null;
-					}
-				case "font":
-					{
-						if (wc == null)
-							throw new CodeEE("<" + tag + ">タグに属性が設定されていません");
-						HtmlAnalzeStateFontTag font = new HtmlAnalzeStateFontTag();
-						while (!wc.EOL)
-						{
-							word = wc.Current as IdentifierWord;
-							wc.ShiftNext();
-							OperatorWord op = wc.Current as OperatorWord;
-							wc.ShiftNext();
-							LiteralStringWord attr = wc.Current as LiteralStringWord;
-							wc.ShiftNext();
-							if (word == null || op == null || op.Code != OperatorCode.Assignment || attr == null)
-								goto error;
-							string attrValue = Unescape(attr.Str);
-							switch (word.Code.ToLower())
-							{
-								case "color":
-									if (font.Color >= 0)
-										throw new CodeEE("<" + tag + ">タグに" + word.Code + "属性が2度以上指定されています");
-									font.Color = stringToColorInt32(attrValue);
-									break;
-								case "bcolor":
-									if (font.BColor >= 0)
-										throw new CodeEE("<" + tag + ">タグに" + word.Code + "属性が2度以上指定されています");
-									font.BColor = stringToColorInt32(attrValue);
-									break;
-								case "face":
-									if (font.FontName != null)
-										throw new CodeEE("<" + tag + ">タグに" + word.Code + "属性が2度以上指定されています");
-									font.FontName = attrValue;
-									break;
-								//case "pos":
-								//	{
-								//		//throw new NotImplCodeEE();
-								//		if (font.PointXisLocked)
-								//			throw new CodeEE("<" + tag + ">タグに" + word.Code + "属性が2度以上指定されています");
-								//		int pos = 0;
-								//		if (!int.TryParse(attrValue, out pos))
-								//			throw new CodeEE("<font>タグのpos属性の属性値が数値として解釈できません");
-								//		font.PointX = pos;
-								//		font.PointXisLocked = true;
-								//		break;
-								//	}
-								default:
-								throw new CodeEE("<" + tag + ">タグの属性名" + word.Code + "は解釈できません");
-							}
-						}
-						//他のfontタグの内側であるなら未設定項目については外側のfontタグの設定を受け継ぐ(posは除く)
-						if (state.FonttagList.Count > 0)
-						{
-							HtmlAnalzeStateFontTag oldFont = state.FonttagList[state.FonttagList.Count - 1];
-							if (font.Color < 0)
-								font.Color = oldFont.Color;
-							if (font.BColor < 0)
-								font.BColor = oldFont.BColor;
-							if (font.FontName == null)
-								font.FontName = oldFont.FontName;
-						}
-						state.FonttagList.Add(font);
-						return null;
-					}
-				default:
-					goto error;
-			}
-
-
-		error:
-			throw new CodeEE("html文字列\"" + st.RowString + "\"のタグ解析中にエラーが発生しました");
-		}
-
-		private static int stringToColorInt32(string str)
-		{
-			if(str.Length == 0)
-				throw new CodeEE("色を表す単語又は#RRGGBB値が必要です");
-			int i = 0;
-			if (str[0] == '#')
-			{
-				string colorvalue = str.Substring(1);
-				try
-				{
-					i = Convert.ToInt32(colorvalue, 16);
-					if (i < 0 || i > 0xFFFFFF)
-						throw new CodeEE(colorvalue + "は適切な色指定の範囲外です");
-				}
-				catch
-				{
-					throw new CodeEE(colorvalue + "は数値として解釈できません");
-				}
-			}
-			else
-			{
-				Color color = Color.FromName(str);
-				if (color.A == 0)//色名として解釈失敗 エラー確定
-				{
-					if(str.Equals("transparent", StringComparison.OrdinalIgnoreCase))
-						throw new CodeEE("無色透明(Transparent)は色として指定できません");
-					try
-					{
-						i = Convert.ToInt32(str, 16);
-					}
-					catch//16進数でもない
-					{
-						throw new CodeEE("指定された色名\"" + str + "\"は無効な色名です");
-					}
-					//#RRGGBBを意図したのかもしれない
-					throw new CodeEE("指定された色名\"" + str + "\"は無効な色名です(16進数で色を指定する場合には数値の前に#が必要です)");
-				}
-				i = color.R * 0x10000 + color.G * 0x100 + color.B;
-			}
-			return i;
-		}
-
 	}
 }

+ 0 - 543
NTERA/Game/Display/PrintStringBuffer.cs

@@ -1,543 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Drawing;
-using System.Text;
-using MinorShift.Emuera;
-using MinorShift.Emuera.Sub;
-using NTERA.Interop;
-
-namespace NTERA.Game.Display
-{
-	/*
-	 * ConsoleStyledString = string + StringStyle
-	 * ConsoleButtonString = (ConsoleStyledString) * n + ButtonValue
-	 * ConsoleDisplayLine = (ConsoleButtonString) * n
-	 * PrintStringBufferはERBのPRINT命令からConsoleDisplayLineを作る
-	*/
-
-	/// <summary>
-	/// PRINT命令を貯める&最終的に解決するクラス
-	/// </summary>
-	internal sealed class PrintStringBuffer
-	{
-		public PrintStringBuffer(IConsole parent)
-		{
-			this.parent = parent;
-		}
-		readonly IConsole parent;
-		StringBuilder builder = new StringBuilder();
-		List<AConsoleDisplayPart> m_stringList = new List<AConsoleDisplayPart>();
-		StringStyle lastStringStyle;
-		List<ConsoleButtonString> m_buttonList = new List<ConsoleButtonString>();
-
-		public int BufferStrLength
-		{
-			get
-			{
-				int length = 0;
-				foreach (AConsoleDisplayPart css in m_stringList)
-				{
-					if (css is ConsoleStyledString)
-						length += css.Str.Length;
-					else
-						length += 1;
-				}
-				return length;
-			}
-		}
-
-		public void Append(AConsoleDisplayPart part)
-		{
-			if (builder.Length != 0)
-			{
-				m_stringList.Add(new ConsoleStyledString(builder.ToString(), lastStringStyle));
-				builder.Remove(0, builder.Length);
-			}
-			m_stringList.Add(part);
-		}
-
-		public void Append(string str, StringStyle style)
-		{
-			Append(str, style, false);
-		}
-
-		public void Append(string str, StringStyle style, bool force_button)
-		{
-			if (BufferStrLength > 2000)
-				return;
-			if (force_button)
-				fromCssToButton();
-			if ((builder.Length == 0) || (lastStringStyle == style))
-			{
-				if (builder.Length > 2000)
-					return;
-				if (builder.Length + str.Length > 2000)
-					str = str.Substring(0, 2000 - builder.Length) + "※※※バッファーの文字数が2000字(全角1000字)を超えています。これ以降は表示できません※※※";
-				builder.Append(str);
-				lastStringStyle = style;
-			}
-			else
-			{
-				m_stringList.Add(new ConsoleStyledString(builder.ToString(), lastStringStyle));
-				builder.Remove(0, builder.Length);
-				builder.Append(str);
-				lastStringStyle = style;
-			}
-			if (force_button)
-				fromCssToButton();
-		}
-
-		public void AppendButton(string str, StringStyle style, string input)
-		{
-			fromCssToButton();
-			m_stringList.Add(new ConsoleStyledString(str, style));
-			if (m_stringList.Count == 0)
-				return;
-			m_buttonList.Add(createButton(m_stringList, input));
-			m_stringList.Clear();
-		}
-
-		public void AppendButton(string str, StringStyle style, long input)
-		{
-			fromCssToButton();
-			m_stringList.Add(new ConsoleStyledString(str, style));
-			if (m_stringList.Count == 0)
-				return;
-			m_buttonList.Add(createButton(m_stringList, input));
-			m_stringList.Clear();
-		}
-
-        public void AppendButton(ConsoleButtonString cbs, StringStyle style)
-        {
-            fromCssToButton();
-            m_stringList.Add(new ConsoleStyledString(cbs.ToString(), style));
-            if (m_stringList.Count == 0)
-                return;
-            m_buttonList.Add(cbs);
-            m_stringList.Clear();
-        }
-
-        public void AppendPlainText(string str, StringStyle style)
-		{
-			fromCssToButton();
-			m_stringList.Add(new ConsoleStyledString(str, style));
-			if (m_stringList.Count == 0)
-				return;
-			m_buttonList.Add(createPlainButton(m_stringList));
-			m_stringList.Clear();
-		}
-
-		public bool IsEmpty => ((m_buttonList.Count == 0) && (builder.Length == 0) && (m_stringList.Count == 0));
-
-		public override string ToString()
-		{
-			StringBuilder buf = new StringBuilder();
-			foreach (ConsoleButtonString button in m_buttonList)
-				buf.Append(button);
-			foreach (AConsoleDisplayPart css in m_stringList)
-				buf.Append(css.Str);
-			buf.Append(builder);
-			return buf.ToString();
-		}
-
-		public ConsoleDisplayLine AppendAndFlushErrButton(string str, StringStyle style, string input, ScriptPosition pos, StringMeasure sm)
-		{
-			fromCssToButton();
-			m_stringList.Add(new ConsoleStyledString(str, style));
-			if (m_stringList.Count == 0)
-				return null;
-			m_buttonList.Add(createButton(m_stringList, input, pos));
-			m_stringList.Clear();
-			return FlushSingleLine(sm, false);
-		}
-
-		public ConsoleDisplayLine FlushSingleLine(StringMeasure stringMeasure, bool temporary)
-		{
-			fromCssToButton();
-			setWidthToButtonList(m_buttonList, stringMeasure, true);
-			ConsoleButtonString[] dispLineButtonArray = new ConsoleButtonString[m_buttonList.Count];
-			m_buttonList.CopyTo(dispLineButtonArray);
-			ConsoleDisplayLine line = new ConsoleDisplayLine(dispLineButtonArray, true, temporary);
-			clearBuffer();
-			return line;
-		}
-
-		public ConsoleDisplayLine[] Flush(StringMeasure stringMeasure, bool temporary)
-		{
-			fromCssToButton();
-			ConsoleDisplayLine[] ret = ButtonsToDisplayLines(m_buttonList, stringMeasure, false, temporary);
-			clearBuffer();
-			return ret;
-		}
-
-		private static ConsoleDisplayLine m_buttonsToDisplayLine(List<ConsoleButtonString> lineButtonList, bool firstLine, bool temporary)
-		{
-			ConsoleButtonString[] dispLineButtonArray = new ConsoleButtonString[lineButtonList.Count];
-			lineButtonList.CopyTo(dispLineButtonArray);
-			lineButtonList.Clear();
-			return new ConsoleDisplayLine(dispLineButtonArray, firstLine, temporary);
-		}
-
-		public static ConsoleDisplayLine[] ButtonsToDisplayLines(List<ConsoleButtonString> buttonList, StringMeasure stringMeasure, bool nobr, bool temporary)
-		{
-			if (buttonList.Count == 0)
-				return new ConsoleDisplayLine[0];
-			setWidthToButtonList(buttonList, stringMeasure, nobr);
-			List<ConsoleDisplayLine> lineList = new List<ConsoleDisplayLine>();
-			List<ConsoleButtonString> lineButtonList = new List<ConsoleButtonString>();
-			int windowWidth = Config.DrawableWidth;
-			bool firstLine = true;
-			for (int i = 0; i < buttonList.Count; i++)
-			{
-				if (buttonList[i] == null)
-				{//強制改行フラグ
-					lineList.Add(m_buttonsToDisplayLine(lineButtonList, firstLine, temporary));
-					firstLine = false;
-					buttonList.RemoveAt(i);
-					i--;
-					continue;
-				}
-				if (nobr || ((buttonList[i].PointX + buttonList[i].Width <= windowWidth)))
-				{//改行不要モードであるか表示可能領域に収まるならそのままでよい
-					lineButtonList.Add(buttonList[i]);
-					continue;
-				}
-				//新しい表示行を作る
-
-				//ボタンを分割するか?
-				//「ボタンの途中で行を折りかえさない」がfalseなら分割する
-				//このボタンが単体で表示可能領域を上回るなら分割必須
-				//クリック可能なボタンでないなら分割する。ただし「ver1739以前の非ボタン折り返しを再現する」ならクリックの可否を区別しない
-				if ((!Config.ButtonWrap) || (lineButtonList.Count == 0) || (!buttonList[i].IsButton && !Config.CompatiLinefeedAs1739))
-				{//ボタン分割する
-					int divIndex = getDivideIndex(buttonList[i], stringMeasure);
-					if (divIndex > 0)
-					{
-						ConsoleButtonString newButton = buttonList[i].DivideAt(divIndex, stringMeasure);
-						//newButton.CalcPointX(buttonList[i].PointX + buttonList[i].Width);
-						buttonList.Insert(i + 1, newButton);
-						lineButtonList.Add(buttonList[i]);
-						i++;
-					}
-					else if (divIndex == 0 && (lineButtonList.Count > 0))
-					{//まるごと次の行に送る
-					}
-					else//分割できない要素のみで構成されたボタンは分割できない
-					{
-						lineButtonList.Add(buttonList[i]);
-						continue;
-					}
-				}
-				lineList.Add(m_buttonsToDisplayLine(lineButtonList, firstLine, temporary));
-				firstLine = false;
-				//位置調整
-//				shiftX = buttonList[i].PointX;
-				int pointX = 0;
-				for (int j = i; j < buttonList.Count; j++)
-				{
-					if (buttonList[j] == null)//強制改行を挟んだ後は調整無用
-						break;
-					buttonList[j].CalcPointX(pointX);
-					pointX += buttonList[j].Width;
-				}
-				i--;//buttonList[i]は新しい行に含めないので次の行のために再検討する必要がある(直後のi++と相殺)
-			}
-			if (lineButtonList.Count > 0)
-			{
-				lineList.Add(m_buttonsToDisplayLine(lineButtonList, firstLine, temporary));
-			}
-			ConsoleDisplayLine[] ret = new ConsoleDisplayLine[lineList.Count];
-			lineList.CopyTo(ret);
-			return ret;
-		}
-
-		/// <summary>
-		/// 1810beta003新規 マークアップ用 Append とFlushを同時にやる
-		/// </summary>
-		/// <param name="str"></param>
-		/// <param name="stringMeasure"></param>
-		/// <returns></returns>
-		public ConsoleDisplayLine[] PrintHtml(string str, StringMeasure stringMeasure)
-		{
-			throw new NotImplementedException();
-		}
-
-		#region Flush用privateメソッド
-
-		private void clearBuffer()
-		{
-			builder.Remove(0, builder.Length);
-			m_stringList.Clear();
-			m_buttonList.Clear();
-		}
-
-		/// <summary>
-		/// cssListをbuttonに変換し、buttonListに追加。
-		/// この時点ではWidthなどは考えない。
-		/// </summary>
-		private void fromCssToButton()
-		{
-			if (builder.Length != 0)
-			{
-				m_stringList.Add(new ConsoleStyledString(builder.ToString(), lastStringStyle));
-				builder.Remove(0, builder.Length);
-			}
-			if (m_stringList.Count == 0)
-				return;
-			m_buttonList.AddRange(createButtons(m_stringList));
-			m_stringList.Clear();
-		}
-
-		/// <summary>
-		/// 物理行を1つのボタンへ。
-		/// </summary>
-		/// <returns></returns>
-		private ConsoleButtonString createButton(List<AConsoleDisplayPart> cssList, string input)
-		{
-			AConsoleDisplayPart[] cssArray = new AConsoleDisplayPart[cssList.Count];
-			cssList.CopyTo(cssArray);
-			cssList.Clear();
-			return new ConsoleButtonString(parent, cssArray, input);
-		}
-		private ConsoleButtonString createButton(List<AConsoleDisplayPart> cssList, string input, ScriptPosition pos)
-		{
-			AConsoleDisplayPart[] cssArray = new AConsoleDisplayPart[cssList.Count];
-			cssList.CopyTo(cssArray);
-			cssList.Clear();
-			return new ConsoleButtonString(parent, cssArray, input, pos);
-		}
-		private ConsoleButtonString createButton(List<AConsoleDisplayPart> cssList, long input)
-		{
-			AConsoleDisplayPart[] cssArray = new AConsoleDisplayPart[cssList.Count];
-			cssList.CopyTo(cssArray);
-			cssList.Clear();
-			return new ConsoleButtonString(parent, cssArray, input);
-		}
-		private ConsoleButtonString createPlainButton(List<AConsoleDisplayPart> cssList)
-		{
-			AConsoleDisplayPart[] cssArray = new AConsoleDisplayPart[cssList.Count];
-			cssList.CopyTo(cssArray);
-			cssList.Clear();
-			return new ConsoleButtonString(parent, cssArray);
-		}
-
-		/// <summary>
-		/// 物理行をボタン単位に分割。引数のcssListの内容は変更される場合がある。
-		/// </summary>
-		/// <returns></returns>
-		private ConsoleButtonString[] createButtons(List<AConsoleDisplayPart> cssList)
-		{
-			StringBuilder buf = new StringBuilder();
-			for (int i = 0; i < cssList.Count; i++)
-			{
-				buf.Append(cssList[i].Str);
-			}
-			List<ButtonPrimitive> bpList = ButtonStringCreator.SplitButton(buf.ToString());
-			ConsoleButtonString[] ret = new ConsoleButtonString[bpList.Count];
-			AConsoleDisplayPart[] cssArray = null;
-			if (ret.Length == 1)
-			{
-				cssArray = new AConsoleDisplayPart[cssList.Count];
-				cssList.CopyTo(cssArray);
-				if (bpList[0].CanSelect)
-					ret[0] = new ConsoleButtonString(parent, cssArray, bpList[0].Input);
-				else
-					ret[0] = new ConsoleButtonString(parent, cssArray);
-				return ret;
-			}
-			int cssStartCharIndex = 0;
-			int buttonEndCharIndex = 0;
-			int cssIndex = 0;
-			List<AConsoleDisplayPart> buttonCssList = new List<AConsoleDisplayPart>();
-			for (int i = 0; i < ret.Length; i++)
-			{
-				ButtonPrimitive bp = bpList[i];
-				buttonEndCharIndex += bp.Str.Length;
-				while (true)
-				{
-					if (cssIndex >= cssList.Count)
-						break;
-					AConsoleDisplayPart css = cssList[cssIndex];
-					if (cssStartCharIndex + css.Str.Length >= buttonEndCharIndex)
-					{//ボタンの終端を発見
-						int used = buttonEndCharIndex - cssStartCharIndex;
-						if (used > 0 && css.CanDivide)
-						{//cssの区切りの途中でボタンの区切りがある。
-							
-							ConsoleStyledString newCss = ((ConsoleStyledString)css).DivideAt(used);
-							if (newCss != null)
-							{
-								cssList.Insert(cssIndex + 1, newCss);
-								newCss.PointX = css.PointX + css.Width;
-							}
-						}
-						buttonCssList.Add(css);
-						cssStartCharIndex += css.Str.Length;
-						cssIndex++;
-						break;
-					}
-					//ボタンの終端はまだ先。
-					buttonCssList.Add(css);
-					cssStartCharIndex += css.Str.Length;
-					cssIndex++;
-				}
-				cssArray = new AConsoleDisplayPart[buttonCssList.Count];
-				buttonCssList.CopyTo(cssArray);
-				if (bp.CanSelect)
-					ret[i] = new ConsoleButtonString(parent, cssArray, bp.Input);
-				else
-					ret[i] = new ConsoleButtonString(parent, cssArray);
-				buttonCssList.Clear();
-			}
-			return ret;
-
-		}
-
-
-		//stringListにPointX、Widthを追加
-		public static void setWidthToButtonList(List<ConsoleButtonString> buttonList, StringMeasure stringMeasure, bool nobr)
-		{
-			int pointX = 0;
-			int count = buttonList.Count;
-			float subPixel = 0;
-			for (int i = 0; i < buttonList.Count; i++)
-			{
-				ConsoleButtonString button = buttonList[i];
-				if (button == null)
-				{//改行フラグ
-					pointX = 0;
-					continue;
-				}
-				button.CalcWidth(stringMeasure, subPixel);
-				button.CalcPointX(pointX);
-				pointX = button.PointX + button.Width;
-				if (button.PointXisLocked)
-					subPixel = 0;
-				//pointX += button.Width;
-				subPixel = button.XsubPixel;
-			}
-
-			//1815 バグバグなのでコメントアウト Width測定の省略はいずれやりたい
-			////1815 alignLeft, nobrを前提にした新方式
-			////PointXの直接指定を可能にし、Width測定を一部省略
-			//ConsoleStyledString lastCss = null;
-			//for (int i = 0; i < buttonList.Count; i++)
-			//{
-			//    ConsoleButtonString button = buttonList[i];
-			//    if (button == null)
-			//    {//改行フラグ
-			//        pointX = 0;
-			//        lastCss = null;
-			//        continue;
-			//    }
-			//    for (int j = 0; j < button.StrArray.Length; j++)
-			//    {
-			//        ConsoleStyledString css = button.StrArray[j];
-			//        if (css.PointXisLocked)//位置固定フラグ
-			//        {//位置固定なら前のcssのWidth測定を省略
-			//            pointX = css.PointX;
-			//            if (lastCss != null)
-			//            {
-			//                lastCss.Width = css.PointX - lastCss.PointX;
-			//                if (lastCss.Width < 0)
-			//                    lastCss.Width = 0;
-			//            }
-			//        }
-			//        else
-			//        {
-			//            if (lastCss != null)
-			//            {
-			//                lastCss.SetWidth(stringMeasure);
-			//                pointX += lastCss.Width;
-			//            }
-			//            css.PointX = pointX;
-			//        }
-			//    }
-			//}
-			////ConsoleButtonStringの位置・幅を決定(クリック可能域の決定のために必要)
-			//for (int i = 0; i < buttonList.Count; i++)
-			//{
-			//    ConsoleButtonString button = buttonList[i];
-			//    if (button == null || button.StrArray.Length == 0)
-			//        continue;
-			//    button.PointX = button.StrArray[0].PointX;
-			//    lastCss = button.StrArray[button.StrArray.Length - 1];
-			//    if (lastCss.Width >= 0)
-			//        button.Width = lastCss.PointX - button.PointX + lastCss.Width;
-			//    else if (i >= buttonList.Count - 1 || buttonList[i+1] == null || buttonList[i+1].StrArray.Length == 0)//行末
-			//        button.Width = Config.WindowX;//右端のボタンについては右側全部をボタン領域にしてしまう
-			//    else
-			//        button.Width = buttonList[i+1].StrArray[0].PointX - button.PointX;
-			//    if (button.Width < 0)
-			//        button.Width = 0;//pos指定次第ではクリック不可能なボタンができてしまう。まあ仕方ない
-			//}
-		}
-
-		private static int getDivideIndex(ConsoleButtonString button, StringMeasure sm)
-		{
-			AConsoleDisplayPart divCss = null;
-			int pointX = button.PointX;
-			int strLength = 0;
-			int index = 0;
-			foreach (AConsoleDisplayPart css in button.StrArray)
-			{
-				if (pointX + css.Width > Config.DrawableWidth)
-				{
-					if (index == 0 && !css.CanDivide)
-						continue;
-					divCss = css;
-					break;
-				}
-				index++;
-				strLength += css.Str.Length;
-				pointX += css.Width;
-			}
-			if (divCss != null)
-			{
-				int cssDivIndex = getDivideIndex(divCss, sm);
-				if (cssDivIndex > 0)
-					strLength += cssDivIndex;
-			}
-			return strLength;
-		}
-
-		private static int getDivideIndex(AConsoleDisplayPart part, StringMeasure sm)
-		{
-			if (!part.CanDivide)
-				return -1;
-			ConsoleStyledString css = part as ConsoleStyledString;
-			if (part == null)
-				return -1;
-			int widthLimit = Config.DrawableWidth - css.PointX;
-			string str = css.Str;
-			Font font = css.Font;
-			int point = 0;
-			int highLength = str.Length;//widthLimitを超える最低の文字index(文字数-1)。
-			int lowLength = 0;//超えない最大の文字index。
-			//int i = (int)(widthLimit / fontDisplaySize);//およその文字数を推定
-			//if (i > str.Length - 1)//配列の外を参照しないように。
-			//	i = str.Length - 1;
-			int i = lowLength;//およその文字数を推定←やめた
-
-			string test = null;
-			while ((highLength - lowLength) > 1)//差が一文字以下になるまで繰り返す。
-			{
-				test = str.Substring(0, i);
-				point = sm.GetDisplayLength(test, font);
-				if (point <= widthLimit)//サイズ内ならlowLengthを更新。文字数を増やす。
-				{
-					lowLength = i;
-					i++;
-				}
-				else//サイズ外ならhighLengthを更新。文字数を減らす。
-				{
-					highLength = i;
-					i--;
-				}
-			}
-			return lowLength;
-		}
-		#endregion
-
-	}
-}

+ 0 - 87
NTERA/Game/Display/StringMeasure.cs

@@ -1,87 +0,0 @@
-using System;
-using System.Drawing;
-using System.Drawing.Imaging;
-using System.Windows.Forms;
-using MinorShift.Emuera;
-using MinorShift._Library;
-
-namespace NTERA.Game.Display
-{
-
-	/// <summary>
-	/// テキスト長計測装置
-	/// 1819 必要になるたびにCreateGraphicsする方式をやめてあらかじめGraphicsを用意しておくことにする
-	/// </summary>
-	public sealed class StringMeasure : IDisposable
-	{
-		public StringMeasure()
-		{
-			textDrawingMode = Config.TextDrawingMode;
-			layoutSize = new Size(Config.WindowX * 2, Config.LineHeight);
-			layoutRect = new RectangleF(0, 0, Config.WindowX * 2, Config.LineHeight);
-			fontDisplaySize = Config.Font.Size / 2 * 1.04f;//実際には指定したフォントより若干幅をとる?
-			//bmp = new Bitmap(Config.WindowX, Config.LineHeight, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
-			bmp = new Bitmap(16, 16, PixelFormat.Format32bppArgb);
-			graph = Graphics.FromImage(bmp);
-			if (textDrawingMode == TextDrawingMode.WINAPI)
-				GDI.GdiMesureTextStart(graph);
-		}
-
-		readonly TextDrawingMode textDrawingMode;
-		readonly StringFormat sf = new StringFormat(StringFormatFlags.MeasureTrailingSpaces);
-		readonly CharacterRange[] ranges = { new CharacterRange(0, 1) };
-		readonly Size layoutSize;
-		readonly RectangleF layoutRect;
-		readonly float fontDisplaySize;
-
-		readonly Graphics graph;
-		readonly Bitmap bmp;
-
-		public int GetDisplayLength(string s, Font font)
-		{
-			if (string.IsNullOrEmpty(s))
-				return 0;
-			if (textDrawingMode == TextDrawingMode.GRAPHICS)
-			{
-				if (s.Contains("\t"))
-					s = s.Replace("\t", "        ");
-				ranges[0].Length = s.Length;
-				//CharacterRange[] ranges = new CharacterRange[] { new CharacterRange(0, s.Length) };
-				sf.SetMeasurableCharacterRanges(ranges);
-				Region[] regions = graph.MeasureCharacterRanges(s, font, layoutRect, sf);
-				RectangleF rectF = regions[0].GetBounds(graph);
-				//return (int)rectF.Width;//プロポーショナルでなくても数ピクセルずれる
-				return (int)((int)((rectF.Width - 1) / fontDisplaySize + 0.95f) * fontDisplaySize);
-			}
-
-			if (textDrawingMode == TextDrawingMode.TEXTRENDERER)
-			{
-				Size size = TextRenderer.MeasureText(graph, s, font, layoutSize, TextFormatFlags.NoPadding | TextFormatFlags.NoPrefix);
-				//Size size = TextRenderer.MeasureText(g, s, StaticConfig.Font);
-				return size.Width;
-			}
-			else// if (StaticConfig.TextDrawingMode == TextDrawingMode.WINAPI)
-			{
-				Size size = GDI.MeasureText(s, font);
-				return size.Width;
-			}
-			//来るわけがない
-			//else
-			//    throw new ExeEE("描画モード不明");
-		}
-
-
-		bool disposed;
-		public void Dispose()
-		{
-			if (disposed)
-				return;
-			disposed = true;
-			if (textDrawingMode == TextDrawingMode.WINAPI)
-				GDI.GdiMesureTextEnd(graph);
-			graph.Dispose();
-			bmp.Dispose();
-            sf.Dispose();
-		}
-	}
-}

+ 20 - 16
NTERA/Game/GameData/Function/Creator.Method.cs

@@ -2631,16 +2631,17 @@ namespace MinorShift.Emuera.GameData.Function
 			}
 			public override string GetStrValue(ExpressionMediator exm, IOperandTerm[] arguments, bool tryTranslate = false)
 			{
-				Int64 lineNo = 0;
-				if (arguments.Length > 0)
-					lineNo = arguments[0].GetIntValue(exm);
-				if (lineNo < 0)
-					throw new CodeEE("引数を0未満にできません");
-				ConsoleDisplayLine[] dispLines = exm.Console.GetDisplayLines(lineNo);
-				if (dispLines == null)
-					return "";
-
-                return HtmlManager.DisplayLine2Html(dispLines, true);
+				//Int64 lineNo = 0;
+				//if (arguments.Length > 0)
+				//	lineNo = arguments[0].GetIntValue(exm);
+				//if (lineNo < 0)
+				//	throw new CodeEE("引数を0未満にできません");
+				//ConsoleDisplayLine[] dispLines = exm.Console.GetDisplayLines(lineNo);
+				//if (dispLines == null)
+				//	return "";
+
+    //            return HtmlManager.DisplayLine2Html(dispLines, true);
+				return "";
 			}
 		}
 
@@ -2655,10 +2656,11 @@ namespace MinorShift.Emuera.GameData.Function
 
 			public override string GetStrValue(ExpressionMediator exm, IOperandTerm[] arguments, bool tryTranslate = false)
 			{
-				ConsoleDisplayLine[] dispLines = exm.Console.PopDisplayingLines();
-				if (dispLines == null)
-					return "";
-				return HtmlManager.DisplayLine2Html(dispLines, false);
+				//ConsoleDisplayLine[] dispLines = exm.Console.PopDisplayingLines();
+				//if (dispLines == null)
+				//	return "";
+				//return HtmlManager.DisplayLine2Html(dispLines, false);
+				return "";
 			}
 		}
 
@@ -2672,7 +2674,8 @@ namespace MinorShift.Emuera.GameData.Function
 			}
 			public override string GetStrValue(ExpressionMediator exm, IOperandTerm[] arguments, bool tryTranslate = false)
 			{
-				return HtmlManager.Html2PlainText(arguments[0].GetStrValue(exm));
+				//return HtmlManager.Html2PlainText(arguments[0].GetStrValue(exm));
+				return "";
 			}
 		}
 		private sealed class HtmlEscapeMethod : FunctionMethod
@@ -2685,7 +2688,8 @@ namespace MinorShift.Emuera.GameData.Function
 			}
 			public override string GetStrValue(ExpressionMediator exm, IOperandTerm[] arguments, bool tryTranslate = false)
 			{
-				return HtmlManager.Escape(arguments[0].GetStrValue(exm));
+				//return HtmlManager.Escape(arguments[0].GetStrValue(exm));
+				return System.Security.SecurityElement.Escape(arguments[0].GetStrValue(exm));
 			}
 		}
 		#endregion

+ 5 - 6
NTERA/Game/GameData/Variable/VariableEvaluator.cs

@@ -7,7 +7,6 @@ using System.Windows.Forms;
 using MinorShift.Emuera.GameData.Expression;
 using MinorShift.Emuera.GameProc.Function;
 using MinorShift.Emuera.Sub;
-using MinorShift._Library;
 using NTERA.Interop;
 using SortOrder = MinorShift.Emuera.GameProc.Function.SortOrder;
 
@@ -20,7 +19,7 @@ namespace MinorShift.Emuera.GameData.Variable
 		readonly GameBase gamebase;
 		readonly ConstantData constant;
 		readonly VariableData varData;
-		MTRandom rand = new MTRandom();
+		Random rand = new Random();
 
 		public VariableData VariableData => varData;
 		internal ConstantData Constant => constant;
@@ -36,21 +35,21 @@ namespace MinorShift.Emuera.GameData.Variable
 
 		public void Randomize(Int64 seed)
 		{
-			rand = new MTRandom(seed);
+			rand = new Random((int)seed);
 		}
 
 		public void InitRanddata()
 		{
-			rand.SetRand(RANDDATA);
+			//rand.SetRand(RANDDATA);
 		}
 
 		public void DumpRanddata()
 		{
-			rand.GetRand(RANDDATA);
+			//rand.GetRand(RANDDATA);
 		}
 		public Int64 GetNextRand(Int64 max)
 		{
-			return rand.NextInt64(max);
+			return rand.Next((int)max);
 		}
 
 		public Int64 getPalamLv(Int64 pl, Int64 maxlv)

+ 8 - 5
NTERA/Game/GameProc/ErbLoader.cs

@@ -1,5 +1,6 @@
 using System;
 using System.Collections.Generic;
+using System.Diagnostics;
 using System.Media;
 using System.Windows.Forms;
 using Microsoft.VisualBasic;
@@ -46,7 +47,8 @@ namespace MinorShift.Emuera.GameProc
 			List<KeyValuePair<string, string>> erbFiles = Config.GetFiles(erbDir, "*.ERB");
             List<string> isOnlyEvent = new List<string>();
             noError = true;
-			uint starttime = WinmmTimer.TickCount;
+			Stopwatch stopwatch = new Stopwatch();
+			stopwatch.Start();
 			try
 			{
 				labelDic.RemoveAll();
@@ -56,7 +58,7 @@ namespace MinorShift.Emuera.GameProc
 					string file = erbFiles[i].Value;
 #if DEBUG
 					if (displayReport)
-						output.PrintSystemLine("Elapsed time: " + (WinmmTimer.TickCount - starttime).ToString("D4") + "ms:" + filename + " is being loaded...");
+						output.PrintSystemLine("Elapsed time: " + stopwatch.ElapsedTicks.ToString("D4") + "ms:" + filename + " is being loaded...");
 #else
 					if (displayReport)
 						output.PrintSystemLine("Loading " + filename + "...");
@@ -66,7 +68,7 @@ namespace MinorShift.Emuera.GameProc
 				}
 				ParserMediator.FlushWarningList();
 #if DEBUG
-				output.PrintSystemLine("Elapsed time: " + (WinmmTimer.TickCount - starttime).ToString("D4") + "ms:");
+				output.PrintSystemLine("Elapsed time: " + stopwatch.ElapsedTicks.ToString("D4") + "ms:");
 #endif
 				if (displayReport)
 					output.PrintSystemLine("Building a list of user-defined functions...");
@@ -74,7 +76,7 @@ namespace MinorShift.Emuera.GameProc
 				ParserMediator.FlushWarningList();
 				labelDic.Initialized = true;
 #if DEBUG
-				output.PrintSystemLine("Elapsed time: " + (WinmmTimer.TickCount - starttime).ToString("D4") + "ms:");
+				output.PrintSystemLine("Elapsed time: " + stopwatch.ElapsedTicks.ToString("D4") + "ms:");
 #endif
 				if (displayReport)
 					output.PrintSystemLine("Script syntax checking...");
@@ -82,10 +84,11 @@ namespace MinorShift.Emuera.GameProc
 				ParserMediator.FlushWarningList();
 
 #if DEBUG
-				output.PrintSystemLine("Elapsed time: " + (WinmmTimer.TickCount - starttime).ToString("D4") + "ms:");
+				output.PrintSystemLine("Elapsed time: " + stopwatch.ElapsedTicks.ToString("D4") + "ms:");
 #endif
 				if (displayReport)
 					output.PrintSystemLine("Load is complete");
+				stopwatch.Stop();
 			}
 			catch (Exception e)
 			{

+ 0 - 3
NTERA/Game/GameProc/Process.cs

@@ -234,12 +234,9 @@ namespace MinorShift.Emuera.GameProc
 		{
 			vEvaluator.RESULTS = s;
 		}
-
-		private uint startTime;
 		
 		public void DoScript()
 		{
-			startTime = WinmmTimer.TickCount;
 			state.lineCount = 0;
 			bool systemProcRunning = true;
 			try

+ 0 - 119
NTERA/Game/_Library/GDI.cs

@@ -1,119 +0,0 @@
-using System;
-using System.Drawing;
-using System.Runtime.InteropServices;
-
-namespace MinorShift._Library
-{
-	public enum StretchMode
-	{
-		STRETCH_ANDSCANS = 1,
-		STRETCH_ORSCANS = 2,
-		STRETCH_DELETESCANS = 3,
-		STRETCH_HALFTONE = 4
-	}
-	internal static class GDI
-	{
-		[DllImport("gdi32.dll", ExactSpelling = true, PreserveSig = true, SetLastError = true)]
-		public static extern IntPtr SelectObject(IntPtr hdc, IntPtr hgdiobj);
-		[DllImport("gdi32.dll")]
-		public static extern bool DeleteObject(IntPtr hObject);
-        [DllImport("gdi32.dll", CharSet = CharSet.Auto)]
-		static extern bool GetTextExtentPoint32(IntPtr hdc, string lpString, int cbString, out Size lpSize);
-
-		[DllImport("user32", EntryPoint = "GetTabbedTextExtent", CharSet = CharSet.Auto)]
-        static extern int GetTabbedTextExtentW(IntPtr hdc, string lpString, int nCount, int nTabPositions, ref int lpnTabStopPositions);
-
-		static IntPtr hDC;
-		static Font lastFont;
-		static IntPtr defaulthFont;
-		//static IntPtr defaulthBrush;
-		//static IntPtr defaulthPen;
-		//static Color lastTextColor;
-		//static Color lastBrushColor;
-		//static Color lastPenColor;
-		static Size fontMetrics;
-		static bool usingStockBrush;
-		static int devnull;
-		//static bool isNt = (System.Environment.OSVersion.Platform == PlatformID.Win32NT) ? true : false;
-		static GDI()
-		{
-			MeasureText = MeasureTextNT;
-		}
-		public static void GDIStart(Graphics g, Color backGroundColor)
-		{
-			//hDC = g.GetHdc();
-			//IntPtr hBrush = CreateSolidBrush(ColorTranslator.ToWin32(backGroundColor));
-			//defaulthBrush = SelectObject(hDC, hBrush);
-			//IntPtr hPen = CreatePen(0, 0, ColorTranslator.ToWin32(backGroundColor));
-			//defaulthPen = SelectObject(hDC, hPen);
-			//SetTextColor(hDC, ColorTranslator.ToWin32(backGroundColor));
-			//SetBkColor(hDC, ColorTranslator.ToWin32(backGroundColor));
-			//lastFont = null;
-			//lastBrushColor = backGroundColor;
-			//lastPenColor = backGroundColor;
-			//lastTextColor = backGroundColor;
-			//usingStockBrush = false;
-			//SetStretchBltMode(hDC, StretchMode.STRETCH_DELETESCANS);
-		}
-
-		public delegate void DelegateTextOut(string str, int x, int y);
-		public delegate void DelegateTextOutFull(Font font, Color color, string str, int x, int y);
-		public delegate Size DelegateMeasureText(string str, Font font);
-		public static DelegateMeasureText MeasureText;
-
-		#region MesureText用
-
-		static IntPtr hDCMesureText;
-		static Font mtLastFont;
-		static IntPtr mtDefaulthFont;
-
-		static Size MeasureText98(string str, Font font)
-		{
-			if (mtLastFont != font)
-			{
-				IntPtr hFont = font.ToHfont();
-				IntPtr hOldFont = SelectObject(hDCMesureText, hFont);
-				if (mtLastFont == null)
-					mtDefaulthFont = hOldFont;
-				else
-					DeleteObject(hOldFont);
-				mtLastFont = font;
-				GetTextExtentPoint32(hDCMesureText, "あ", "あ".Length, out fontMetrics);
-			}
-			int ret = GetTabbedTextExtentW(hDCMesureText, str, LangManager.GetStrlenLang(str), 0, ref devnull);
-			Size size = new Size(ret & 0xffff, (ret >> 16) & 0xffff);
-			return size;
-		}
-		static Size MeasureTextNT(string str, Font font)
-		{
-			if (mtLastFont != font)
-			{
-				IntPtr hFont = font.ToHfont();
-				IntPtr hOldFont = SelectObject(hDCMesureText, hFont);
-				if (mtLastFont == null)
-					mtDefaulthFont = hOldFont;
-				else
-					DeleteObject(hOldFont);
-				mtLastFont = font;
-				GetTextExtentPoint32(hDCMesureText, "あ", "あ".Length, out fontMetrics);
-			}
-			int ret = GetTabbedTextExtentW(hDCMesureText, str, str.Length, 0, ref devnull);
-			Size size = new Size(ret & 0xffff, (ret >> 16) & 0xffff);
-			return size;
-		}
-
-		public static void GdiMesureTextStart(Graphics g)
-		{
-			hDCMesureText = g.GetHdc();
-			mtLastFont = null;
-		}
-		public static void GdiMesureTextEnd(Graphics g)
-		{
-			if (mtLastFont != null)
-				DeleteObject(SelectObject(hDCMesureText, mtDefaulthFont));
-			g.ReleaseHdc(hDCMesureText);
-			mtLastFont = null;
-		}
-		#endregion
-	}
-}

+ 0 - 412
NTERA/Game/_Library/SFMT.cs

@@ -1,412 +0,0 @@
-/*
-このファイルはSFMTアルゴリズムによって擬似乱数を作成するためのクラスライブラリです。
-このファイルはRei HOBARAさんが
-http://www.rei.to/random.html
-において公開しているC#向けのSFMTライブラリを改変したものです。
-
-さらに大元のSFMTアルゴリズムについては
-http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/
-を参照してください。
-
-2009/7/2 MinorShift
-*/
-
-/*
- * Copyright (C) Rei HOBARA 2007
- * 
- * Name:
- *     SFMT.cs
- * Class:
- *     Rei.Random.SFMT
- *     Rei.Random.MTPeriodType
- * Purpose:
- *     A random number generator using SIMD-oriented Fast Mersenne Twister(SFMT).
- * Remark:
- *     This code is C# implementation of SFMT.
- *     SFMT was introduced by Mutsuo Saito and Makoto Matsumoto.
- *     See http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html for detail of SFMT.
- * History:
- *     2007/10/6 initial release.
- * 
- */
- 
-#define MT19937
-using System;
-
-namespace MinorShift._Library{
-
-    /// <summary>
-    /// SFMTの擬似乱数ジェネレータークラス。
-    /// </summary>
-    public sealed class MTRandom {
-
-        /// <summary>
-        /// 現在時刻を種とした、(2^19937-1)周期のSFMT擬似乱数ジェネレーターを初期化します。
-        /// </summary>
-        public MTRandom() : this(Environment.TickCount) { }
-
-        /// <summary>
-        /// seedを種とした、(2^MEXP-1)周期の擬似乱数ジェネレーターを初期化します。
-        /// </summary>
-		public MTRandom(Int64 seed)
-        {
-			unchecked
-			{
-				init_gen_rand((UInt32)seed);
-			}
-        }
-        
-        
-        //maxが2^nでない大きい値であると値が偏る。
-        public Int64 NextInt64(Int64 max)
-        {
-			if(max <= 0)
-				throw new ArgumentOutOfRangeException();
-			return (Int64)(NextUInt64() % (UInt64)max);
-		}
-		
-        public Int64 NextInt64()
-        {
-			unchecked{return (Int64)NextUInt64();}
-		}
-		
-        public UInt64 NextUInt64()
-        {
-			UInt64 ret = NextUInt32();
-			ret = (ret << 32) +  NextUInt32();
-			return ret;
-		}
-        
-        /// <summary>
-		/// [0,1) 範囲で乱数生成 ←0は含む,1は含まないの意味
-		/// </summary>
-		/// <returns></returns>
-		public double NextDouble()
-		{
-			return NextUInt32() * (1.0/4294967296.0); 
-			/* divided by 2^32 */
-		}
-        
-        public void SetRand(Int64[] array)
-        {
-			if((array == null)|| (array.Length != (N32 + 1)))
-				throw new ArgumentOutOfRangeException();
-			
-			for(int i = 0;i<N32;i++)
-				sfmt[i] = (UInt32)array[i];
-			idx = (int)array[N32];
-		}
-
-		public void GetRand(Int64[] array)
-		{
-			if ((array == null) || (array.Length != (N32 + 1)))
-				throw new ArgumentOutOfRangeException();
-			for(int i = 0;i<N32;i++)
-				array[i] = sfmt[i];
-			array[N32] = idx;
-		}
-        
-        
-#region private/protected
-		#if MT607
-			private const int MEXP = 607;
-			private const int POS1 = 2;
-			private const int SL1 = 15;
-			private const int SL2 = 3;
-			private const int SR1 = 13;
-			private const int SR2 = 3;
-			private const UInt32 MSK1 = 0xfdff37ffU;
-			private const UInt32 MSK2 = 0xef7f3f7dU;
-			private const UInt32 MSK3 = 0xff777b7dU;
-			private const UInt32 MSK4 = 0x7ff7fb2fU;
-			private const UInt32 PARITY1 = 0x00000001U;
-			private const UInt32 PARITY2 = 0x00000000U;
-			private const UInt32 PARITY3 = 0x00000000U;
-			private const UInt32 PARITY4 = 0x5986f054U;
-		#elif MT1279
-			private const int MEXP = 1279;
-			private const int POS1 = 7;
-			private const int SL1 = 14;
-			private const int SL2 = 3;
-			private const int SR1 = 5;
-			private const int SR2 = 1;
-			private const UInt32 MSK1 = 0xf7fefffdU;
-			private const UInt32 MSK2 = 0x7fefcfffU;
-			private const UInt32 MSK3 = 0xaff3ef3fU;
-			private const UInt32 MSK4 = 0xb5ffff7fU;
-			private const UInt32 PARITY1 = 0x00000001U;
-			private const UInt32 PARITY2 = 0x00000000U;
-			private const UInt32 PARITY3 = 0x00000000U;
-			private const UInt32 PARITY4 = 0x20000000U;
-		#elif MT2281
-			private const int MEXP = 2281;
-			private const int POS1 = 12;
-			private const int SL1 = 19;
-			private const int SL2 = 1;
-			private const int SR1 = 5;
-			private const int SR2 = 1;
-			private const UInt32 MSK1 = 0xbff7ffbfU;
-			private const UInt32 MSK2 = 0xfdfffffeU;
-			private const UInt32 MSK3 = 0xf7ffef7fU;
-			private const UInt32 MSK4 = 0xf2f7cbbfU;
-			private const UInt32 PARITY1 = 0x00000001U;
-			private const UInt32 PARITY2 = 0x00000000U;
-			private const UInt32 PARITY3 = 0x00000000U;
-			private const UInt32 PARITY4 = 0x41dfa600U;
-		#elif MT4253
-			private const int MEXP = 4253;
-			private const int POS1 = 17;
-			private const int SL1 = 20;
-			private const int SL2 = 1;
-			private const int SR1 = 7;
-			private const int SR2 = 1;
-			private const UInt32 MSK1 = 0x9f7bffffU;
-			private const UInt32 MSK2 = 0x9fffff5fU;
-			private const UInt32 MSK3 = 0x3efffffbU;
-			private const UInt32 MSK4 = 0xfffff7bbU;
-			private const UInt32 PARITY1 = 0xa8000001U;
-			private const UInt32 PARITY2 = 0xaf5390a3U;
-			private const UInt32 PARITY3 = 0xb740b3f8U;
-			private const UInt32 PARITY4 = 0x6c11486dU;
-		#elif MT11213
-			private const int MEXP = 11213;
-			private const int POS1 = 68;
-			private const int SL1 = 14;
-			private const int SL2 = 3;
-			private const int SR1 = 7;
-			private const int SR2 = 3;
-			private const UInt32 MSK1 = 0xeffff7fbU;
-			private const UInt32 MSK2 = 0xffffffefU;
-			private const UInt32 MSK3 = 0xdfdfbfffU;
-			private const UInt32 MSK4 = 0x7fffdbfdU;
-			private const UInt32 PARITY1 = 0x00000001U;
-			private const UInt32 PARITY2 = 0x00000000U;
-			private const UInt32 PARITY3 = 0xe8148000U;
-			private const UInt32 PARITY4 = 0xd0c7afa3U;
-		#elif MT19937
-			private const int MEXP = 19937;
-			private const int POS1 = 122;
-			private const int SL1 = 18;
-			private const int SL2 = 1;
-			private const int SR1 = 11;
-			private const int SR2 = 1;
-			private const UInt32 MSK1 = 0xdfffffefU;
-			private const UInt32 MSK2 = 0xddfecb7fU;
-			private const UInt32 MSK3 = 0xbffaffffU;
-			private const UInt32 MSK4 = 0xbffffff6U;
-			private const UInt32 PARITY1 = 0x00000001U;
-			private const UInt32 PARITY2 = 0x00000000U;
-			private const UInt32 PARITY3 = 0x00000000U;
-			private const UInt32 PARITY4 = 0x13c9e684U;
-			//private const UInt32 PARITY4 = 0x20000000U;
-		#elif MT44497
-			private const int MEXP = 44497;
-			private const int POS1 = 330;
-			private const int SL1 = 5;
-			private const int SL2 = 3;
-			private const int SR1 = 9;
-			private const int SR2 = 3;
-			private const UInt32 MSK1 = 0xeffffffbU;
-			private const UInt32 MSK2 = 0xdfbebfffU;
-			private const UInt32 MSK3 = 0xbfbf7befU;
-			private const UInt32 MSK4 = 0x9ffd7bffU;
-			private const UInt32 PARITY1 = 0x00000001U;
-			private const UInt32 PARITY2 = 0x00000000U;
-			private const UInt32 PARITY3 = 0xa3ac4000U;
-			private const UInt32 PARITY4 = 0xecc1327aU;
-		#elif MT86243
-			private const int MEXP = 86243;
-			private const int POS1 = 366;
-			private const int SL1 = 6;
-			private const int SL2 = 7;
-			private const int SR1 = 19;
-			private const int SR2 = 1;
-			private const UInt32 MSK1 = 0xfdbffbffU;
-			private const UInt32 MSK2 = 0xbff7ff3fU;
-			private const UInt32 MSK3 = 0xfd77efffU;
-			private const UInt32 MSK4 = 0xbf9ff3ffU;
-			private const UInt32 PARITY1 = 0x00000001U;
-			private const UInt32 PARITY2 = 0x00000000U;
-			private const UInt32 PARITY3 = 0x00000000U;
-			private const UInt32 PARITY4 = 0xe9528d85U;
-		#elif MT132049
-			private const int MEXP = 132049;
-			private const int POS1 = 110;
-			private const int SL1 = 19;
-			private const int SL2 = 1;
-			private const int SR1 = 21;
-			private const int SR2 = 1;
-			private const UInt32 MSK1 = 0xffffbb5fU;
-			private const UInt32 MSK2 = 0xfb6ebf95U;
-			private const UInt32 MSK3 = 0xfffefffaU;
-			private const UInt32 MSK4 = 0xcff77fffU;
-			private const UInt32 PARITY1 = 0x00000001U;
-			private const UInt32 PARITY2 = 0x00000000U;
-			private const UInt32 PARITY3 = 0xcb520000U;
-			private const UInt32 PARITY4 = 0xc7e91c7dU;
-		#elif MT216091
-			private const int MEXP = 216091;
-			private const int POS1 = 627;
-			private const int SL1 = 11;
-			private const int SL2 = 3;
-			private const int SR1 = 10;
-			private const int SR2 = 1;
-			private const UInt32 MSK1 = 0xbff7bff7U;
-			private const UInt32 MSK2 = 0xbfffffffU;
-			private const UInt32 MSK3 = 0xbffffa7fU;
-			private const UInt32 MSK4 = 0xffddfbfbU;
-			private const UInt32 PARITY1 = 0xf8000001U;
-			private const UInt32 PARITY2 = 0x89e80709U;
-			private const UInt32 PARITY3 = 0x3bd2b64bU;
-			private const UInt32 PARITY4 = 0x0c64b1e4U;
-		}
-		#endif
-
-        private const int N = MEXP / 128 + 1;
-        private const int N32 = N * 4;
-        private const int SL2_x8 = SL2 * 8;
-        private const int SR2_x8 = SR2 * 8;
-        private const int SL2_ix8 = 64 - SL2 * 8;
-        private const int SR2_ix8 = 64 - SR2 * 8;
-        
-        /// <summary>
-        /// 内部状態ベクトル。
-        /// </summary>
-        private uint[] sfmt;
-        /// <summary>
-        /// 内部状態ベクトルのうち、次に乱数として使用するインデックス。
-        /// </summary>
-		private int idx;
-        
-        /// <summary>
-        /// 符号なし32bitの擬似乱数を取得します。
-        /// </summary>
-		private uint NextUInt32()
-		{
-		    if (idx < N32) return sfmt[idx++];
-
-		    gen_rand_all();
-		    idx = 0;
-		    return sfmt[idx++];
-        }
-
-        /// <summary>
-        /// ジェネレーターを初期化します。
-        /// </summary>
-        /// <param name="seed"></param>
-		private void init_gen_rand(uint seed)
-		{
-            int i;
-            //内部状態配列確保
-            sfmt = new UInt32[N32];
-            //内部状態配列初期化
-            sfmt[0] = seed;
-            for (i = 1; i < N32; i++)
-                sfmt[i] = (UInt32)(1812433253 * (sfmt[i - 1] ^ (sfmt[i - 1] >> 30)) + i);
-            //確認
-            period_certification();
-            //初期位置設定
-            idx = N32;
-        }
-
-        /// <summary>
-        /// 内部状態ベクトルが適切か確認し、必要であれば調節します。
-        /// </summary>
-		private void period_certification()
-		{
-            uint[] PARITY = { PARITY1, PARITY2, PARITY3, PARITY4 };
-            uint inner = 0;
-		    int i;
-
-		    for (i = 0; i < 4; i++) inner ^= sfmt[i] & PARITY[i];
-            for (i = 16; i > 0; i >>= 1) inner ^= inner >> i;
-            inner &= 1;
-            // check OK
-            if (inner == 1) return;
-            // check NG, and modification
-            for (i = 0; i < 4; i++) {
-                uint work = 1;
-                int j;
-                for (j = 0; j < 32; j++) {
-                    if ((work & PARITY[i]) != 0) {
-                        sfmt[i] ^= work;
-                        return;
-                    }
-                    work = work << 1;
-                }
-            }
-        }
-
-        /// <summary>
-        /// 内部状態ベクトルを更新します。
-        /// </summary>
-		private void gen_rand_all()
-		{
-#if MT19937
-			gen_rand_all_19937();
-#else
-			int a, b, c, d;
-			UInt64 xh, xl, yh, yl;
-
-			a = 0;
-			b = POS1 * 4;
-			c = (N - 2) * 4;
-			d = (N - 1) * 4;
-			do
-			{
-				xh = ((UInt64)sfmt[a + 3] << 32) | sfmt[a + 2];
-				xl = ((UInt64)sfmt[a + 1] << 32) | sfmt[a + 0];
-				yh = xh << (SL2_x8) | xl >> (SL2_ix8);
-				yl = xl << (SL2_x8);
-				xh = ((UInt64)sfmt[c + 3] << 32) | sfmt[c + 2];
-				xl = ((UInt64)sfmt[c + 1] << 32) | sfmt[c + 0];
-				yh ^= xh >> (SR2_x8);
-				yl ^= xl >> (SR2_x8) | xh << (SR2_ix8);
-
-				sfmt[a + 3] = sfmt[a + 3] ^ ((sfmt[b + 3] >> SR1) & MSK4) ^ (sfmt[d + 3] << SL1) ^ ((UInt32)(yh >> 32));
-				sfmt[a + 2] = sfmt[a + 2] ^ ((sfmt[b + 2] >> SR1) & MSK3) ^ (sfmt[d + 2] << SL1) ^ ((UInt32)yh);
-				sfmt[a + 1] = sfmt[a + 1] ^ ((sfmt[b + 1] >> SR1) & MSK2) ^ (sfmt[d + 1] << SL1) ^ ((UInt32)(yl >> 32));
-				sfmt[a + 0] = sfmt[a + 0] ^ ((sfmt[b + 0] >> SR1) & MSK1) ^ (sfmt[d + 0] << SL1) ^ ((UInt32)yl);
-
-				c = d; d = a; a += 4; b += 4;
-				if (b >= N32) b = 0;
-			} while (a < N32);
-#endif
-
-		}
-
-        /// <summary>
-        /// gen_rand_allの(2^19937-1)周期用。
-        /// </summary>
-		private void gen_rand_all_19937()
-		{
-		    uint[] p = sfmt;
-
-            const int cMEXP = 19937;
-            const int cPOS1 = 122;
-            const uint cMSK1 = 0xdfffffefU;
-            const uint cMSK2 = 0xddfecb7fU;
-            const uint cMSK3 = 0xbffaffffU;
-            const uint cMSK4 = 0xbffffff6U;
-            const int cSL1 = 18;
-            const int cSR1 = 11;
-            const int cN = cMEXP / 128 + 1;
-            const int cN32 = cN * 4;
-
-            var a = 0;
-            var b = cPOS1 * 4;
-            var c = (cN - 2) * 4;
-            var d = (cN - 1) * 4;
-            do {
-                p[a + 3] = p[a + 3] ^ (p[a + 3] << 8) ^ (p[a + 2] >> 24) ^ (p[c + 3] >> 8) ^ ((p[b + 3] >> cSR1) & cMSK4) ^ (p[d + 3] << cSL1);
-                p[a + 2] = p[a + 2] ^ (p[a + 2] << 8) ^ (p[a + 1] >> 24) ^ (p[c + 3] << 24) ^ (p[c + 2] >> 8) ^ ((p[b + 2] >> cSR1) & cMSK3) ^ (p[d + 2] << cSL1);
-                p[a + 1] = p[a + 1] ^ (p[a + 1] << 8) ^ (p[a + 0] >> 24) ^ (p[c + 2] << 24) ^ (p[c + 1] >> 8) ^ ((p[b + 1] >> cSR1) & cMSK2) ^ (p[d + 1] << cSL1);
-                p[a + 0] = p[a + 0] ^ (p[a + 0] << 8) ^ (p[c + 1] << 24) ^ (p[c + 0] >> 8) ^ ((p[b + 0] >> cSR1) & cMSK1) ^ (p[d + 0] << cSL1);
-                c = d; d = a; a += 4; b += 4;
-                if (b >= cN32) b = 0;
-            } while (a < cN32);
-        }
-#endregion
-    }
-
-}

+ 0 - 39
NTERA/Game/_Library/WinmmTimer.cs

@@ -1,39 +0,0 @@
-using System.Runtime.InteropServices;
-
-namespace MinorShift._Library
-{
-	/// <summary>
-	/// wrapされたtimer。外からは、このTickCountだけを呼び出す。
-	/// </summary>
-	internal sealed class WinmmTimer
-	{
-		static WinmmTimer()
-		{
-			_instance = new WinmmTimer();
-		}
-
-		private WinmmTimer()
-		{
-			mm_BeginPeriod(1);
-		}
-		~WinmmTimer()
-		{
-			mm_EndPeriod(1);
-		}
-
-		/// <summary>
-		/// 起動時にBeginPeriod、終了時にEndPeriodを呼び出すためだけのインスタンス。
-		/// staticなデストラクタがあればいらないんだけど
-		/// </summary>
-		private static volatile WinmmTimer _instance;
-
-		public static uint TickCount => mm_GetTime();
-
-	    [DllImport("winmm.dll", EntryPoint = "timeGetTime")]
-		private static extern uint mm_GetTime();
-		[DllImport("winmm.dll", EntryPoint = "timeBeginPeriod")]
-		private static extern uint mm_BeginPeriod(uint uMilliseconds);
-		[DllImport("winmm.dll", EntryPoint = "timeEndPeriod")]
-		private static extern uint mm_EndPeriod(uint uMilliseconds);
-	}
-}

+ 0 - 3
NTERA/Interop/IConsole.cs

@@ -76,9 +76,6 @@ namespace NTERA.Interop
 		void SetRedraw(long value);
 		int NewButtonGeneration { get; }
 		void UpdateGeneration();
-		bool ButtonIsSelected(ConsoleButtonString button);
-		ConsoleDisplayLine[] GetDisplayLines(long something);
-		ConsoleDisplayLine[] PopDisplayingLines();
 		string GetWindowTitle();
 		long LineCount { get; }
 		string getDefStBar();

+ 2 - 13
NTERA/NTERA.csproj

@@ -79,6 +79,7 @@
     <Compile Include="Game\Content\AppContents.cs" />
     <Compile Include="Game\Content\BaseImage.cs" />
     <Compile Include="Game\Content\CroppedImage.cs" />
+    <Compile Include="Game\Display\HTMLManager.cs" />
     <Compile Include="Game\GameData\ConstantData.cs" />
     <Compile Include="Game\GameData\DefineMacro.cs" />
     <Compile Include="Game\GameData\Expression\CaseExpression.cs" />
@@ -144,25 +145,12 @@
     <Compile Include="Game\Sub\SubWord.cs" />
     <Compile Include="Game\Sub\Word.cs" />
     <Compile Include="Game\Sub\WordCollection.cs" />
-    <Compile Include="Game\_Library\GDI.cs" />
     <Compile Include="Game\_Library\LangManager.cs" />
-    <Compile Include="Game\_Library\SFMT.cs" />
-    <Compile Include="Game\_Library\WinmmTimer.cs" />
-    <Compile Include="Game\Display\AConsoleDisplayPart.cs" />
-    <Compile Include="Game\Display\ButtonStringCreator.cs" />
-    <Compile Include="Game\Display\ConsoleButtonString.cs" />
-    <Compile Include="Game\Display\ConsoleDisplayLine.cs" />
-    <Compile Include="Game\Display\ConsoleImagePart.cs" />
-    <Compile Include="Game\Display\ConsoleShapePart.cs" />
-    <Compile Include="Game\Display\ConsoleStyledString.cs" />
     <Compile Include="Interop\GameInstance.cs" />
-    <Compile Include="Game\Display\HTMLManager.cs" />
     <Compile Include="Console\HTMLParser.cs" />
     <Compile Include="Interop\IConsole.cs" />
     <Compile Include="Interop\IMainWindow.cs" />
-    <Compile Include="Game\Display\PrintStringBuffer.cs" />
     <Compile Include="Interop\ProgramInstance.cs" />
-    <Compile Include="Game\Display\StringMeasure.cs" />
     <Compile Include="Program.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <EmbeddedResource Include="Console\ConsoleControl.resx">
@@ -194,5 +182,6 @@
   <ItemGroup>
     <None Include="App.config" />
   </ItemGroup>
+  <ItemGroup />
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
 </Project>