X-Git-Url: http://git.bytex64.net/?a=blobdiff_plain;f=WebThing.cs;h=6f8a16482c459d36a05c8d4e61a0013e05fcbd05;hb=85b244419aec2552d114990aa86900aeac83a7e0;hp=5e4ca343d34d89784b020853a8a485c812a0dfb2;hpb=d76e00c61a81db8a74b57ebd8d5abb6042164df9;p=WebThing.git diff --git a/WebThing.cs b/WebThing.cs index 5e4ca34..6f8a164 100644 --- a/WebThing.cs +++ b/WebThing.cs @@ -40,36 +40,11 @@ namespace bytex64.WebThing { public Gtk.Notebook Tabs { get { return _Tabs; } } - /* - private int _CurrentTab; - public int CurrentTab { - get { return _CurrentTab; } - set { - if (value >= _Tabs.Count) - _CurrentTab = _Tabs.Count - 1; - else if (value < 0) - _CurrentTab = 0; - else - _CurrentTab = value; - - _WebView.Hide(); - _ScrolledWindow.Remove(_WebView); - _WebView = _Tabs[_CurrentTab]; - _ScrolledWindow.Add(_WebView); - foreach (WebView view in Tabs) - Console.WriteLine(view.MainFrame.Uri); - _WebView.Show(); - _WebView.GrabFocus(); - } - } - */ private Gtk.Table WidgetGrid; private Gtk.Alignment InteriorOverlay; public Dictionary Plugins; - public Dictionary Options; - public string[] Arguments; [DllImport ("SoupSettings.dll")] private static extern void soup_settings(); @@ -77,7 +52,10 @@ namespace bytex64.WebThing { public void Run() { Application.Init(); Plugins = new Dictionary(); - ParseArgs(); + + Config.ParseCommandLine(); + Config.Load(); + //Config.DumpOptions(); soup_settings(); @@ -116,66 +94,6 @@ namespace bytex64.WebThing { Application.Run(); } - protected void ParseArgs() { - Options = new Dictionary(); - Queue q = new Queue(); - foreach (string s in System.Environment.GetCommandLineArgs()) { - q.Enqueue(s); - } - q.Dequeue(); // Remove self argument - - Regex SimpleOpt = new Regex(@"^-([a-zA-Z0-9]+)$"); - Regex LongOpt = new Regex(@"^--([\w-]+)$"); - string OptLast = null; - List args = new List(); - - while (q.Count > 0) { - string opt = q.Dequeue(); - Match m; - - m = SimpleOpt.Match(opt); - if (m.Success) { - string s = m.Groups[1].Value; - if (s.Length > 1) { - foreach (char c in s) { - Options[c.ToString()] = ""; - } - OptLast = null; - } else { - Options[s] = ""; - OptLast = s; - } - continue; - } - - m = LongOpt.Match(opt); - if (m.Success) { - string s = m.Groups[1].Value; - Options[s] = ""; - OptLast = s; - continue; - } - - // else - - if (OptLast != null) { - Options[OptLast] = opt; - OptLast = null; - } else { - args.Add(opt); - } - } - Arguments = args.ToArray(); - - /* - Console.WriteLine("Options:"); - foreach (string key in Options.Keys) - Console.WriteLine(" {0}\t{1}", key, Options[key]); - - Console.WriteLine("Arguments: {0}", String.Join(" ", Arguments)); - */ - } - public void LoadPlugin(string assemblyname) { Assembly a = Assembly.LoadFile("plugins/" + assemblyname + ".dll"); Type[] types = a.GetTypes();