{"id":6960,"date":"2022-02-23T18:49:03","date_gmt":"2022-02-23T09:49:03","guid":{"rendered":"https:\/\/www.auctionpro.co.kr\/?p=6960"},"modified":"2022-02-25T09:22:15","modified_gmt":"2022-02-25T00:22:15","slug":"c-%eb%a1%9c%ea%b7%b8-%ec%9d%bc%ec%9e%90%eb%b3%84%eb%a1%9c-%ec%83%9d%ec%84%b1","status":"publish","type":"post","link":"https:\/\/www.auctionpro.co.kr\/?p=6960","title":{"rendered":"C# \ub85c\uadf8 \uc77c\uc790\ubcc4\ub85c \uc0dd\uc131"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\">Remark : \uc77c\uc790\ubcc4  log \ub370\uc774\ud0c0 \uc800\uc7a5 <\/h3>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:c# decode:true \" title=\"Class\">using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Web;\nusing System.Text;\nusing System.IO;\n\nnamespace Core\n{\n    public class FileWrite\n    {\n        \/\/******************************************************************************\n        \/\/ \ud568\uc218\uba85    : SimpleCheckFolder\n        \/\/ \uc791\uc131\uc790    : \ud64d\uae38\ub3d9\n        \/\/ \uc791\uc131\uc77c    : 2021-11-23\n        \/\/ \uc124\uba85      : \ub85c\uadf8 \uc77c\uc790\ubcc4\ub85c \uc0dd\uc131 \n        \/\/ \ub9ac\ud134\uac12    : \n        \/\/ \ub9e4\uac1c\ubcc0\uc218  :\n        \/\/ Remark    :\n        \/\/ \uc774\ub825\uc0ac\ud56d  :\n        \/\/******************************************************************************\n        public static string SimpleCheckFolder(string SubFolder)\n        {\n            string targetPath = @\"D:\\CoreLog\\\" + SubFolder + @\"\\\";\n            StringBuilder sb = new StringBuilder();\n            sb.Remove(0, sb.Length);\n            sb.Append(targetPath).Append(System.DateTime.Today.ToString(\"yyyyMMdd\"));\n\n            \/\/ To copy a folder's contents to a new location:\n            \/\/ Create a new target folder, if necessary.\n            if (!System.IO.Directory.Exists(sb.ToString()))\n            {\n                System.IO.Directory.CreateDirectory(sb.ToString());\n            }\n\n            return sb.ToString();\n        }\n       \/\/\ud30c\uc77c \uc4f0\uae30\n        \/\/\ub0a0\uc9dc\uc2dc\uac04,OTA,\ud56d\uacf5\uc0ac,PNR,Complited\n        \/\/******************************************************************************\n        \/\/ \ud568\uc218\uba85    : Write\n        \/\/ \uc791\uc131\uc790    : \ud64d\uae38\ub3c4\n        \/\/ \uc791\uc131\uc77c    : 2021-11-23\n        \/\/ \uc124\uba85      : Test\n        \/\/ \ub9ac\ud134\uac12    : \ud30c\uc77c\uba85.\n        \/\/ \ub9e4\uac1c\ubcc0\uc218  :  \n        \/\/ Remark    : \n        \/\/ \uc774\ub825\uc0ac\ud56d  :\n        \/\/******************************************************************************\n        public static string Write(string OTA, string PNR, string Carrier, string Complited, string sPath, string sXML)\n        {\n            string LogTime = DateTime.Now.ToString(\"yyyyMMddHHmm_ss_fff\");\n            string FileName = LogTime + \"_\" + OTA + \"_\" + PNR + \"_\" + Carrier + \"_\" + Complited + \".xml\";\n\n            try\n            {\n                string PathFileName = sPath + @\"\\\" + FileName;\n\n                using (FileStream fs = new FileStream(PathFileName, FileMode.Create))\n                {\n                    using (StreamWriter w = new StreamWriter(fs, Encoding.UTF8))\n                    {\n                        w.WriteLine(sXML);\n                    }\n                }\n\n            }\n            catch\n            {\n                \/\/string Err = ex.Message.ToString();\n\n            }\n\n            return FileName;\n\n        }\n\n\n    }\n}<\/pre><\/div>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:c# decode:true \" title=\"\uc0ac\uc6a9\"> \/\/\ub85c\uadf8 \ubc0f \ub514\ube44 \uc800\uc7a5\n string sPath = FileWrite.SimpleCheckFolder(\"Foldername\");\n string FileName = FileWrite.Write(\"ID\",\"Req\",\"Branch\",\"0\",sPath, sData);\n<\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Log \uc0c1\ud0dc<\/h2>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/www.auctionpro.co.kr\/wp-content\/uploads\/2022\/02\/SimpleCheckFolder.png\"><img loading=\"lazy\" decoding=\"async\" width=\"617\" height=\"525\" src=\"https:\/\/www.auctionpro.co.kr\/wp-content\/uploads\/2022\/02\/SimpleCheckFolder.png\" alt=\"\" class=\"wp-image-6961\" srcset=\"https:\/\/www.auctionpro.co.kr\/wp-content\/uploads\/2022\/02\/SimpleCheckFolder.png 617w, https:\/\/www.auctionpro.co.kr\/wp-content\/uploads\/2022\/02\/SimpleCheckFolder-300x255.png 300w, https:\/\/www.auctionpro.co.kr\/wp-content\/uploads\/2022\/02\/SimpleCheckFolder-150x128.png 150w, https:\/\/www.auctionpro.co.kr\/wp-content\/uploads\/2022\/02\/SimpleCheckFolder-400x340.png 400w\" sizes=\"auto, (max-width: 617px) 100vw, 617px\" \/><\/a><\/figure>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>Remark : \uc77c\uc790\ubcc4 log \ub370\uc774\ud0c0 \uc800\uc7a5 Log \uc0c1\ud0dc<\/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":[10],"tags":[],"class_list":["post-6960","post","type-post","status-publish","format-standard","hentry","category-devc"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.auctionpro.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/6960","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=6960"}],"version-history":[{"count":0,"href":"https:\/\/www.auctionpro.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/6960\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.auctionpro.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6960"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.auctionpro.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6960"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.auctionpro.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6960"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}