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


C# Options.Parse方法代码示例

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


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

示例1: Main

        static void Main(string[] args)
        {
            bool showHelp = false;
            IEnumerable<string> assemblies = Enumerable.Empty<string>();

            var optionSet = new Options() {
                { "h|help", "show this message and exit", x => showHelp = x != null},
                { "a=|assemblies=", "comma-seperated list of the names of assemblies to test", x => assemblies = x.Split(',') }
            };

            try
            {
                optionSet.Parse(args);
                if (showHelp)
                {
                    ShowHelp(optionSet);
                    return;
                }
                if (!assemblies.Any())
                {
                    throw new InvalidOperationException("No assemblies specified.");
                }
            }
            catch (InvalidOperationException exception)
            {
                Console.Write(string.Format("{0}: ", AppDomain.CurrentDomain.FriendlyName));
                Console.WriteLine(exception.Message);
                Console.WriteLine("Try {0} --help for more information", AppDomain.CurrentDomain.FriendlyName);
                return;
            }
            assemblies.ForEach(x => new PrintFailuresOutputter().Output(x, SimpleRunner.RunAllInAssembly(x)));
        }
开发者ID:peteraritchie,项目名称:Simple.Testing,代码行数:32,代码来源:Program.cs

示例2: Run

 public int Run(Cli console,string[] args)
 {
     string source = null;
     string local  = null;
     Options opts = new Options("Downloads a specified file")
     {
         new Option((string s)=>source =s,"address","The source address of the file to be downloaded"),
         new Option((string l)=>local =l,"localFile","Save the remote file as this name"),
     };
     opts.Parse(args);
     if(source == null)
     {
         return 1;
     }
     using(var client = new System.Net.WebClient())
     {
         if(local !=null)
         {
             client.DownloadFile(new Uri(source),local);
         }
         else
         {
             var result = client.DownloadString(new Uri(source));
             console.Out.WriteLine(result);
         }
     }
     return 0;
 }
开发者ID:jmaxxz,项目名称:Jmaxxz.Console,代码行数:28,代码来源:Download.cs

