static string [] LoadArgs (string file)
{
StreamReader f;
var args = new List<string> ();
string line;
try {
f = new StreamReader (file);
} catch {
return null;
}
StringBuilder sb = new StringBuilder ();
while ((line = f.ReadLine ()) != null){
int t = line.Length;
for (int i = 0; i < t; i++){
char c = line [i];
if (c == '"' || c == '\''){
char end = c;
for (i++; i < t; i++){
c = line [i];
if (c == end)
break;
sb.Append (c);
}
} else if (c == ' '){
if (sb.Length > 0){
args.Add (sb.ToString ());
sb.Length = 0;
}
} else
sb.Append (c);
}
if (sb.Length > 0){
args.Add (sb.ToString ());
sb.Length = 0;
}
}
return args.ToArray ();
}