当前位置: 首页>>代码示例>>C#>>正文


C# Options.GetUsage方法代码示例

本文整理汇总了C#中Options.GetUsage方法的典型用法代码示例。如果您正苦于以下问题:C# Options.GetUsage方法的具体用法?C# Options.GetUsage怎么用?C# Options.GetUsage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Options的用法示例。


在下文中一共展示了Options.GetUsage方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

 static void Main(string[] args)
 {
     var options = new Options();
     if (Parser.Default.ParseArguments(args, options))
     {
         if (!options.ConsoleIn && options.InputFile == null
             || !options.ConsoleOut && options.OutputFile == null)
         {
             Console.WriteLine(options.GetUsage());
             return;
         }
         // consume Options instance properties
         var inReader = options.ConsoleIn
             ? Console.In
             : new StreamReader(options.InputFile);
         using (var outWriter = options.ConsoleIn
             ? Console.Out
             : new StreamWriter(options.OutputFile)
             )
         {
             var xml = inReader.ReadToEnd();
             var doc = XDocument.Parse(xml);
             var md = doc.Root.ToMarkDown();
             outWriter.Write(md);
             outWriter.Close();
         }
     }
     else
     {
         // Display the default usage information
         Console.WriteLine(options.GetUsage());
     }
 }
开发者ID:tynorton,项目名称:XmlCommentMarkDownGenerator,代码行数:33,代码来源:Program.cs

示例2: Main

        private static void Main(string[] args)
        {
            var options = new Options();
            if (CommandLine.Parser.Default.ParseArguments(args, options))
            {
                if (options.CsvHeaders)
                {
                    Console.WriteLine("Type,File name");
                }

                foreach (string fileName in options.FileNames)
                {
                    Console.WriteLine(new FileProperties(fileName).ToCsvLine());
                }

                if (options.Interactive)
                {
                    Console.WriteLine("Press any key to continue...");
                    Console.ReadKey();
                }
            }
            else
            {
                options.GetUsage();
            }
        }
开发者ID:JohnBillington,项目名称:ReadBinaryType,代码行数:26,代码来源:Program.cs

示例3: Main

        static int Main(string[] args)
        {
            try
            {
                // set up a simple configuration that logs on the console.
               log4net.Config.XmlConfigurator.Configure();
                // command line parsing
                Options options = new Options();
                if (!CommandLine.Parser.Default.ParseArguments(args, options))
                {
                    Console.WriteLine(options.GetUsage());
                    return -1;
                }
                string dbPath = options.InputFile;
                _log.Info(string.Format("db path = {0}", dbPath));

                LegacyDBUploder uploader = new treeDiM.PLMPackLib.LegacyDBUploder();
                LoggingCallback callback = new LoggingCallback();
                uploader.DatabasePath = dbPath;
                uploader.UserName = options.UserName;
                uploader.Password = options.Password;
                uploader.ActuallyUpload = !options.Test;
                uploader.Upload(callback);
            }
            catch (Exception ex)
            {
                _log.Error(ex.ToString());
                return -1;
            }
            return 0;
        }
开发者ID:minrogi,项目名称:PLMPack,代码行数:31,代码来源:Program.cs

示例4: DoCoreTask

        private static void DoCoreTask(Options options)
        {
            Console.WriteLine(Environment.NewLine);

            if (!File.Exists(options.InputFile))
            {
                Console.WriteLine("Error : File Not Found, Exiting");
                Environment.Exit(1);
            }

            ePubFixer.Variables.Filename = options.InputFile;
            ePubFixer.Variables.CreateHtmlTOC = options.CreateHtmlTOC;
            ePubFixer.Variables.TextInChapters = options.RetrieveChapterText;
            int optCount = 0;

            if (options.CreateTOC)
            {
                optCount++;
                TOC toc = new TOC();
                toc.UpdateFile();
                Console.WriteLine("TOC has been created");
            }

            if (optCount == 0)
                Console.WriteLine("No Options Selected, see help\n\n\n" + options.GetUsage());
        }
