コード例 #1
0
ファイル: SFCompose.cs プロジェクト: zmyer/service-fabric
        public static int Main(string[] args)
        {
            var parsedArguments = new Arguments();

            if (!CommandLineUtility.ParseCommandLineArguments(args, parsedArguments) || !parsedArguments.IsValid())
            {
                Console.Write(CommandLineUtility.CommandLineArgumentsUsage(typeof(Arguments)));
                return(-1);
            }

            if (!parsedArguments.VolumeDescriptionRequired)
            {
                VolumeMount.TestSettingVolumeDescriptionRequired = false;
            }

            if (parsedArguments.Operation == Arguments.Type.SingleInstance)
            {
                ApplicationOperation(parsedArguments);
            }
            else
            {
                ComposeOperation(parsedArguments);
            }
            return(0);
        }
コード例 #2
0
        static int Main(string[] args)
        {
            var parser  = new CommandLineArgumentParser(typeof(CommandArgs), new ErrorReporter(Console.Error.WriteLine));
            var cmdArgs = new CommandArgs();

            if (!parser.Parse(args, cmdArgs))
            {
                Console.Write(CommandLineUtility.CommandLineArgumentsUsage(typeof(CommandArgs)));
                return(-1);
            }

            string                 appManifestPath      = cmdArgs.ApplicationManifestPath;
            List <string>          serviceManifestPaths = new List <string>(cmdArgs.ServiceManifestPathList.Split(';'));
            AppManifestCleanupUtil util = new AppManifestCleanupUtil();

            List <string> appParamFilePaths = null;

            if (cmdArgs.ApplicationParametersFilePathList != null)
            {
                appParamFilePaths = new List <string>(cmdArgs.ApplicationParametersFilePathList.Split(';'));
            }

            util.CleanUp(appManifestPath, serviceManifestPaths, appParamFilePaths);

            return(0);
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: jeffj6123/mesh-lrc-test
        static int Main(string[] args)
        {
            var parsedArguments = new ToolArguments();

            if (!CommandLineUtility.ParseCommandLineArguments(args, parsedArguments))
            {
                Console.Out.Write(CommandLineUtility.CommandLineArgumentsUsage(typeof(ToolArguments)));
                return(-1);
            }

            clusterUrl               = parsedArguments.clusterUrl;
            certLocation             = parsedArguments.certLocation;
            serverCertThumbprint     = parsedArguments.serverCertThumbprint;
            applicationName          = parsedArguments.appName;
            applicationFileLocation  = parsedArguments.applicationFileLocation;
            applicationFileLocation2 = parsedArguments.applicationFileLocation2;

            var settings = new ClientSettings(GetSecurityCredentials);
            IServiceFabricClient sfClient = ServiceFabricClientFactory.Create(new Uri(clusterConnectionUrl), settings);

            //check if the application exists first
            var applicationInfo = sfClient.ApplicationResources.GetApplicationResourceAsync(applicationName).GetAwaiter().GetResult();

            if (applicationInfo == null)
            {
                Console.Out.Write("Application does not exist");
                return(-1);
            }

            upgrade(sfClient);

            return(0);
        }
コード例 #4
0
        private static int Main(string[] args)
        {
            var parsedArguments = new ToolArguments();

            if (!CommandLineUtility.ParseCommandLineArguments(args, parsedArguments) || !parsedArguments.IsValid())
            {
                Console.Write(CommandLineUtility.CommandLineArgumentsUsage(typeof(ToolArguments)));
                return(-1);
            }

            try
            {
                AssemblyResolvePath = parsedArguments.AssemblyResolvePath;
                AppDomain currentDomain = AppDomain.CurrentDomain;
                currentDomain.AssemblyResolve += new ResolveEventHandler(ResolveHandler);

                Tool.Run(parsedArguments);
            }
            catch (Exception e)
            {
                Console.Error.WriteLine(e);
                return(-1);
            }

            return(0);
        }
コード例 #5
0
        private void ShowHelp()
        {
            consoleOut.WriteLine("MbUnit {0} Console Application (running on .Net {1})",
                                 typeof(MainClass).Assembly.GetName().Version,
                                 typeof(Object).Assembly.GetName().Version
                                 );
            consoleOut.WriteLine("Author: Jonathan de Halleux");
            consoleOut.WriteLine("Get the latest at http://www.mbunit.com");
            consoleOut.WriteLine("------------------------------------------");

            consoleOut.Write(CommandLineUtility.CommandLineArgumentsUsage(typeof(MainArguments)));
            consoleOut.WriteLine("------------------------------------------");
        }
コード例 #6
0
ファイル: MbUnitForm.cs プロジェクト: tmauldin/mb-unit
        public void ExecuteArguments()
        {
            if (this.arguments == null)
            {
                return;
            }
            System.Threading.Thread.Sleep(500);

            try
            {
                if (this.arguments.Help)
                {
                    MessageBox.Show(
                        CommandLineUtility.CommandLineArgumentsUsage(typeof(MbUnitFormArguments))
                        );
                }

                // load files or project if possible
                if (this.arguments.Files != null)
                {
                    foreach (string fileName in arguments.Files)
                    {
                        if (fileName.ToLower().EndsWith(".mbunit"))
                        {
                            this.Invoke(new LoadProjectDelegate(this.LoadProjectInvoker),
                                        new object[] { fileName, false });
                            break;
                        }
                        this.treeView.AddAssembly(fileName);
                    }
                }

                // load last settings
                if (ConfigurationSettings.AppSettings["restorePreviousState"] == "true" && this.noArgs)
                {
                    this.Invoke(new LoadProjectDelegate(this.LoadProjectInvoker),
                                new object[] { previousSettings, true });
                    return;
                }

                // populate tree
                this.treeView.ThreadedPopulateTree(false);
                while (treeView.WorkerThreadAlive)
                {
                    System.Threading.Thread.Sleep(100);
                }

                // run
                if (this.arguments.Run)
                {
                    this.treeView.ThreadedRunTests();
                    while (treeView.WorkerThreadAlive)
                    {
                        System.Threading.Thread.Sleep(100);
                    }
                }

                // generate report
                foreach (ReportType reportType in this.arguments.ReportTypes)
                {
                    switch (reportType)
                    {
                    case ReportType.Html:
                        this.treeView.GenerateHtmlReport(); break;

                    case ReportType.Text:
                        this.treeView.GenerateTextReport(); break;

                    case ReportType.Dox:
                        this.treeView.GenerateDoxReport(); break;

                    case ReportType.Xml:
                        this.treeView.GenerateXmlReport(); break;
                    }
                }

                // exit
                if (this.arguments.Close)
                {
                    System.Threading.Thread.Sleep(1000);
                    while (treeView.WorkerThreadAlive)
                    {
                        System.Threading.Thread.Sleep(100);
                    }
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Failure while executing arguments");
                Console.WriteLine(ex.ToString());
                throw new ApplicationException("Failure while executing arguments", ex);
            }
        }