Exemplo n.º 1
0
        public void ExportDocument(DocumentImpl document)
        {
            PainterImpl painter = new PainterImpl();

            painter.ExportDocument(
                document
                );
        }
Exemplo n.º 2
0
        public void ExportScreenshot(DocumentImpl document)
        {
            PainterImpl painter = new PainterImpl();

            painter.ExportScreenshot(
                new SolidBrush( this.control_Note1.BackColor),
                this.control_Note1.Width,
                document
                );
        }
Exemplo n.º 3
0
        //────────────────────────────────────────
        #endregion



        #region アクション
        //────────────────────────────────────────

        public void ExportDocument(
            DocumentImpl document
            )
        {
            StringBuilder s_Body = new StringBuilder();

            foreach (LineImpl line in document.Lines)
            {
                s_Body.Append(line.ToString_Export());
                s_Body.Append(Environment.NewLine);
            }

            //バックアップ出力
            string timestamp;
            {
                // ファイル名を適当に作成。
                StringBuilder s   = new StringBuilder();
                DateTime      now = System.DateTime.Now;
                s.Append(now.Year);
                s.Append("_");
                s.Append(now.Month);
                s.Append("_");
                s.Append(now.Day);
                s.Append("_");
                s.Append(now.Hour);
                s.Append("_");
                s.Append(now.Minute);
                s.Append("_");
                s.Append(now.Second);
                s.Append("_");
                s.Append(now.Millisecond);
                timestamp = s.ToString();

                File.WriteAllText(Path.Combine(Application.StartupPath, "backup-" + timestamp + ".txt"), s_Body.ToString());
            }

            //セーブファイル出力
            {
                if ("" == document.FileSave)
                {
                    StringBuilder s = new StringBuilder();
                    s.Append("save-since");
                    s.Append(timestamp);
                    s.Append(".txt");
                    document.FileSave = Path.Combine(Application.StartupPath, s.ToString());
                }

                File.WriteAllText(document.FileSave, s_Body.ToString());
            }
        }
Exemplo n.º 4
0
        //────────────────────────────────────────
        public void ExportDocument(
            DocumentImpl document
            )
        {
            StringBuilder s_Body = new StringBuilder();

            foreach (LineImpl line in document.Lines)
            {
                s_Body.Append(line.ToString_Export());
                s_Body.Append(Environment.NewLine);
            }

            //バックアップ出力
            string timestamp;
            {
                // ファイル名を適当に作成。
                StringBuilder s = new StringBuilder();
                DateTime now = System.DateTime.Now;
                s.Append(now.Year);
                s.Append("_");
                s.Append(now.Month);
                s.Append("_");
                s.Append(now.Day);
                s.Append("_");
                s.Append(now.Hour);
                s.Append("_");
                s.Append(now.Minute);
                s.Append("_");
                s.Append(now.Second);
                s.Append("_");
                s.Append(now.Millisecond);
                timestamp = s.ToString();

                File.WriteAllText(Path.Combine(Application.StartupPath, "backup-"+timestamp + ".txt"), s_Body.ToString());
            }

            //セーブファイル出力
            {
                if ("" == document.FileSave)
                {
                    StringBuilder s = new StringBuilder();
                    s.Append("save-since");
                    s.Append(timestamp);
                    s.Append(".txt");
                    document.FileSave = Path.Combine(Application.StartupPath, s.ToString());
                }

                File.WriteAllText(document.FileSave, s_Body.ToString());
            }
        }
Exemplo n.º 5
0
        public void Paint(
            Graphics g,
            int width,
            int height,
            int rowBeginview,
            int rowViewed,
            DocumentImpl document
            )
        {
            int top;

            for (top = 0; top < height; top += document.HeightLine)
            {
                g.DrawLine(document.CreatePenGrid(), 0, top, width, top);
            }

            Stack <LineImpl> breadcrumbLocation = new Stack <LineImpl>();

            top = 0;
            int row           = 0;
            int lastRowViewed = rowBeginview + rowViewed;

            foreach (LineImpl line in document.Lines)
            {
                if (rowBeginview <= row && row <= lastRowViewed)
                {
                    //表示

                    line.Paint(g, top);
                    top += document.HeightLine;
                }
                else
                {
                }

                row++;
            }
        }
