3 using System.Collections;
4 using System.ComponentModel;
5 using System.Windows.Forms;
13 /// Summary description for Form1.
15 public class TestAppForm : System.Windows.Forms.Form
17 private System.Windows.Forms.Label label2;
18 private System.Windows.Forms.Button RefreshCDsButton;
19 private System.Windows.Forms.ListBox CDDrivesList;
20 private System.Windows.Forms.ListBox SearchPathList;
21 private System.Windows.Forms.Label label1;
22 private System.Windows.Forms.TextBox EnumFilesPath;
23 private System.Windows.Forms.ListBox EnumList;
24 private System.Windows.Forms.Label label3;
25 private System.Windows.Forms.TextBox NewSearchPathText;
26 private System.Windows.Forms.Button AddSearchPathButton;
27 private System.Windows.Forms.Button RemovePathButton;
28 private System.Windows.Forms.Button RefreshEnumList;
29 private System.Windows.Forms.Button RefreshSearchPathButton;
31 /// Required designer variable.
33 private System.ComponentModel.Container components = null;
38 // Required for Windows Form Designer support
40 InitializeComponent();
43 // TODO: Add any constructor code after InitializeComponent call
48 /// Clean up any resources being used.
50 protected override void Dispose( bool disposing )
54 if (components != null)
59 base.Dispose( disposing );
62 #region Windows Form Designer generated code
64 /// Required method for Designer support - do not modify
65 /// the contents of this method with the code editor.
67 private void InitializeComponent()
69 this.label2 = new System.Windows.Forms.Label();
70 this.RefreshCDsButton = new System.Windows.Forms.Button();
71 this.CDDrivesList = new System.Windows.Forms.ListBox();
72 this.SearchPathList = new System.Windows.Forms.ListBox();
73 this.label1 = new System.Windows.Forms.Label();
74 this.EnumFilesPath = new System.Windows.Forms.TextBox();
75 this.EnumList = new System.Windows.Forms.ListBox();
76 this.label3 = new System.Windows.Forms.Label();
77 this.RefreshEnumList = new System.Windows.Forms.Button();
78 this.NewSearchPathText = new System.Windows.Forms.TextBox();
79 this.AddSearchPathButton = new System.Windows.Forms.Button();
80 this.RemovePathButton = new System.Windows.Forms.Button();
81 this.RefreshSearchPathButton = new System.Windows.Forms.Button();
86 this.label2.Location = new System.Drawing.Point(8, 8);
87 this.label2.Name = "label2";
88 this.label2.Size = new System.Drawing.Size(136, 16);
89 this.label2.TabIndex = 2;
90 this.label2.Text = "Available CD-ROM Drives";
94 this.RefreshCDsButton.Location = new System.Drawing.Point(8, 152);
95 this.RefreshCDsButton.Name = "RefreshCDsButton";
96 this.RefreshCDsButton.Size = new System.Drawing.Size(72, 24);
97 this.RefreshCDsButton.TabIndex = 4;
98 this.RefreshCDsButton.Text = "Refresh";
99 this.RefreshCDsButton.Click += new System.EventHandler(this.RefreshCDsButton_Click);
103 this.CDDrivesList.Location = new System.Drawing.Point(8, 24);
104 this.CDDrivesList.Name = "CDDrivesList";
105 this.CDDrivesList.Size = new System.Drawing.Size(136, 121);
106 this.CDDrivesList.TabIndex = 7;
110 this.SearchPathList.Location = new System.Drawing.Point(152, 24);
111 this.SearchPathList.Name = "SearchPathList";
112 this.SearchPathList.Size = new System.Drawing.Size(248, 95);
113 this.SearchPathList.TabIndex = 8;
117 this.label1.Location = new System.Drawing.Point(152, 8);
118 this.label1.Name = "label1";
119 this.label1.Size = new System.Drawing.Size(136, 16);
120 this.label1.TabIndex = 10;
121 this.label1.Text = "Search Path";
125 this.EnumFilesPath.Location = new System.Drawing.Point(408, 128);
126 this.EnumFilesPath.Name = "EnumFilesPath";
127 this.EnumFilesPath.Size = new System.Drawing.Size(208, 20);
128 this.EnumFilesPath.TabIndex = 11;
129 this.EnumFilesPath.Text = "";
133 this.EnumList.Location = new System.Drawing.Point(408, 24);
134 this.EnumList.Name = "EnumList";
135 this.EnumList.Size = new System.Drawing.Size(208, 95);
136 this.EnumList.TabIndex = 12;
140 this.label3.Location = new System.Drawing.Point(408, 8);
141 this.label3.Name = "label3";
142 this.label3.Size = new System.Drawing.Size(136, 16);
143 this.label3.TabIndex = 13;
144 this.label3.Text = "Enumerate Files";
148 this.RefreshEnumList.Location = new System.Drawing.Point(544, 152);
149 this.RefreshEnumList.Name = "RefreshEnumList";
150 this.RefreshEnumList.Size = new System.Drawing.Size(72, 24);
151 this.RefreshEnumList.TabIndex = 14;
152 this.RefreshEnumList.Text = "Refresh";
153 this.RefreshEnumList.Click += new System.EventHandler(this.RefreshEnumList_Click);
157 this.NewSearchPathText.Location = new System.Drawing.Point(152, 128);
158 this.NewSearchPathText.Name = "NewSearchPathText";
159 this.NewSearchPathText.Size = new System.Drawing.Size(248, 20);
160 this.NewSearchPathText.TabIndex = 15;
161 this.NewSearchPathText.Text = "";
163 // AddSearchPathButton
165 this.AddSearchPathButton.Location = new System.Drawing.Point(152, 152);
166 this.AddSearchPathButton.Name = "AddSearchPathButton";
167 this.AddSearchPathButton.Size = new System.Drawing.Size(72, 24);
168 this.AddSearchPathButton.TabIndex = 9;
169 this.AddSearchPathButton.Text = "Add Path";
170 this.AddSearchPathButton.Click += new System.EventHandler(this.AddSearchPathButton_Click);
174 this.RemovePathButton.Location = new System.Drawing.Point(232, 152);
175 this.RemovePathButton.Name = "RemovePathButton";
176 this.RemovePathButton.Size = new System.Drawing.Size(88, 24);
177 this.RemovePathButton.TabIndex = 16;
178 this.RemovePathButton.Text = "Remove Path";
179 this.RemovePathButton.Click += new System.EventHandler(this.RemovePathButton_Click);
181 // RefreshSearchPathButton
183 this.RefreshSearchPathButton.Location = new System.Drawing.Point(328, 152);
184 this.RefreshSearchPathButton.Name = "RefreshSearchPathButton";
185 this.RefreshSearchPathButton.Size = new System.Drawing.Size(72, 24);
186 this.RefreshSearchPathButton.TabIndex = 17;
187 this.RefreshSearchPathButton.Text = "Refresh";
188 this.RefreshSearchPathButton.Click += new System.EventHandler(this.RefreshSearchPathButton_Click);
192 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
193 this.ClientSize = new System.Drawing.Size(624, 309);
194 this.Controls.AddRange(new System.Windows.Forms.Control[] {
195 this.RefreshSearchPathButton,
196 this.RemovePathButton,
197 this.NewSearchPathText,
198 this.RefreshEnumList,
205 this.RefreshCDsButton,
207 this.AddSearchPathButton});
208 this.Name = "TestAppForm";
209 this.Text = "PhysFS Test Application";
210 this.Load += new System.EventHandler(this.TestAppForm_Load);
211 this.ResumeLayout(false);
217 /// The main entry point for the application.
222 Application.Run(new TestAppForm());
225 private void TestAppForm_Load(object sender, System.EventArgs e)
230 private void RefreshCDsButton_Click(object sender, System.EventArgs e)
232 // Clear ths listbox if it contains any items
233 CDDrivesList.Items.Clear();
234 // Add the items to the list
235 CDDrivesList.Items.AddRange(PhysFS.GetCDROMDrives());
238 private void RefreshSearchPathButton_Click(object sender, System.EventArgs e)
240 // Clear ths listbox if it contains any items
241 SearchPathList.Items.Clear();
242 // Add the items to the list
243 SearchPathList.Items.AddRange(PhysFS.GetSearchPath());
246 private void AddSearchPathButton_Click(object sender, System.EventArgs e)
249 PhysFS.AddToSearchPath(NewSearchPathText.Text, false);
250 // Clear ths listbox if it contains any items
251 SearchPathList.Items.Clear();
252 // Add the items to the list
253 SearchPathList.Items.AddRange(PhysFS.GetSearchPath());
256 private void RemovePathButton_Click(object sender, System.EventArgs e)
258 if(SearchPathList.SelectedItem != null)
260 PhysFS.RemoveFromSearchPath(SearchPathList.SelectedItem.ToString());
261 // Clear ths listbox if it contains any items
262 SearchPathList.Items.Clear();
263 // Add the items to the list
264 SearchPathList.Items.AddRange(PhysFS.GetSearchPath());
268 private void RefreshEnumList_Click(object sender, System.EventArgs e)
270 EnumList.Items.Clear();
271 EnumList.Items.AddRange(PhysFS.EnumerateFiles(EnumFilesPath.Text));