-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFileDialog.cs
More file actions
89 lines (81 loc) · 3.05 KB
/
FileDialog.cs
File metadata and controls
89 lines (81 loc) · 3.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
namespace RangeOfInfluenceDetection
{
public partial class frmFileDialog : Form
{
// メンバ変数
Source m_source;
// 選択されていたファイル名を取得
string m_fileName = string.Empty;
//選択されていたファイル拡張子を取得
string m_extension = string.Empty;
public frmFileDialog(Source source)
{
InitializeComponent();
// メンバ変数に格納する
m_source = source;
m_fileName = m_source.Name;
}
/// <summary>
/// 戻るボタン押下時
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnReturn_Click(object sender, EventArgs e)
{
// 呼び出し元を活性状態にする
m_source.Enabled = true;
this.Close();
}
/// <summary>
/// 実行ボタン押下時
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnRun_Click(object sender, EventArgs e)
{
// ファイル名チェック
// 指定ファイルと変更されている箇所を検索する(戻り値変更された箇所の場所を特定できる情報)
using (FileStream fs = new FileStream(txtComparisonPath.Text, FileMode.Open))
{
StreamReader sr = new StreamReader(fs);
string Text = sr.ReadToEnd();
// 指定されたパスのファイルを読み込んだところまで実装
}
// 呼び出し元を活性状態にする
m_source.Enabled = true;
}
/// <summary>
/// ファイルパス選択ダイアログを開く
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnOpen_Click(object sender, EventArgs e)
{
string filePath = string.Empty;
string fileContent = string.Empty;
using (OpenFileDialog openFileDialog = new OpenFileDialog())
{
// デフォルトは選択したソリューションが存在するディレクトリ
openFileDialog.InitialDirectory = AppInfomation.SearchDirectory; // "c:\\"
// フィルタは無し
//openFileDialog.Filter = $"{pathSelect.M_display()} ({pathSelect.M_extension()})|*.txt|All files (*.*)|*.*";
// ダイアログでOKボタン押下の場合
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
filePath = openFileDialog.FileName;
txtComparisonPath.Text = filePath;
}
}
}
}
}