Exemplo n.º 6
0
        public static DocumentImpl Import(string text, string fileSave, DocumentImpl oldDocument_OrNull)
        {
            DocumentImpl document = new DocumentImpl();

            document.Lines.Clear();

            string[] lines = text.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
            foreach (string line in lines)
            {
                LineImpl lineElement = LineImpl.Import(line, document);
                document.Lines.Add(lineElement);
            }

            document.FileSave = fileSave;

            if (null != oldDocument_OrNull)
            {
                document.Font       = oldDocument_OrNull.Font;
                document.Image      = oldDocument_OrNull.Image;
                document.HeightLine = oldDocument_OrNull.HeightLine;
            }
            return(document);
        }
Exemplo n.º 7
0
        private void Form1_KeyDown(object sender, KeyEventArgs e)
        {
            Keys keys = e.KeyCode;

            int rowViewed = this.control_Perspective1.GetControl_Note1().GetRow_Viewed();

            switch (keys)
            {
            case Keys.F5:
                //ドキュメントの再読込み。
                if (File.Exists(this.Document.FileSave))
                {
                    string text            = File.ReadAllText(this.Document.FileSave);
                    int    oldRowBeginview = this.Document.RowBeginview;
                    this.Document = DocumentImpl.Import(text, this.Document.FileSave, this.Document);
                    this.Document.RowBeginview = oldRowBeginview;
                    this.Refresh();
                }
                break;

            case Keys.PageDown:
                this.Document.RowBeginview += rowViewed / 2;
                this.Refresh();
                break;

            case Keys.PageUp:
                this.Document.RowBeginview -= rowViewed / 2;
                if (this.Document.RowBeginview < 0)
                {
                    this.Document.RowBeginview = 0;
                }
                this.Refresh();
                break;
            }
            //System.Console.WriteLine("keyDown=["+keys.ToString()+"] "+Keys.PageDown+" "+Keys.PageUp);
        }