示例3: Main

        static void Main(string[] args)
        {
            Console.WriteLine("Stitch Command Line Compiler {0}", Assembly.GetExecutingAssembly().GetName().Version.ToString());
            Console.WriteLine("Copyright (C) 2011 Nathan Palmer");
            Console.WriteLine("http://github.com/nathanpalmer/stitch-aspnet");
            Console.WriteLine();

            try
            {
                var options = new Options();
                var configuration = new Settings();
                options.Add("r=|root=", "Root path (default is working directory)", v => configuration.Root = v);
                options.Add("p=|paths=", "Comma delimited list of paths that should be compiled", v => configuration.Paths = v.Split(','));
                options.Add("d=|dep=", "Comma delimited list of dependencies that should be included", v => configuration.Dependencies = v.Split(','));
                options.Add("i=|identifier=", "Identifier to use for including other files (default is require)", v => configuration.Identifier = v);
                options.Add("c=|compilers=", "Comma delimited list of compilers to use (default is CoffeeScriptCompiler, JavaScriptCompiler)", v => configuration.Compilers = v.Split(',').Select(compiler => (ICompile) Activator.CreateInstance(Type.GetType("Stitch.Compilers." + compiler + ", Stitch.Core"))).ToArray());

                if (args.Length == 0)
                {
                    ShowHelp(options, "No arguments specified.");
                }
                else
                {
                    var extra = options.Parse(args).ToArray();
                    if (extra.Length > 1)
                    {
                        Console.WriteLine("The following arguments did not parse.\r\n\r\n" + string.Join(",", extra));
                    }
                    else if (extra.Length == 1)
                    {
                        var file = new FileInfo(extra[0]);
                        if (file.Exists)
                        {
                            file.Delete();
                        }

                        Console.WriteLine("Generating {0}", file.Name);

                        var package = new Package(
                            configuration.Root,
                            configuration.Paths,
                            configuration.Dependencies,
                            configuration.Identifier ?? "require",
                            configuration.Compilers);

                        File.WriteAllText(file.FullName, package.Compile());
                    }
                    else
                    {
                        ShowHelp(options, "You must specify a destination.");
                        return;
                    }

                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Fatal Exception: " + ex.ToString());
            }
        }
开发者ID:nathanpalmer,项目名称:stitch-aspnet,代码行数:60,代码来源:Program.cs

示例4: Run

 public int Run(Cli console,string[] args)
 {
     int time =0;
     Options opts = new Options("Waits for a period of time")
     {
         new Option((int t)=>time =t,"WaitTime","Time in milliseconds to sleep for")
     };
     opts.Parse(args);
     Thread.Sleep(time);
     return 0;
 }
开发者ID:michaelgwelch,项目名称:Jmaxxz.Console,代码行数:11,代码来源:Sleep.cs

示例5: SimpleDataParameter

 public void SimpleDataParameter()
 {
     var opt =0;
     Options ops = new Options
     {
         new Option(new string[]{}, (int x)=>opt = x, "value",""),
     };
     
     ops.Parse(new []{"1"});
     
     Assert.AreEqual(1,opt, "Data was not initialized correctly");
 }
开发者ID:digitalhermit,项目名称:Jmaxxz.Console,代码行数:12,代码来源:OptionsTest.cs

示例6: Main

        //this is the driver method that I am using to test the options class as it is being written, needs to be replaced with a good unit test suite
        public static void Main (string[] args)
        {
            var opt = new Option(new []{"h","talk"},()=>Console.WriteLine("hello world"),"Prints greeting");
            var opt2 = new Option(new []{"a","add3"},(int i)=>Console.WriteLine(i+3),"value","Adds 3 to value");
            var opt3 = new Option(new []{"x","so","dsdsdsajdlasdsjkdjask","ThisIsAnotherOne","YetAnotherOne","ItGoesOn", "d"},()=>Console.WriteLine("Goodbye World"),"This is a test of word wrapping if everything goes ok this shoudl wrap around on to several lines while maintaining an offset for other text. If this is not wrapped correctly something is wrong...very wrong.");

            Options opts = new Options("This is not the real options for this command so do not try them.")
            {
                opt,
                opt2,
                new Option((string x) => Console.WriteLine(x),"hostname","The hostname of the server"),
                opt3,
            };
            opts.PrintUsage();
            opt.Invoke("h",null);
            opt2.Invoke("a","10000");
            opts.Parse(new []{"--h","--add3","6"});
            opts.Parse(new []{"-ha","7"});
            opts.Parse(new []{"-a","this is fail"});
            Console.ReadLine();
        }
开发者ID:digitalhermit,项目名称:Jmaxxz.Console,代码行数:22,代码来源:Main.cs

示例7: TwoDataParameters

 public void TwoDataParameters()
 {
     var opt =0;
     var opt2 = 0.0;
     Options ops = new Options
     {
         new Option(new string[]{}, (int x)=>opt = x,"value", ""),
         new Option(new string[]{}, (double x)=>opt2 = x, "value",""),
     };
     
     ops.Parse(new []{"1", "2.0"});
     
     Assert.AreEqual(1,opt, "Opt was not initialized correctly");
     Assert.AreEqual(2.0, opt2, "Opt2 was not handled correctly");
 }
开发者ID:digitalhermit,项目名称:Jmaxxz.Console,代码行数:15,代码来源:OptionsTest.cs

示例8: SimpleOptionRan

 public void SimpleOptionRan()
 {
     var opt1Ran =false;
     var opt2Ran =false;
     Options ops = new Options
     {
         new Option(new []{"r","run"}, ()=>opt1Ran=true, ""),
         new Option(new []{"d","dont"}, ()=>opt2Ran=true, ""),
     };
     
     ops.Parse(new []{"-r"});
     
     Assert.IsTrue(opt1Ran, "Option1 did not run");
     Assert.IsFalse(opt2Ran, "Option2 ran");
 }
开发者ID:digitalhermit,项目名称:Jmaxxz.Console,代码行数:15,代码来源:OptionsTest.cs

示例9: OptionDoesNotRunTwice

 public void OptionDoesNotRunTwice()
 {
     int opt1Ran =0;
     var opt2Ran =false;
     Options ops = new Options
     {
         new Option(new []{"r","run"}, ()=>opt1Ran++, ""),
         new Option(new []{"d","dont"}, ()=>opt2Ran=true, ""),
     };
     
     ops.Parse(new []{"-r","-r","--run"});
     
     Assert.AreEqual(1,opt1Ran, "Option1 did not run once and only once");
     Assert.IsFalse(opt2Ran, "Option2 ran");
 }
开发者ID:digitalhermit,项目名称:Jmaxxz.Console,代码行数:15,代码来源:OptionsTest.cs

示例10: Main

        public static int Main(string[] args)
        {
            string command = "";
            string parameters = "";
            string name = "";
            string dir = "";
            int options = 16;

            Options opts = new Options
            {
                new Option(new string[]{}, x=>name=x),
                new Option(new string[]{}, x=>command=x),
                new Option(new []{"p","params"}, x=>parameters=x),
                new Option(new []{"d","startdir"}, x=>dir=x),
                new Option(new []{"o","output"}, ()=>options|=8),
                new Option(new []{"c","exit"}, ()=>options|=2),
                new Option(new []{"u","unicode"}, ()=>options|=64),
                new Option(new []{"a","prompt"}, ()=>options|=4),
            };
            opts.Parse (args);

            if (command == "" || name == "")
            {
                Console.WriteLine ("Usage: VSAddTool.exe <Tool Name> <Command> [-p <command parameters>][-d <start in directory>]");
                return 1;
            }

            using (var exToolKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\VisualStudio\10.0\External Tools",true))
            {
                int numOfTools = (int)exToolKey.GetValue ("ToolNumKeys");

                string pathVal = "ToolCmd" + numOfTools;
                string argsVal = "ToolArg" + numOfTools;
                string dirVal = "ToolDir" + numOfTools;
                string nameVal = "ToolTitle" + numOfTools;
                string optsVal = "ToolOpt" + numOfTools;

                exToolKey.SetValue (pathVal, command, RegistryValueKind.String);
                exToolKey.SetValue (argsVal, parameters, RegistryValueKind.String);
                exToolKey.SetValue (nameVal, name, RegistryValueKind.String);
                exToolKey.SetValue (dirVal, dir, RegistryValueKind.String);
                exToolKey.SetValue (optsVal, options, RegistryValueKind.DWord);
                exToolKey.SetValue ("ToolNumKeys", numOfTools + 1, RegistryValueKind.DWord);
            }

            return 0;
        }
开发者ID:jmaxxz,项目名称:VsAddTool,代码行数:47,代码来源:Main.cs

示例11: Main

        static void Main(string[] args)
        {
            var options = new Options(args);
            if (!options.Parse())
                Environment.Exit(1);

            if (string.IsNullOrWhiteSpace(options.DestinationFile))
            {
                options.DestinationFile = options.SourceFile;
                Console.Write("No destination file specified. Will save to source file");
            }

            if (options.Kind == TransformType.Merge)
                XmlTransformer.MergeFile(options.SourceFile, options.TransformFile, options.DestinationFile);
            else
                XmlTransformer.TransformXml(options.SourceFile, options.TransformFile, options.DestinationFile);

            Environment.Exit(0);
        }
开发者ID:micahlmartin,项目名称:XmlTransformer,代码行数:19,代码来源:Program.cs

示例12: Should_parse_options

        public void Should_parse_options()
        {
            string arg1 = null, arg2 = null, arg3 = null;
            var o = new Options{
                { "arg1", "Argument 1", v => arg1 = v },
                { "arg2", "Argument 2", v => arg2 = v },
                { "arg3", "Argument 3", v => arg3 = v }
            };
            bool malformedArgumentActionCalled = false;
            o.MalformedArgumentAction = delegate(string v) {
                Assert.That(v, Is.EqualTo("malformed"));
                malformedArgumentActionCalled = true;
            };
            IDictionary<string, string> unmatchedParameters = o.Parse(new[]{ "--arg1=val1", "-arg2=val2", "/arg3:val3", "malformed", "-unmatched=val4" });

            Assert.That(arg1, Is.EqualTo("val1"));
            Assert.That(arg2, Is.EqualTo("val2"));
            Assert.That(arg3, Is.EqualTo("val3"));
            Assert.That(unmatchedParameters.Count, Is.EqualTo(1));
            Assert.That(unmatchedParameters["unmatched"], Is.EqualTo("val4"));
            Assert.That(malformedArgumentActionCalled, Is.True);
        }
开发者ID:smartinz,项目名称:randomhacking,代码行数:22,代码来源:OptionsTest.cs

示例13: Main

        static int Main(string[] args)
        {
            try
            {
                var directories = new List<string>();
                var files = new List<string>();

                var programCommand = Command.None;
                Func<CompositionContractInfo, bool> contractPredicate = c => false;
                Func<CompositionInfo, PartDefinitionInfo, bool> partPredicate = (ci, p) => false;
                var verbose = false;
                var whitelist = new RejectionWhitelist();

                var opts = new Options();
                
                opts.Add<string>("dir", @"C:\MyApp\Parts", "Specify directories to search for parts.",
                    d => directories.Add(d));
                opts.Add<string>("file", "MyParts.dll", "Specify assemblies to search for parts.",
                    f => files.Add(f));
                opts.AddSwitch("verbose", "Print verbose information on each part.",
                    () => verbose = true);

                var programCommandGroup = new ExclusiveGroup();

                opts.Add<string>("type", "MyNamespace.MyType", "Print details of the given part type.", t => {
                        programCommand = Command.PrintParts;
                        partPredicate = AddToPredicate(partPredicate, (ci, p) => p == ci.GetPartDefinitionInfo(t));
                    },
                    programCommandGroup);

                opts.Add<string>("importers", "MyContract", "List importers of the given contract.", i => {
                        programCommand = Command.PrintParts;
                        partPredicate = AddToPredicate(partPredicate, (ci, p) => p.ImportsContract(i));
                    },
                    programCommandGroup);

                opts.Add<string>("exporters", "MyContract", "List exporters of the given contract.", e => {
                        programCommand = Command.PrintParts;
                        partPredicate = AddToPredicate(partPredicate, (ci, p) => p.ExportsContract(e));
                    },
                    programCommandGroup);

                opts.AddSwitch("rejected", "List all rejected parts.", () => {
                        programCommand = Command.PrintParts;
                        partPredicate = AddToPredicate(partPredicate, (ci, p) => p.IsRejected);
                    },
                    programCommandGroup);

                opts.AddSwitch("causes", "List root causes - parts with errors not related to the rejection of other parts.", () => {
                        programCommand = Command.PrintParts;
                        partPredicate = AddToPredicate(partPredicate, (ci, p) => p.IsPrimaryRejection);
                    },
                    programCommandGroup);

                opts.Add<string>("whitelist", "RejectionWhitelist.txt", "Specify parts that may be validly rejected; requres the /rejected or /causes commands.",
                    w => whitelist = new RejectionWhitelist(w));

                opts.AddSwitch("parts", "List all parts found in the source assemblies.", () => {
                        programCommand = Command.PrintParts;
                        partPredicate = AddToPredicate(partPredicate, (ci, p) => true);
                    },
                    programCommandGroup);

                opts.AddSwitch("?", "Print usage.",
                    () => programCommand = Command.PrintUsage, programCommandGroup);

                var contractsSubgroup = new InclusiveSubroup(programCommandGroup);
                opts.AddSwitch("imports", "Find imported contracts.", () => {
                        programCommand = Command.PrintContracts;
                        contractPredicate = AddToPredicate(contractPredicate, c => c.Importers.Any());
                    },
                    contractsSubgroup);

                opts.AddSwitch("exports", "Find exported contracts.", () => {
                        programCommand = Command.PrintContracts;
                        contractPredicate = AddToPredicate(contractPredicate, c => c.Exporters.Any());
                    },
                    contractsSubgroup);

                opts.Parse(args);

                return Run(directories, files, programCommand, contractPredicate, partPredicate, verbose, whitelist, opts);
            }
            catch (Exception ex)
            {
                Console.Write("Error: ");
                Console.WriteLine(ex.Message);
                return 1;
            }
        }
开发者ID:ibratoev,项目名称:MEF.NET35,代码行数:90,代码来源:Program.cs

示例14: Main

        static void Main(string[] args) {
            var workerCount = 50;
            var workerPrefix = "w";
            var faultInterval = 100000;
            var sleepInterval = 50;
            var port = new Random().Next(1000, 30000);
            var host = "127.0.0.1";
            var runServer = true;
            var poolSize = ConnectionPool.DefaultMaxConnections;
            var maxGlobalIterations = 100000;
            var options = new Options {
                {"w=", "Workers (default: 50)", x => workerCount = int.Parse(x)},
                {"P=", "Worker Prefix (default: w)", x => workerPrefix = x},
                {"S=", "Worker Pool Size (default: 100)", x => poolSize = int.Parse(x)},
                {"f=", "Fault Interval (default: every 100000)", x => faultInterval = int.Parse(x)},
                {"s=", "Sleep Interval (default: 50ms)", x => sleepInterval = int.Parse(x)},
                {"X", "Disable Server (enabled by default)", x => runServer = x == null},
                {"p=", "Server port (default: random)", x=> port = int.Parse(x)},
                {"h=", "Server host (default: 127.0.0.1)", x=> host = x},
                {"m=", "Max iterations before a new pool is created (default: 100000)", x => maxGlobalIterations = int.Parse(x)},
            };
            options.Parse(args).ToArray();
            var tasks = new List<Task>();
            if(runServer) {
                Console.WriteLine("Server: {0}:{1}", host, port);
                Console.WriteLine("starting server");
                tasks.Add(RunServer(host, port, faultInterval));
            }

            var workers = new List<WorkerInfo>(workerCount);
            if(workerCount > 0) {
                Console.WriteLine("Starting {0} workers with a {1}ms sleep interval", workerCount, sleepInterval);
                var startSignal = new ManualResetEvent(false);
                var readySignals = new List<WaitHandle>();
                var pool = ConnectionPool.Create(host, port);
                pool.MaxConnections = poolSize;
                var poolUseCount = 0;
                for(var i = 0; i < workerCount; i++) {
                    var ready = new ManualResetEvent(false);
                    readySignals.Add(ready);
                    var workerInfo = new WorkerInfo { Id = workerPrefix + i.ToString("000"), Status = WorkerStatus.PreClient };
                    workers.Add(workerInfo);
                    workerInfo.Task = Task.Factory.StartNew(() => {
                        //Thread.CurrentThread.Name = workerInfo.Id;
                        var myPool = pool;
                        var r = new Random();
                        ready.Set();
                        Console.WriteLine("{0}: ready", workerInfo.Id);
                        startSignal.WaitOne();
                        var oldPoolUse = 0;
                        var maxOldPoolIterations = r.Next(10, 100);
                        while(true) {
                            try {
                                workerInfo.Status = WorkerStatus.CheckingPool;
                                var globalUseCount = Interlocked.Increment(ref poolUseCount);
                                if(globalUseCount > maxGlobalIterations) {
                                    lock(pool) {
                                        if(pool == myPool) {
                                            Console.WriteLine("{0}: creating new pool", workerInfo.Id);
                                            Interlocked.Exchange(ref poolUseCount, 0);
                                            pool = ConnectionPool.Create(host, port);
                                            pool.MaxConnections = poolSize;
                                            myPool = pool;
                                            oldPoolUse = 0;
                                        }
                                    }
                                } else if(myPool != pool) {
                                    oldPoolUse++;
                                    if(oldPoolUse > maxOldPoolIterations) {
                                        myPool = pool;
                                        oldPoolUse = 0;
                                    }
                                }
                                using(var client = new ClacksClient(myPool)) {
                                    for(var k = 0; k < 50; k++) {
                                        workerInfo.Status = WorkerStatus.GeneratingPayload;
                                        var payload = new StringBuilder();
                                        payload.AppendFormat("id:{0},data:", workerInfo.Id);
                                        var size = r.Next(2, 100);
                                        for(var l = 0; l < size; l++) {
                                            payload.Append(Guid.NewGuid().ToString());
                                        }
                                        var data = payload.ToString();
                                        var bytes = Encoding.ASCII.GetBytes(data);
                                        workerInfo.Status = WorkerStatus.MakingRequest;
                                        var response = client.Exec(new Client.Request("BIN").WithArgument(workerInfo.Id).WithData(bytes).ExpectData("OK"));
                                        workerInfo.Status = WorkerStatus.CheckingResponse;
                                        if(response.Status != "OK") {
                                            throw new Exception("wrong status: " + response.Status);
                                        }
                                        if(response.Arguments.Length != 1) {
                                            throw new Exception("wrong arg length: " + response.Arguments.Length);
                                        }
                                        var responseData = Encoding.ASCII.GetString(response.Data);
                                        if(data != responseData) {
                                            lock(workers) {
                                                Console.WriteLine("bad data response for worker {0}", workerInfo.Id);
                                                Console.WriteLine("sent:     {0}", data);
                                                Console.WriteLine("received: {0}", responseData);
                                            }
//.........这里部分代码省略.........
开发者ID:MindTouch,项目名称:MindTouch.Clacks,代码行数:101,代码来源:Program.cs

示例15: Main

        //--- Class Methods ---
        static int Main(string[] args)
        {
            string dbusername = "root", dbname = "wikidb", dbserver = "localhost", dbpassword = null, updateDLL = null, targetVersion = null;
            int dbport = 3306, exit = 0;
            bool showHelp = false, dryrun = false, verbose = false;

            // set command line options
            var options = new Options() {
                { "p=|dbpassword=", "Database password", p => dbpassword = p},
                { "v=|version=", "Target Version", v => targetVersion = v},
                { "u=|dbusername=", "Database user name (default: root)", u => dbusername = u},
                { "d=|dbname=", "Database name (default: wikidb)", p => dbname = p},
                { "s=|dbserver=", "Database server (default: localhost)", s => dbserver = s},
                { "n=|port=", "Database port (default: 3306)", n => {dbport = Int32.Parse(n);}},
                { "i|info", "Display verbose information (default: false)", i => {verbose = true;}},
                { "f|dryrun", "Just display the methods that will be called, do not execute any of them. (default: false)", f => { dryrun = verbose = true;} },
                { "h|?|help", "show help text", h => { verbose = true; }},
            };
            if(args == null || args.Length == 0) {
                showHelp = true;
            } else {
                try {
                    var trailingOptions = options.Parse(args).ToArray();

                    // if there are more trailing arguments display help
                    if(trailingOptions.Length != 1) {
                        showHelp = true;
                    } else {
                        updateDLL = Path.GetFullPath(trailingOptions.First());
                    }
                } catch(InvalidOperationException) {
                    exit = -3;
                    Console.Error.WriteLine("Invalid arguments");
                    showHelp = true;
                }
            }
            if(!showHelp) {

                // Check Arguments
                CheckArg(updateDLL, "No DLL file was specified");
                CheckArg(dbpassword, "No Database password specified");
                CheckArg(targetVersion, "No version specified");

                // Begin Parsing DLL
                var dllAssembly = Assembly.LoadFile(updateDLL);

                // Instatiate Mysql Upgrade class
                MysqlDataUpdater mysqlSchemaUpdater = null;
                try {
                    mysqlSchemaUpdater = new MysqlDataUpdater(dbserver, dbport, dbname, dbusername, dbpassword, targetVersion);
                } catch(VersionInfoException) {
                    PrintErrorAndExit("You entered an incorrect version numner.");
                }
                mysqlSchemaUpdater.LoadMethods(dllAssembly);
                var methods = mysqlSchemaUpdater.GetMethods();

                // Execute each method
                foreach(var method in methods) {
                    if(verbose) {
                        Console.WriteLine(String.Format("Executing Method: {0}", method));
                    }
                    if(!dryrun) {
                        try { mysqlSchemaUpdater.TestConnection(); }
                        catch (Exception) {
                            System.Threading.Thread.Sleep(5000);
                            mysqlSchemaUpdater.TestConnection();
                        }
                        mysqlSchemaUpdater.ExecuteMethod(method);
                    }
                }
            }
            else {
                ShowHelp(options);
            }
            return exit;
        }
开发者ID:sdether,项目名称:DReAM,代码行数:77,代码来源:updateDb.cs


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