示例#1
0
        /// <summary>
        /// 大雑把にfunctionを一覧。
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button2_Click(object sender, EventArgs e)
        {
            Log_ReportsImpl.BDebugmode_Static = true;
            Log_Reports log_Reports;
            //(2)メソッド開始
            Log_Method log_Method = new Log_MethodImpl();

            // デバッグモード静的設定の後で。
            log_Method.BeginMethod(Info_Actorslist.Name_Library, this, "button2_Click", out log_Reports);


            Exception error_Exception;


            //コンフィグファイル
            ConfigxmlImpl configxml = new ConfigxmlImpl();

            configxml.Read(log_Reports);



            //CSV→テーブル
            Table_Humaninput tableH;

            if (log_Reports.Successful)
            {
                if (!File.Exists(configxml.FilepathExportLualist))
                {
                    goto gt_Error_File1;
                }

                string csvtext = File.ReadAllText(configxml.FilepathExportLualist);
                CsvTo_Table_HumaninputImpl trans = new CsvTo_Table_HumaninputImpl();
                tableH = trans.Read(
                    csvtext,
                    new Request_ReadsTableImpl(),
                    new Format_Table_HumaninputImpl(),
                    //true,
                    log_Reports
                    );
            }
            else
            {
                tableH = null;
            }



            //各.luaファイル
            List <string> listFile     = new List <string>();
            List <string> listRow      = new List <string>();
            List <string> listFunction = new List <string>();

            if (log_Reports.Successful)
            {
                Regex regex2 = new Regex(@"^\s*function\s+(.*)$", RegexOptions.Compiled);
                tableH.ForEach_Datapart(
                    (Record_Humaninput recordH, ref bool isBreak2, Log_Reports log_Reports2) =>
                {
                    string filepathRelational = recordH.TextAt("FILE");
                    string filepath           = Path.Combine(configxml.FolderpathProject, filepathRelational);
                    //ystem.Console.WriteLine("filepath=[" + filepath + "]");

                    string luatext = File.ReadAllText(filepath, Encoding.GetEncoding("Shift-JIS"));
                    string[] lines = luatext.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);

                    int row = 1;    //行番号
                    foreach (string line in lines)
                    {
                        Match m2 = regex2.Match(line);
                        if (m2.Success)
                        {
                            listFile.Add(filepathRelational);
                            listRow.Add(row.ToString());
                            listFunction.Add(line);
                            //System.Console.WriteLine("ファイル=[" + filepathRelational + "] [" + row + "]行 関数line=[" + line + "]");
                        }
                        else
                        {
                        }

                        row++;
                    }
                }, log_Reports);
            }



            //配列(空回し);buffer
            Dictionary <string, string> dictionary1 = new Dictionary <string, string>();// 関数名の問題文字列:["シーン","クラスネーム"]

            if (log_Reports.Successful)
            {
                Regex regex4 = new Regex(@"^\s*function\s+(.*?)(_OnClose|_OnVanish)\s*\(.*$", RegexOptions.Compiled);


                //「_OnClose」ならシーン、
                //「_OnVanish」ならクラスネームに確定します。

                for (int i = 0; i < listFunction.Count; i++)
                {
                    string function = listFunction[i];

                    Match m4 = regex4.Match(function);
                    if (m4.Success)
                    {
                        if ("_OnClose" == m4.Groups[2].Value)
                        {
                            //シーン
                            dictionary1.Add(m4.Groups[1].Value, "シーン");
                        }
                        else if ("_OnVanish" == m4.Groups[2].Value)
                        {
                            //クラスネーム
                            dictionary1.Add(m4.Groups[1].Value, "クラスネーム");
                        }
                        else
                        {
                        }
                    }
                }
            }



            //配列→CSV
            if (log_Reports.Successful)
            {
                Regex regex3 = new Regex(@"^\s*function\s+(.*?)(?:_OnStart|_OnStep|_OnClose|_OnVanish|_OnDraw)\s*\(.*$", RegexOptions.Compiled);
                Regex regex4 = new Regex(@"^\s*function\s+(?:OnLoad|OnVanish)\s*\(.*$", RegexOptions.Compiled);
                Regex regex5 = new Regex(@"^\s*function\s+(.*?)_init\s*\(.*$", RegexOptions.Compiled);
                Regex regex6 = new Regex(@"^\s*function\s+(.*?)Thread\s*\(.*$", RegexOptions.Compiled);
                Regex regex7 = new Regex(@"^\s*function\s+thread_(.*?)\s*\(.*$", RegexOptions.Compiled);

                CsvLineParserImpl parser = new CsvLineParserImpl();

                StringBuilder sb = new StringBuilder();
                sb.Append("NO,FILE,ROW,INITIALIZER,SCENE,THREAD,CLASS_NAME,FUNCTION,END");//,EOL
                sb.Append(Environment.NewLine);
                sb.Append("int,string,int,string,string,string,string,string,");
                sb.Append(Environment.NewLine);
                sb.Append("-1,ファイルパス,行番号,suica32用ローダースレッド・ハンドラ?,シーン,スレッド?,クラス名,関数シグネチャー,");
                sb.Append(Environment.NewLine);
                int row = 0;
                for (int i = 0; i < listFunction.Count; i++)
                {
                    string file      = listFile[i];
                    string numberRow = listRow[i];
                    string function  = listFunction[i];

                    string initializer = "";
                    string scene       = "";
                    string thread      = "";
                    string classname   = "";

                    Match m3 = regex3.Match(function);
                    if (m3.Success)
                    {
                        string functionname2 = m3.Groups[1].Value;

                        if (dictionary1.ContainsKey(functionname2))
                        {
                            switch (dictionary1[functionname2])
                            {
                            case "シーン":
                                scene = functionname2;
                                break;

                            case "クラスネーム":
                                classname = functionname2;
                                break;

                            default:
                                break;
                            }
                        }

                        goto gt_Csv;
                    }

                    Match m4 = regex4.Match(function);
                    if (m4.Success)
                    {
                        scene = Path.GetFileNameWithoutExtension(file);
                        goto gt_Csv;
                    }

                    Match m5 = regex5.Match(function);
                    if (m5.Success)
                    {
                        initializer = m5.Groups[1].Value;
                        goto gt_Csv;
                    }

                    Match m6 = regex6.Match(function);
                    if (m6.Success)
                    {
                        thread = m6.Groups[1].Value;
                        goto gt_Csv;
                    }

                    Match m7 = regex7.Match(function);
                    if (m7.Success)
                    {
                        thread = m7.Groups[1].Value;
                        goto gt_Csv;
                    }

gt_Csv:
                    sb.Append(row);
                    sb.Append(",");
                    sb.Append(file);
                    sb.Append(",");
                    sb.Append(numberRow);
                    sb.Append(",");
                    sb.Append(initializer);
                    sb.Append(",");
                    sb.Append(scene);
                    sb.Append(",");
                    sb.Append(thread);
                    sb.Append(",");
                    sb.Append(classname);
                    sb.Append(",");
                    sb.Append(parser.EscapeCell(function));
                    sb.Append(",");
                    sb.Append(Environment.NewLine);
                    //ystem.Console.WriteLine("row=[" + row + "] file=[" + file + "] numberRow=[" + numberRow + "] initializer=[" + initializer + "] scene=[" + scene + "] thread=[" + thread + "] classname=[" + classname + "] classname=[" + classname + "] function=[" + parser.EscapeCell(function) + "]");
                    row++;
                }

                sb.Append("EOF,,,,,,,,");
                sb.Append(Environment.NewLine);

                string csvfile = Path.Combine(Application.StartupPath, configxml.FilepathExportFunctionlist);
                System.Console.WriteLine("csvfile=[" + csvfile + "]");
                File.WriteAllText(csvfile, sb.ToString(), Encoding.UTF8);
            }



            goto gt_EndMethod;
            #region 異常系
            //────────────────────────────────────────
