Example #1
0
        public static int Main(string[] args)
        {
            try
            {
                if (args.ToList().Exists(a => a == "/debug" || a == "/d"))
                {
                    ConsoleHelper.ShowDebug = true;
                    ConsoleHelper.DebugWriteLine("Debug Mode Active");

                    var count = 0;
                    foreach (var arg in args)
                    {
                        ConsoleHelper.DebugWriteLine("arg[" + count++.ToString() + "] = " + arg);
                    }
                }



                                #if DEBUG
                /*
                 * args = new string[] { "f.rd", @"C:\Users\kboronka\Documents\Virtual Machines\caches", @"/pause" };
                 * args = new string[] { "rdp", "192.168.171.208", @"username", "password", @"/pause" };
                 * args = new string[] { "ip.set", "gigabit", "dhcp", @"/debug", @"/pause", @"/admin" };
                 * args = new string[] { "ip.set", "gigabit", "192.168.14.111", "255.255.255.0", @"/debug", @"/pause", @"/admin" };
                 * args = new string[] { "ip.config", @"/pause" };
                 * args = new string[] { "mssql-gs", "192.168.14.110", "TestDB", "sa", "test123", @"\scripts\", @"/pause" };
                 * args = new string[] { "f.open", "c:\temp" };
                 * args = new string[] { "file.open", @"c:\temp", @"/pause" };
                 * args = new string[] { "-b.net", "3.5", @"LabelPrinter.sln", "/p:Configuration=Release /p:Platform=\"Any CPU\"" };
                 * args = new string[] { "fanuc.downloadPR", "10.240.26.104", @"C:\Temp\posreg.test.csv", @"/pause" };
                 * args = new string[] { "svn.GetAssemblyVersion", @"https://github.com/kboronka/sar-tool/trunk/sar/Properties/AssemblyInfo.cs", @"/pause" };
                 * args = new string[] { "svn.GetNewAssemblyVersion", @"https://github.com/kboronka/sar-tool/trunk/sar/Properties/AssemblyInfo.cs", @"/pause" };
                 * args = new string[] { "dotNetVersions", @"/pause" };
                 * args = new string[] { "r", "test.cs", @"break;\r\n(.*)case", @"break;\n\n\n$1case", @"/pause" };
                 */
                                #endif

                var hub = new CommandHub();
                Progress.Start();
                if (args.Length == 0)
                {
                    ConsoleHelper.ApplicationTitle();
                }
                int exitCode = hub.ProcessCommands(args);

                Progress.Stop();
                return(exitCode);
            }
            catch (Exception ex)
            {
                ConsoleHelper.WriteException(ex);
                Progress.Stop();
                return(ConsoleHelper.EXIT_ERROR);
            }
        }