开发者ID:andresperezpayeras,项目名称:epubfixer,代码行数:26,代码来源:Program.cs

示例5: Main

        private static void Main(string[] args)
        {
            string invokedVerb = null;
            object invokedVerbInstance = null;

            var options = new Options();
            TaskFunctionality taskManager = new TaskFunctionality();

            if (!CommandLine.Parser.Default.ParseArguments(args, options,
                (verb, subOptions) =>
                {
                    invokedVerb = verb;
                    invokedVerbInstance = subOptions;
                }))
            {
                options.GetUsage(invokedVerb);
            }
            if (invokedVerbInstance != null)
            {
                if (invokedVerb == "add")
                {
                    var addSubOptions = (AddSubOptions) invokedVerbInstance;
                    taskManager.Add(addSubOptions.AddMessage, addSubOptions.AddDescription,addSubOptions.AddDate, addSubOptions.AddDuDate, addSubOptions.GetFile);
                    return;
                }

                if (invokedVerb == "update")
                {
                    var updateSubOptions = (UpdateSubOptions) invokedVerbInstance;
                    if(updateSubOptions.UpdateDate==null)
                        taskManager.UpdateStatus(updateSubOptions.GetId, updateSubOptions.GetStatus, updateSubOptions.GetFileName);
                    else taskManager.UpdateDate(updateSubOptions.GetId, updateSubOptions.UpdateDate, updateSubOptions.GetFileName);
                    Console.Write("Update finished successfully");
                    return;
                }

                if (invokedVerb == "get")
                {
                    var getSubOptions = (GetSubOptions) invokedVerbInstance;
                    if(getSubOptions.GetAscedingType == null && getSubOptions.GetDescendingType==null)
                        taskManager.GetTask(getSubOptions.GetFile);
                    else if(getSubOptions.GetAscedingType == null)
                        taskManager.SortDescending(getSubOptions.GetFile, getSubOptions.GetDescendingType);
                    else
                    {
                        taskManager.SortAscending(getSubOptions.GetFile, getSubOptions.GetAscedingType);
                    }
                    return;
                }
                if (invokedVerb == "search")
                {
                    var searchSubOptions = (SearchSubOptions)invokedVerbInstance;
                    taskManager.Search(searchSubOptions.GetWord,searchSubOptions.GetFile);
                }
             }
        }
开发者ID:florentinac,项目名称:TaskManager,代码行数:56,代码来源:TaskManagerMain.cs

示例6: Main

 public static void Main(string[] args)
 {
     var options = new Options();
     if (Parser.Default.ParseArguments(args, options))
     {
         StartServer(options);
     }
     else
     {
         // Display the default usage information
         Console.WriteLine(options.GetUsage());
     }
 }
开发者ID:sewa312,项目名称:hpcourse,代码行数:13,代码来源:Program.cs

示例7: Main

        static void Main(string[] args)
        {
            var options = new Options();
            if (!CommandLine.Parser.Default.ParseArguments(args, options))

            {
                Console.WriteLine(options.GetUsage());

                return;
            }

            // Connect to the desired Team Foundation Server
            TfsTeamProjectCollection tfsServer = new TfsTeamProjectCollection(new Uri(options.ServerNameUrl));

            // Authenticate with the Team Foundation Server
            tfsServer.Authenticate();

            // Get a reference to a Work Item Store
            var workItemStore = new WorkItemStore(tfsServer);

            var project = GetProjectByName(workItemStore, options.ProjectName);

            if (project == null)
            {
                Console.WriteLine($"Could not find project '{options.ProjectName}'");
                return;
            }

            var query = GetWorkItemQueryByName(workItemStore, project, options.QueryPath);

            if (query == null)
            {
                Console.WriteLine($"Could not find query '{options.QueryPath}' in project '{options.ProjectName}'");
                return;
            }

            var queryText = query.QueryText.Replace("@project", $"'{project.Name}'");

            Console.WriteLine($"Executing query '{options.QueryPath}' with text '{queryText}'");

            var count = workItemStore.QueryCount(queryText);

            Console.WriteLine($"Exporting {count} work items");

            var workItems = workItemStore.Query(queryText);

            foreach (WorkItem workItem in workItems)
            {
                StoreAttachments(workItem, options.OutputPath);
            }
        }
