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