public CommandLineOptions(string[] commandLineArgs, NameValueCollection queryParams, string argumentText)
 {
     var args = new ProgramArgs(commandLineArgs, queryParams, argumentText);
     DedicatedServer = args.IsSet("dedicated_server");
     SaveTemplates = args.IsSet("save_templates");
     DeleteTemplates = args.IsSet("delete_templates");
     ArenaFilename = args.GetValue("arena");
     if (args.IsSet("quickstart")) QuickStart = new QuickStartOptions
     {
         GameServerEndPoints = args.GetValues("server"),
         GameServerName = args.GetValue("server_name") ?? "Some Server",
         LoginToken = args.GetValue("login_token"),
         ShipName = args.GetValue("ship"),
         Weapon2Name = args.GetValue("weapon"),
         ExtraDeviceName = args.GetValue("mod"),
     };
 }
        public ProgramArgsProxy(IEnumerable<string> programArgs)
            : base(Globals.ProgramArgsProxy)
        {
            var parser = new InputParser(programArgs);
            var parserDictionary = parser.ArgCollection;

            InvalidArgs = parser.InvalidArgs;

            string path = Directory.GetCurrentDirectory();
            IList<string> pathCollection;
            if (parserDictionary.TryGetValue(ProgramArgsConstants.PathArg, out pathCollection))
            {
                path = pathCollection.Count < 1 ? path : pathCollection[0];
            }

            IList<string> blacklistCollection;
            if (!parserDictionary.TryGetValue(ProgramArgsConstants.BlacklistArg, out blacklistCollection))
            {
                blacklistCollection = new List<string>();
            }

            IList<string> fileGlobs;
            if (!parserDictionary.TryGetValue(ProgramArgsConstants.FileGlobsArg, out fileGlobs))
            {
                fileGlobs = new List<string>
                {
                    "*",
                };
            }

            var outputFile = string.Empty;
            IList<string> outputFileCollection;
            if (parserDictionary.TryGetValue(ProgramArgsConstants.OutputArg, out outputFileCollection))
            {
                outputFile = outputFileCollection[0];
            }

            var outputFileFormat = OutputReportType.FLAT.ToString();
            IList<string> outputFileFormatCollection;
            if (parserDictionary.TryGetValue(ProgramArgsConstants.OutputFormatArg, out outputFileFormatCollection))
            {
                outputFileFormat = outputFileFormatCollection[0];
            }

            //Add default blacklist stuff
            blacklistCollection.Add("thumbs.db");
            blacklistCollection.Add("Thumbs.db");
            blacklistCollection.Add("readme.txt");
            blacklistCollection.Add("read me.txt");
            blacklistCollection.Add("Help Wanted.txt");
            blacklistCollection.Add("PureMVC.DotNET.35");
            blacklistCollection.Add("SimMetrics");
            blacklistCollection.Add("DuplicateFileReporter");

            var userWantsHelp = parserDictionary.ContainsKey(ProgramArgsConstants.HelpArg);
            var useStringClusterAnalysis = parserDictionary.ContainsKey(ProgramArgsConstants.UseStringClusterAnalysisArg);
            var useFnv = parserDictionary.ContainsKey(ProgramArgsConstants.UseFnvHash);
            var useQuickSampleHash = parserDictionary.ContainsKey(ProgramArgsConstants.UseQuickSampleHash);

            Args = new ProgramArgs(
                path,
                useStringClusterAnalysis,
                useFnv,
                useQuickSampleHash,
                blacklistCollection,
                outputFile,
                outputFileFormat,
                userWantsHelp,
                fileGlobs);
        }