开发者ID:bwegman,项目名称:TFSDownloadAttachments,代码行数:51,代码来源:Program.cs

示例8: Main

        static void Main(string[] args)
        {
            try
             {
            var options = new Options();
            ICommandLineParser parser = new CommandLineParser();
            if (parser.ParseArguments(args, options))
            {
               SiebelDB sdb = new SiebelDB(options);
               var atts = sdb.GetDefectAttachments(options.Number);

               if (atts != null && atts.Count() > 0)
               {
                  Console.WriteLine(@"@echo off");
                  Console.WriteLine();
                  foreach (var att in atts)
                  {
                     Console.WriteLine(@"echo -- Copying {0}", att.FileNameFull);
                     Console.WriteLine(@"copy ""{0}S_DEFECT_ATT_{1}_{2}.SAF"" ""{3}.saf"" /z",
                         options.RemotePath, att.RowID, att.Revision, att.FileNameFull);
                     Console.WriteLine(@"sseunzip.exe 2>nul ""{0}.saf"" ""{0}""",
                         att.FileNameFull);
                     Console.WriteLine(@"echo -- Done {0}", att.FileNameFull);
                     Console.WriteLine();
                  }
               }
               else
               {
                  Console.Error.Write("No such defects or no attachments.");
               }
            }
            else
            {
               Console.Error.Write(options.GetUsage());
            }

             }
             catch (System.Exception ex)
             {
            Console.WriteLine(ex.Message);
             }
        }
开发者ID:dreamiurg,项目名称:gad,代码行数:42,代码来源:Program.cs

示例9: run

        public void run(string [] args)
        {
            var options = new Options();
            if (!Parser.Default.ParseArguments(args, options))
            {
                logger.Error("Invalid Arguments.");
                logger.Error(options.GetUsage());
                Environment.Exit(1);
            }

            if (options.VerifyMode)
            {
                logger.Info("Running in verify mode");
                _verifyStripeSubscriptions.Verify();
                Environment.Exit(0);
            }

            LoadAndImportFile();
            CreateStripePlansAndSubscriptions();
        }
开发者ID:plachmann,项目名称:crds-angular,代码行数:20,代码来源:Program.cs

