Example #1
0
        static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                printUsage();
                return;
            }

            try
            {
                string     s_name   = args[0];
                SampleApp  s_app    = (SampleApp)Enum.Parse(typeof(SampleApp), s_name, true);
                ISampleApp app      = instantiateSample(s_app);
                string[]   app_args = new string[args.Length - 1];
                Array.Copy(args, 1, app_args, 0, app_args.Length);
                Console.WriteLine(
                    "\nLaunching '{0}': {1} ...",
                    Enum.GetName(typeof(SampleApp), s_app),
                    app.ShortDescription());
                app.Call(app_args);
            }
            catch (Exception ex)
            {
                Console.WriteLine("---\n" + ex + "\n---");
                printUsage();
                return;
            }
        }
Example #2
0
        static void printUsage()
        {
            Console.WriteLine("\nSolClient Sample Application Launcher, Copyright 2008-2016 Solace Systems, Inc.");
            Console.WriteLine("Usage: SolClientSamples.exe <SAMPLENAME> <SAMPLE ARGS...> ");
            Console.WriteLine("\nWhere <SAMPLENAME> is one of the following:");
            SampleApp[] sampleAppEnums = (SampleApp[])Enum.GetValues(typeof(SampleApp));
            Array.Sort(sampleAppEnums, new SampleAppComparer());
            foreach (SampleApp s in sampleAppEnums)
            {
                string     s_name = Enum.GetName(typeof(SampleApp), s);
                string     msg    = s_name.PadRight(28);
                ISampleApp app    = instantiateSample(s);
                if (app != null)
                {
                    msg += app.ShortDescription();
                }
                Console.WriteLine(msg);
            }

            Console.WriteLine("\n<SAMPLE ARGS...> are arguments to pass to this sample application.");
            Console.WriteLine("Specify no arguments to get usage information for the selected sample.\n");
        }