Exemple #1
0
 /// <summary>
 /// Main program where the console command-line user interface starts
 /// </summary>
 /// <param name="args"></param>
 static void Main(string[] args)
 {
     if (!Environment.UserInteractive)
     {
         // running as service
         using (var service = new WcscliSerialService())
             ServiceBase.Run(service);
     }
     else
     {
         // Command-line specific code goes here
         Console.Title = "Chassis Manager Command-line Interface.";
         WcsCliCmProxy.InteractiveParseUserCommandGetCmResponse(false, ConvertConsoleCommandLineArgsToCommandInput(args));
         if (isBatchOrVersionCmd)
         {
             // If batch file is specified as input then do not get in to interactive mode.. quit..
             return;
         }
         if (!WcsCli2CmConnectionManager.TestConnectionToCmService())
         {
             Console.WriteLine("Please try again by executing \"{0}\" \n", WcsCliConstants.wcscliConsoleParameterHelp);
             return;
         }
         ContinuousConsoleUserInputCapture();
     }
 }
Exemple #2
0
        /// <summary>
        /// Main program where the console command-line user interface starts
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            bool runApplication = false;

            // Check if we run as application or a service
            if (args != null)
            {
                // List of valid command line parameters
                List <string> validParams = new List <string> {
                    "-h", "-p", "-s", "-u", "-x", "-b", "-v"
                };
                for (int i = 0; i < args.Length; i++)
                {
                    // If the command line argument contains a valid parameter, run as application
                    foreach (string validParam in validParams)
                    {
                        if ((args[i].Trim().Equals(@validParam, StringComparison.InvariantCultureIgnoreCase)))
                        {
                            runApplication = true;
                            break;
                        }
                    }
                    // Found a valid flag
                    if (runApplication)
                    {
                        break;
                    }
                }
            }

            if ((!runApplication) && (!Environment.UserInteractive))
            {
                // running as service
                using (var service = new WcscliSerialService())
                    ServiceBase.Run(service);
            }
            else
            {
                // Command-line specific code goes here
                Console.Title = "Chassis Manager Command-line Interface.";
                WcsCliCmProxy.InteractiveParseUserCommandGetCmResponse(false, ConvertConsoleCommandLineArgsToCommandInput(args));
                if (isBatchOrVersionCmd)
                {
                    // If batch file is specified as input then do not get in to interactive mode.. quit..
                    return;
                }
                if (!WcsCli2CmConnectionManager.TestConnectionToCmService())
                {
                    Console.WriteLine("Please try again by executing \"{0}\" \n", WcsCliConstants.wcscliConsoleParameterHelp);
                    return;
                }
                ContinuousConsoleUserInputCapture();
            }
        }
Exemple #3
0
 /// <summary>
 /// Main program where the console command-line user interface starts
 /// </summary>
 /// <param name="args"></param>
 static void Main(string[] args)
 {
     if (!Environment.UserInteractive)
     {
         // running as service
         using (var service = new WcscliSerialService())
             ServiceBase.Run(service);
     }
     else 
     {
         // Command-line specific code goes here 
         Console.Title = "Chassis Manager Command-line Interface.";
         WcsCliCmProxy.InteractiveParseUserCommandGetCmResponse(false, ConvertConsoleCommandLineArgsToCommandInput(args));
         if (isBatchOrVersionCmd)
         {
             // If batch file is specified as input then do not get in to interactive mode.. quit.. 
             return;
         }
         if (!WcsCli2CmConnectionManager.TestConnectionToCmService())
         {
             Console.WriteLine("Please try again by executing \"{0}\" \n", WcsCliConstants.wcscliConsoleParameterHelp);
             return;
         }
         ContinuousConsoleUserInputCapture();
     }
 }
Exemple #4
0
        /// <summary>
        /// Main program where the console command-line user interface starts
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            bool runApplication = false;

            // Check if we run as application or a service
            if (args != null)
            {
                // List of valid command line parameters
                List<string> validParams = new List<string> {"-h", "-p", "-s", "-u", "-x", "-b", "-v"};
                for (int i = 0; i < args.Length; i++)
                {
                    // If the command line argument contains a valid parameter, run as application
                    foreach (string validParam in validParams)
                    {
                        if ((args[i].Trim().Equals(@validParam, StringComparison.InvariantCultureIgnoreCase)))
                        {
                            runApplication = true;
                            break;
                        }
                    }
                    // Found a valid flag
                    if (runApplication)
                        break;
                }
            }

            if ((!runApplication) && (!Environment.UserInteractive))
            {
                // running as service
                using (var service = new WcscliSerialService())
                    ServiceBase.Run(service);
            }
            else
            {
                // Command-line specific code goes here
                Console.Title = "Chassis Manager Command-line Interface.";
                WcsCliCmProxy.InteractiveParseUserCommandGetCmResponse(false, ConvertConsoleCommandLineArgsToCommandInput(args));
                if (isBatchOrVersionCmd)
                {
                    // If batch file is specified as input then do not get in to interactive mode.. quit..
                    return;
                }
                if (!WcsCli2CmConnectionManager.TestConnectionToCmService())
                {
                    Console.WriteLine("Please try again by executing \"{0}\" \n", WcsCliConstants.wcscliConsoleParameterHelp);
                    return;
                }
                ContinuousConsoleUserInputCapture();
            }
        }