Example #1
0
 public GeneralContext(TrackerHost tracker)
 {
     this.tracker = tracker;
     Options.AddRange(new Option[] {
         new Option("Manage HTTP endpoints", new ListenerContext(this)),
         new Option("Manage watched directories", new DirectoryContext(this)),
         new Option("Statistics", new StatisticsContext(this)),
         new Option("Quit", "q", "quit")
     });
 }
Example #2
0
        static void ParseArgs(string[] args, TrackerHost host)
        {
            for (int i = 0; (i +1) < args.Length; i += 2)
            {
                switch(args[i])
                {
                case ("-d"):
                    if (!System.IO.Directory.Exists (args[i+1]))
                        Console.WriteLine ("Invalid directory: {0}", args[i+1]);
                    else
                        host.AddWatcher(args[i+1]);
                    break;

                case ("-u"):
                    Uri uri;
                    if (!Uri.TryCreate (args[i+1], UriKind.Absolute, out uri))
                        Console.WriteLine ("Invalid url: {0}", args[i+1]);
                    else
                        host.AddListener (uri);
                    break;
                }
            }
        }
Example #3
0
 static void Main(string[] args)
 {
     TrackerHost host = new TrackerHost();
     ParseArgs(args, host);
     host.Run();
 }