public static GLine CreateSimpleGLine(string content)
        {
            TextDecoration dec = TextDecoration.Default;
            CharGroup      cg  = content.Length > 0? GLine.CalcCharGroup(content[0]) : CharGroup.Hankaku;

            return(new GLine(GLine.ToCharArray(content), new GWord(dec, 0, cg)));
        }
示例#2
0
        private static string TestPutChar(string initial, int col, char ch)
        {
            GLineManipulator m = new GLineManipulator();

            m.Load(GLine.ToCharArray(initial), col);
            //Debug.WriteLine(String.Format("Test{0}  [{1}] col={2} char={3}", num, SafeString(m._text), m.CaretColumn, ch));
            m.PutChar(ch, TextDecoration.ClonedDefault());
            //Debug.WriteLine(String.Format("Result [{0}] col={1}", SafeString(m._text), m.CaretColumn));
            return(SafeString(m.InternalBuffer));
        }
        //テキストファイルから読み出す。装飾はムリだけど
        public void LoadForTest(string filename)
        {
            StreamReader r = null;

            try {
                r = new StreamReader(filename, Encoding.Default);
                TextDecoration dec  = TextDecoration.Default;
                string         line = r.ReadLine();
                while (line != null)
                {
                    //GWordへの分割はしてない、注意
                    CharGroup cg = line.Length > 0? GLine.CalcCharGroup(line[0]) : CharGroup.Hankaku;
                    this.AddLine(new GLine(GLine.ToCharArray(line), new GWord(dec, 0, cg)));
                    line = r.ReadLine();
                }
            } finally {
                if (r != null)
                {
                    r.Close();
                }
            }
        }