Exemplo n.º 8
0
        //────────────────────────────────────────

        public Form1()
        {
            InitializeComponent();
            //this.Document = new DocumentImpl();
            //初期ドキュメント
            {
                StringBuilder sb = new StringBuilder();

                sb.Append("");
                sb.Append(Environment.NewLine);
                sb.Append("{AIMSサンプル『suica32』調査中}");
                sb.Append(Environment.NewLine);
                sb.Append("");
                sb.Append(Environment.NewLine);
                sb.Append(" <boot>{boot.lua}");
                sb.Append(Environment.NewLine);
                sb.Append("  ┃");
                sb.Append(Environment.NewLine);
                sb.Append("  ┗追加><frame>{s/frame.lua}");
                sb.Append(Environment.NewLine);
                sb.Append("      :│");
                sb.Append(Environment.NewLine);
                sb.Append("      :├作成→[黒画面左]");
                sb.Append(Environment.NewLine);
                sb.Append("      :│");
                sb.Append(Environment.NewLine);
                sb.Append("      :└作成→[黒画面右]");
                sb.Append(Environment.NewLine);
                sb.Append("      :");
                sb.Append(Environment.NewLine);
                sb.Append("      <logo>{s/logo.lua}");
                sb.Append(Environment.NewLine);
                sb.Append("      :│");
                sb.Append(Environment.NewLine);
                sb.Append("      :├作成→[「Loading...」]");
                sb.Append(Environment.NewLine);
                sb.Append("      :│");
                sb.Append(Environment.NewLine);
                sb.Append("      :└作成→[ロゴ]");
                sb.Append(Environment.NewLine);
                sb.Append("      :");
                sb.Append(Environment.NewLine);
                sb.Append("      <title>{s/title.lua}");
                sb.Append(Environment.NewLine);
                sb.Append("      :│");
                sb.Append(Environment.NewLine);
                sb.Append("      :└作成→[タイトル]");
                sb.Append(Environment.NewLine);
                sb.Append("      :");
                sb.Append(Environment.NewLine);
                sb.Append("      <game>{s/game.lua}");
                sb.Append(Environment.NewLine);
                sb.Append("      :│");
                sb.Append(Environment.NewLine);
                sb.Append("      :├作成→[\"padlistener\"/ゲームパッド制御]");
                sb.Append(Environment.NewLine);
                sb.Append("      :│");
                sb.Append(Environment.NewLine);
                sb.Append("      :├作成→[A.bg/背景]");
                sb.Append(Environment.NewLine);
                sb.Append("      :│");
                sb.Append(Environment.NewLine);
                sb.Append("      :├作成→[A.player \"player\"/プレイヤー]");
                sb.Append(Environment.NewLine);
                sb.Append("      :│");
                sb.Append(Environment.NewLine);
                sb.Append("      :├作成→[A.score \"pxf\"/スコアボード「SCORE 0000000000        HI 0000000000」]");
                sb.Append(Environment.NewLine);
                sb.Append("      :│");
                sb.Append(Environment.NewLine);
                sb.Append("      :├作成→[A.extend \"pxf\"/エクステンド「EXTEND0000000000」]");
                sb.Append(Environment.NewLine);
                sb.Append("      :│");
                sb.Append(Environment.NewLine);
                sb.Append("      :├作成→[A.level \"pxf\"/レベル「LEVEL 00」]");
                sb.Append(Environment.NewLine);
                sb.Append("      :│");
                sb.Append(Environment.NewLine);
                sb.Append("      :├作成→[A.lives \"lifecounter\"/ライフカウンター」]");
                sb.Append(Environment.NewLine);
                sb.Append("      :│");
                sb.Append(Environment.NewLine);
                sb.Append("      :├作成→[enemy]");
                sb.Append(Environment.NewLine);
                sb.Append("      :│");
                sb.Append(Environment.NewLine);
                sb.Append("      :├作成→[bullets]");
                sb.Append(Environment.NewLine);
                sb.Append("      :│");
                sb.Append(Environment.NewLine);
                sb.Append("      :├作成→[font]");
                sb.Append(Environment.NewLine);
                sb.Append("      :│");
                sb.Append(Environment.NewLine);
                sb.Append("      :├作成→[common.black]");
                sb.Append(Environment.NewLine);
                sb.Append("      :│");
                sb.Append(Environment.NewLine);
                sb.Append("      :├作成→[common.white]");
                sb.Append(Environment.NewLine);
                sb.Append("      :│");
                sb.Append(Environment.NewLine);
                sb.Append("      :├作成→[common.clear]");
                sb.Append(Environment.NewLine);
                sb.Append("      :I");
                sb.Append(Environment.NewLine);
                sb.Append("      :L開始V(thread_gameover){game.lua。<gameover>へチェンジ・シーンします。}");
                sb.Append(Environment.NewLine);
                sb.Append("      :");
                sb.Append(Environment.NewLine);
                sb.Append("      <gameover>{s/game.lua}");
                sb.Append(Environment.NewLine);
                sb.Append("");
                sb.Append(Environment.NewLine);
                sb.Append("{以上}");
                sb.Append(Environment.NewLine);

                this.Document = DocumentImpl.Import(sb.ToString(), "", null);
            }
        }