gt_Error_File1:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー13007!", log_Method);

                Log_TextIndented s = new Log_TextIndentedImpl();
                s.Append("ファイルが足りません。");
                s.Append(Environment.NewLine);
                s.Append("readme.txtを読んで、手順を踏んでください。");
                s.Append(Environment.NewLine);
                s.Append("  .lua一覧CSVファイル=[");
                s.Append(configxml.FilepathExportLualist);
                s.Append("]");

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion

gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            log_Reports.EndLogging(log_Method);
        }
示例#2
0
        /// <summary>
        /// フォントの一行表記。
        /// "MS ゴシック", "12.25", "Bold, Italic"
        /// </summary>
        public string ToTextbox()
        {
            StringBuilder sb = new StringBuilder();

            //━━━━━
            //フォント名
            //━━━━━
            CsvLineParserImpl p = new CsvLineParserImpl();


            sb.Append(CsvLineParserImpl.EscapeCell(this.Name));

            sb.Append(",");//カンマの前後に無用に空白を入れないこと。

            //━━━━━
            //サイズ
            //━━━━━
            sb.Append(CsvLineParserImpl.EscapeCell(this.Size.ToString()));

            sb.Append(",");//カンマの前後に無用に空白を入れないこと。

            //━━━━━
            //フォントスタイル
            //━━━━━
            {
                StringBuilder sb2 = new StringBuilder();

                if (!this.Bold && !this.Italic)
                {
                    sb2.Append("Regular");
                }
                else if (this.Bold && this.Italic)
                {
                    sb2.Append("Bold, Italic");
                }
                else if (this.Bold)
                {
                    sb2.Append("Bold");
                }
                else if (this.Italic)
                {
                    sb2.Append("Italic");
                }
                else
                {
                }

                if (this.Strikeout)
                {
                    sb.Append(", Strikeout");
                }

                if (this.Strikeout)
                {
                    sb.Append(", Underline");
                }

                sb.Append(CsvLineParserImpl.EscapeCell(sb2.ToString()));
            }

            return(sb.ToString());
        }