{"id":1065,"date":"2020-12-28T12:05:50","date_gmt":"2020-12-28T03:05:50","guid":{"rendered":"https:\/\/www.typea.info\/blog\/?p=1065"},"modified":"2020-12-28T12:30:05","modified_gmt":"2020-12-28T03:30:05","slug":"jra_van_datalab_jvlink_vs2019_cs_rewrite","status":"publish","type":"post","link":"https:\/\/www.typea.info\/blog\/index.php\/2020\/12\/28\/jra_van_datalab_jvlink_vs2019_cs_rewrite\/","title":{"rendered":"JRA-VAN Datalab JV-Link \u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3092\u898b\u306a\u304c\u3089 Visual Studio 2019 C# \u306b\u66f8\u304d\u76f4\u3059"},"content":{"rendered":"<p>\u00a0<\/p>\n<p><a href=\"https:\/\/www.amazon.co.jp\/2020%E5%B9%B4%E7%89%88%E4%B8%AD%E5%A4%AE%E7%AB%B6%E9%A6%AC%E5%85%A8%E9%87%8D%E8%B3%9E%E3%83%87%E3%83%BC%E3%82%BF%E6%94%BB%E7%95%A5%E3%83%96%E3%83%83%E3%82%AF-%E8%8B%B1%E5%92%8C%E3%83%A0%E3%83%83%E3%82%AF\/dp\/4865457615\/ref=as_li_ss_il?__mk_ja_JP=%E3%82%AB%E3%82%BF%E3%82%AB%E3%83%8A&amp;dchild=1&amp;keywords=JRA-VAN&amp;qid=1609124776&amp;sr=8-11&amp;linkCode=li2&amp;tag=typea09-22&amp;linkId=f61206d1317da93e41711533e3c9d050&amp;language=ja_JP\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" src=\"\/\/ws-fe.amazon-adsystem.com\/widgets\/q?_encoding=UTF8&amp;ASIN=4865457615&amp;Format=_SL160_&amp;ID=AsinImage&amp;MarketPlace=JP&amp;ServiceVersion=20070822&amp;WS=1&amp;tag=typea09-22&amp;language=ja_JP\" border=\"0\" \/><\/a><img loading=\"lazy\" decoding=\"async\" style=\"border: none !important; margin: 0px !important;\" src=\"https:\/\/ir-jp.amazon-adsystem.com\/e\/ir?t=typea09-22&amp;language=ja_JP&amp;l=li2&amp;o=9&amp;a=4865457615\" alt=\"\" width=\"1\" height=\"1\" border=\"0\" \/><\/p>\n<p>\u00a0<\/p>\n<p><a href=\"https:\/\/www.typea.info\/blog\/index.php\/2020\/12\/27\/jra_van_datalab_jvlink_vs2019_cs\/\">JRA-VAN Datalab JV-Link \u3092 Visual Studio2019 C#\u3067\u4f7f\u7528\u3067\u304d\u308b<\/a>\u3088\u3046\u306b\u306a\u3063\u305f\u306e\u3067\u3001\u5b9f\u969b\u306b\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3057\u3066\u307f\u308b\u3002<\/p>\n<p>\u5f15\u304d\u7d9a\u304d\u3001<a href=\"https:\/\/jra-van.jp\/dlb\/sdv\/sdk\/DataLab410.pdf\">\u958b\u767a\u30ac\u30a4\u30c9\u306e\u30b5\u30f3\u30d7\u30eb<\/a>\u3092\u898b\u306a\u304c\u3089\u3002\u6a5f\u80fd\u306e\u78ba\u8a8d\u3092\u3057\u305f\u3044\u3060\u3051\u306a\u306e\u3067\u3001\u753b\u9762\u306e\u4f5c\u308a\u8fbc\u307f\u306f\u3057\u306a\u3044(\u30d7\u30ed\u30b0\u30ec\u30b9\u30d0\u30fc\u3068\u304b)\u3067\u3001\u30c7\u30d0\u30c3\u30b0\u30b3\u30f3\u30bd\u30fc\u30eb\u306b\u7d50\u679c\u3092\u8868\u793a\u3055\u305b\u308b\u3060\u3051\u3002<\/p>\n<p>\u7d50\u679c\u304c\u4ee5\u4e0b\u3002<\/p>\n<p><a href=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/2020\/12\/jra_van_run.png\"><img loading=\"lazy\" decoding=\"async\" title=\"jra_van_run.png\" src=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/2020\/12\/jra_van_run.png\" alt=\"Jra van run\" width=\"476\" height=\"386\" border=\"0\" \/><\/a><\/p>\n<p>\u00a0<\/p>\n<h2>\u6e96\u5099<\/h2>\n<p>\u30c7\u30fc\u30bf\u69cb\u9020\u4f53\u3092\u3001SDK\u304b\u3089\u53d6\u8fbc\u3080<\/p>\n<p>JRA-VAN Data Lab. SDK Ver4.5.1.5\\Win\\JV-Data\u69cb\u9020\u4f53\\C#\u7248\\JVData_Struct.cs<\/p>\n<p><a href=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/2020\/12\/jra_van_solution.png\"><img loading=\"lazy\" decoding=\"async\" title=\"jra_van_solution.png\" src=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/2020\/12\/jra_van_solution.png\" alt=\"Jra van solution\" width=\"375\" height=\"334\" border=\"0\" \/><\/a><\/p>\n<p>\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3055\u308c\u308b\u30c7\u30fc\u30bf\u304c\u3001Shift_JIS\u306a\u306e\u3067\u3001\u69cb\u9020\u4f53\u5b9a\u7fa9\u306e\u51e6\u7406\u3067\u30b3\u30fc\u30c7\u30c3\u30af\u306e\u5909\u63db\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3059\u308b\u3002<\/p>\n<p>System.ArgumentException: &#8221;Shift_JIS&#8217; is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method. &#8216;<\/p>\n<p>Encode\u306e\u62e1\u5f35\u3092NuGet\u304b\u3089\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3002<\/p>\n<p>\u30d7\u30ed\u30b8\u30a7\u30af\u30c8 &#8211; NuGet\u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u7ba1\u7406\u304b\u3089\u3001System .Text .Encoding.CodecPages \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3001<\/p>\n<p><a href=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/2020\/12\/Cshart_shift_jis.png\"><img loading=\"lazy\" decoding=\"async\" title=\"Cshart_shift_jis.png\" src=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/2020\/12\/Cshart_shift_jis.png\" alt=\"Cshart shift jis\" width=\"515\" height=\"195\" border=\"0\" \/><\/a><\/p>\n<p>\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u3001\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u306b\u3067\u3082\u66f8\u3044\u3066\u304a\u304f\u3002<\/p>\n<pre class=\"prettyprint\">using System.Text;\nEncoding.RegisterProvider(CodePagesEncodingProvider.Instance);\n<\/pre>\n<p>\u00a0<\/p>\n<h2>\u30c7\u30fc\u30bf\u53d6\u5f97\u30dc\u30bf\u30f3\u306e\u30b3\u30fc\u30c9<\/h2>\n<pre class=\"prettyprint\">\u00a0\nprivate void btnGetData_Click(object sender, EventArgs e)\n{\n    \/\/ \u30c7\u30fc\u30bf\u8aad\u307f\u51fa\u3057\u51e6\u7406\u306e\u4e00\u822c\u7684\u306a\u6d41\u308c\n    int returnCode = 0;\n    int readCount = 0;\n    int downloadCount = 0;\n    \n    try\n    {\n        \/\/ \u2460JVLink\uff89\u521d\u671f\u5316(JVInit)\n        \/\/ JVLink\u306e\u521d\u671f\u5316\u3092\u884c\u3044\u307e\u3059\u3002JVOpen\u3092\u547c\u3073\u51fa\u3059\u524d\u306b\u6700\u4f4e1\u56de\u547c\u3073\u51fa\u3059\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002 \n        returnCode = this.jVLink.JVInit(\"UNKNOW\");\n        if (returnCode &amp;lt; 0)\n        {\n            MessageBox.Show($\"JVInit\u30a8\u30e9\u30fc\u3002 RC={returnCode}\");\n            return;\n        }\n    \n        \/\/ \u2461JVData\uff89\u30aa\u30fc\u30d7\u30f3(JVOpen) \n        \/\/ \u8981\u6c42\u306b\u5fdc\u3058\u305f\u30c7\u30fc\u30bf\u3092\u8aad\u307f\u51fa\u305b\u308b\u3088\u3046\u306b\u6e96\u5099\u3057\u307e\u3059\u3002\n        \/\/ \u5fc5\u8981\u3067\u3042\u308c\u3070\u30b5\u30fc\u30d0\u30fc\u304b\u3089\u30c7\u30fc\u30bf\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308b\u51e6\u7406\u3092\u8d77\u52d5\u3057\u307e\u3059\u3002\n        \/\/ JVOpen\u304b\u3089\u306e\u623b\u308a\u3068\u3057\u3066\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3092\u884c\u306a\u3046\u4e88\u5b9a\u30d5\u30a1\u30a4\u30eb\u6570\u304c\u8fd4\u3055\u308c\u307e\u3059\u3002 \n    \n        string dataSpec = \"RACE\";               \/\/ \u30c7\u30fc\u30bf\u7a2e\u5225\u306b\u300c\u30ec\u30fc\u30b9\u60c5\u5831\u300d\u3092\u8a2d\u5b9a\n        string fromTime = \"20201101000000\";    \/\/ From\u30bf\u30a4\u30e0\u306b2020\u5e7411\u67081\u65e5\u3092\u8a2d\u5b9a\n        int optionFlag = 2;                     \/\/ \u30aa\u30d7\u30b7\u30e7\u30f3\u306b\u300c\u4eca\u9031\u30c7\u30fc\u30bf\u300d\u3092\u8a2d\u5b9a\n        returnCode = this.jVLink.JVOpen(dataSpec, fromTime, optionFlag, ref readCount, ref downloadCount, out string lastFileTimestamp);\n        if (returnCode &amp;lt; 0)\n        {\n            MessageBox.Show($\"JOpen\u30a8\u30e9\u30fc\u3002 RC={returnCode}\");\n            return;\n        }\n    \n        if (readCount == 0)\n        {\n            MessageBox.Show($\"\u8a72\u5f53\u30c7\u30fc\u30bf\u304c\u3042\u308a\u307e\u305b\u3093\u3002\");\n            return;\n        }\n    \n        \/\/ \u2462\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u4e2d\u306e\u30d7\u30ed\u30b0\u30ec\u30b9\u30d0\u30fc\u8868\u793a(JVStatus)\n        \/\/ JVOpen\u306f\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u30b9\u30ec\u30c3\u30c9\u3092\u8d77\u52d5\u3059\u308b\u3068\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u5b8c\u4e86\u524d\u306b\u547c\u3073\u51fa\u3057\u5074\u306b\u5236\u5fa1\u3092\u8fd4\u3057\u307e\u3059\u306e\u3067\u3001\n        \/\/ \u547c\u3073\u51fa\u3057\u5074\u306fJVStatus\u3092\u4f7f\u3063\u3066\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u51e6\u7406\u306e\u9032\u884c\u72b6\u6cc1\u3092\u76e3\u8996\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\n        \/\/ JVStatus\u306f\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u6e08\u307f\u306e\u30d5\u30a1\u30a4\u30eb\u6570\u3092\u8fd4\u3057\u307e\u3059\u306e\u3067\u3001JVOpen\u6642\u306e\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u4e88\u5b9a\u30d5\u30a1\u30a4\u30eb\u6570\u3068\u4e00\u81f4\u3057\u305f\u5834\u5408\u306b\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u51e6\u7406\u306e\u5b8c\u4e86\u3068\u3057\u307e\u3059\u3002 \n    \n        int count = 0;\n        while((count = this.jVLink.JVStatus()) &amp;lt; downloadCount)\n        {\n            Debug.WriteLine($\"count;{count} &amp;lt;= download count;{downloadCount}\");\n    \n            System.Threading.Thread.Sleep(10000);\n        }\n    \n        \/\/ \u2463JVData\uff89\u8aad\u307f\u51fa\u3057(JVRead)\n        \/\/ \u30c7\u30fc\u30bf\u3092\u8aad\u307f\u51fa\u3057\u307e\u3059\u3002\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u30b9\u30ec\u30c3\u30c9\u304c\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u5b9f\u884c\u4e2d\u306bJVRead\u3092\u547c\u3073\u51fa\u3059\u3068\u30a8\u30e9\u30fc\u3068\u306a\u308a\u307e\u3059\u3002\n    \n        string recordSpec = null;\n        JVData_Struct.JV_SE_RACE_UMA uma = new JVData_Struct.JV_SE_RACE_UMA();\n        string buff = null;\n        int buffSize = 1500;\n        string fName = null;\n    \n        buff = new string('\\0', buffSize);\n        if (readCount &amp;gt; 0)\n        {\n            while ((returnCode = this.jVLink.JVRead(out buff, out buffSize, out fName)) != 0)\n            {\n    \n                if (returnCode &amp;gt; 0)\n                {\n                    recordSpec = buff.Substring(0, 2);\n                    if (recordSpec == \"SE\")\n                    {\n                        uma.SetDataB(ref buff);\n                        Debug.WriteLine($\"\u958b\u50ac\u5e74\u6708\u65e5:{uma.id.Year}{uma.id.MonthDay} \u7af6\u99ac\u5834:{uma.id.JyoCD} \u958b\u50ac\u56de:{uma.id.Kaiji} \u958b\u50ac\u65e5\u76ee:{uma.id.Nichiji} R:{uma.id.RaceNum} \u67a0:{uma.Wakuban} \u99ac\u756a:{uma.Umaban} \u99ac\u540d:{uma.Bamei}\");\n                    }\n                    else\n                    {\n                        \/\/Debug.WriteLine($\"SKIP:{recordSpec}\");\n    \n                    }\n                }\n                else if (returnCode == -1)\n                {\n    \n                }\n                else\n                {\n                    MessageBox.Show($\"\u8aad\u307f\u8fbc\u307f\u30a8\u30e9\u30fc\u3002 RC={returnCode}\");\n                    return;\n                }\n            }\n        }\n    \n        \/\/ \u2464\u30c7\u30fc\u30bf\u5185\u5bb9\u3092\u30c6\u30ad\u30b9\u30c8\u30dc\u30c3\u30af\u30b9\u306b\u8868\u793a\n        \/\/ \u4e00\u822c\u306e\u7af6\u99ac\u30bd\u30d5\u30c8\u3067\u306f\u3053\u306e\u51e6\u7406\u306e\u4ee3\u308f\u308a\u306b\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3078\u30c7\u30fc\u30bf\u3092\u53cd\u6620\u3059\u308b\u51e6\u7406\u304c\u884c\u306a\u308f\u308c\u307e\u3059\u3002\n    } \n    finally\n    {\n        \/\/ \u2465JVData\u306e\u30af\u30ed\u30fc\u30ba(JVClose) \n        \/\/ JVOpen\u3067\u78ba\u4fdd\u3055\u308c\u305f\u30ea\u30bd\u30fc\u30b9\u3092\u958b\u653e\u3057\u307e\u3059\u3002\n        this.jVLink.JVClose();\n    }\n}\n<\/pre>\n<p>\u4ee5\u4e0a\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u00a0 \u00a0 JRA-VAN Datalab JV-Link \u3092 Visual Studio2019 C#\u3067\u4f7f\u7528\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u3063\u305f\u306e\u3067\u3001\u5b9f\u969b\u306b\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3057\u3066\u307f\u308b\u3002 \u5f15\u304d\u7d9a\u304d\u3001\u958b\u767a\u30ac\u30a4\u30c9\u306e\u30b5\u30f3\u30d7\u30eb\u3092\u898b\u306a\u304c\u3089\u3002\u6a5f\u80fd\u306e\u78ba\u8a8d\u3092\u3057\u305f\u3044 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1064,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"sns_share_botton_hide":"","vkExUnit_sns_title":"","_vk_print_noindex":"","sitemap_hide":"","_veu_custom_css":"","veu_display_promotion_alert":"","vkexunit_cta_each_option":"","footnotes":""},"categories":[],"tags":[141,142],"class_list":["post-1065","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","tag-jra-van","tag-jv-link"],"veu_head_title_object":{"title":"","add_site_title":""},"_links":{"self":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts\/1065","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=1065"}],"version-history":[{"count":4,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts\/1065\/revisions"}],"predecessor-version":[{"id":1071,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts\/1065\/revisions\/1071"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/media\/1064"}],"wp:attachment":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=1065"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=1065"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=1065"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}