Example #3
0
 public static ProgramArgs Parse(string[] args)
 {
     var result = new ProgramArgs();
     var parser = new FluentCommandLineParser();
     parser.Setup<List<string>>('a', "apitargets")
         .Callback(items => result.TargetAssemblies = items)
         .WithDescription("Assemblies to create documentation for.");
     parser.Setup<string>('t', "templates")
         .Callback(text => result.TemplatesDirectory = text)
         .WithDescription("Folder containing razor templates.");
     parser.Setup<List<string>>('x', "apixml")
         .Callback(items => result.XmlDocLocations = items)
         .WithDescription("XML doc files and folders containing them.");
     parser.Setup<bool>('s', "nosplash")
         .Callback(b => result.NoSplash = b)
         .WithDescription("Enable to hide the splash message.");
     parser.Setup<string>('o', "output")
         .Callback(text => result.OutputFolder = text)
         .WithDescription("The folder to output the resulting files into.");
     parser.Setup<List<string>>('d', "docs")
         .Callback(items => result.DocsSources = items)
         .WithDescription("The documentation sources to convert to HTML.");
     parser.SetupHelp("?", "help")
         .Callback(help => {
             result.HelpRequested = true;
             System.Console.WriteLine(help);
         });
     parser.Parse(args);
     return result;
 }
 // Formerly known as Stash
 public BitBucketPullRequestProvider(ProgramArgs programArgs)
 {
     _programArgs = programArgs;
     DiscoverBitBucketServerCredentials();
     _bitBucketClient.OAuth2LeggedAuthentication(_programArgs.BitBucketApiKey, _programArgs.BitBucketApiSecret);
 }
Example #5
0
 public SemanticReleaseNotesBuilder(List <PullRequestDto> pullRequests, string summary, ProgramArgs programArgs)
 {
     _pullRequests         = pullRequests;
     _summary              = summary;
     _programArgs          = programArgs;
     _categoryDescriptions = BuildCategoryDescriptions();
 }
        private static void OldTest(string[] args)
        {
            var endpoint = ProgramArgs.Parse(args, new[] { "127.0.0.1:9211" }).EndPoint;

            var cts           = new CancellationTokenSource();
            var bufferManager = BufferManager.CreateBufferManager(2 << 16, 1024);
            var encoder       = new ClientFrameEncoder(0xA0, 0XC0);
            var decoder       = new ClientFrameDecoder(0xA0, 0XC0);

            endpoint.ToConnectObservable()
            .ObserveOn(TaskPoolScheduler.Default)
            .Subscribe(socket =>
            {
                var frameClientSubject =
                    socket.ToFrameClientSubject(encoder, decoder, bufferManager, cts.Token);

                var observerDisposable =
                    frameClientSubject
                    .ObserveOn(TaskPoolScheduler.Default)
                    .Subscribe(
                        managedBuffer =>
                {
                    var segment = managedBuffer.Value;
                    if (!ReceivedDataProcessor.Instance.Process(segment) && segment.Array != null)
                    {
                        Console.WriteLine(
                            "Echo: " + Encoding.UTF8.GetString(segment.Array, segment.Offset,
                                                               segment.Count));
                    }
                    managedBuffer.Dispose();
                },
                        error =>
                {
                    Console.WriteLine("Error: " + error.Message);
                    cts.Cancel();
                },
                        () =>
                {
                    Console.WriteLine("OnCompleted: Frame Protocol Receiver");
                    cts.Cancel();
                });

                var cmdSender = new DevCommandSender(frameClientSubject, bufferManager);

                Console.In.ToLineObservable("exit")
                .Subscribe(
                    line =>
                {
                    if (string.IsNullOrEmpty(line))
                    {
                        return;
                    }
                    if (line == "start")
                    {
                        cmdSender.Start();
                        return;
                    }
                    if (line == "stop")
                    {
                        cmdSender.Stop();
                        return;
                    }
                    var writeBuffer = Encoding.UTF8.GetBytes(line);
                    frameClientSubject.OnNext(
                        DisposableValue.Create(new ArraySegment <byte>(writeBuffer), Disposable.Empty));
                },
                    error =>
                {
                    Console.WriteLine("Error: " + error.Message);
                    cts.Cancel();
                },
                    () =>
                {
                    Console.WriteLine("OnCompleted: LineReader");
                    cts.Cancel();
                });

                cts.Token.WaitHandle.WaitOne();
                observerDisposable.Dispose();
            },
                       error =>
            {
                Console.WriteLine("Failed to connect: " + error.Message);
                cts.Cancel();
            },
                       cts.Token);

            cts.Token.WaitHandle.WaitOne();
        }
Example #7
0
 public MarkdownFormatter(ProgramArgs programArgs)
 {
     _programArgs = programArgs;
 }