示例10: Main

        static void Main(string[] args)
        {
            //  CreateCameraCaptureの引数はカメラのIndex(通常は0から始まる)
            using (var capture = Cv.CreateCameraCapture(0))
            {
                Console.WriteLine("Hit any key to quit");

                /*
                double fps=12.0;
                int interval=1;
                double zoom=1.0;
                string OutputFile;
                */

                double fps ;
                int interval ;
                double zoom=1.0 ;
                string OutputFile;

                var opts = new Options();
                 bool isSuccess = CommandLine.Parser.Default.ParseArguments(args, opts);

                if(!isSuccess)
                {
                    opts.GetUsage();
                    Console.WriteLine(Environment.GetCommandLineArgs()[0] + "  -o Outputfilename(string) -f fps(double) -i CaptureInterval(int)");
                    Environment.Exit(0);
                }

                    fps = opts.fps;
                    interval = opts.interval;
                    zoom = opts.zoom;
                    OutputFile = opts.OutputFile;
                    Console.WriteLine(OutputFile);
                    if (fps > 30 | interval < 0.1)
                    {
                        Console.WriteLine(" :-p");
                        Environment.Exit(1);
                    }

                Int32 codec = 0; // コーデック(AVI)
                IplImage frame = new IplImage();

                /*
                double width = capture.FrameWidth/2;
                double height = capture.FrameHeight/2;

                //double width = 640, height = 240;
                Cv.SetCaptureProperty(capture, CaptureProperty.FrameWidth, width);
                Cv.SetCaptureProperty(capture, CaptureProperty.FrameHeight, height);
                CvSize size = new CvSize((int)width, (int)height);
                CvVideoWriter vw = new CvVideoWriter(OutputFile, codec, fps, size, true);
                */

                int width = (int)(Cv.GetCaptureProperty(capture, CaptureProperty.FrameWidth)*zoom);
                int height = (int)(Cv.GetCaptureProperty(capture, CaptureProperty.FrameHeight)*zoom);

                //Cv.SetCaptureProperty(capture, CaptureProperty.FrameWidth, width);
                //Cv.SetCaptureProperty(capture, CaptureProperty.FrameWidth, height);
                //Bitmap bitmap = new Bitmap(width, height);

                CvSize size = new CvSize(width, height);
                CvVideoWriter vw = new CvVideoWriter(OutputFile, codec, fps, size, true);

                //CvFont font = new CvFont(FontFace.HersheyTriplex, 0.7, 0.7);
                //(FontFace.HersheyPlain, 1.0, 1.0, 0, 2);

                double fontSize;
                if(width>600)
                     fontSize=1.0;
                else
                     fontSize=0.5;

                CvFont font = new CvFont(FontFace.HersheyPlain,fontSize,fontSize);

                //  何かキーを押すまでは、Webカメラの画像を表示し続ける
                while (Cv.WaitKey(1) == -1)
                {
                    System.Threading.Thread.Sleep(1000*interval);
                    //  カメラからフレームを取得
                    frame = Cv.QueryFrame(capture);
                    string str = DateTime.Now.ToString();

                    //  Window「Capture」を作って、Webカメラの画像を表示
                    if (frame != null)
                    {
                        frame.PutText(str, new CvPoint(10, 20), font, new CvColor(200,100,50));
                        Cv.ShowImage("Timelapse", frame);
                        //frame.SaveImage("result.bmp");
                       //bitmap = BitmapConverter.ToBitmap(frame);
                        //OpenCvSharp.IplImage ipl2 = (OpenCvSharp.IplImage)BitmapConverter.ToIplImage(bitmap);
                        vw.WriteFrame(frame);
                        // vw.WriteFrame(ipl2);
                        frame.Dispose();
                    }
                }

                Cv.DestroyWindow("Capture");
                vw.Dispose();
            }
//.........这里部分代码省略.........
开发者ID:HyperInfo,项目名称:TimeLaps,代码行数:101,代码来源:Program.cs

示例11: Program

        private Program(String[] args)
        {
            _options = new Options();
            if (!CommandLine.Parser.Default.ParseArguments(args, _options))
            {
                throw new Exception("Unexpected command line.");
            }

            var iconfig = _options.ParseInputOption();
            if (iconfig == Options.InputConfiguration.Invalid)
            {
                Console.WriteLine("The input source must be a SQL Profiler capture file or a live SQL connection.");
                Console.WriteLine("\tTo use an input file, specify the TRC file with -f");
                Console.WriteLine(
                    "\tTo use a live connection, specify the SQL connection string with -c and the SQL Profiler configuration with -t");
                Console.WriteLine();
                Console.WriteLine(_options.GetUsage());
                Environment.Exit(-1);
            }

            if (iconfig == Options.InputConfiguration.File)
            {
                // use a file source
                _traceSource = new TraceSource(_options.InputFile);
            }
            else
            {
                // use a SQL connection source
                var csb = new SqlConnectionStringBuilder(_options.SqlConnectionString);
                var conn = csb.IntegratedSecurity
                    ? new SqlConnectionInfo(csb.DataSource)
                    : new SqlConnectionInfo(csb.DataSource, csb.UserID, csb.Password);
                _traceSource = new TraceSource(conn, _options.TdfFile);
            }

        }
开发者ID:jshield,项目名称:sqlperms,代码行数:36,代码来源:Program.cs


注:本文中的Options.GetUsage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。