Beispiel #1
0
        private void btnOpen_Click(object sender, EventArgs e)
        {
            op = new OudParser();

            if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                // SJISを指定して読み込まないと文字化け起こすよ!
                StreamReader data = new StreamReader(ofd.OpenFile(), Encoding.GetEncoding("Shift_JIS"));
                if (op.load(data.ReadToEnd()))
                {
                    lbox1.Items.AddRange(op.getlist().ToArray());
                }
                else
                {
                    MessageBox.Show("Oudiaのデータではありません!", "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                data.Close();
            }
        }
Beispiel #2
0
        private void ofd_FileOk(object sender, CancelEventArgs e)
        {
            bool result = false;

            this.Activate();

            // XML読み込み
            if (Path.GetExtension(ofd.FileName) == ".tdml")
            {
                tcon.load(ofd.FileName);
                result = true;
            }
            // Oud読み込み
            else if (Path.GetExtension(ofd.FileName) == ".oud")
            {
                OudParser op = new OudParser();
                // SJISを指定して読み込まないと文字化け起こすよ!
                StreamReader sr = new StreamReader(ofd.OpenFile(), Encoding.GetEncoding("Shift_JIS"));
                if (op.load(sr.ReadToEnd()))
                {
                    op.convert();
                    tcon.load(op.getXml());
                    result = true;
                }

                sr.Close();
            }

            // 読み込んだデータを反映
            if (result)
            {
                tcon.parse();
                Text += "- " + tcon.Tp.Linename;
            }
            else
            {
                string code = "FL002";
                MessageBox.Show(ec.getMessage(code), code, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }