Ejemplo n.º 1
0
        //────────────────────────────────────────
        #endregion



        #region イベントハンドラー
        //────────────────────────────────────────

        /// <summary>
        /// 「.luaファイルを一覧」ボタン。
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_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, "button1_Click", out log_Reports);



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

            configxml.Read(log_Reports);



            //サーチ
            List <string> listFilepath = new List <string>();
            FinderLuaImpl finder       = new FinderLuaImpl();

            finder.SearchLua(listFilepath, configxml.FolderpathProject, log_Reports);

            //出力
            if (log_Reports.Successful)
            {
                StringBuilder sb = new StringBuilder();
                sb.Append("NO,FILE,END");//,EOL
                sb.Append(Environment.NewLine);
                sb.Append("int,string,");
                sb.Append(Environment.NewLine);
                sb.Append("-1,ファイルパス,");
                sb.Append(Environment.NewLine);
                int row = 0;
                foreach (string filepath in listFilepath)
                {
                    string filepath2;
                    if (filepath.StartsWith(configxml.FolderpathProject))
                    {
                        // プロジェクト・フォルダーからの相対パスに変換
                        filepath2 = filepath.Substring(configxml.FolderpathProject.Length);
                        if (filepath2.StartsWith("\\"))
                        {
                            //頭に \ が付いていれば除去します。
                            filepath2 = filepath2.Substring(1);
                        }
                    }
                    else
                    {
                        filepath2 = filepath;
                    }

                    sb.Append(row);
                    sb.Append(",");
                    sb.Append(filepath2);
                    sb.Append(",");
                    sb.Append(Environment.NewLine);
                    //System.Console.WriteLine("filepath=[" + filepath + "] filepath2=[" + filepath2 + "]");
                    row++;
                }
                sb.Append("EOF,,");
                sb.Append(Environment.NewLine);

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



            goto gt_EndMethod;

gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            log_Reports.EndLogging(log_Method);
        }
Ejemplo n.º 2
0
        //────────────────────────────────────────
        /// <summary>
        /// 「.luaファイルを一覧」ボタン。
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_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, "button1_Click", out log_Reports);

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

            //サーチ
            List<string> listFilepath = new List<string>();
            FinderLuaImpl finder = new FinderLuaImpl();
            finder.SearchLua(listFilepath, configxml.FolderpathProject, log_Reports);

            //出力
            if (log_Reports.Successful)
            {
                StringBuilder sb = new StringBuilder();
                sb.Append("NO,FILE,END");//,EOL
                sb.Append(Environment.NewLine);
                sb.Append("int,string,");
                sb.Append(Environment.NewLine);
                sb.Append("-1,ファイルパス,");
                sb.Append(Environment.NewLine);
                int row = 0;
                foreach (string filepath in listFilepath)
                {
                    string filepath2;
                    if (filepath.StartsWith(configxml.FolderpathProject))
                    {
                        // プロジェクト・フォルダーからの相対パスに変換
                        filepath2 = filepath.Substring(configxml.FolderpathProject.Length);
                        if (filepath2.StartsWith("\\"))
                        {
                            //頭に \ が付いていれば除去します。
                            filepath2 = filepath2.Substring(1);
                        }
                    }
                    else
                    {
                        filepath2 = filepath;
                    }

                    sb.Append(row);
                    sb.Append(",");
                    sb.Append(filepath2);
                    sb.Append(",");
                    sb.Append(Environment.NewLine);
                    //System.Console.WriteLine("filepath=[" + filepath + "] filepath2=[" + filepath2 + "]");
                    row++;
                }
                sb.Append("EOF,,");
                sb.Append(Environment.NewLine);

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

            goto gt_EndMethod;

            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            log_Reports.EndLogging(log_Method);
        }