Exemplo n.º 9
0
        //────────────────────────────────────────

        public static LineImpl Import(string line, DocumentImpl ownerDocument)
        {
            List <DecorationImpl> decorations = new List <DecorationImpl>();

            for (int i = 0; i < line.Length; i++)
            {
                char ch = line[i];

                switch (ch)
                {
                //
                //シーン。
                //
                case '┣':
                    decorations.Add(new DecorationImpl(EnumNode.Scene, EnumShape.ArrowBranch));
                    break;

                case '┗':
                    decorations.Add(new DecorationImpl(EnumNode.Scene, EnumShape.ArrowCurve));
                    break;

                case '┃':
                    decorations.Add(new DecorationImpl(EnumNode.Scene, EnumShape.ArrowMiddle));
                    break;

                case '追':
                    decorations.Add(new DecorationImpl(EnumNode.Scene, EnumShape.ArrowPointer1));
                    break;

                case '加':
                    decorations.Add(new DecorationImpl(EnumNode.Scene, EnumShape.ArrowPointer2));
                    break;

                case '>':
                    decorations.Add(new DecorationImpl(EnumNode.Scene, EnumShape.ArrowPointer3));
                    break;

                case ':':
                    decorations.Add(new DecorationImpl(EnumNode.Scene, EnumShape.Joint));
                    break;

                case ' ':
                    decorations.Add(new DecorationImpl(EnumNode.Scene, EnumShape.Space));
                    break;

                //
                //アクター。
                //
                case '├':
                    decorations.Add(new DecorationImpl(EnumNode.Actor, EnumShape.ArrowBranch));
                    break;

                case '└':
                    decorations.Add(new DecorationImpl(EnumNode.Actor, EnumShape.ArrowCurve));
                    break;

                case '│':
                    decorations.Add(new DecorationImpl(EnumNode.Actor, EnumShape.ArrowMiddle));
                    break;

                case '作':
                    decorations.Add(new DecorationImpl(EnumNode.Actor, EnumShape.ArrowPointer1));
                    break;

                case '成':
                    decorations.Add(new DecorationImpl(EnumNode.Actor, EnumShape.ArrowPointer2));
                    break;

                case '→':
                    decorations.Add(new DecorationImpl(EnumNode.Actor, EnumShape.ArrowPointer3));
                    break;

                case '・':
                    decorations.Add(new DecorationImpl(EnumNode.Actor, EnumShape.Joint));
                    break;

                //
                //スレッド。
                //
                case 'T':
                    decorations.Add(new DecorationImpl(EnumNode.Thread, EnumShape.ArrowBranch));
                    break;

                case 'L':
                    decorations.Add(new DecorationImpl(EnumNode.Thread, EnumShape.ArrowCurve));
                    break;

                case 'I':
                    decorations.Add(new DecorationImpl(EnumNode.Thread, EnumShape.ArrowMiddle));
                    break;

                case '開':
                    decorations.Add(new DecorationImpl(EnumNode.Thread, EnumShape.ArrowPointer1));
                    break;

                case '始':
                    decorations.Add(new DecorationImpl(EnumNode.Thread, EnumShape.ArrowPointer2));
                    break;

                case 'V':
                    decorations.Add(new DecorationImpl(EnumNode.Thread, EnumShape.ArrowPointer3));
                    break;

                //case '・':
                //    decorations.Add(new DecorationImpl(EnumNode.Actor, EnumShape.Joint));
                //    break;
                //
                //
                //
                case '<':
                {
                    //シーン名
                    StringBuilder s = new StringBuilder();
                    i++;
                    for (; i < line.Length; i++)
                    {
                        ch = line[i];

                        if (ch == '>')
                        {
                            break;
                        }
                        else
                        {
                            s.Append(ch);
                        }
                    }
                    decorations.Add(new DecorationImpl(EnumNode.Scene, s.ToString()));
                }
                break;

                case '[':
                {
                    //アクター名
                    StringBuilder s = new StringBuilder();
                    i++;
                    for (; i < line.Length; i++)
                    {
                        ch = line[i];

                        if (ch == ']')
                        {
                            break;
                        }
                        else
                        {
                            s.Append(ch);
                        }
                    }
                    decorations.Add(new DecorationImpl(EnumNode.Actor, s.ToString()));
                }
                break;

                case '(':
                {
                    //スレッド名
                    StringBuilder s = new StringBuilder();
                    i++;
                    for (; i < line.Length; i++)
                    {
                        ch = line[i];

                        if (ch == ')')
                        {
                            break;
                        }
                        else
                        {
                            s.Append(ch);
                        }
                    }
                    decorations.Add(new DecorationImpl(EnumNode.Thread, s.ToString()));
                }
                break;

                case '{':
                {
                    //コメント
                    StringBuilder s = new StringBuilder();
                    i++;
                    for (; i < line.Length; i++)
                    {
                        ch = line[i];

                        if (ch == '}')
                        {
                            break;
                        }
                        else
                        {
                            s.Append(ch);
                        }
                    }
                    decorations.Add(new DecorationImpl(EnumNode.Comment, s.ToString()));
                }
                break;

                default:
                    //エラー
                    decorations.Add(new DecorationImpl(EnumNode.Error, "×"));
                    break;
                }
            }

            System.Console.WriteLine("line=[" + line + "] line.Length=[" + line.Length + "] decorations.Count=[" + decorations.Count + "]");
            return(new LineImpl(decorations, ownerDocument));
        }
Exemplo n.º 10
0
 public LineImpl(List <DecorationImpl> decorations, DocumentImpl ownerDocument)
 {
     this.Decorations   = decorations;
     this.OwnerDocument = ownerDocument;
     this.width         = 1.0f;
 }
Exemplo n.º 11
0
        //────────────────────────────────────────

        public LineImpl(DecorationImpl[] decorations, DocumentImpl ownerDocument)
        {
            this.Decorations   = new List <DecorationImpl>(decorations);
            this.OwnerDocument = ownerDocument;
            this.width         = 1.0f;
        }
