コード例 #1
0
ファイル: Form1.cs プロジェクト: marius00/GrimDamage
        private void btnLoadSave_Click(object sender, EventArgs e)
        {
            var ofd = new OpenFileDialog {
                InitialDirectory = GlobalSettings.SavedParsePath,
                Filter           = "Damage logs (*.dmg)|*.dmg|All files (*.*)|*.*"
            };

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                if (File.Exists(ofd.FileName))
                {
                    string data = File.ReadAllText(ofd.FileName);
                    _browser.TransferSave(data);
                }
                else
                {
                    MessageBox.Show(
                        "Could not find the file you requested",
                        "Error",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Warning
                        );
                }
            }
        }