commit:a404d1c43af3650f2f17c00879a75b9efb2ce6bd
author:Chip Black
committer:Chip Black
date:Thu May 1 13:59:22 2008 -0500
parents:65a66fd245f9f717bef9080300484faa44665639
Profiles are now a list instead of a hash so they'll stay in order.
diff --git a/VFSEncoder.cs b/VFSEncoder.cs
line changes: +15/-17
index 36aa23f..05add64
--- a/VFSEncoder.cs
+++ b/VFSEncoder.cs
@@ -7,7 +7,8 @@ namespace VFSEncoder {
 	using System.Text.RegularExpressions;
 
 	public class VFSEncoder {
-		static Hashtable encoder_commands;
+		static ArrayList<string> encoder_names;
+		static ArrayList<string> encoder_commands;
 
 		static Window window;
 		static Table options;
@@ -19,24 +20,21 @@ namespace VFSEncoder {
 		static Button go;
 
 		static void load_encoder_commands() {
-			encoder_commands = new Hashtable();
+			encoder_commands = new ArrayList();
 			StreamReader r = new StreamReader("profiles.txt");
 			string line;
-			while(true) {
-				try {
-					line = r.ReadLine();
-					if (line == null) break;
-				} catch(IOException e) {
-					Console.WriteLine(e.Message);
-					break;
-				}
+			try {
+				while(null != (line = r.ReadLine()) {
 
-				int i = line.IndexOf(":");
-				if (i == -1) continue;
+					int i = line.IndexOf(":");
+					if (i == -1) continue;
 
-				string k = line.Substring(0, i).Trim();
-				encoder_commands.Add(k, line.Substring(i+1).Trim());
-				Console.WriteLine("Added encoder command {0} : {1}", k, encoder_commands[k]);
+					encoder_names.Add(line.Substring(0, i).Trim());
+					encoder_commands.Add(line.Substring(i+1).Trim());
+				}
+			} catch(IOException e) {
+				Console.WriteLine(e.Message);
+				break;
 			}
 			r.Close();
 		}
@@ -59,7 +57,7 @@ namespace VFSEncoder {
 
 			Process p = new Process();
 			p.StartInfo.FileName = "ffmpeg";
-			p.StartInfo.Arguments = "-y " + String.Format((string)encoder_commands[profiles.ActiveText], browse.Filename, outfile);
+			p.StartInfo.Arguments = "-y " + String.Format(encoder_commands[profiles.Active], browse.Filename, outfile);
 			p.StartInfo.UseShellExecute = false;
 			p.StartInfo.RedirectStandardError = true;
 			p.Start();
@@ -124,7 +122,7 @@ namespace VFSEncoder {
 			browse = new FileChooserButton(filechooser);
 			options.Attach(browse, 1, 2, 0, 1);
 			profiles = ComboBox.NewText();
-			foreach (string k in encoder_commands.Keys)
+			foreach (string k in encoder_names)
 				profiles.AppendText(k);
 			profiles.Active = 0;
 			options.Attach(profiles, 1, 2, 1, 2);