Exemplo n.º 12
0
 public LineImpl( List<DecorationImpl> decorations, DocumentImpl ownerDocument)
 {
     this.Decorations = decorations;
     this.OwnerDocument = ownerDocument;
     this.width = 1.0f;
 }
Exemplo n.º 13
0
        public void ExportScreenshot(
            Brush brushBackground,
            int width,
            DocumentImpl document
            )
        {
            //タイムスタンプ
            string timestamp;
            {
                StringBuilder s   = new StringBuilder();
                DateTime      now = System.DateTime.Now;
                s.Append(now.Year);
                s.Append("_");
                s.Append(now.Month);
                s.Append("_");
                s.Append(now.Day);
                s.Append("_");
                s.Append(now.Hour);
                s.Append("_");
                s.Append(now.Minute);
                s.Append("_");
                s.Append(now.Second);
                s.Append("_");
                s.Append(now.Millisecond);
                timestamp = s.ToString();
            }

            //行数。
            int rows = document.Lines.Count;
            //1枚のスクリーンショットに収める行数。
            int rowsByOne  = 20;//仮。
            int numberPage = 0;

            int lastPage = rows / rowsByOne;

            if (0 < rows % rowsByOne)
            {
                lastPage++;
            }
            //System.Console.WriteLine("rows=[" + rows + "] rowsByOne=[" + rowsByOne + "] lastPage=[" + lastPage + "]");

            // 1ページ分を保存できる高さとします。
            int height = rowsByOne * document.HeightLine;

            while (numberPage < lastPage)
            {
                //Graphicsオブジェクトを取得
                Graphics g = null;

                try
                {
                    Bitmap bitmap;
                    bitmap = new Bitmap(width, height);
                    g      = Graphics.FromImage(bitmap);

                    //背景を塗りつぶします。
                    g.FillRectangle(brushBackground, 0, 0, width, height);

                    this.Paint(g, width, height, numberPage * rowsByOne, rowsByOne, document);

                    bitmap.Save(Path.Combine(Application.StartupPath, timestamp + "_P" + numberPage + ".png"), System.Drawing.Imaging.ImageFormat.Png);
                }
                finally
                {
                    if (null != g)
                    {
                        g.Dispose();
                    }
                }

                numberPage++;
            }
        }
Exemplo n.º 14
0
        public void ExportScreenshot(
            Brush brushBackground,
            int width,
            DocumentImpl document
            )
        {
            //タイムスタンプ
            string timestamp;
            {
                StringBuilder s = new StringBuilder();
                DateTime now = System.DateTime.Now;
                s.Append(now.Year);
                s.Append("_");
                s.Append(now.Month);
                s.Append("_");
                s.Append(now.Day);
                s.Append("_");
                s.Append(now.Hour);
                s.Append("_");
                s.Append(now.Minute);
                s.Append("_");
                s.Append(now.Second);
                s.Append("_");
                s.Append(now.Millisecond);
                timestamp = s.ToString();
            }

            //行数。
            int rows = document.Lines.Count;
            //1枚のスクリーンショットに収める行数。
            int rowsByOne = 20;//仮。
            int numberPage = 0;

            int lastPage = rows / rowsByOne;
            if (0 < rows % rowsByOne)
            {
                lastPage++;
            }
            //System.Console.WriteLine("rows=[" + rows + "] rowsByOne=[" + rowsByOne + "] lastPage=[" + lastPage + "]");

            // 1ページ分を保存できる高さとします。
            int height = rowsByOne * document.HeightLine;

            while (numberPage < lastPage)
            {
                //Graphicsオブジェクトを取得
                Graphics g = null;

                try
                {
                    Bitmap bitmap;
                    bitmap = new Bitmap(width, height);
                    g = Graphics.FromImage(bitmap);

                    //背景を塗りつぶします。
                    g.FillRectangle(brushBackground, 0, 0, width, height);

                    this.Paint(g, width, height, numberPage*rowsByOne, rowsByOne, document);

                    bitmap.Save(Path.Combine(Application.StartupPath, timestamp + "_P" + numberPage + ".png"), System.Drawing.Imaging.ImageFormat.Png);
                }
                finally
                {
                    if (null != g)
                    {
                        g.Dispose();
                    }
                }

                numberPage++;
            }
        }
