Profiles are now a list instead of a hash so they'll stay in order.
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;
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();
}
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();
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);