| 1 |
using System; |
| 2 |
using System.Collections.Generic; |
| 3 |
using System.ComponentModel; |
| 4 |
using System.Data; |
| 5 |
using System.Drawing; |
| 6 |
using System.Linq; |
| 7 |
using System.Text; |
| 8 |
using System.Windows.Forms; |
| 9 |
|
| 10 |
namespace UT3_Server_Launcher |
| 11 |
{ |
| 12 |
public partial class FormProfile : Form |
| 13 |
{ |
| 14 |
|
| 15 |
////////// |
| 16 |
// 定義 // |
| 17 |
////////// |
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
////////////////// |
| 22 |
// メンバー変数 // |
| 23 |
////////////////// |
| 24 |
|
| 25 |
int itemsCount = 8; |
| 26 |
|
| 27 |
FormMain fm; |
| 28 |
|
| 29 |
public FormProfile() |
| 30 |
{ |
| 31 |
InitializeComponent(); |
| 32 |
} |
| 33 |
|
| 34 |
public FormProfile(FormMain _fm) |
| 35 |
{ |
| 36 |
fm = _fm; |
| 37 |
|
| 38 |
InitializeComponent(); |
| 39 |
} |
| 40 |
|
| 41 |
private void FormProfile_Load(object sender, EventArgs e) |
| 42 |
{ |
| 43 |
// フォームの読み込み |
| 44 |
|
| 45 |
// プロフィール名の保存 |
| 46 |
string profile = Properties.Settings.Default.SettingsKey; |
| 47 |
|
| 48 |
// listviewにプロフィール一覧を読み込む |
| 49 |
int i = 0; |
| 50 |
while (i < itemsCount) |
| 51 |
{ |
| 52 |
i++; |
| 53 |
|
| 54 |
// Profile01から読み込む |
| 55 |
Properties.Settings.Default.SettingsKey = string.Format("{0}{1,0:D2}", "Profile", i); |
| 56 |
Properties.Settings.Default.Reload(); |
| 57 |
|
| 58 |
ListViewItem item = new ListViewItem(); |
| 59 |
|
| 60 |
// アイテムの設定 |
| 61 |
|
| 62 |
// 名前 |
| 63 |
item.Text = i.ToString(); |
| 64 |
|
| 65 |
// EnableMUTとActiveMUTがnullなら設定が存在しない |
| 66 |
if (Properties.Settings.Default.ActiveMUT == null && |
| 67 |
Properties.Settings.Default.ActiveMUT == null) |
| 68 |
{ |
| 69 |
// サーバー名 |
| 70 |
item.SubItems.Add(string.Empty); |
| 71 |
// ゲームモード |
| 72 |
item.SubItems.Add(string.Empty); |
| 73 |
} |
| 74 |
else |
| 75 |
{ |
| 76 |
// サーバー名 |
| 77 |
item.SubItems.Add(Properties.Settings.Default.ServerName); |
| 78 |
// ゲームモード |
| 79 |
string[] Mode = fm.mode.getList(); |
| 80 |
item.SubItems.Add(Mode[Properties.Settings.Default.GameType]); |
| 81 |
} |
| 82 |
// listviewに追加 |
| 83 |
lstVwProfile.Items.Add(item); |
| 84 |
} |
| 85 |
|
| 86 |
// プロファイルの復元 |
| 87 |
Properties.Settings.Default.SettingsKey = profile; |
| 88 |
Properties.Settings.Default.Reload(); |
| 89 |
|
| 90 |
// フォーカスをCancelボタンに変更 |
| 91 |
this.ActiveControl = this.btnCancel; |
| 92 |
} |
| 93 |
|
| 94 |
private void btnOK_Click(object sender, EventArgs e) |
| 95 |
{ |
| 96 |
if (lstVwProfile.SelectedItems.Count != 0) |
| 97 |
{ |
| 98 |
fm.profileName = string.Format("{0}{1,0:D2}", "Profile", int.Parse(lstVwProfile.SelectedItems[0].Text)); |
| 99 |
} |
| 100 |
this.Close(); |
| 101 |
} |
| 102 |
|
| 103 |
private void btnCancel_Click(object sender, EventArgs e) |
| 104 |
{ |
| 105 |
this.Close(); |
| 106 |
} |
| 107 |
|
| 108 |
} |
| 109 |
} |