Exemplo n.º 15
0
        public void Paint(
            Graphics g,
            int width,
            int height,
            int rowBeginview,
            int rowViewed,
            DocumentImpl document
            )
        {
            int top;
            for (top = 0; top < height; top += document.HeightLine)
            {
                g.DrawLine(document.CreatePenGrid(), 0, top, width, top);
            }

            Stack<LineImpl> breadcrumbLocation = new Stack<LineImpl>();
            top = 0;
            int row = 0;
            int lastRowViewed = rowBeginview + rowViewed;
            foreach (LineImpl line in document.Lines)
            {
                if (rowBeginview <= row && row <= lastRowViewed)
                {
                    //表示

                    line.Paint(g, top);
                    top += document.HeightLine;
                }
                else
                {
                }

                row++;
            }
        }
Exemplo n.º 16
0
 //────────────────────────────────────────
 public LineImpl( DecorationImpl[] decorations, DocumentImpl ownerDocument)
 {
     this.Decorations = new List<DecorationImpl>( decorations);
     this.OwnerDocument = ownerDocument;
     this.width = 1.0f;
 }
Exemplo n.º 17
0
Arquivo: Form1.cs Projeto: muzudho/XtA
        private void Form1_KeyDown(object sender, KeyEventArgs e)
        {
            Keys keys = e.KeyCode;

            int rowViewed = this.control_Perspective1.GetControl_Note1().GetRow_Viewed();

            switch (keys)
            {
                case Keys.F5:
                    //ドキュメントの再読込み。
                    if (File.Exists(this.Document.FileSave))
                    {
                        string text = File.ReadAllText(this.Document.FileSave);
                        int oldRowBeginview = this.Document.RowBeginview;
                        this.Document = DocumentImpl.Import(text, this.Document.FileSave, this.Document);
                        this.Document.RowBeginview = oldRowBeginview;
                        this.Refresh();
                    }
                    break;
                case Keys.PageDown:
                    this.Document.RowBeginview += rowViewed / 2;
                    this.Refresh();
                    break;
                case Keys.PageUp:
                    this.Document.RowBeginview -= rowViewed / 2;
                    if (this.Document.RowBeginview < 0)
                    {
                        this.Document.RowBeginview = 0;
                    }
                    this.Refresh();
                    break;
            }
            //System.Console.WriteLine("keyDown=["+keys.ToString()+"] "+Keys.PageDown+" "+Keys.PageUp);
        }
