{"id":8603,"date":"2023-03-27T16:04:34","date_gmt":"2023-03-27T07:04:34","guid":{"rendered":"https:\/\/www.auctionpro.co.kr\/?p=8603"},"modified":"2024-05-24T10:41:54","modified_gmt":"2024-05-24T01:41:54","slug":"c-%ec%97%90%ec%84%9c-%eb%b0%b0%ec%b9%98-%ed%8c%8c%ec%9d%bc-%ec%82%ac%ec%9a%a9%ed%95%98%ea%b8%b0","status":"publish","type":"post","link":"https:\/\/www.auctionpro.co.kr\/?p=8603","title":{"rendered":"c# \uc5d0\uc11c \ubc30\uce58 \ud30c\uc77c \uc0ac\uc6a9\ud558\uae30"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Overview : WinSCP \ub294  win\uc2a4\ucf00\uc974\ub7ec\ub85c \uc798 \uc791\ub3d9\ub418\uc9c0 \uc54a\uae30 \ub54c\ubb38\uc5d0  \ud504\ub85c\uadf8\ub7a8\uc73c\ub85c \ub9cc\ub4e4\uc5b4 \ubcf4\uc790<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/www.auctionpro.co.kr\/wp-content\/uploads\/2023\/04\/image-2.png\"><img loading=\"lazy\" decoding=\"async\" width=\"684\" height=\"489\" src=\"https:\/\/www.auctionpro.co.kr\/wp-content\/uploads\/2023\/04\/image-2.png\" alt=\"\" class=\"wp-image-8654\" srcset=\"https:\/\/www.auctionpro.co.kr\/wp-content\/uploads\/2023\/04\/image-2.png 684w, https:\/\/www.auctionpro.co.kr\/wp-content\/uploads\/2023\/04\/image-2-300x214.png 300w, https:\/\/www.auctionpro.co.kr\/wp-content\/uploads\/2023\/04\/image-2-660x472.png 660w\" sizes=\"auto, (max-width: 684px) 100vw, 684px\" \/><\/a><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">WinSCP \ub85c  FTP\ub85c \ud30c\uc77c\uc804\uc1a1 <\/h3>\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed is-provider-auctionpro wp-block-embed-auctionpro\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"X1PFujmSfq\"><a href=\"https:\/\/www.auctionpro.co.kr\/?p=6175\">WinSCP<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;WinSCP&#8221; &#8212; AuctionPro\" src=\"https:\/\/www.auctionpro.co.kr\/?p=6175&#038;embed=true#?secret=KuUzbS2vM4#?secret=X1PFujmSfq\" data-secret=\"X1PFujmSfq\" width=\"500\" height=\"282\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">\ubc30\uce58 \ud30c\uc77c \uc138\ud305 \uc608\uc81c<\/h3>\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed is-provider-auctionpro wp-block-embed-auctionpro\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"QNVurIoWVY\"><a href=\"https:\/\/www.auctionpro.co.kr\/?p=8598\">\ubc30\uce58 \ud30c\uc77c(Batch File)<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;\ubc30\uce58 \ud30c\uc77c(Batch File)&#8221; &#8212; AuctionPro\" src=\"https:\/\/www.auctionpro.co.kr\/?p=8598&#038;embed=true#?secret=oyXLA039fh#?secret=QNVurIoWVY\" data-secret=\"QNVurIoWVY\" width=\"500\" height=\"282\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">WinSCP  \uc0ac\uc6a9  C# \uba54\uc778 \uc18c\uc2a4<\/h3>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:vim decode:true \">using System.Diagnostics;\n:: \uc911\ub7b5 ::\n private void WinSCP()\n        {\n            string batDir =  @\"C:\\SCP\\\";\n            string batFile = \"MyScript.bat\";\n            Process proc = null;\n            try\n            {\n                if (batDir.Length &gt; 2 &amp;&amp; batFile.Length &gt; 2)\n                {\n                    proc = new Process();\n                    proc.StartInfo.WorkingDirectory = batDir;\n                    proc.StartInfo.FileName = batFile;\n                    proc.StartInfo.CreateNoWindow = false;\n                    proc.Start();\n                    proc.WaitForExit();\n                    \/\/LogShow(\"\ud30c\uc77c\uc804\uc1a1 \uc2a4\ud06c\ub9bd\ud2b8\uac00 \uc2e4\ud589 \ub418\uc5c8\uc2b5\ub2c8\ub2e4.\");\n                }\n            }\n            catch (Exception ex)\n            {\n                \/\/LogShow(ex.StackTrace.ToString());\n            }\n        }<\/pre><\/div>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/www.auctionpro.co.kr\/wp-content\/uploads\/2023\/04\/image-1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"826\" height=\"699\" src=\"https:\/\/www.auctionpro.co.kr\/wp-content\/uploads\/2023\/04\/image-1.png\" alt=\"\" class=\"wp-image-8650\" srcset=\"https:\/\/www.auctionpro.co.kr\/wp-content\/uploads\/2023\/04\/image-1.png 826w, https:\/\/www.auctionpro.co.kr\/wp-content\/uploads\/2023\/04\/image-1-300x254.png 300w, https:\/\/www.auctionpro.co.kr\/wp-content\/uploads\/2023\/04\/image-1-768x650.png 768w, https:\/\/www.auctionpro.co.kr\/wp-content\/uploads\/2023\/04\/image-1-660x559.png 660w\" sizes=\"auto, (max-width: 826px) 100vw, 826px\" \/><\/a><\/figure>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:c# decode:true \" title=\"WinFTPProcess\">using System;\nusing System.Windows.Forms;\nusing System.Threading;\nusing System.Diagnostics;\n\nnamespace WinFTPProcess\n{\n    public partial class Form1 : Form\n    {\n        public Form1()\n        {\n            InitializeComponent();\n        }\n\n        private void btnStart_Click(object sender, EventArgs e)\n        {\n            int sTime = 1000000;\n\n            switch (cmbTime.SelectedIndex)\n            {\n                case 0:\n                    sTime = 5 * 1000;  \/\/5\ucd08\n                    break;\n                case 1:\n                    sTime = 30 * 1000; \/\/30\ucd08\n                    break;\n                case 2:\n                    sTime = 10 * 60 * 1000; \/\/10\ubd84\n                    break;\n                default:\n                    sTime = 20 * 60 * 1000; \/\/20\ubd84 \n                    break;\n            }\n\n            if (txtBatFile.Text.Length &gt; 5)\n            {\n                timer2.Interval = 2000;\n                timer2.Enabled = true;\n                timer2.Start();\n\n                timer1.Interval = sTime;\n                timer1.Enabled = true;\n                timer1.Start();\n\n                btnStart.Enabled = false;\n                btnStop.Enabled = true;\n\n                LogShow(\"FTP \ub97c \uc2dc\uc791 \ud569\ub2c8\ub2e4.\");\n\n                WinSCP(); \/\/WinSCP\ub97c \uc2dc\uc791\ud569\ub2c8\ub2e4. \n            }\n        }\n\n        private void Form1_Load(object sender, EventArgs e)\n        {\n            \/\/Start Stop \ubc84\ud2bc init\n            btnStart.Enabled = true;\n            btnStop.Enabled = false;\n\n            \/\/ Timer init\n            timer1.Enabled = false;\n            \/\/ cmbTime init\n            cmbTime.SelectedIndex = 1;\n\n            \/\/timer2 int\n            timer2.Enabled = false;\n            timer2.Interval = 2000;\n        }\n\n        private void btnStop_Click(object sender, EventArgs e)\n        {\n            \/\/stop \ubc84\ud2bc\uc744 \ub204\ub974\uba74 \n            btnStart.Enabled = true;\n            btnStop.Enabled = false;\n\n            LogShow(\"\uc911\uc9c0 \ub418\uc5c8\uc2b5\ub2c8\ub2e4.\");\n\n            timer2.Stop();\n            timer2.Enabled = false;\n\n            timer1.Stop();\n            timer1.Enabled = false;\n\n            toolStripProgressBar1.Value = 0;\n        }\n\n        \/\/FTP WinSCP\n        private void WinSCP()\n        {\n            string batDir = txtBatDir.Text;\n            string batFile = txtBatFile.Text;\n\n            Process proc = null;\n\n            try\n            {\n                if (batDir.Length &gt; 2 &amp;&amp; batFile.Length &gt; 2)\n                {\n                    proc = new Process();\n                    proc.StartInfo.WorkingDirectory = batDir;\n                    proc.StartInfo.FileName = batFile;\n                    proc.StartInfo.CreateNoWindow = false;\n                    proc.Start();\n                    proc.WaitForExit();\n                    LogShow(\"\ud30c\uc77c\uc804\uc1a1 \uc2a4\ud06c\ub9bd\ud2b8\uac00 \uc2e4\ud589 \ub418\uc5c8\uc2b5\ub2c8\ub2e4.\");\n                }\n            }\n            catch (Exception ex)\n            {\n                LogShow(ex.StackTrace.ToString());\n            }\n\n        }\n\n        \/\/\ub85c\uadf8 \ubfcc\ub824\uc8fc\uae30 \ud568\uc218 \n        private void LogShow(string LogDate)\n        {\n            if (txtLog.Text.Length &gt; 1000)\n                txtLog.Text = DateTime.Now.ToString() + \" \" + LogDate;\n            else\n                txtLog.Text = txtLog.Text + \"\\r\\n\" + DateTime.Now.ToString() + \" \" + LogDate;\n\n            txtLog.SelectionStart = txtLog.Text.Length;\n            txtLog.ScrollToCaret();\n            txtLog.Refresh();\n        }\n\n        private void timer1_Tick(object sender, EventArgs e)\n        {\n            WinSCP(); \/\/\ud30c\uc77c\uc804\uc1a1\n        }\n\n        private void timer2_Tick(object sender, EventArgs e)\n        {\n            toolStripProgressBar1.Value = 0;\n\n            Thread.Sleep(1000);\n\n            toolStripProgressBar1.Value = 100;\n        }\n    }\n}\n<\/pre><\/div>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"498\" height=\"278\" src=\"https:\/\/www.auctionpro.co.kr\/wp-content\/uploads\/2023\/03\/batch.gif\" alt=\"\" class=\"wp-image-8608\"\/><\/figure>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>Overview : WinSCP \ub294 win\uc2a4\ucf00\uc974\ub7ec\ub85c \uc798 \uc791\ub3d9\ub418\uc9c0 \uc54a\uae30 \ub54c\ubb38\uc5d0 \ud504\ub85c\uadf8\ub7a8\uc73c\ub85c \ub9cc\ub4e4\uc5b4 \ubcf4\uc790 WinSCP \ub85c FTP\ub85c \ud30c\uc77c\uc804\uc1a1 \ubc30\uce58 \ud30c\uc77c \uc138\ud305 \uc608\uc81c WinSCP \uc0ac\uc6a9 C# \uba54\uc778 \uc18c\uc2a4<\/p>\n<\/div>","protected":false},"author":6,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[245],"tags":[],"class_list":["post-8603","post","type-post","status-publish","format-standard","hentry","category--batch-file"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.auctionpro.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/8603","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.auctionpro.co.kr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.auctionpro.co.kr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.auctionpro.co.kr\/index.php?rest_route=\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/www.auctionpro.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8603"}],"version-history":[{"count":0,"href":"https:\/\/www.auctionpro.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/8603\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.auctionpro.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8603"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.auctionpro.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8603"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.auctionpro.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8603"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}