{"id":1281,"date":"2012-02-09T22:06:37","date_gmt":"2012-02-09T13:06:37","guid":{"rendered":"http:\/\/nanoappli.com\/blog\/?p=1281"},"modified":"2012-02-09T22:06:37","modified_gmt":"2012-02-09T13:06:37","slug":"c%e3%82%b3%e3%83%9e%e3%83%b3%e3%83%89%e3%83%a9%e3%82%a4%e3%83%b3%e5%bc%95%e6%95%b0%e3%81%ae%e8%a7%a3%e6%9e%90%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa-wingetopt","status":"publish","type":"post","link":"http:\/\/nanoappli.com\/blog\/archives\/1281","title":{"rendered":"[C#]\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u5f15\u6570\u306e\u89e3\u6790\u30e9\u30a4\u30d6\u30e9\u30ea WinGetOpt"},"content":{"rendered":"<p>\n<br \/>\nC#\u3067\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f5c\u6210\u3057\u305f\u969b\u306e\u3001\u8d77\u52d5\u5f15\u6570\u3092\u89e3\u6790\u3059\u308b\u305f\u3081\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f5c\u308a\u307e\u3057\u305f\u3002<br \/>\n<br \/>\n<br \/>\n<h2>\u51fa\u6765\u308b\u3053\u3068<\/h2>\n\u4ee5\u4e0b\u306e\u5f62\u5f0f\u3067\u30d1\u30e9\u30e1\u30fc\u30bf\u6307\u5b9a\u3055\u308c\u305f\u5f15\u6570\u3092\u89e3\u6790\u3067\u304d\u307e\u3059<br \/>\n<br \/>\n1:key,value\u306e\u6307\u5b9a\u304c\u53ef\u80fd<br \/>\n\u3000\u3000\u4f8b: example.exe \/key1 value1 \/key2 value2<br \/>\n<br \/>\n2:value\u7121\u3057\u3067\u3001\u30ad\u30fc\u3060\u3051\u6307\u5b9a\u3059\u308b\u3053\u3068\u3082\u53ef\u80fd(\u30b9\u30a4\u30c3\u30c1\u30fb\u30d5\u30e9\u30b0\u7b49)<br \/>\n\u3000\u3000\u4f8b: example.exe \/verbose<br \/>\n<br \/>\n3:\u666e\u901a\u306b\u5024\u3060\u3051\u6307\u5b9a\u3059\u308b\u3053\u3068\u3082\u3082\u3061\u308d\u3093\u53ef\u80fd<br \/>\n\u3000\u3000\u4f8b: example.exe c:\\out.txt<br \/>\n<br \/>\n4:\u3082\u3061\u308d\u3093\u4e0a\u8a18\u5168\u90e8\u3092\u7d44\u307f\u5408\u308f\u305b\u308b\u3053\u3068\u3082\u53ef\u80fd<br \/>\n\u3000\u3000\u4f8b: getOrder.exe \/MarchantId MID001 \/MarketplaceId A1XXX \/verbose c:\\orderList.txt<br \/>\n<br \/>\n<br \/>\n<h2>\u30b5\u30f3\u30d7\u30eb<\/h2>\n\u3053\u306e\u624b\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f7f\u3046\u4eba\u306f\u3001\u4ed5\u69d8\u8aac\u660e\u306e\u6587\u7ae0\u3088\u308a\u3001\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u898b\u305f\u65b9\u304c\u901f\u3044\u3068\u601d\u3046\u306e\u3067\u3001\u3044\u304d\u306a\u308a\u30b5\u30f3\u30d7\u30eb\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u63d0\u793a\u3057\u307e\u3059\u3002\u30d7\u30ed\u30b0\u30e9\u30e0\u4e2d\u306eWinGetOpt.Options, WinGetOpt.CommandLine, WinGetOpt.OptionParser\u306e3\u3064\u304c\u3001\u4eca\u56de\u4f5c\u6210\u3057\u305f\u30af\u30e9\u30b9\u3067\u3059\u3002<br \/>\n<br \/>\n<pre lang=\"x\">\n    using WinGetOpt;\n    public static void Main( String[] args ) {\n        \/\/---------------------\n        \/\/ \u30c6\u30b9\u30c8\u7528\u30d1\u30e9\u30e1\u30fc\u30bf\n        \/\/---------------------\n        String [] test = { \"\/secret_key\",   \"SEC_AAAAA\",\n                           \"\/access_key\",   \"ACC_AAAAA\",\n                           \"\/multi_key\",    \"value1\",\n                           \"\/multi_key\",    \"value2\",\n                           \"\/verbose\",\n                           \"\/nodefined_key\",\"valueZ\",\n                           \"c:\\\\outfileName.txt\"\n                         };\n\n        \/\/------------------------------------\n        \/\/ \u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u89e3\u6790\u3059\u308b\n        \/\/------------------------------------\n        CommandLine cl = getParam( test );\n\n    \n        \/\/------------------------------------\n        \/\/ \u89e3\u6790\u5f8c\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u51fa\u529b\u3059\u308b\n        \/\/------------------------------------\n\n        \/\/ dump\n        Console.WriteLine( \"ToString() :\" + cl.ToString() );\n\n        \/\/ \u6307\u5b9a\u3055\u308c\u305f\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u53d6\u5f97\n        Console.WriteLine( \"secret_key :\" + cl.GetOptionValue( \"secret_key\" ) );\n\n        \/\/ \u5024\u3092\u6301\u305f\u306a\u3044flg\u3082\u6307\u5b9a\u53ef\u80fd\n        if ( cl.HasOption( \"verbose\" ) ) {\n            Console.WriteLine( \"verbose\u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u307e\u3059\" );\n        }\n\n\n        \/\/ \u30aa\u30d7\u30b7\u30e7\u30f3\u30d1\u30e9\u30e1\u30fc\u30bf\u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u308b\u304b\u306e\u30c1\u30a7\u30c3\u30af\n        if ( cl.HasOption( \"entry_point\" ) ) {\n            Console.WriteLine( \"entry_point\u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u307e\u3059\" );\n        } else {\n            Console.WriteLine( \"entry_point\u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093\" );\n        }\n\n        \/\/ \u7279\u5b9a\u306e\u30ad\u30fc\u306b\u5bfe\u3057\u3066\u8907\u6570\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u6307\u5b9a\u3082\u53ef\u80fd\n        foreach ( String value in cl.GetOptionValues( \"multi_key\" ) ) {\n            Console.WriteLine( \"key1 : \" + value );\n        }\n    }\n\n\n    \/\/**********************************************************************************************\n    \/\/\/ <summary>\u8d77\u52d5\u5f15\u6570\u3092\u53d6\u5f97\u3059\u308b\n    \/\/\/ <\/summary>\n    \/\/\/ <param name=\"mws\"><\/param>\n    \/\/**********************************************************************************************\n    private static CommandLine getParam( String[] args ) {\n        Options optdef;\n\n        \/\/---------------------------------------------------------\n        \/\/ \u30aa\u30d7\u30b7\u30e7\u30f3\u306e\u5b9a\u7fa9\u3092\u884c\u3046(optName, hasArg, description)\n        \/\/---------------------------------------------------------\n        optdef = new Options();\n        optdef.AddOption( \"access_key\",  true , \"MWS\u306e\u79d8\u5bc6\u30ad\u30fc\"                );\n        optdef.AddOption( \"secret_key\",  true , \"MWS\u306e\u30a2\u30af\u30bb\u30b9\u30ad\u30fc\"            );\n        optdef.AddOption( \"entry_point\", true , \"\u691c\u7d22\u3092\u884c\u3046\u30b5\u30a4\u30c8\u306eURL\"        );\n        optdef.AddOption( \"multi_key\",   true , \"\u3053\u306e\u30ad\u30fc\u306f\u8907\u6570\u6307\u5b9a\u3067\u304d\u307e\u3059\"   );\n        optdef.AddOption( \"verbose\",     false, \"\u30ed\u30b0\u306e\u8a73\u7d30\u8868\u793a\u3092\u884c\u3046\u304b\u30d5\u30e9\u30b0\" );\n\n        \/\/---------------------------------------------------------\n        \/\/ \u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u89e3\u6790\u3059\u308b\n        \/\/---------------------------------------------------------\n        OptionParser parser = new OptionParser();\n        return parser.parse( optdef, args );\n    }\n\n<\/pre>\n<br \/>\n<h2>\u5b9f\u884c\u7d50\u679c<\/h2>\n<br \/>\n\u898b\u3084\u3059\u304f\u3059\u308b\u305f\u3081\u3001\u4e00\u90e8\u6539\u884c\u3057\u3066\u3044\u307e\u3059<br \/>\n<pre lang=\"x\">\nToString() :param={{key:secret_key value:SEC_AAAAA},\n                   {key:access_key value:ACC_AAAAA}, \n                   {key:multi_key value:{value1,value2,},\n                   {key:verbose value:true},\n                   {key: value:{\/nodefined_key,valueZ,c:\\outfileName.txt,},\n\nsecret_key :SEC_AAAAA\n\nverbose\u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u307e\u3059\n\nentry_point\u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093\n\nkey1 : value1\nkey1 : value2\n<\/pre>\n<br \/>\n\u3061\u306a\u307f\u306b\u3001key(xxx.exe \/key\u306e&#8221;\/key&#8221;\u90e8)\u7121\u3057\u30d1\u30e9\u30e1\u30fc\u30bf\u306f\u3001cl.GetOptionValues(&#8220;&#8221;)\u3067\u53d6\u5f97\u3067\u304d\u307e\u3059\u3002<br \/>\n<br \/>\n<br \/>\n\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9:<br \/>\n<a href='http:\/\/nanoappli.com\/blog\/wp-content\/uploads\/2012\/02\/WinGetOpt.zip'>WinGetOpt.zip<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>C#\u3067\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f5c\u6210\u3057\u305f\u969b\u306e\u3001\u8d77\u52d5\u5f15\u6570\u3092\u89e3\u6790\u3059\u308b\u305f\u3081\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f5c\u308a\u307e\u3057\u305f\u3002 \u51fa\u6765\u308b\u3053\u3068 \u4ee5\u4e0b\u306e\u5f62\u5f0f\u3067\u30d1\u30e9\u30e1\u30fc\u30bf\u6307\u5b9a\u3055\u308c\u305f\u5f15\u6570\u3092\u89e3\u6790\u3067\u304d\u307e\u3059 1:key,value\u306e\u6307\u5b9a\u304c\u53ef\u80fd \u3000\u3000\u4f8b: example.exe \/key1 value1 \/key2 value2 2:value\u7121\u3057\u3067\u3001\u30ad\u30fc\u3060\u3051\u6307\u5b9a\u3059\u308b\u3053\u3068\u3082\u53ef\u80fd(\u30b9\u30a4\u30c3\u30c1\u30fb\u30d5\u30e9\u30b0\u7b49) \u3000\u3000\u4f8b: example.exe \/verbose 3:\u666e\u901a\u306b\u5024\u3060\u3051\u6307\u5b9a\u3059\u308b\u3053\u3068\u3082\u3082\u3061\u308d\u3093\u53ef\u80fd \u3000\u3000\u4f8b: example.exe c:\\out.txt 4:\u3082\u3061\u308d\u3093\u4e0a\u8a18\u5168\u90e8\u3092\u7d44\u307f\u5408\u308f\u305b\u308b\u3053\u3068\u3082\u53ef\u80fd \u3000\u3000\u4f8b: getOrder.exe \/March\u2026<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true},"categories":[5],"tags":[37],"jetpack_featured_media_url":"","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":6695,"url":"http:\/\/nanoappli.com\/blog\/archives\/6695","url_meta":{"origin":1281,"position":0},"title":"C#\u304b\u3089VBScript\u306e\u30b3\u30fc\u30c9\u3092\u547c\u3073\u51fa\u3059\u4e00\u756a\u7c21\u5358\u306a\u30b5\u30f3\u30d7\u30eb","date":"2015\u5e7412\u670823\u65e5","format":false,"excerpt":"C#\u3084VB.NET\u3067Windows\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f5c\u3063\u3066\u3044\u308b\u3068\u304d\u3001\u30d7\u30e9\u30b0\u30a4\u30f3\u306e\u3088\u3046\u306a\u5f62\u3067\u5b9f\u884c\u5185\u5bb9\u3092\u30ab\u30b9\u2026","rel":"","context":"","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/nanoappli.com\/blog\/wp-content\/uploads\/2015\/12\/20151223_2_1.jpg?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":2838,"url":"http:\/\/nanoappli.com\/blog\/archives\/2838","url_meta":{"origin":1281,"position":1},"title":"[C#][.Net]Chart\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u306b\u8868\u793a\u3055\u308c\u3066\u3044\u308b\u30b0\u30e9\u30d5\u3092\u30d5\u30a1\u30a4\u30eb\u306b\u4fdd\u5b58\u3059\u308b","date":"2012\u5e745\u670825\u65e5","format":false,"excerpt":"VS2010\u306e.Net Framework\u3067\u7528\u610f\u3055\u308c\u3066\u3044\u308bChart\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u3092\u4f7f\u7528\u3057\u3066\u63cf\u753b\u3057\u305f\u30b0\u2026","rel":"","context":"","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/nanoappli.com\/blog\/wp-content\/uploads\/2012\/05\/20120525_10.jpg?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":1139,"url":"http:\/\/nanoappli.com\/blog\/archives\/1139","url_meta":{"origin":1281,"position":2},"title":"[jQuery]\u65b0\u3057\u3044\u30ce\u30fc\u30c9\u3092\u8ffd\u52a0\u3059\u308b\u3068\u304d\u306b\u3001\u30bf\u30b0\u306e\u5c5e\u6027\u3082\u540c\u6642\u306b\u6307\u5b9a\u3059\u308b\u65b9\u6cd5","date":"2012\u5e742\u67083\u65e5","format":false,"excerpt":"jQuery\u3067\u306f\u3001$( \"<a \/>\" )\u3068\u3044\u3046\u8868\u8a18\u3067\u65b0\u3057\u3044DOM\u30ce\u30fc\u30c9\u3092\u4f5c\u308b\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\u3002\u2026","rel":"","context":"","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1768,"url":"http:\/\/nanoappli.com\/blog\/archives\/1768","url_meta":{"origin":1281,"position":3},"title":"[C#,VS2010]CrystalReports\u3067\u5e33\u7968\u30ec\u30a4\u30a2\u30a6\u30c8\u5074\u306b\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u6e21\u3059","date":"2012\u5e743\u670814\u65e5","format":false,"excerpt":"CrystalReports\u3067\u306fDataSet\u3092\u4f7f\u7528\u3057\u3066\u5e33\u7968\u306b\u5370\u5b57\u3059\u308b\u30c7\u30fc\u30bf\u3092\u6e21\u3057\u307e\u3059\u3002\u901a\u5e38\u306f\u3053\u308c\u3067\u2026","rel":"","context":"","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/nanoappli.com\/blog\/wp-content\/uploads\/2012\/03\/20120314_04.jpg?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":560,"url":"http:\/\/nanoappli.com\/blog\/archives\/560","url_meta":{"origin":1281,"position":4},"title":"jQuery\u3092\u4f7f\u7528\u3057\u3066table\u3078\u884c\u306e\u8ffd\u52a0\u524a\u9664\u3092\u884c\u3046","date":"2012\u5e741\u670816\u65e5","format":false,"excerpt":"HTML\u3092javascript\u304b\u3089\u52d5\u7684\u306b\u64cd\u4f5c\u3059\u308b\u5834\u5408\u3001jQuery\u3092\u4f7f\u7528\u3059\u308b\u3068\u4fbf\u5229\u3067\u3059\u3002 \u672c\u8a18\u4e8b\u3067\u306f\u2026","rel":"","context":"","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2363,"url":"http:\/\/nanoappli.com\/blog\/archives\/2363","url_meta":{"origin":1281,"position":5},"title":"[C#] WinForm\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u304b\u3089\u30b3\u30f3\u30bd\u30fc\u30eb(\u6a19\u6e96\u51fa\u529b)\u306b\u6587\u5b57\u3092\u51fa\u529b\u3059\u308b","date":"2012\u5e745\u67088\u65e5","format":false,"excerpt":"Windows\u3067\u306f\u901a\u5e38GUI(WinForm)\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f5c\u6210\u3057\u305f\u5834\u5408\u3001\u901a\u5e38\u3067\u306f\u30b3\u30f3\u30bd\u30fc\u30eb\u3078\u306e\u6587\u5b57\u2026","rel":"","context":"","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"http:\/\/nanoappli.com\/blog\/wp-json\/wp\/v2\/posts\/1281"}],"collection":[{"href":"http:\/\/nanoappli.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/nanoappli.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/nanoappli.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/nanoappli.com\/blog\/wp-json\/wp\/v2\/comments?post=1281"}],"version-history":[{"count":12,"href":"http:\/\/nanoappli.com\/blog\/wp-json\/wp\/v2\/posts\/1281\/revisions"}],"predecessor-version":[{"id":1294,"href":"http:\/\/nanoappli.com\/blog\/wp-json\/wp\/v2\/posts\/1281\/revisions\/1294"}],"wp:attachment":[{"href":"http:\/\/nanoappli.com\/blog\/wp-json\/wp\/v2\/media?parent=1281"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/nanoappli.com\/blog\/wp-json\/wp\/v2\/categories?post=1281"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/nanoappli.com\/blog\/wp-json\/wp\/v2\/tags?post=1281"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}