Exemplo n.º 18
0
        //────────────────────────────────────────
        public static LineImpl Import(string line, DocumentImpl ownerDocument)
        {
            List<DecorationImpl> decorations = new List<DecorationImpl>();

            for (int i = 0; i < line.Length; i++)
            {
                char ch = line[i];

                switch (ch)
                {
                    //
                    //シーン。
                    //
                    case '┣':
                        decorations.Add(new DecorationImpl(EnumNode.Scene, EnumShape.ArrowBranch));
                        break;
                    case '┗':
                        decorations.Add(new DecorationImpl(EnumNode.Scene, EnumShape.ArrowCurve));
                        break;
                    case '┃':
                        decorations.Add(new DecorationImpl(EnumNode.Scene, EnumShape.ArrowMiddle));
                        break;
                    case '追':
                        decorations.Add(new DecorationImpl(EnumNode.Scene, EnumShape.ArrowPointer1));
                        break;
                    case '加':
                        decorations.Add(new DecorationImpl(EnumNode.Scene, EnumShape.ArrowPointer2));
                        break;
                    case '>':
                        decorations.Add(new DecorationImpl(EnumNode.Scene, EnumShape.ArrowPointer3));
                        break;
                    case ':':
                        decorations.Add(new DecorationImpl(EnumNode.Scene, EnumShape.Joint));
                        break;
                    case ' ':
                        decorations.Add(new DecorationImpl(EnumNode.Scene, EnumShape.Space));
                        break;
                    //
                    //アクター。
                    //
                    case '├':
                        decorations.Add(new DecorationImpl(EnumNode.Actor, EnumShape.ArrowBranch));
                        break;
                    case '└':
                        decorations.Add(new DecorationImpl(EnumNode.Actor, EnumShape.ArrowCurve));
                        break;
                    case '│':
                        decorations.Add(new DecorationImpl(EnumNode.Actor, EnumShape.ArrowMiddle));
                        break;
                    case '作':
                        decorations.Add(new DecorationImpl(EnumNode.Actor, EnumShape.ArrowPointer1));
                        break;
                    case '成':
                        decorations.Add(new DecorationImpl(EnumNode.Actor, EnumShape.ArrowPointer2));
                        break;
                    case '→':
                        decorations.Add(new DecorationImpl(EnumNode.Actor, EnumShape.ArrowPointer3));
                        break;
                    case '・':
                        decorations.Add(new DecorationImpl(EnumNode.Actor, EnumShape.Joint));
                        break;
                    //
                    //スレッド。
                    //
                    case 'T':
                        decorations.Add(new DecorationImpl(EnumNode.Thread, EnumShape.ArrowBranch));
                        break;
                    case 'L':
                        decorations.Add(new DecorationImpl(EnumNode.Thread, EnumShape.ArrowCurve));
                        break;
                    case 'I':
                        decorations.Add(new DecorationImpl(EnumNode.Thread, EnumShape.ArrowMiddle));
                        break;
                    case '開':
                        decorations.Add(new DecorationImpl(EnumNode.Thread, EnumShape.ArrowPointer1));
                        break;
                    case '始':
                        decorations.Add(new DecorationImpl(EnumNode.Thread, EnumShape.ArrowPointer2));
                        break;
                    case 'V':
                        decorations.Add(new DecorationImpl(EnumNode.Thread, EnumShape.ArrowPointer3));
                        break;
                    //case '・':
                    //    decorations.Add(new DecorationImpl(EnumNode.Actor, EnumShape.Joint));
                    //    break;
                    //
                    //
                    //
                    case '<':
                        {
                            //シーン名
                            StringBuilder s = new StringBuilder();
                            i++;
                            for (; i < line.Length; i++)
                            {
                                ch = line[i];

                                if (ch == '>')
                                {
                                    break;
                                }
                                else
                                {
                                    s.Append(ch);
                                }
                            }
                            decorations.Add(new DecorationImpl(EnumNode.Scene, s.ToString()));

                        }
                        break;
                    case '[':
                        {
                            //アクター名
                            StringBuilder s = new StringBuilder();
                            i++;
                            for (; i < line.Length; i++)
                            {
                                ch = line[i];

                                if (ch == ']')
                                {
                                    break;
                                }
                                else
                                {
                                    s.Append(ch);
                                }
                            }
                            decorations.Add(new DecorationImpl(EnumNode.Actor, s.ToString()));
                        }
                        break;
                    case '(':
                        {
                            //スレッド名
                            StringBuilder s = new StringBuilder();
                            i++;
                            for (; i < line.Length; i++)
                            {
                                ch = line[i];

                                if (ch == ')')
                                {
                                    break;
                                }
                                else
                                {
                                    s.Append(ch);
                                }
                            }
                            decorations.Add(new DecorationImpl(EnumNode.Thread, s.ToString()));
                        }
                        break;
                    case '{':
                        {
                            //コメント
                            StringBuilder s = new StringBuilder();
                            i++;
                            for (; i < line.Length; i++)
                            {
                                ch = line[i];

                                if (ch == '}')
                                {
                                    break;
                                }
                                else
                                {
                                    s.Append(ch);
                                }
                            }
                            decorations.Add(new DecorationImpl(EnumNode.Comment, s.ToString()));
                        }
                        break;
                    default:
                        //エラー
                        decorations.Add(new DecorationImpl(EnumNode.Error, "×"));
                        break;
                }
            }

            System.Console.WriteLine("line=[" + line + "] line.Length=[" + line.Length + "] decorations.Count=[" + decorations.Count + "]");
            return new LineImpl( decorations, ownerDocument);
        }
Exemplo n.º 19
0
        public static DocumentImpl Import(string text, string fileSave, DocumentImpl oldDocument_OrNull)
        {
            DocumentImpl document = new DocumentImpl();
            document.Lines.Clear();

            string[] lines = text.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
            foreach (string line in lines)
            {
                LineImpl lineElement = LineImpl.Import(line, document);
                document.Lines.Add(lineElement);
            }

            document.FileSave = fileSave;

            if (null != oldDocument_OrNull)
            {
                document.Font = oldDocument_OrNull.Font;
                document.Image = oldDocument_OrNull.Image;
                document.HeightLine = oldDocument_OrNull.HeightLine;
            }
            return document;
        }