Esempio n. 1
0
        /// <summary>
        /// CSV出力ボタン押下イベント
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btXmlToCsv_Click(object sender, EventArgs e)
        {
            bool bRet = true;
            // 対象パス
            string tgtPath = _comLogic.ExclIniEndWQuot(tbTgtPath.Text);
            // データセットクラスインスタンス生成
            DataStore ds = new DataStore();

            // Xml採掘メソッド使用
            bRet = MiningXml(ds, tgtPath);
            if (!bRet)
            {
                return;
            }

            // ファイル名称取得
            string tgtName = Path.GetFileName(tgtPath);

            // CSV出力
            using (StreamWriter swMain = new StreamWriter(tgtName + ".csv", false, Encoding.UTF8))
                using (StreamWriter swSub = new StreamWriter(tgtName + "_ElemInfo.csv", false, Encoding.UTF8))
                {
                    // 階層数分ループ
                    for (int i = 0; i <= ds.TotalRowNum; i++)
                    {
                        // CSV変換後リスト
                        swMain.WriteLine(ds.Xml2CsvList[i]);
                        // 階層順要素情報リスト
                        swSub.WriteLine(ds.ElemInfo2CsvList[i]);
                    }
                }
        }
Esempio n. 2
0
        private void btStart_Click(object sender, EventArgs e)
        {
            // 先頭末尾Wクォート除去メソッド使用
            string tgtPath = _comLgc.ExclIniEndWQuot(tbTgtPath.Text);

            // ファイル読込メソッド呼出しメソッド使用
            CallReadVideo(tgtPath);
        }
Esempio n. 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            // 対象パス取得
            string tgtPath = _comLogic.ExclIniEndWQuot(tbTgtPath.Text);
            // 出力パス取得
            string outPath = tbOutPath.Text;
            // 変換前文字コード
            Encoding srcEnc = Str2Enc(cbSrcChcp.Text);
            // 変換後文字コード
            Encoding destEnc = Str2Enc(cbDestChcp.Text);

            // ねずみ返し
            if (tgtPath == string.Empty)
            {
                MessageBox.Show("対象パスがありません");
                return;
            }

            // 出力パスが設定されている場合
            if (outPath != string.Empty)
            {
                // 最後一文字が「\」でない場合
                if (outPath.Substring(outPath.Length - 1, 1) != @"\")
                {
                    outPath += @"\";
                }
            }

            // ファイルの場合
            if (File.Exists(tgtPath))
            {
                // 文字コード変換メソッド使用
                ChcpConversion(tgtPath, outPath, srcEnc, destEnc);
            }
            else if (Directory.Exists(tgtPath))
            {
                // フォルダからXMLファイルのパスだけ取得
                string[] targetFolder = Directory.GetFiles(tgtPath, "*", SearchOption.TopDirectoryOnly);

                // ループ
                foreach (string x in targetFolder)
                {
                    // 文字コード変換メソッド使用
                    ChcpConversion(x, outPath, srcEnc, destEnc);
                }
            }
            else
            {
                MessageBox.Show("対象が存在しません");
                return;
            }

            MessageBox.Show("完了しました");
        }